diff --git a/.sconsign.dblite b/.sconsign.dblite index 96fcbb3..6da3446 100644 Binary files a/.sconsign.dblite and b/.sconsign.dblite differ diff --git a/project/addons/quarkphysics/bin/libquarkphysics.linux.template_debug.x86_64.so b/project/addons/quarkphysics/bin/libquarkphysics.linux.template_debug.x86_64.so index 1820eb8..e493f53 100644 Binary files a/project/addons/quarkphysics/bin/libquarkphysics.linux.template_debug.x86_64.so and b/project/addons/quarkphysics/bin/libquarkphysics.linux.template_debug.x86_64.so differ diff --git a/project/examples/1_welcome/main.tscn b/project/examples/1_welcome/main.tscn index 10af6ae..245b33a 100644 --- a/project/examples/1_welcome/main.tscn +++ b/project/examples/1_welcome/main.tscn @@ -88,7 +88,7 @@ data_particle_positions = PackedVector2Array(-48, -80, 48, -80, -32, -48, -32, 1 data_particle_radius = PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data_particle_is_internal = PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1) data_springs = Array[PackedInt32Array]([PackedInt32Array(13, 11), PackedInt32Array(11, 10), PackedInt32Array(10, 9), PackedInt32Array(9, 8), PackedInt32Array(8, 0), PackedInt32Array(1, 7), PackedInt32Array(7, 5), PackedInt32Array(5, 6), PackedInt32Array(16, 15), PackedInt32Array(15, 14), PackedInt32Array(14, 13), PackedInt32Array(2, 4), PackedInt32Array(4, 3), PackedInt32Array(3, 12), PackedInt32Array(17, 19), PackedInt32Array(19, 18), PackedInt32Array(18, 16), PackedInt32Array(0, 20), PackedInt32Array(20, 21), PackedInt32Array(2, 22), PackedInt32Array(21, 24), PackedInt32Array(22, 23), PackedInt32Array(12, 25), PackedInt32Array(25, 26), PackedInt32Array(23, 27), PackedInt32Array(27, 28), PackedInt32Array(28, 6), PackedInt32Array(24, 1), PackedInt32Array(26, 17)]) -data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(28, 5), PackedInt32Array(6, 27), PackedInt32Array(27, 5), PackedInt32Array(27, 7), PackedInt32Array(5, 23), PackedInt32Array(23, 7), PackedInt32Array(23, 24), PackedInt32Array(22, 24), PackedInt32Array(23, 21), PackedInt32Array(21, 22), PackedInt32Array(22, 20), PackedInt32Array(20, 2), PackedInt32Array(2, 21), PackedInt32Array(2, 8), PackedInt32Array(0, 2), PackedInt32Array(8, 20), PackedInt32Array(9, 4), PackedInt32Array(9, 2), PackedInt32Array(4, 8), PackedInt32Array(9, 3), PackedInt32Array(10, 4), PackedInt32Array(3, 10), PackedInt32Array(11, 3), PackedInt32Array(12, 10), PackedInt32Array(11, 12), PackedInt32Array(12, 14), PackedInt32Array(14, 11), PackedInt32Array(12, 13), PackedInt32Array(12, 15), PackedInt32Array(25, 16), PackedInt32Array(15, 26), PackedInt32Array(26, 16), PackedInt32Array(16, 17), PackedInt32Array(16, 19), PackedInt32Array(17, 18), PackedInt32Array(26, 19), PackedInt32Array(1, 23), PackedInt32Array(7, 24), PackedInt32Array(14, 25), PackedInt32Array(15, 25)]) +data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(6, 27), PackedInt32Array(27, 5), PackedInt32Array(5, 23), PackedInt32Array(23, 7), PackedInt32Array(23, 24), PackedInt32Array(23, 21), PackedInt32Array(21, 22), PackedInt32Array(22, 20), PackedInt32Array(20, 2), PackedInt32Array(2, 8), PackedInt32Array(0, 2), PackedInt32Array(9, 4), PackedInt32Array(4, 8), PackedInt32Array(9, 3), PackedInt32Array(3, 10), PackedInt32Array(12, 10), PackedInt32Array(11, 12), PackedInt32Array(12, 14), PackedInt32Array(12, 15), PackedInt32Array(25, 16), PackedInt32Array(26, 16), PackedInt32Array(16, 17), PackedInt32Array(17, 18), PackedInt32Array(7, 24), PackedInt32Array(15, 25), PackedInt32Array(13, 12)]) data_polygon = PackedInt32Array(13, 11, 10, 9, 8, 0, 20, 21, 24, 1, 7, 5, 6, 28, 27, 23, 22, 2, 4, 3, 12, 25, 26, 17, 19, 18, 16, 15, 14) [node name="WordU" type="QSoftBodyNode" parent="."] @@ -111,7 +111,7 @@ data_particle_positions = PackedVector2Array(-64, -80, 64, -80, -32, -80, 32, -8 data_particle_radius = PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data_particle_is_internal = PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data_springs = Array[PackedInt32Array]([PackedInt32Array(4, 18), PackedInt32Array(18, 17), PackedInt32Array(17, 16), PackedInt32Array(16, 15), PackedInt32Array(0, 2), PackedInt32Array(2, 14), PackedInt32Array(0, 15), PackedInt32Array(14, 13), PackedInt32Array(13, 12), PackedInt32Array(12, 11), PackedInt32Array(11, 9), PackedInt32Array(9, 10), PackedInt32Array(23, 21), PackedInt32Array(10, 23), PackedInt32Array(21, 19), PackedInt32Array(19, 3), PackedInt32Array(3, 1), PackedInt32Array(1, 20), PackedInt32Array(20, 22), PackedInt32Array(22, 22), PackedInt32Array(22, 24), PackedInt32Array(24, 25), PackedInt32Array(25, 7), PackedInt32Array(7, 6), PackedInt32Array(6, 8), PackedInt32Array(8, 5), PackedInt32Array(5, 4)]) -data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(2, 15), PackedInt32Array(0, 14), PackedInt32Array(14, 16), PackedInt32Array(15, 13), PackedInt32Array(13, 17), PackedInt32Array(16, 12), PackedInt32Array(12, 18), PackedInt32Array(17, 11), PackedInt32Array(11, 5), PackedInt32Array(18, 11), PackedInt32Array(11, 4), PackedInt32Array(5, 18), PackedInt32Array(5, 9), PackedInt32Array(11, 8), PackedInt32Array(9, 6), PackedInt32Array(8, 10), PackedInt32Array(10, 25), PackedInt32Array(6, 10), PackedInt32Array(10, 7), PackedInt32Array(6, 25), PackedInt32Array(24, 10), PackedInt32Array(23, 25), PackedInt32Array(23, 24), PackedInt32Array(23, 22), PackedInt32Array(21, 24), PackedInt32Array(21, 22), PackedInt32Array(21, 20), PackedInt32Array(19, 22), PackedInt32Array(19, 20), PackedInt32Array(19, 1), PackedInt32Array(3, 20), PackedInt32Array(15, 14), PackedInt32Array(16, 13), PackedInt32Array(17, 12)]) +data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(0, 14), PackedInt32Array(15, 13), PackedInt32Array(16, 12), PackedInt32Array(17, 11), PackedInt32Array(11, 5), PackedInt32Array(18, 11), PackedInt32Array(11, 4), PackedInt32Array(11, 8), PackedInt32Array(9, 6), PackedInt32Array(10, 25), PackedInt32Array(6, 10), PackedInt32Array(6, 25), PackedInt32Array(23, 25), PackedInt32Array(23, 24), PackedInt32Array(21, 24), PackedInt32Array(21, 22), PackedInt32Array(19, 22), PackedInt32Array(19, 20), PackedInt32Array(3, 20), PackedInt32Array(15, 14), PackedInt32Array(16, 13), PackedInt32Array(17, 12), PackedInt32Array(8, 9)]) data_polygon = PackedInt32Array(0, 2, 14, 13, 12, 11, 9, 10, 23, 21, 19, 3, 1, 20, 22, 24, 25, 7, 6, 8, 5, 4, 18, 17, 16, 15) [node name="WordA" type="QSoftBodyNode" parent="."] @@ -134,7 +134,7 @@ data_particle_positions = PackedVector2Array(48, -80, 0, -80, 32, -80, 3.1e-05, data_particle_radius = PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data_particle_is_internal = PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data_springs = Array[PackedInt32Array]([PackedInt32Array(9, 8), PackedInt32Array(8, 5), PackedInt32Array(5, 1), PackedInt32Array(1, 2), PackedInt32Array(2, 0), PackedInt32Array(0, 6), PackedInt32Array(6, 10), PackedInt32Array(10, 12), PackedInt32Array(12, 16), PackedInt32Array(16, 15), PackedInt32Array(15, 18), PackedInt32Array(18, 19), PackedInt32Array(19, 20), PackedInt32Array(20, 14), PackedInt32Array(14, 23), PackedInt32Array(24, 23), PackedInt32Array(24, 26), PackedInt32Array(26, 29), PackedInt32Array(29, 27), PackedInt32Array(27, 28), PackedInt32Array(28, 25), PackedInt32Array(25, 22), PackedInt32Array(22, 21), PackedInt32Array(21, 17), PackedInt32Array(17, 13), PackedInt32Array(13, 11), PackedInt32Array(11, 4), PackedInt32Array(4, 3), PackedInt32Array(3, 7), PackedInt32Array(7, 9)]) -data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(9, 5), PackedInt32Array(7, 8), PackedInt32Array(5, 7), PackedInt32Array(7, 1), PackedInt32Array(3, 5), PackedInt32Array(1, 3), PackedInt32Array(3, 2), PackedInt32Array(4, 1), PackedInt32Array(2, 4), PackedInt32Array(4, 6), PackedInt32Array(0, 4), PackedInt32Array(2, 6), PackedInt32Array(4, 10), PackedInt32Array(11, 10), PackedInt32Array(11, 6), PackedInt32Array(11, 12), PackedInt32Array(10, 13), PackedInt32Array(13, 12), PackedInt32Array(12, 17), PackedInt32Array(13, 16), PackedInt32Array(17, 16), PackedInt32Array(17, 18), PackedInt32Array(16, 18), PackedInt32Array(15, 17), PackedInt32Array(21, 19), PackedInt32Array(19, 17), PackedInt32Array(18, 21), PackedInt32Array(21, 20), PackedInt32Array(19, 22), PackedInt32Array(22, 20), PackedInt32Array(23, 22), PackedInt32Array(22, 14), PackedInt32Array(20, 23), PackedInt32Array(23, 25), PackedInt32Array(22, 24), PackedInt32Array(24, 25), PackedInt32Array(25, 29), PackedInt32Array(26, 25), PackedInt32Array(29, 24), PackedInt32Array(25, 27), PackedInt32Array(28, 29)]) +data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(7, 8), PackedInt32Array(5, 7), PackedInt32Array(7, 1), PackedInt32Array(1, 3), PackedInt32Array(3, 2), PackedInt32Array(2, 4), PackedInt32Array(4, 6), PackedInt32Array(2, 6), PackedInt32Array(11, 10), PackedInt32Array(11, 6), PackedInt32Array(13, 12), PackedInt32Array(12, 17), PackedInt32Array(17, 16), PackedInt32Array(17, 18), PackedInt32Array(16, 18), PackedInt32Array(21, 19), PackedInt32Array(19, 17), PackedInt32Array(21, 20), PackedInt32Array(22, 20), PackedInt32Array(23, 22), PackedInt32Array(22, 14), PackedInt32Array(24, 25), PackedInt32Array(25, 29), PackedInt32Array(29, 24), PackedInt32Array(25, 27), PackedInt32Array(10, 13), PackedInt32Array(23, 25)]) data_polygon = PackedInt32Array(8, 5, 1, 2, 0, 6, 10, 12, 16, 15, 18, 19, 20, 14, 23, 24, 26, 29, 27, 28, 25, 22, 21, 17, 13, 11, 4, 3, 7, 9) [node name="WordR" type="QSoftBodyNode" parent="."] @@ -156,7 +156,7 @@ data_particle_positions = PackedVector2Array(-64, 80, -64, 48, -64, 16, -64, -16 data_particle_radius = PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data_particle_is_internal = PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) data_springs = Array[PackedInt32Array]([PackedInt32Array(17, 0), PackedInt32Array(1, 0), PackedInt32Array(1, 2), PackedInt32Array(2, 3), PackedInt32Array(3, 4), PackedInt32Array(4, 5), PackedInt32Array(5, 6), PackedInt32Array(6, 7), PackedInt32Array(7, 8), PackedInt32Array(8, 9), PackedInt32Array(9, 10), PackedInt32Array(10, 11), PackedInt32Array(11, 12), PackedInt32Array(12, 13), PackedInt32Array(13, 14), PackedInt32Array(14, 15), PackedInt32Array(16, 17), PackedInt32Array(16, 18), PackedInt32Array(18, 15)]) -data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(0, 16), PackedInt32Array(17, 1), PackedInt32Array(1, 16), PackedInt32Array(1, 18), PackedInt32Array(2, 16), PackedInt32Array(2, 18), PackedInt32Array(2, 15), PackedInt32Array(3, 18), PackedInt32Array(3, 15), PackedInt32Array(3, 14), PackedInt32Array(15, 4), PackedInt32Array(14, 7), PackedInt32Array(4, 7), PackedInt32Array(14, 5), PackedInt32Array(4, 6), PackedInt32Array(3, 7), PackedInt32Array(14, 8), PackedInt32Array(7, 13), PackedInt32Array(8, 13), PackedInt32Array(13, 9), PackedInt32Array(12, 8), PackedInt32Array(12, 9), PackedInt32Array(12, 10), PackedInt32Array(9, 11), PackedInt32Array(10, 13), PackedInt32Array(11, 8)]) +data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(1, 16), PackedInt32Array(1, 18), PackedInt32Array(2, 18), PackedInt32Array(3, 15), PackedInt32Array(3, 14), PackedInt32Array(14, 7), PackedInt32Array(4, 7), PackedInt32Array(4, 6), PackedInt32Array(3, 7), PackedInt32Array(14, 8), PackedInt32Array(8, 13), PackedInt32Array(13, 9), PackedInt32Array(12, 9), PackedInt32Array(12, 10), PackedInt32Array(2, 15), PackedInt32Array(0, 16)]) data_polygon = PackedInt32Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 16, 17) [node name="WordK" type="QSoftBodyNode" parent="."] @@ -164,8 +164,8 @@ rigidity = 0.3 self_collision = true shape_matching = true shape_matching_rate = 0.35 -position = Vector2(782, 133) -rotation = -0.261799 +position = Vector2(768, 128) +rotation = 0.178834 [node name="QMeshAdvancedNode" type="QMeshAdvancedNode" parent="WordK"] enable_vector_rendering = true @@ -175,9 +175,9 @@ enable_stroke = true stroke_color = Color(0.0862745, 0.0901961, 0.101961, 1) enable_curved_corners = true curve_length = 3.0 -data_particle_positions = PackedVector2Array(-64.5, -79.5, -64.5001, -47.5, -64.5, -15.5, -64.5, 16.5, -64.5001, 48.5, -64.5, 80.5, -32.5, -79.5, -32.5, -47.5, -32.5, -15.5, -32.5, 16.5, -32.5, 48.5, -32.5, 80.5, 31.5, -79.5, 63.4999, -63.5, -16.5, -31.5, -0.499998, 0.500001, -16.5, 32.5, 63.4999, 64.5, 31.5001, 80.5, 15.5, -15.5, 31.5, -31.5, 47.5, -47.5, -0.499998, -47.5, 15.5, -63.5, 15.5, 16.5, -0.499998, 48.5, 31.5, 32.5, 15.5, 64.5, 47.5, 48.5) -data_particle_radius = PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) -data_particle_is_internal = PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) -data_springs = Array[PackedInt32Array]([PackedInt32Array(0, 1), PackedInt32Array(1, 2), PackedInt32Array(2, 3), PackedInt32Array(3, 4), PackedInt32Array(4, 5), PackedInt32Array(5, 11), PackedInt32Array(11, 10), PackedInt32Array(9, 10), PackedInt32Array(9, 16), PackedInt32Array(0, 6), PackedInt32Array(6, 7), PackedInt32Array(7, 8), PackedInt32Array(8, 14), PackedInt32Array(14, 22), PackedInt32Array(22, 23), PackedInt32Array(23, 12), PackedInt32Array(13, 21), PackedInt32Array(21, 20), PackedInt32Array(20, 19), PackedInt32Array(19, 15), PackedInt32Array(16, 25), PackedInt32Array(25, 27), PackedInt32Array(27, 18), PackedInt32Array(17, 28), PackedInt32Array(28, 26), PackedInt32Array(26, 24), PackedInt32Array(24, 15)]) -data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(1, 7), PackedInt32Array(2, 8), PackedInt32Array(3, 9), PackedInt32Array(8, 9), PackedInt32Array(4, 10), PackedInt32Array(6, 1), PackedInt32Array(0, 7), PackedInt32Array(7, 2), PackedInt32Array(1, 8), PackedInt32Array(8, 3), PackedInt32Array(2, 9), PackedInt32Array(9, 4), PackedInt32Array(3, 10), PackedInt32Array(10, 5), PackedInt32Array(4, 11), PackedInt32Array(15, 8), PackedInt32Array(15, 9), PackedInt32Array(14, 19), PackedInt32Array(22, 20), PackedInt32Array(23, 21), PackedInt32Array(12, 13), PackedInt32Array(16, 24), PackedInt32Array(25, 26), PackedInt32Array(27, 28), PackedInt32Array(18, 17), PackedInt32Array(8, 19), PackedInt32Array(14, 15), PackedInt32Array(14, 20), PackedInt32Array(19, 22), PackedInt32Array(22, 21), PackedInt32Array(20, 23), PackedInt32Array(23, 13), PackedInt32Array(21, 12), PackedInt32Array(9, 24), PackedInt32Array(15, 16), PackedInt32Array(16, 26), PackedInt32Array(24, 25), PackedInt32Array(25, 28), PackedInt32Array(26, 27), PackedInt32Array(27, 17), PackedInt32Array(28, 18)]) -data_polygon = PackedInt32Array(5, 4, 3, 2, 1, 0, 6, 7, 8, 14, 22, 23, 12, 13, 21, 20, 19, 15, 24, 26, 28, 17, 18, 27, 25, 16, 9, 10, 11) +data_particle_positions = PackedVector2Array(-48, -80, -48, -48, -48, -16, -48, 16, -48, 48, -48, 80, -16, -80, -16, -48, -16, -16, -16, 16, -16, 48, -16, 80, 48, -80, 80, -64, 16, 0, 80, 64, 48, 80, 48, -32, 16, -48, 16, 48, 48, 32) +data_particle_radius = PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) +data_particle_is_internal = PackedByteArray(1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) +data_springs = Array[PackedInt32Array]([PackedInt32Array(0, 6), PackedInt32Array(6, 7), PackedInt32Array(7, 8), PackedInt32Array(12, 13), PackedInt32Array(15, 16), PackedInt32Array(9, 10), PackedInt32Array(10, 11), PackedInt32Array(11, 5), PackedInt32Array(5, 4), PackedInt32Array(4, 3), PackedInt32Array(2, 1), PackedInt32Array(1, 0), PackedInt32Array(8, 18), PackedInt32Array(18, 12), PackedInt32Array(13, 17), PackedInt32Array(17, 14), PackedInt32Array(14, 20), PackedInt32Array(20, 15), PackedInt32Array(16, 19), PackedInt32Array(19, 9), PackedInt32Array(2, 3)]) +data_internal_springs = Array[PackedInt32Array]([PackedInt32Array(1, 7), PackedInt32Array(2, 8), PackedInt32Array(3, 9), PackedInt32Array(4, 10), PackedInt32Array(18, 17), PackedInt32Array(20, 19), PackedInt32Array(0, 7), PackedInt32Array(1, 8), PackedInt32Array(3, 10), PackedInt32Array(4, 11), PackedInt32Array(8, 14), PackedInt32Array(9, 14), PackedInt32Array(2, 9), PackedInt32Array(18, 14), PackedInt32Array(12, 17), PackedInt32Array(14, 19), PackedInt32Array(20, 16), PackedInt32Array(8, 9)]) +data_polygon = PackedInt32Array(0, 6, 7, 8, 18, 12, 13, 17, 14, 20, 15, 16, 19, 9, 10, 11, 5, 4, 3, 2, 1) diff --git a/project/examples/1_welcome/src/mesh_files/word_a.qmesh b/project/examples/1_welcome/src/mesh_files/word_a.qmesh index 80b0b46..03b817d 100644 --- a/project/examples/1_welcome/src/mesh_files/word_a.qmesh +++ b/project/examples/1_welcome/src/mesh_files/word_a.qmesh @@ -1,585 +1,519 @@ { - "meshes": [ - { - "name": "Mesh_0", - "position": [ - 0, - 0 - ], - "rotation": 0, - "particles": [ - { - "position": [ - 48, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 0, - -80.000023 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - -80.000023 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 0.000031, - -48.000031 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - -48.000004 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -80.000023 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 64, - -48.000031 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -48.000031 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64.000015, - -64 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - -32 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 64, - -15.999999 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - -15.999999 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 64, - 16 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - 16 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -48, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 48, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 64, - 47.999985 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - 47.999985 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 0, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 0.000031, - 47.999985 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - 47.999985 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - 47.999985 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - 16 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - 16 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -48, - -16 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 16, - -16 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 16, - 16 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -15.999999 - ], - "radius": 0, - "is_internal": false - } - ], - "springs": [ - [ - 9, - 8 - ], - [ - 8, - 5 - ], - [ - 5, - 1 - ], - [ - 1, - 2 - ], - [ - 2, - 0 - ], - [ - 0, - 6 - ], - [ - 6, - 10 - ], - [ - 10, - 12 - ], - [ - 12, - 16 - ], - [ - 16, - 15 - ], - [ - 15, - 18 - ], - [ - 18, - 19 - ], - [ - 19, - 20 - ], - [ - 20, - 14 - ], - [ - 14, - 23 - ], - [ - 24, - 23 - ], - [ - 24, - 26 - ], - [ - 26, - 29 - ], - [ - 29, - 27 - ], - [ - 27, - 28 - ], - [ - 28, - 25 - ], - [ - 25, - 22 - ], - [ - 22, - 21 - ], - [ - 21, - 17 - ], - [ - 17, - 13 - ], - [ - 13, - 11 - ], - [ - 11, - 4 - ], - [ - 4, - 3 - ], - [ - 3, - 7 - ], - [ - 7, - 9 - ] - ], - "internal_springs": [ - [ - 9, - 5 - ], - [ - 7, - 8 - ], - [ - 5, - 7 - ], - [ - 7, - 1 - ], - [ - 3, - 5 - ], - [ - 1, - 3 - ], - [ - 3, - 2 - ], - [ - 4, - 1 - ], - [ - 2, - 4 - ], - [ - 4, - 6 - ], - [ - 0, - 4 - ], - [ - 2, - 6 - ], - [ - 4, - 10 - ], - [ - 11, - 10 - ], - [ - 11, - 6 - ], - [ - 11, - 12 - ], - [ - 10, - 13 - ], - [ - 13, - 12 - ], - [ - 12, - 17 - ], - [ - 13, - 16 - ], - [ - 17, - 16 - ], - [ - 17, - 18 - ], - [ - 16, - 18 - ], - [ - 15, - 17 - ], - [ - 21, - 19 - ], - [ - 19, - 17 - ], - [ - 18, - 21 - ], - [ - 21, - 20 - ], - [ - 19, - 22 - ], - [ - 22, - 20 - ], - [ - 23, - 22 - ], - [ - 22, - 14 - ], - [ - 20, - 23 - ], - [ - 23, - 25 - ], - [ - 22, - 24 - ], - [ - 24, - 25 - ], - [ - 25, - 29 - ], - [ - 26, - 25 - ], - [ - 29, - 24 - ], - [ - 25, - 27 - ], - [ - 28, - 29 - ] - ], - "polygon": [ - 8, - 5, - 1, - 2, - 0, - 6, - 10, - 12, - 16, - 15, - 18, - 19, - 20, - 14, - 23, - 24, - 26, - 29, - 27, - 28, - 25, - 22, - 21, - 17, - 13, - 11, - 4, - 3, - 7, - 9 - ] - } - ], - "reference_image_location": "", - "reference_image_position": [ - 0, - 0 - ], - "reference_image_alpha": 0.117647, - "grid_size": [ - 16, - 16 - ], - "snap_to_grid": true + "meshes": [ + { + "internal_springs": [ + [ + 7, + 8 + ], + [ + 5, + 7 + ], + [ + 7, + 1 + ], + [ + 1, + 3 + ], + [ + 3, + 2 + ], + [ + 2, + 4 + ], + [ + 4, + 6 + ], + [ + 2, + 6 + ], + [ + 11, + 10 + ], + [ + 11, + 6 + ], + [ + 13, + 12 + ], + [ + 12, + 17 + ], + [ + 17, + 16 + ], + [ + 17, + 18 + ], + [ + 16, + 18 + ], + [ + 21, + 19 + ], + [ + 19, + 17 + ], + [ + 21, + 20 + ], + [ + 22, + 20 + ], + [ + 23, + 22 + ], + [ + 22, + 14 + ], + [ + 24, + 25 + ], + [ + 25, + 29 + ], + [ + 29, + 24 + ], + [ + 25, + 27 + ], + [ + 10, + 13 + ], + [ + 23, + 25 + ] + ], + "name": "QMeshData", + "particles": [ + { + "is_internal": false, + "position": [ + 48, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 0, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 0.000030999999580672, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -64 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -32 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -48, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 48, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 0, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 0.000030999999580672, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -48, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 16, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 16, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -16 + ], + "radius": 0 + } + ], + "polygon": [ + 8, + 5, + 1, + 2, + 0, + 6, + 10, + 12, + 16, + 15, + 18, + 19, + 20, + 14, + 23, + 24, + 26, + 29, + 27, + 28, + 25, + 22, + 21, + 17, + 13, + 11, + 4, + 3, + 7, + 9 + ], + "position": [ + 0, + 0 + ], + "rotation": 0, + "springs": [ + [ + 9, + 8 + ], + [ + 8, + 5 + ], + [ + 5, + 1 + ], + [ + 1, + 2 + ], + [ + 2, + 0 + ], + [ + 0, + 6 + ], + [ + 6, + 10 + ], + [ + 10, + 12 + ], + [ + 12, + 16 + ], + [ + 16, + 15 + ], + [ + 15, + 18 + ], + [ + 18, + 19 + ], + [ + 19, + 20 + ], + [ + 20, + 14 + ], + [ + 14, + 23 + ], + [ + 24, + 23 + ], + [ + 24, + 26 + ], + [ + 26, + 29 + ], + [ + 29, + 27 + ], + [ + 27, + 28 + ], + [ + 28, + 25 + ], + [ + 25, + 22 + ], + [ + 22, + 21 + ], + [ + 21, + 17 + ], + [ + 17, + 13 + ], + [ + 13, + 11 + ], + [ + 11, + 4 + ], + [ + 4, + 3 + ], + [ + 3, + 7 + ], + [ + 7, + 9 + ] + ], + "uv_maps": [] + } + ] } \ No newline at end of file diff --git a/project/examples/1_welcome/src/mesh_files/word_k.qmesh b/project/examples/1_welcome/src/mesh_files/word_k.qmesh index 1796408..dedb332 100644 --- a/project/examples/1_welcome/src/mesh_files/word_k.qmesh +++ b/project/examples/1_welcome/src/mesh_files/word_k.qmesh @@ -1,564 +1,366 @@ { - "meshes": [ - { - "name": "Mesh_0", - "position": [ - 0, - 0 - ], - "rotation": 0, - "particles": [ - { - "position": [ - -64, - -80.000008 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64.000061, - -47.999992 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - -15.999994 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - 15.999997 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64.000061, - 48 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - 79.999969 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -47.999992 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -15.999994 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - 15.999997 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - 48 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - 79.999969 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32.000015, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 63.999878, - -63.999989 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -16, - -31.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 0.000001, - 0.000001 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -16, - 32 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 63.999878, - 64 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32.000076, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 16, - -15.999994 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32.000015, - -31.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 48, - -47.999992 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 0.000001, - -47.999992 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 16, - -63.999989 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 16, - 15.999997 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 0.000001, - 48 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32.000015, - 32 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 16, - 64 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 48, - 48 - ], - "radius": 0, - "is_internal": false - } - ], - "springs": [ - [ - 0, - 1 - ], - [ - 1, - 2 - ], - [ - 2, - 3 - ], - [ - 3, - 4 - ], - [ - 4, - 5 - ], - [ - 5, - 11 - ], - [ - 11, - 10 - ], - [ - 9, - 10 - ], - [ - 9, - 16 - ], - [ - 0, - 6 - ], - [ - 6, - 7 - ], - [ - 7, - 8 - ], - [ - 8, - 14 - ], - [ - 14, - 22 - ], - [ - 22, - 23 - ], - [ - 23, - 12 - ], - [ - 13, - 21 - ], - [ - 21, - 20 - ], - [ - 20, - 19 - ], - [ - 19, - 15 - ], - [ - 16, - 25 - ], - [ - 25, - 27 - ], - [ - 27, - 18 - ], - [ - 17, - 28 - ], - [ - 28, - 26 - ], - [ - 26, - 24 - ], - [ - 24, - 15 - ] - ], - "internal_springs": [ - [ - 1, - 7 - ], - [ - 2, - 8 - ], - [ - 3, - 9 - ], - [ - 8, - 9 - ], - [ - 4, - 10 - ], - [ - 6, - 1 - ], - [ - 0, - 7 - ], - [ - 7, - 2 - ], - [ - 1, - 8 - ], - [ - 8, - 3 - ], - [ - 2, - 9 - ], - [ - 9, - 4 - ], - [ - 3, - 10 - ], - [ - 10, - 5 - ], - [ - 4, - 11 - ], - [ - 15, - 8 - ], - [ - 15, - 9 - ], - [ - 14, - 19 - ], - [ - 22, - 20 - ], - [ - 23, - 21 - ], - [ - 12, - 13 - ], - [ - 16, - 24 - ], - [ - 25, - 26 - ], - [ - 27, - 28 - ], - [ - 18, - 17 - ], - [ - 8, - 19 - ], - [ - 14, - 15 - ], - [ - 14, - 20 - ], - [ - 19, - 22 - ], - [ - 22, - 21 - ], - [ - 20, - 23 - ], - [ - 23, - 13 - ], - [ - 21, - 12 - ], - [ - 9, - 24 - ], - [ - 15, - 16 - ], - [ - 16, - 26 - ], - [ - 24, - 25 - ], - [ - 25, - 28 - ], - [ - 26, - 27 - ], - [ - 27, - 17 - ], - [ - 28, - 18 - ] - ], - "polygon": [ - 5, - 4, - 3, - 2, - 1, - 0, - 6, - 7, - 8, - 14, - 22, - 23, - 12, - 13, - 21, - 20, - 19, - 15, - 24, - 26, - 28, - 17, - 18, - 27, - 25, - 16, - 9, - 10, - 11 - ] - } - ], - "reference_image_location": "", - "reference_image_position": [ - 0, - 0 - ], - "reference_image_alpha": 0.117647, - "grid_size": [ - 16, - 16 - ], - "snap_to_grid": true + "meshes": [ + { + "internal_springs": [ + [ + 1, + 7 + ], + [ + 2, + 8 + ], + [ + 3, + 9 + ], + [ + 4, + 10 + ], + [ + 18, + 17 + ], + [ + 20, + 19 + ], + [ + 0, + 7 + ], + [ + 1, + 8 + ], + [ + 3, + 10 + ], + [ + 4, + 11 + ], + [ + 8, + 14 + ], + [ + 9, + 14 + ], + [ + 2, + 9 + ], + [ + 18, + 14 + ], + [ + 12, + 17 + ], + [ + 14, + 19 + ], + [ + 20, + 16 + ], + [ + 8, + 9 + ] + ], + "name": "QMeshData", + "particles": [ + { + "is_internal": true, + "position": [ + -48, + -80 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -48, + -48 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -48, + -16 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -48, + 16 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -48, + 48 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -48, + 80 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -16, + -80 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -16, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -16, + -16 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -16, + 16 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -16, + 48 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + -16, + 80 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 48, + -80 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 80, + -64 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 16, + 0 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 80, + 64 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 48, + 80 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 48, + -32 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 16, + -48 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 16, + 48 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 48, + 32 + ], + "radius": 0 + } + ], + "polygon": [ + 0, + 6, + 7, + 8, + 18, + 12, + 13, + 17, + 14, + 20, + 15, + 16, + 19, + 9, + 10, + 11, + 5, + 4, + 3, + 2, + 1 + ], + "position": [ + 0, + 0 + ], + "rotation": 0, + "springs": [ + [ + 0, + 6 + ], + [ + 6, + 7 + ], + [ + 7, + 8 + ], + [ + 12, + 13 + ], + [ + 15, + 16 + ], + [ + 9, + 10 + ], + [ + 10, + 11 + ], + [ + 11, + 5 + ], + [ + 5, + 4 + ], + [ + 4, + 3 + ], + [ + 2, + 1 + ], + [ + 1, + 0 + ], + [ + 8, + 18 + ], + [ + 18, + 12 + ], + [ + 13, + 17 + ], + [ + 17, + 14 + ], + [ + 14, + 20 + ], + [ + 20, + 15 + ], + [ + 16, + 19 + ], + [ + 19, + 9 + ], + [ + 2, + 3 + ] + ], + "uv_maps": [] + } + ] } \ No newline at end of file diff --git a/project/examples/1_welcome/src/mesh_files/word_q.qmesh b/project/examples/1_welcome/src/mesh_files/word_q.qmesh index 18d651f..63afaec 100644 --- a/project/examples/1_welcome/src/mesh_files/word_q.qmesh +++ b/project/examples/1_welcome/src/mesh_files/word_q.qmesh @@ -1,572 +1,502 @@ { - "meshes": [ - { - "name": "Mesh_0", - "position": [ - 0, - 0 - ], - "rotation": 0, - "particles": [ - { - "position": [ - -47.999992, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 48, - -80.000015 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32.000004, - -48.000015 - ], - "radius": 0, - "is_internal": true - }, - { - "position": [ - -32, - 15.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -31.999996, - -15.999999 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 64, - -16 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 63.999996, - 32 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 63.999996, - -47.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -63.999996, - -47.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64.000008, - -15.999995 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - 15.999993 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64.000008, - 47.999992 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -31.999996, - 47.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -48.000008, - 79.999992 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -31.999996, - 80.000008 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -0.000002, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - 80.000008 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 64, - 48 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 47.999996, - 96 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 79.999992, - 96.000008 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -0.000003, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -0.000002, - -48 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - -48.000008 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32.000004, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -0, - 48 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - 47.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 32, - -15.999999 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 31.999996, - 32 - ], - "radius": 0, - "is_internal": false - } - ], - "springs": [ - [ - 13, - 11 - ], - [ - 11, - 10 - ], - [ - 10, - 9 - ], - [ - 9, - 8 - ], - [ - 8, - 0 - ], - [ - 1, - 7 - ], - [ - 7, - 5 - ], - [ - 5, - 6 - ], - [ - 16, - 15 - ], - [ - 15, - 14 - ], - [ - 14, - 13 - ], - [ - 2, - 4 - ], - [ - 4, - 3 - ], - [ - 3, - 12 - ], - [ - 17, - 19 - ], - [ - 19, - 18 - ], - [ - 18, - 16 - ], - [ - 0, - 20 - ], - [ - 20, - 21 - ], - [ - 2, - 22 - ], - [ - 21, - 24 - ], - [ - 22, - 23 - ], - [ - 9, - 9 - ], - [ - 12, - 25 - ], - [ - 25, - 26 - ], - [ - 23, - 27 - ], - [ - 27, - 28 - ], - [ - 28, - 6 - ], - [ - 24, - 1 - ], - [ - 26, - 17 - ] - ], - "internal_springs": [ - [ - 28, - 5 - ], - [ - 6, - 27 - ], - [ - 27, - 5 - ], - [ - 27, - 7 - ], - [ - 5, - 23 - ], - [ - 23, - 7 - ], - [ - 23, - 24 - ], - [ - 1, - 23 - ], - [ - 7, - 24 - ], - [ - 22, - 24 - ], - [ - 23, - 21 - ], - [ - 21, - 22 - ], - [ - 22, - 20 - ], - [ - 20, - 2 - ], - [ - 2, - 21 - ], - [ - 2, - 8 - ], - [ - 0, - 2 - ], - [ - 8, - 20 - ], - [ - 9, - 4 - ], - [ - 9, - 2 - ], - [ - 4, - 8 - ], - [ - 9, - 3 - ], - [ - 10, - 4 - ], - [ - 3, - 10 - ], - [ - 11, - 3 - ], - [ - 12, - 10 - ], - [ - 11, - 12 - ], - [ - 12, - 14 - ], - [ - 14, - 11 - ], - [ - 12, - 13 - ], - [ - 14, - 25 - ], - [ - 12, - 15 - ], - [ - 15, - 25 - ], - [ - 25, - 16 - ], - [ - 15, - 26 - ], - [ - 26, - 16 - ], - [ - 16, - 17 - ], - [ - 16, - 19 - ], - [ - 17, - 18 - ], - [ - 26, - 19 - ] - ], - "polygon": [ - 13, - 11, - 10, - 9, - 8, - 0, - 20, - 21, - 24, - 1, - 7, - 5, - 6, - 28, - 27, - 23, - 22, - 2, - 4, - 3, - 12, - 25, - 26, - 17, - 19, - 18, - 16, - 15, - 14 - ] - } - ], - "reference_image_location": "", - "reference_image_position": [ - 0, - 0 - ], - "reference_image_alpha": 0.117647, - "grid_size": [ - 16, - 16 - ], - "snap_to_grid": true + "meshes": [ + { + "internal_springs": [ + [ + 6, + 27 + ], + [ + 27, + 5 + ], + [ + 5, + 23 + ], + [ + 23, + 7 + ], + [ + 23, + 24 + ], + [ + 23, + 21 + ], + [ + 21, + 22 + ], + [ + 22, + 20 + ], + [ + 20, + 2 + ], + [ + 2, + 8 + ], + [ + 0, + 2 + ], + [ + 9, + 4 + ], + [ + 4, + 8 + ], + [ + 9, + 3 + ], + [ + 3, + 10 + ], + [ + 12, + 10 + ], + [ + 11, + 12 + ], + [ + 12, + 14 + ], + [ + 12, + 15 + ], + [ + 25, + 16 + ], + [ + 26, + 16 + ], + [ + 16, + 17 + ], + [ + 17, + 18 + ], + [ + 7, + 24 + ], + [ + 15, + 25 + ], + [ + 13, + 12 + ] + ], + "name": "QMeshData", + "particles": [ + { + "is_internal": false, + "position": [ + -48, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 48, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + 32 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 60.5, + -49.5 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -48, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -0.00000199999999, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 48, + 96 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 80, + 96 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -0.00000300000011, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -0.00000199999999, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 0, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -16 + ], + "radius": 0 + }, + { + "is_internal": true, + "position": [ + 32, + 32 + ], + "radius": 0 + } + ], + "polygon": [ + 13, + 11, + 10, + 9, + 8, + 0, + 20, + 21, + 24, + 1, + 7, + 5, + 6, + 28, + 27, + 23, + 22, + 2, + 4, + 3, + 12, + 25, + 26, + 17, + 19, + 18, + 16, + 15, + 14 + ], + "position": [ + 0, + 0 + ], + "rotation": 0, + "springs": [ + [ + 13, + 11 + ], + [ + 11, + 10 + ], + [ + 10, + 9 + ], + [ + 9, + 8 + ], + [ + 8, + 0 + ], + [ + 1, + 7 + ], + [ + 7, + 5 + ], + [ + 5, + 6 + ], + [ + 16, + 15 + ], + [ + 15, + 14 + ], + [ + 14, + 13 + ], + [ + 2, + 4 + ], + [ + 4, + 3 + ], + [ + 3, + 12 + ], + [ + 17, + 19 + ], + [ + 19, + 18 + ], + [ + 18, + 16 + ], + [ + 0, + 20 + ], + [ + 20, + 21 + ], + [ + 2, + 22 + ], + [ + 21, + 24 + ], + [ + 22, + 23 + ], + [ + 12, + 25 + ], + [ + 25, + 26 + ], + [ + 23, + 27 + ], + [ + 27, + 28 + ], + [ + 28, + 6 + ], + [ + 24, + 1 + ], + [ + 26, + 17 + ] + ], + "uv_maps": [] + } + ] } \ No newline at end of file diff --git a/project/examples/1_welcome/src/mesh_files/word_r.qmesh b/project/examples/1_welcome/src/mesh_files/word_r.qmesh index 1d1e6c0..62cb150 100644 --- a/project/examples/1_welcome/src/mesh_files/word_r.qmesh +++ b/project/examples/1_welcome/src/mesh_files/word_r.qmesh @@ -1,382 +1,332 @@ { - "meshes": [ - { - "name": "Mesh_0", - "position": [ - 0, - 0 - ], - "rotation": 0, - "particles": [ - { - "position": [ - -64, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - 48.000004 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -63.999969, - 15.999998 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -63.999969, - -15.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - -47.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -64, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - -64 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -0.000002, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 31.999968, - -80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 64, - -64 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 64, - -31.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - 31.999937, - -47.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -0.000002, - -47.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32.000031, - -31.999992 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32.000031, - -15.999996 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32.000031, - 48.000004 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32, - 80 - ], - "radius": 0, - "is_internal": false - }, - { - "position": [ - -32.000031, - 16.000006 - ], - "radius": 0, - "is_internal": false - } - ], - "springs": [ - [ - 17, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 2 - ], - [ - 2, - 3 - ], - [ - 3, - 4 - ], - [ - 4, - 5 - ], - [ - 5, - 6 - ], - [ - 6, - 7 - ], - [ - 7, - 8 - ], - [ - 8, - 9 - ], - [ - 9, - 10 - ], - [ - 10, - 11 - ], - [ - 11, - 12 - ], - [ - 12, - 13 - ], - [ - 13, - 14 - ], - [ - 14, - 15 - ], - [ - 16, - 17 - ], - [ - 16, - 18 - ], - [ - 18, - 15 - ] - ], - "internal_springs": [ - [ - 0, - 16 - ], - [ - 17, - 1 - ], - [ - 1, - 16 - ], - [ - 1, - 18 - ], - [ - 2, - 16 - ], - [ - 2, - 18 - ], - [ - 2, - 15 - ], - [ - 3, - 18 - ], - [ - 3, - 15 - ], - [ - 3, - 14 - ], - [ - 15, - 4 - ], - [ - 14, - 7 - ], - [ - 4, - 7 - ], - [ - 14, - 5 - ], - [ - 4, - 6 - ], - [ - 3, - 7 - ], - [ - 14, - 8 - ], - [ - 7, - 13 - ], - [ - 8, - 13 - ], - [ - 13, - 9 - ], - [ - 12, - 8 - ], - [ - 12, - 9 - ], - [ - 12, - 10 - ], - [ - 9, - 11 - ], - [ - 10, - 13 - ], - [ - 11, - 8 - ] - ], - "polygon": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 18, - 16, - 17 - ] - } - ], - "reference_image_location": "", - "reference_image_position": [ - 0, - 0 - ], - "reference_image_alpha": 0.117647, - "grid_size": [ - 16, - 16 - ], - "snap_to_grid": true + "meshes": [ + { + "internal_springs": [ + [ + 1, + 16 + ], + [ + 1, + 18 + ], + [ + 2, + 18 + ], + [ + 3, + 15 + ], + [ + 3, + 14 + ], + [ + 14, + 7 + ], + [ + 4, + 7 + ], + [ + 4, + 6 + ], + [ + 3, + 7 + ], + [ + 14, + 8 + ], + [ + 8, + 13 + ], + [ + 13, + 9 + ], + [ + 12, + 9 + ], + [ + 12, + 10 + ], + [ + 2, + 15 + ], + [ + 0, + 16 + ] + ], + "name": "QMeshData", + "particles": [ + { + "is_internal": false, + "position": [ + -64, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -64 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -0.00000199999999, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + -64 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + -32 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 31.9999008178711, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -0.00000199999999, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -32 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 16 + ], + "radius": 0 + } + ], + "polygon": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 18, + 16, + 17 + ], + "position": [ + 0, + 0 + ], + "rotation": 0, + "springs": [ + [ + 17, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ], + [ + 3, + 4 + ], + [ + 4, + 5 + ], + [ + 5, + 6 + ], + [ + 6, + 7 + ], + [ + 7, + 8 + ], + [ + 8, + 9 + ], + [ + 9, + 10 + ], + [ + 10, + 11 + ], + [ + 11, + 12 + ], + [ + 12, + 13 + ], + [ + 13, + 14 + ], + [ + 14, + 15 + ], + [ + 16, + 17 + ], + [ + 16, + 18 + ], + [ + 18, + 15 + ] + ], + "uv_maps": [] + } + ] } \ No newline at end of file diff --git a/project/examples/1_welcome/src/mesh_files/word_u.qmesh b/project/examples/1_welcome/src/mesh_files/word_u.qmesh index 4fba538..bf6d19e 100644 --- a/project/examples/1_welcome/src/mesh_files/word_u.qmesh +++ b/project/examples/1_welcome/src/mesh_files/word_u.qmesh @@ -1 +1,455 @@ -{"meshes":[{"name":"Mesh_0","position":[0,0],"rotation":0,"particles":[{"position":[-63.999985,-80.000008],"radius":0,"is_internal":false},{"position":[64.000015,-80.000015],"radius":0,"is_internal":false},{"position":[-32,-80],"radius":0,"is_internal":false},{"position":[32.000015,-80.000008],"radius":0,"is_internal":false},{"position":[-47.999985,80.000008],"radius":0,"is_internal":false},{"position":[-31.999985,79.999992],"radius":0,"is_internal":false},{"position":[32.000015,79.999992],"radius":0,"is_internal":false},{"position":[48.000019,80.000008],"radius":0,"is_internal":false},{"position":[0.000015,80],"radius":0,"is_internal":false},{"position":[0.000015,48.000008],"radius":0,"is_internal":false},{"position":[32.000015,48.000008],"radius":0,"is_internal":false},{"position":[-31.999985,48],"radius":0,"is_internal":false},{"position":[-31.999985,16],"radius":0,"is_internal":false},{"position":[-31.999985,-15.999999],"radius":0,"is_internal":false},{"position":[-31.999985,-48],"radius":0,"is_internal":false},{"position":[-63.999985,-48],"radius":0,"is_internal":false},{"position":[-63.999985,-15.999999],"radius":0,"is_internal":false},{"position":[-63.999985,16],"radius":0,"is_internal":false},{"position":[-63.999985,48],"radius":0,"is_internal":false},{"position":[32.000015,-48],"radius":0,"is_internal":false},{"position":[64.000015,-48],"radius":0,"is_internal":false},{"position":[32.000015,-15.999999],"radius":0,"is_internal":false},{"position":[64,-15.999999],"radius":0,"is_internal":false},{"position":[32.000015,16],"radius":0,"is_internal":false},{"position":[64,15.999998],"radius":0,"is_internal":false},{"position":[64.000015,48],"radius":0,"is_internal":false}],"springs":[[4,18],[18,17],[17,16],[16,15],[0,2],[2,14],[0,15],[14,13],[13,12],[12,11],[11,9],[9,10],[23,21],[10,23],[21,19],[19,3],[3,1],[1,20],[20,22],[22,22],[22,24],[24,25],[25,7],[7,6],[6,8],[8,5],[5,4]],"internal_springs":[[2,15],[0,14],[14,16],[15,13],[13,17],[16,12],[12,18],[17,11],[11,5],[18,11],[11,4],[5,18],[5,9],[11,8],[9,6],[8,10],[10,25],[6,10],[10,7],[6,25],[24,10],[23,25],[23,24],[23,22],[21,24],[21,22],[21,20],[19,22],[19,20],[19,1],[3,20],[15,14],[16,13],[17,12]],"polygon":[0,2,14,13,12,11,9,10,23,21,19,3,1,20,22,24,25,7,6,8,5,4,18,17,16,15]}],"reference_image_location":"","reference_image_position":[0,0],"reference_image_alpha":0.117647,"grid_size":[16,16],"snap_to_grid":true} \ No newline at end of file +{ + "meshes": [ + { + "internal_springs": [ + [ + 0, + 14 + ], + [ + 15, + 13 + ], + [ + 16, + 12 + ], + [ + 17, + 11 + ], + [ + 11, + 5 + ], + [ + 18, + 11 + ], + [ + 11, + 4 + ], + [ + 11, + 8 + ], + [ + 9, + 6 + ], + [ + 10, + 25 + ], + [ + 6, + 10 + ], + [ + 6, + 25 + ], + [ + 23, + 25 + ], + [ + 23, + 24 + ], + [ + 21, + 24 + ], + [ + 21, + 22 + ], + [ + 19, + 22 + ], + [ + 19, + 20 + ], + [ + 3, + 20 + ], + [ + 15, + 14 + ], + [ + 16, + 13 + ], + [ + 17, + 12 + ], + [ + 8, + 9 + ] + ], + "name": "QMeshData", + "particles": [ + { + "is_internal": false, + "position": [ + -64, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -48, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 48, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 0.0000149999996210681, + 80 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 0.0000149999996210681, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -32, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + -64, + 48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + -48 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + -16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 32, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + 16 + ], + "radius": 0 + }, + { + "is_internal": false, + "position": [ + 64, + 48 + ], + "radius": 0 + } + ], + "polygon": [ + 0, + 2, + 14, + 13, + 12, + 11, + 9, + 10, + 23, + 21, + 19, + 3, + 1, + 20, + 22, + 24, + 25, + 7, + 6, + 8, + 5, + 4, + 18, + 17, + 16, + 15 + ], + "position": [ + 0, + 0 + ], + "rotation": 0, + "springs": [ + [ + 4, + 18 + ], + [ + 18, + 17 + ], + [ + 17, + 16 + ], + [ + 16, + 15 + ], + [ + 0, + 2 + ], + [ + 2, + 14 + ], + [ + 0, + 15 + ], + [ + 14, + 13 + ], + [ + 13, + 12 + ], + [ + 12, + 11 + ], + [ + 11, + 9 + ], + [ + 9, + 10 + ], + [ + 23, + 21 + ], + [ + 10, + 23 + ], + [ + 21, + 19 + ], + [ + 19, + 3 + ], + [ + 3, + 1 + ], + [ + 1, + 20 + ], + [ + 20, + 22 + ], + [ + 22, + 22 + ], + [ + 22, + 24 + ], + [ + 24, + 25 + ], + [ + 25, + 7 + ], + [ + 7, + 6 + ], + [ + 6, + 8 + ], + [ + 8, + 5 + ], + [ + 5, + 4 + ] + ], + "uv_maps": [] + } + ] +} \ No newline at end of file diff --git a/project/project.godot b/project/project.godot index 2986b46..8f5323e 100644 --- a/project/project.godot +++ b/project/project.godot @@ -13,7 +13,7 @@ config_version=5 config/name="examples" run/main_scene="res://examples/examples_main.tscn" config/features=PackedStringArray("4.3", "GL Compatibility") -config/icon="res://icon.svg" +config/icon="res://examples/icon.svg" [autoload] diff --git a/src/QuarkPhysics/extensions/qplatformerbody.os b/src/QuarkPhysics/extensions/qplatformerbody.os index 3396ce3..8439be6 100644 Binary files a/src/QuarkPhysics/extensions/qplatformerbody.os and b/src/QuarkPhysics/extensions/qplatformerbody.os differ diff --git a/src/QuarkPhysics/extensions/qspatialhashing.os b/src/QuarkPhysics/extensions/qspatialhashing.os index 7600559..e5fcdfe 100644 Binary files a/src/QuarkPhysics/extensions/qspatialhashing.os and b/src/QuarkPhysics/extensions/qspatialhashing.os differ diff --git a/src/QuarkPhysics/qaabb.cpp b/src/QuarkPhysics/qaabb.cpp index 1dff0a3..e4b50bf 100644 --- a/src/QuarkPhysics/qaabb.cpp +++ b/src/QuarkPhysics/qaabb.cpp @@ -26,4 +26,34 @@ **************************************************************************************/ #include "qaabb.h" +#include "qparticle.h" +QAABB QAABB::GetAABBFromParticles(vector &particleCollection) +{ + float minX=9999999.0; + float minY=9999999.0; + float maxX=-9999999.0; + float maxY=-9999999.0; + + for(int n=0;nGetRadius()>0.5f ? particle->GetRadius():0; + float pMinX=particle->GetGlobalPosition().x-r; + float pMinY=particle->GetGlobalPosition().y-r; + float pMaxX=particle->GetGlobalPosition().x+r; + float pMaxY=particle->GetGlobalPosition().y+r; + + if(pMinXmaxX) + maxX=pMaxX; + if(pMaxY>maxY) + maxY=pMaxY; + } + + + + return QAABB(QVector(minX,minY),QVector(maxX,maxY) ); +} diff --git a/src/QuarkPhysics/qaabb.h b/src/QuarkPhysics/qaabb.h index fce0b5e..4c759c7 100644 --- a/src/QuarkPhysics/qaabb.h +++ b/src/QuarkPhysics/qaabb.h @@ -28,7 +28,11 @@ #ifndef QAABB_H #define QAABB_H #include "qvector.h" +#include +using namespace std; + +class QParticle; class QAABB { @@ -130,6 +134,8 @@ class QAABB maxPos.y >= otherAABB.minPos.y && minPos.y <= otherAABB.maxPos.y; } + static QAABB GetAABBFromParticles(vector &particleCollection); + }; diff --git a/src/QuarkPhysics/qaabb.os b/src/QuarkPhysics/qaabb.os index c3f5c13..f1481f4 100644 Binary files a/src/QuarkPhysics/qaabb.os and b/src/QuarkPhysics/qaabb.os differ diff --git a/src/QuarkPhysics/qareabody.os b/src/QuarkPhysics/qareabody.os index b97144c..af3bd6c 100644 Binary files a/src/QuarkPhysics/qareabody.os and b/src/QuarkPhysics/qareabody.os differ diff --git a/src/QuarkPhysics/qbody.os b/src/QuarkPhysics/qbody.os index d695b64..ef68017 100644 Binary files a/src/QuarkPhysics/qbody.os and b/src/QuarkPhysics/qbody.os differ diff --git a/src/QuarkPhysics/qbroadphase.os b/src/QuarkPhysics/qbroadphase.os index 0ef3d68..b440b40 100644 Binary files a/src/QuarkPhysics/qbroadphase.os and b/src/QuarkPhysics/qbroadphase.os differ diff --git a/src/QuarkPhysics/qcollision.cpp b/src/QuarkPhysics/qcollision.cpp index 221428c..d25f098 100644 --- a/src/QuarkPhysics/qcollision.cpp +++ b/src/QuarkPhysics/qcollision.cpp @@ -59,6 +59,10 @@ void QCollision::PolylineAndPolygon(vector &polylineParticles, vecto //Get angle bisector list of the polygon vector bisectorList; + bool isSelfCollision=false; + if(polylineParticles==polygonParticles){ + isSelfCollision=true; + } float maxRayLength=QWorld::MAX_WORLD_SIZE; for(int i=0;i &polylineParticles, vecto int sia=ni; // segment index a QVector bisectorVector=QVector::Zero(); - if(polylineParticles==polygonParticles){ + if(isSelfCollision){ float rayLength=abs((p->GetGlobalPosition()-pp->GetGlobalPosition() ).Dot(bisectorUnit ) )*0.5f; @@ -138,14 +142,34 @@ void QCollision::PolylineAndPolygon(vector &polylineParticles, vecto normal=(s2Pos-s1Pos).Normalized().Perpendicular(); + + //For self collisions + /* QVector s1LocalPos; + QVector s2LocalPos; + QVector normalLocal; */ + + + //B. Start the loop for all particles of the polygon for(int n=0;nIsConnectedWithSpring(s1) || p->IsConnectedWithSpring(s2) ){ + continue; + } + + + } + QVector pPos=p->GetGlobalPosition(); if(p->GetRadius()>0.5f){ @@ -154,7 +178,7 @@ void QCollision::PolylineAndPolygon(vector &polylineParticles, vecto //C. Check an intersection between the segment of polyline and the virtual vector - QVector intersection=LineIntersectionLine(pPos,pPos+bisectorList[n],s1Pos,s2Pos); + QVector intersection=LineIntersectionLine(pPos,pPos+bisectorVec,s1Pos,s2Pos); if( intersection.isNaN() )continue; diff --git a/src/QuarkPhysics/qcollision.os b/src/QuarkPhysics/qcollision.os index b625d99..f254ed9 100644 Binary files a/src/QuarkPhysics/qcollision.os and b/src/QuarkPhysics/qcollision.os differ diff --git a/src/QuarkPhysics/qgizmos.os b/src/QuarkPhysics/qgizmos.os index cc62a84..7005d4c 100644 Binary files a/src/QuarkPhysics/qgizmos.os and b/src/QuarkPhysics/qgizmos.os differ diff --git a/src/QuarkPhysics/qjoint.os b/src/QuarkPhysics/qjoint.os index 89ff14a..540bc68 100644 Binary files a/src/QuarkPhysics/qjoint.os and b/src/QuarkPhysics/qjoint.os differ diff --git a/src/QuarkPhysics/qmanifold.os b/src/QuarkPhysics/qmanifold.os index 85f080a..825aa95 100644 Binary files a/src/QuarkPhysics/qmanifold.os and b/src/QuarkPhysics/qmanifold.os differ diff --git a/src/QuarkPhysics/qmesh.cpp b/src/QuarkPhysics/qmesh.cpp index a11696c..079ec5a 100644 --- a/src/QuarkPhysics/qmesh.cpp +++ b/src/QuarkPhysics/qmesh.cpp @@ -516,6 +516,10 @@ void QMesh::DecompositePolygon(vector &polygonParticles, vectorGetParticleA()!=nullptr || spring->GetParticleB()!=nullptr){ + spring->GetParticleA()->springConnectedParticles.insert(spring->GetParticleB() ); + spring->GetParticleB()->springConnectedParticles.insert(spring->GetParticleA() ); + } collisionBehaviorNeedsUpdate=true; return this; } @@ -531,6 +535,11 @@ QMesh *QMesh::RemoveSpring(QSpring *spring) QMesh *QMesh::RemoveSpringAt(int index) { + QSpring *spring=springs[index]; + + spring->GetParticleA()->springConnectedParticles.erase(spring->GetParticleB() ); + spring->GetParticleB()->springConnectedParticles.erase(spring->GetParticleA() ); + springs.erase(springs.begin()+index); collisionBehaviorNeedsUpdate=true; return this; @@ -649,13 +658,13 @@ QMesh *QMesh::CreateWithMeshData(MeshData &data,bool enableSprings, bool enableP for(int i=0;i springIndexes=data.springList[i]; QSpring *spring=new QSpring( res->particles[springIndexes.first],res->particles[springIndexes.second],false); - res->springs.push_back(spring); + res->AddSpring(spring); } //Internal springs for(int i=0;i springIndexes=data.internalSpringList[i]; QSpring *spring=new QSpring( res->particles[springIndexes.first],res->particles[springIndexes.second],true); - res->springs.push_back(spring); + res->AddSpring(spring); } } //Adding UV Maps diff --git a/src/QuarkPhysics/qmesh.h b/src/QuarkPhysics/qmesh.h index 0954e83..2c804b5 100644 --- a/src/QuarkPhysics/qmesh.h +++ b/src/QuarkPhysics/qmesh.h @@ -135,6 +135,7 @@ struct QMesh friend class QSoftBody; friend class QRaycast; friend class QCollision; + friend class QParticle; /** Creates a mesh. */ QMesh(); @@ -381,23 +382,7 @@ struct QMesh - - - - - - - /** Adds a polygon to the mesh - * @param polygon A particle pointers collection of the polygon. - */ - QMesh *AddClosedPolygon(vector polygon); - /** Removes a polygon from the mesh at the specified index. - * @param index The index of the polygon. - * @return QMesh* A pointer to mesh itself. - */ - QMesh *RemoveClosedPolygonAt(int index); - - /** Returns the total polygon count in the mesh. + /** Returns the total sub polygon count in the mesh. */ int GetSubConvexPolygonCount(){ if (subConvexPolygonsNeedsUpdate==true){ @@ -406,8 +391,8 @@ struct QMesh } return subConvexPolygons.size(); } - /** Returns polygon at the specified index - * @param index The index of the polygon to get. + /** Returns sub polygon at the specified index + * @param index The index of the sub polygon to get. */ vector &GetSubConvexPolygonAt(int index){ if (subConvexPolygonsNeedsUpdate==true){ diff --git a/src/QuarkPhysics/qmesh.os b/src/QuarkPhysics/qmesh.os index f60ecba..a3755d7 100644 Binary files a/src/QuarkPhysics/qmesh.os and b/src/QuarkPhysics/qmesh.os differ diff --git a/src/QuarkPhysics/qparticle.cpp b/src/QuarkPhysics/qparticle.cpp index 80767af..12c2532 100644 --- a/src/QuarkPhysics/qparticle.cpp +++ b/src/QuarkPhysics/qparticle.cpp @@ -87,6 +87,7 @@ QParticle *QParticle::SetPosition(QVector value){ if (ownerBody->GetBodyType()==QBody::BodyTypes::SOFT){ ownerBody->WakeUp(); } + ownerMesh->subConvexPolygonsNeedsUpdate=true; } } return this; @@ -170,6 +171,11 @@ QParticle *QParticle::ApplyAccumulatedForces() return this; } +bool QParticle::IsConnectedWithSpring(QParticle *particle) +{ + return springConnectedParticles.find(particle) != springConnectedParticles.end(); +} + void QParticle::ApplyForceToParticleSegment(QParticle *pA, QParticle *pB,QVector force, QVector fromPosition) { QVector segmentVector=pB->globalPosition-pA->globalPosition; diff --git a/src/QuarkPhysics/qparticle.h b/src/QuarkPhysics/qparticle.h index 7e03b91..0333e64 100644 --- a/src/QuarkPhysics/qparticle.h +++ b/src/QuarkPhysics/qparticle.h @@ -29,6 +29,7 @@ #define QPARTICLE_H #include "qvector.h" #include +#include class QMesh; /** @brief QParticle objects form the network structures of QMesh objects defined for all body object types. They are the smallest building blocks of physics simulation and are manipulated differently in different body object types. For example, in QRigidBody objects, particles are collectively forced into positions obtained through various calculations based on the current body properties. However, in soft body objects, simulation particles are individually manipulated and can move freely, determining the next steps of the simulation through their individual movements. QMesh objects offer a number of methods to manage particles. For more information on restrictions between particles in soft body objects, see the QSpring object. @@ -51,6 +52,9 @@ class QParticle QVector force=QVector::Zero(); std::vector accumulatedForces; + +protected: + std::unordered_set springConnectedParticles; public: QParticle(); QParticle(float posX,float posY,float radius=0.5f); @@ -171,6 +175,14 @@ class QParticle /** Calculates the arithmetic average of the accumulated forces based on the number of forces, applies it to the particle, and then clears all forces. */ QParticle *ApplyAccumulatedForces(); + //Spring Connected Particles + /** + * Checks if the given particle is connected to this particle via a spring. Returns true if a connection exists, otherwise returns false. + * @param particle A particle to check + * @return Returns true if a connection exists, otherwise returns false. + */ + bool IsConnectedWithSpring(QParticle *particle); + //Static Methods /** Applies a specified force to a segment created by two particles at a specific position. @@ -180,6 +192,9 @@ class QParticle * @param fromPosition The position of the force. */ static void ApplyForceToParticleSegment(QParticle *pA,QParticle *pB,QVector force,QVector fromPosition); + + friend class QMesh; + }; diff --git a/src/QuarkPhysics/qparticle.os b/src/QuarkPhysics/qparticle.os index d34a05a..04a5ca9 100644 Binary files a/src/QuarkPhysics/qparticle.os and b/src/QuarkPhysics/qparticle.os differ diff --git a/src/QuarkPhysics/qraycast.os b/src/QuarkPhysics/qraycast.os index 656d110..ddecde1 100644 Binary files a/src/QuarkPhysics/qraycast.os and b/src/QuarkPhysics/qraycast.os differ diff --git a/src/QuarkPhysics/qrigidbody.os b/src/QuarkPhysics/qrigidbody.os index a27c07f..c87a23c 100644 Binary files a/src/QuarkPhysics/qrigidbody.os and b/src/QuarkPhysics/qrigidbody.os differ diff --git a/src/QuarkPhysics/qsoftbody.os b/src/QuarkPhysics/qsoftbody.os index 2f48fdb..7caacd1 100644 Binary files a/src/QuarkPhysics/qsoftbody.os and b/src/QuarkPhysics/qsoftbody.os differ diff --git a/src/QuarkPhysics/qspring.os b/src/QuarkPhysics/qspring.os index f142051..a424873 100644 Binary files a/src/QuarkPhysics/qspring.os and b/src/QuarkPhysics/qspring.os differ diff --git a/src/QuarkPhysics/quarkphysics.os b/src/QuarkPhysics/quarkphysics.os index c0fd5c3..01b0cf2 100644 Binary files a/src/QuarkPhysics/quarkphysics.os and b/src/QuarkPhysics/quarkphysics.os differ diff --git a/src/QuarkPhysics/qworld.cpp b/src/QuarkPhysics/qworld.cpp index 5fcc366..a0a843b 100644 --- a/src/QuarkPhysics/qworld.cpp +++ b/src/QuarkPhysics/qworld.cpp @@ -929,9 +929,11 @@ vector QWorld::GetCollisions(QBody *bodyA, QBody *bodyB){ }else if(QMesh::CheckCollisionBehaviors(meshA,meshB,QMesh::POLYLINE, QMesh::POLYGONS )){ QMesh *polylineMesh=meshA->collisionBehavior==QMesh::POLYLINE ? meshA:meshB; QMesh *polygonMesh=meshA->collisionBehavior==QMesh::POLYGONS ? meshA:meshB; - for(int b=0;bGetSubConvexPolygonCount();b++){ - QCollision::CircleAndPolygon(polylineMesh->polygon,polygonMesh->GetSubConvexPolygonAt(b),contactList); - QCollision::PolylineAndPolygon(polylineMesh->polygon,polygonMesh->GetSubConvexPolygonAt(b),contactList); + for(size_t b=0;bGetSubConvexPolygonCount();b++){ + vector polygonSub=polygonMesh->GetSubConvexPolygonAt(b); + QCollision::CircleAndPolygon(polylineMesh->polygon,polygonSub,contactList); + QCollision::PolylineAndPolygon(polylineMesh->polygon,polygonSub,contactList); + } }else if(QMesh::CheckCollisionBehaviors(meshA,meshB,QMesh::POLYLINE, QMesh::POLYLINE )){ diff --git a/src/QuarkPhysics/qworld.os b/src/QuarkPhysics/qworld.os index 84daa67..5b12349 100644 Binary files a/src/QuarkPhysics/qworld.os and b/src/QuarkPhysics/qworld.os differ diff --git a/src/qareabody_node.os b/src/qareabody_node.os index 20ea507..484c070 100644 Binary files a/src/qareabody_node.os and b/src/qareabody_node.os differ diff --git a/src/qbody_node.os b/src/qbody_node.os index a24acba..fd5b5b1 100644 Binary files a/src/qbody_node.os and b/src/qbody_node.os differ diff --git a/src/qjoint_object.os b/src/qjoint_object.os index 194a203..38904d9 100644 Binary files a/src/qjoint_object.os and b/src/qjoint_object.os differ diff --git a/src/qmesh_advanced_node.os b/src/qmesh_advanced_node.os index 269e814..e72ee2f 100644 Binary files a/src/qmesh_advanced_node.os and b/src/qmesh_advanced_node.os differ diff --git a/src/qmesh_circle_node.os b/src/qmesh_circle_node.os index 150db9d..96dc493 100644 Binary files a/src/qmesh_circle_node.os and b/src/qmesh_circle_node.os differ diff --git a/src/qmesh_node.os b/src/qmesh_node.os index 544fe7e..0d2b3ce 100644 Binary files a/src/qmesh_node.os and b/src/qmesh_node.os differ diff --git a/src/qmesh_polygon_node.os b/src/qmesh_polygon_node.os index f91a721..9eb3374 100644 Binary files a/src/qmesh_polygon_node.os and b/src/qmesh_polygon_node.os differ diff --git a/src/qmesh_rect_node.os b/src/qmesh_rect_node.os index 88c1906..a84d447 100644 Binary files a/src/qmesh_rect_node.os and b/src/qmesh_rect_node.os differ diff --git a/src/qparticle_object.os b/src/qparticle_object.os index 563d06a..dddcce0 100644 Binary files a/src/qparticle_object.os and b/src/qparticle_object.os differ diff --git a/src/qplatformerbody_node.os b/src/qplatformerbody_node.os index a03ae1a..a46936e 100644 Binary files a/src/qplatformerbody_node.os and b/src/qplatformerbody_node.os differ diff --git a/src/qraycast_object.os b/src/qraycast_object.os index c8aa2c9..ff0d01b 100644 Binary files a/src/qraycast_object.os and b/src/qraycast_object.os differ diff --git a/src/qrigidbody_node.os b/src/qrigidbody_node.os index b23bc56..f1126fd 100644 Binary files a/src/qrigidbody_node.os and b/src/qrigidbody_node.os differ diff --git a/src/qsoftbody_node.os b/src/qsoftbody_node.os index 06f34eb..52e11bb 100644 Binary files a/src/qsoftbody_node.os and b/src/qsoftbody_node.os differ diff --git a/src/qspring_object.os b/src/qspring_object.os index f928674..cad3ff3 100644 Binary files a/src/qspring_object.os and b/src/qspring_object.os differ diff --git a/src/qworld_node.os b/src/qworld_node.os index 276c20a..c30bcbf 100644 Binary files a/src/qworld_node.os and b/src/qworld_node.os differ diff --git a/src/register_types.os b/src/register_types.os index 6c00056..bd943f2 100644 Binary files a/src/register_types.os and b/src/register_types.os differ