@bloomengine/engine 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/package.json +4 -11
  2. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/build.gradle +0 -51
  3. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/src/main/AndroidManifest.xml +0 -20
  4. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/src/main/cpp/CMakeLists.txt +0 -20
  5. package/native/third_party/JoltPhysics/Build/Android/UnitTests/build.gradle +0 -51
  6. package/native/third_party/JoltPhysics/Build/Android/UnitTests/src/main/AndroidManifest.xml +0 -20
  7. package/native/third_party/JoltPhysics/Build/Android/UnitTests/src/main/cpp/CMakeLists.txt +0 -20
  8. package/native/third_party/JoltPhysics/Build/Android/build.gradle +0 -17
  9. package/native/third_party/JoltPhysics/Build/Android/gradle/wrapper/gradle-wrapper.jar +0 -0
  10. package/native/third_party/JoltPhysics/Build/Android/gradle/wrapper/gradle-wrapper.properties +0 -5
  11. package/native/third_party/JoltPhysics/Build/Android/gradle.properties +0 -21
  12. package/native/third_party/JoltPhysics/Build/Android/gradlew +0 -185
  13. package/native/third_party/JoltPhysics/Build/Android/gradlew.bat +0 -89
  14. package/native/third_party/JoltPhysics/Build/Android/settings.gradle +0 -10
  15. package/native/third_party/JoltPhysics/Build/CMakeLists.txt +0 -449
  16. package/native/third_party/JoltPhysics/Build/README.md +0 -250
  17. package/native/third_party/JoltPhysics/Build/cmake_linux_clang_gcc.sh +0 -28
  18. package/native/third_party/JoltPhysics/Build/cmake_linux_emscripten.sh +0 -19
  19. package/native/third_party/JoltPhysics/Build/cmake_linux_mingw.sh +0 -19
  20. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl.bat +0 -3
  21. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_32bit.bat +0 -3
  22. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_arm.bat +0 -3
  23. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_arm_32bit.bat +0 -4
  24. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_cross_platform_deterministic.bat +0 -3
  25. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_double.bat +0 -3
  26. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_no_object_stream.bat +0 -3
  27. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang.bat +0 -10
  28. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang_cross_platform_deterministic.bat +0 -10
  29. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang_double.bat +0 -10
  30. package/native/third_party/JoltPhysics/Build/cmake_vs2022_uwp.bat +0 -5
  31. package/native/third_party/JoltPhysics/Build/cmake_vs2022_uwp_arm.bat +0 -5
  32. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl.bat +0 -3
  33. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl_cross_platform_deterministic.bat +0 -3
  34. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl_double.bat +0 -3
  35. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang.bat +0 -10
  36. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang_cross_platform_deterministic.bat +0 -10
  37. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang_double.bat +0 -10
  38. package/native/third_party/JoltPhysics/Build/cmake_windows_mingw.sh +0 -19
  39. package/native/third_party/JoltPhysics/Build/cmake_xcode_ios.sh +0 -4
  40. package/native/third_party/JoltPhysics/Build/cmake_xcode_macos.sh +0 -4
  41. package/native/third_party/JoltPhysics/Build/iOS/JoltViewerInfo.plist +0 -34
  42. package/native/third_party/JoltPhysics/Build/iOS/SamplesInfo.plist +0 -34
  43. package/native/third_party/JoltPhysics/Build/iOS/UnitTestsInfo.plist +0 -34
  44. package/native/third_party/JoltPhysics/Build/macOS/icon.icns +0 -0
  45. package/native/third_party/JoltPhysics/Build/macos_install_vulkan_sdk.sh +0 -13
  46. package/native/third_party/JoltPhysics/Build/ubuntu24_install_vulkan_sdk.sh +0 -4
  47. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeBuilder.cpp +0 -242
  48. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeBuilder.h +0 -121
  49. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeToBuffer.h +0 -296
  50. package/native/third_party/JoltPhysics/Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h +0 -323
  51. package/native/third_party/JoltPhysics/Jolt/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h +0 -555
  52. package/native/third_party/JoltPhysics/Jolt/ConfigurationString.h +0 -112
  53. package/native/third_party/JoltPhysics/Jolt/Core/ARMNeon.h +0 -94
  54. package/native/third_party/JoltPhysics/Jolt/Core/Array.h +0 -713
  55. package/native/third_party/JoltPhysics/Jolt/Core/Atomics.h +0 -44
  56. package/native/third_party/JoltPhysics/Jolt/Core/BinaryHeap.h +0 -96
  57. package/native/third_party/JoltPhysics/Jolt/Core/ByteBuffer.h +0 -74
  58. package/native/third_party/JoltPhysics/Jolt/Core/Color.cpp +0 -38
  59. package/native/third_party/JoltPhysics/Jolt/Core/Color.h +0 -98
  60. package/native/third_party/JoltPhysics/Jolt/Core/Core.h +0 -652
  61. package/native/third_party/JoltPhysics/Jolt/Core/FPControlWord.h +0 -143
  62. package/native/third_party/JoltPhysics/Jolt/Core/FPException.h +0 -96
  63. package/native/third_party/JoltPhysics/Jolt/Core/FPFlushDenormals.h +0 -43
  64. package/native/third_party/JoltPhysics/Jolt/Core/Factory.cpp +0 -92
  65. package/native/third_party/JoltPhysics/Jolt/Core/Factory.h +0 -54
  66. package/native/third_party/JoltPhysics/Jolt/Core/FixedSizeFreeList.h +0 -122
  67. package/native/third_party/JoltPhysics/Jolt/Core/FixedSizeFreeList.inl +0 -215
  68. package/native/third_party/JoltPhysics/Jolt/Core/HashCombine.h +0 -234
  69. package/native/third_party/JoltPhysics/Jolt/Core/HashTable.h +0 -876
  70. package/native/third_party/JoltPhysics/Jolt/Core/InsertionSort.h +0 -58
  71. package/native/third_party/JoltPhysics/Jolt/Core/IssueReporting.cpp +0 -27
  72. package/native/third_party/JoltPhysics/Jolt/Core/IssueReporting.h +0 -38
  73. package/native/third_party/JoltPhysics/Jolt/Core/JobSystem.h +0 -311
  74. package/native/third_party/JoltPhysics/Jolt/Core/JobSystem.inl +0 -56
  75. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemSingleThreaded.cpp +0 -65
  76. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemSingleThreaded.h +0 -62
  77. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemThreadPool.cpp +0 -364
  78. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemThreadPool.h +0 -101
  79. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemWithBarrier.cpp +0 -230
  80. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemWithBarrier.h +0 -85
  81. package/native/third_party/JoltPhysics/Jolt/Core/LinearCurve.cpp +0 -51
  82. package/native/third_party/JoltPhysics/Jolt/Core/LinearCurve.h +0 -67
  83. package/native/third_party/JoltPhysics/Jolt/Core/LockFreeHashMap.h +0 -182
  84. package/native/third_party/JoltPhysics/Jolt/Core/LockFreeHashMap.inl +0 -351
  85. package/native/third_party/JoltPhysics/Jolt/Core/Memory.cpp +0 -85
  86. package/native/third_party/JoltPhysics/Jolt/Core/Memory.h +0 -85
  87. package/native/third_party/JoltPhysics/Jolt/Core/Mutex.h +0 -223
  88. package/native/third_party/JoltPhysics/Jolt/Core/MutexArray.h +0 -98
  89. package/native/third_party/JoltPhysics/Jolt/Core/NonCopyable.h +0 -18
  90. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.cpp +0 -677
  91. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.h +0 -301
  92. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.inl +0 -90
  93. package/native/third_party/JoltPhysics/Jolt/Core/QuickSort.h +0 -137
  94. package/native/third_party/JoltPhysics/Jolt/Core/RTTI.cpp +0 -149
  95. package/native/third_party/JoltPhysics/Jolt/Core/RTTI.h +0 -436
  96. package/native/third_party/JoltPhysics/Jolt/Core/Reference.h +0 -244
  97. package/native/third_party/JoltPhysics/Jolt/Core/Result.h +0 -174
  98. package/native/third_party/JoltPhysics/Jolt/Core/STLAlignedAllocator.h +0 -72
  99. package/native/third_party/JoltPhysics/Jolt/Core/STLAllocator.h +0 -127
  100. package/native/third_party/JoltPhysics/Jolt/Core/STLLocalAllocator.h +0 -170
  101. package/native/third_party/JoltPhysics/Jolt/Core/STLTempAllocator.h +0 -80
  102. package/native/third_party/JoltPhysics/Jolt/Core/ScopeExit.h +0 -49
  103. package/native/third_party/JoltPhysics/Jolt/Core/Semaphore.cpp +0 -135
  104. package/native/third_party/JoltPhysics/Jolt/Core/Semaphore.h +0 -68
  105. package/native/third_party/JoltPhysics/Jolt/Core/StaticArray.h +0 -329
  106. package/native/third_party/JoltPhysics/Jolt/Core/StreamIn.h +0 -120
  107. package/native/third_party/JoltPhysics/Jolt/Core/StreamOut.h +0 -97
  108. package/native/third_party/JoltPhysics/Jolt/Core/StreamUtils.h +0 -168
  109. package/native/third_party/JoltPhysics/Jolt/Core/StreamWrapper.h +0 -53
  110. package/native/third_party/JoltPhysics/Jolt/Core/StridedPtr.h +0 -63
  111. package/native/third_party/JoltPhysics/Jolt/Core/StringTools.cpp +0 -101
  112. package/native/third_party/JoltPhysics/Jolt/Core/StringTools.h +0 -38
  113. package/native/third_party/JoltPhysics/Jolt/Core/TempAllocator.h +0 -209
  114. package/native/third_party/JoltPhysics/Jolt/Core/TickCounter.cpp +0 -37
  115. package/native/third_party/JoltPhysics/Jolt/Core/TickCounter.h +0 -58
  116. package/native/third_party/JoltPhysics/Jolt/Core/UnorderedMap.h +0 -80
  117. package/native/third_party/JoltPhysics/Jolt/Core/UnorderedSet.h +0 -32
  118. package/native/third_party/JoltPhysics/Jolt/Geometry/AABox.h +0 -313
  119. package/native/third_party/JoltPhysics/Jolt/Geometry/AABox4.h +0 -224
  120. package/native/third_party/JoltPhysics/Jolt/Geometry/ClipPoly.h +0 -200
  121. package/native/third_party/JoltPhysics/Jolt/Geometry/ClosestPoint.h +0 -498
  122. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder.cpp +0 -1467
  123. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder.h +0 -276
  124. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder2D.cpp +0 -335
  125. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder2D.h +0 -105
  126. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexSupport.h +0 -188
  127. package/native/third_party/JoltPhysics/Jolt/Geometry/EPAConvexHullBuilder.h +0 -845
  128. package/native/third_party/JoltPhysics/Jolt/Geometry/EPAPenetrationDepth.h +0 -557
  129. package/native/third_party/JoltPhysics/Jolt/Geometry/Ellipse.h +0 -77
  130. package/native/third_party/JoltPhysics/Jolt/Geometry/GJKClosestPoint.h +0 -945
  131. package/native/third_party/JoltPhysics/Jolt/Geometry/IndexedTriangle.h +0 -130
  132. package/native/third_party/JoltPhysics/Jolt/Geometry/Indexify.cpp +0 -222
  133. package/native/third_party/JoltPhysics/Jolt/Geometry/Indexify.h +0 -19
  134. package/native/third_party/JoltPhysics/Jolt/Geometry/MortonCode.h +0 -40
  135. package/native/third_party/JoltPhysics/Jolt/Geometry/OrientedBox.cpp +0 -178
  136. package/native/third_party/JoltPhysics/Jolt/Geometry/OrientedBox.h +0 -39
  137. package/native/third_party/JoltPhysics/Jolt/Geometry/Plane.h +0 -104
  138. package/native/third_party/JoltPhysics/Jolt/Geometry/RayAABox.h +0 -241
  139. package/native/third_party/JoltPhysics/Jolt/Geometry/RayCapsule.h +0 -37
  140. package/native/third_party/JoltPhysics/Jolt/Geometry/RayCylinder.h +0 -101
  141. package/native/third_party/JoltPhysics/Jolt/Geometry/RaySphere.h +0 -96
  142. package/native/third_party/JoltPhysics/Jolt/Geometry/RayTriangle.h +0 -158
  143. package/native/third_party/JoltPhysics/Jolt/Geometry/Sphere.h +0 -72
  144. package/native/third_party/JoltPhysics/Jolt/Geometry/Triangle.h +0 -34
  145. package/native/third_party/JoltPhysics/Jolt/Jolt.cmake +0 -703
  146. package/native/third_party/JoltPhysics/Jolt/Jolt.h +0 -16
  147. package/native/third_party/JoltPhysics/Jolt/Jolt.natvis +0 -116
  148. package/native/third_party/JoltPhysics/Jolt/Math/BVec16.h +0 -99
  149. package/native/third_party/JoltPhysics/Jolt/Math/BVec16.inl +0 -177
  150. package/native/third_party/JoltPhysics/Jolt/Math/DMat44.h +0 -158
  151. package/native/third_party/JoltPhysics/Jolt/Math/DMat44.inl +0 -310
  152. package/native/third_party/JoltPhysics/Jolt/Math/DVec3.h +0 -291
  153. package/native/third_party/JoltPhysics/Jolt/Math/DVec3.inl +0 -941
  154. package/native/third_party/JoltPhysics/Jolt/Math/Double3.h +0 -48
  155. package/native/third_party/JoltPhysics/Jolt/Math/DynMatrix.h +0 -31
  156. package/native/third_party/JoltPhysics/Jolt/Math/EigenValueSymmetric.h +0 -177
  157. package/native/third_party/JoltPhysics/Jolt/Math/FindRoot.h +0 -42
  158. package/native/third_party/JoltPhysics/Jolt/Math/Float2.h +0 -36
  159. package/native/third_party/JoltPhysics/Jolt/Math/Float3.h +0 -50
  160. package/native/third_party/JoltPhysics/Jolt/Math/Float4.h +0 -44
  161. package/native/third_party/JoltPhysics/Jolt/Math/GaussianElimination.h +0 -102
  162. package/native/third_party/JoltPhysics/Jolt/Math/HalfFloat.h +0 -208
  163. package/native/third_party/JoltPhysics/Jolt/Math/Mat44.h +0 -243
  164. package/native/third_party/JoltPhysics/Jolt/Math/Mat44.inl +0 -952
  165. package/native/third_party/JoltPhysics/Jolt/Math/Math.h +0 -208
  166. package/native/third_party/JoltPhysics/Jolt/Math/MathTypes.h +0 -32
  167. package/native/third_party/JoltPhysics/Jolt/Math/Matrix.h +0 -259
  168. package/native/third_party/JoltPhysics/Jolt/Math/Quat.h +0 -268
  169. package/native/third_party/JoltPhysics/Jolt/Math/Quat.inl +0 -406
  170. package/native/third_party/JoltPhysics/Jolt/Math/Real.h +0 -44
  171. package/native/third_party/JoltPhysics/Jolt/Math/Swizzle.h +0 -19
  172. package/native/third_party/JoltPhysics/Jolt/Math/Trigonometry.h +0 -79
  173. package/native/third_party/JoltPhysics/Jolt/Math/UVec4.h +0 -232
  174. package/native/third_party/JoltPhysics/Jolt/Math/UVec4.inl +0 -636
  175. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.cpp +0 -71
  176. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.h +0 -308
  177. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.inl +0 -942
  178. package/native/third_party/JoltPhysics/Jolt/Math/Vec4.h +0 -320
  179. package/native/third_party/JoltPhysics/Jolt/Math/Vec4.inl +0 -1152
  180. package/native/third_party/JoltPhysics/Jolt/Math/Vector.h +0 -211
  181. package/native/third_party/JoltPhysics/Jolt/ObjectStream/GetPrimitiveTypeOfType.h +0 -54
  182. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStream.cpp +0 -38
  183. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStream.h +0 -337
  184. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryIn.cpp +0 -252
  185. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryIn.h +0 -57
  186. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryOut.cpp +0 -165
  187. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryOut.h +0 -57
  188. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamIn.cpp +0 -635
  189. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamIn.h +0 -148
  190. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamOut.cpp +0 -166
  191. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamOut.h +0 -101
  192. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextIn.cpp +0 -418
  193. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextIn.h +0 -55
  194. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextOut.cpp +0 -255
  195. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextOut.h +0 -62
  196. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTypes.h +0 -26
  197. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttribute.h +0 -111
  198. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttributeEnum.h +0 -67
  199. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttributeTyped.h +0 -60
  200. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableObject.cpp +0 -15
  201. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableObject.h +0 -170
  202. package/native/third_party/JoltPhysics/Jolt/ObjectStream/TypeDeclarations.cpp +0 -70
  203. package/native/third_party/JoltPhysics/Jolt/ObjectStream/TypeDeclarations.h +0 -45
  204. package/native/third_party/JoltPhysics/Jolt/Physics/Body/AllowedDOFs.h +0 -68
  205. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.cpp +0 -426
  206. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.h +0 -452
  207. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.inl +0 -197
  208. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyAccess.h +0 -68
  209. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyActivationListener.h +0 -28
  210. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyCreationSettings.cpp +0 -234
  211. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyCreationSettings.h +0 -124
  212. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyFilter.h +0 -130
  213. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyID.h +0 -101
  214. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyInterface.cpp +0 -1099
  215. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyInterface.h +0 -324
  216. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLock.h +0 -111
  217. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLockInterface.h +0 -134
  218. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLockMulti.h +0 -120
  219. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyManager.cpp +0 -1220
  220. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyManager.h +0 -403
  221. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyPair.h +0 -36
  222. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyType.h +0 -19
  223. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MassProperties.cpp +0 -185
  224. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MassProperties.h +0 -58
  225. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.cpp +0 -92
  226. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.h +0 -308
  227. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.inl +0 -178
  228. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionQuality.h +0 -31
  229. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionType.h +0 -17
  230. package/native/third_party/JoltPhysics/Jolt/Physics/Character/Character.cpp +0 -354
  231. package/native/third_party/JoltPhysics/Jolt/Physics/Character/Character.h +0 -159
  232. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterBase.cpp +0 -59
  233. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterBase.h +0 -157
  234. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterID.h +0 -98
  235. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterVirtual.cpp +0 -1933
  236. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterVirtual.h +0 -752
  237. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/AABoxCast.h +0 -20
  238. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ActiveEdgeMode.h +0 -17
  239. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ActiveEdges.h +0 -114
  240. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BackFaceMode.h +0 -16
  241. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhase.cpp +0 -16
  242. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhase.h +0 -109
  243. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp +0 -313
  244. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h +0 -38
  245. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h +0 -148
  246. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayerInterfaceMask.h +0 -92
  247. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayerInterfaceTable.h +0 -64
  248. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.cpp +0 -629
  249. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h +0 -108
  250. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h +0 -56
  251. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/ObjectVsBroadPhaseLayerFilterMask.h +0 -35
  252. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/ObjectVsBroadPhaseLayerFilterTable.h +0 -66
  253. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/QuadTree.cpp +0 -1768
  254. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/QuadTree.h +0 -389
  255. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp +0 -107
  256. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastConvexVsTriangles.h +0 -46
  257. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastResult.h +0 -37
  258. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastSphereVsTriangles.cpp +0 -223
  259. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastSphereVsTriangles.h +0 -49
  260. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollectFacesMode.h +0 -16
  261. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp +0 -155
  262. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideConvexVsTriangles.h +0 -56
  263. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollidePointResult.h +0 -25
  264. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideShape.h +0 -106
  265. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideShapeVsShapePerLeaf.h +0 -94
  266. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSoftBodyVertexIterator.h +0 -110
  267. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSoftBodyVerticesVsTriangles.h +0 -102
  268. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp +0 -121
  269. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSphereVsTriangles.h +0 -50
  270. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionCollector.h +0 -109
  271. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionCollectorImpl.h +0 -219
  272. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionDispatch.cpp +0 -107
  273. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionDispatch.h +0 -97
  274. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionGroup.cpp +0 -35
  275. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionGroup.h +0 -97
  276. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ContactListener.h +0 -143
  277. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/EstimateCollisionResponse.cpp +0 -213
  278. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/EstimateCollisionResponse.h +0 -48
  279. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilter.cpp +0 -32
  280. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilter.h +0 -46
  281. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilterTable.cpp +0 -38
  282. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilterTable.h +0 -130
  283. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h +0 -279
  284. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.cpp +0 -271
  285. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h +0 -44
  286. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseQuery.cpp +0 -448
  287. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseQuery.h +0 -77
  288. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseStats.cpp +0 -62
  289. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseStats.h +0 -110
  290. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayer.h +0 -111
  291. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayerPairFilterMask.h +0 -52
  292. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayerPairFilterTable.h +0 -78
  293. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterial.cpp +0 -35
  294. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterial.h +0 -57
  295. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterialSimple.cpp +0 -38
  296. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterialSimple.h +0 -37
  297. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/RayCast.h +0 -87
  298. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/BoxShape.cpp +0 -318
  299. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/BoxShape.h +0 -115
  300. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CapsuleShape.cpp +0 -438
  301. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CapsuleShape.h +0 -129
  302. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShape.cpp +0 -433
  303. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShape.h +0 -354
  304. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShapeVisitors.h +0 -461
  305. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexHullShape.cpp +0 -1311
  306. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexHullShape.h +0 -202
  307. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexShape.cpp +0 -566
  308. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexShape.h +0 -150
  309. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CylinderShape.cpp +0 -418
  310. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CylinderShape.h +0 -126
  311. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/DecoratedShape.cpp +0 -87
  312. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/DecoratedShape.h +0 -80
  313. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/EmptyShape.cpp +0 -64
  314. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/EmptyShape.h +0 -75
  315. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/GetTrianglesContext.h +0 -248
  316. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/HeightFieldShape.cpp +0 -2754
  317. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/HeightFieldShape.h +0 -380
  318. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MeshShape.cpp +0 -1305
  319. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MeshShape.h +0 -228
  320. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MutableCompoundShape.cpp +0 -596
  321. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MutableCompoundShape.h +0 -176
  322. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.cpp +0 -217
  323. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h +0 -140
  324. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PlaneShape.cpp +0 -541
  325. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PlaneShape.h +0 -147
  326. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PolyhedronSubmergedVolumeCalculator.h +0 -319
  327. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.cpp +0 -333
  328. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h +0 -161
  329. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaleHelpers.h +0 -83
  330. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaledShape.cpp +0 -238
  331. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaledShape.h +0 -145
  332. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/Shape.cpp +0 -325
  333. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/Shape.h +0 -466
  334. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SphereShape.cpp +0 -347
  335. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SphereShape.h +0 -125
  336. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/StaticCompoundShape.cpp +0 -674
  337. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/StaticCompoundShape.h +0 -139
  338. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SubShapeID.h +0 -138
  339. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SubShapeIDPair.h +0 -65
  340. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.cpp +0 -453
  341. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.gliffy +0 -1
  342. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h +0 -135
  343. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCylinderShape.cpp +0 -691
  344. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCylinderShape.h +0 -132
  345. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TriangleShape.cpp +0 -430
  346. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TriangleShape.h +0 -143
  347. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ShapeCast.h +0 -173
  348. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ShapeFilter.h +0 -73
  349. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SimShapeFilter.h +0 -40
  350. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SimShapeFilterWrapper.h +0 -58
  351. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SortReverseAndStore.h +0 -48
  352. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/TransformedShape.cpp +0 -180
  353. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/TransformedShape.h +0 -194
  354. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/CalculateSolverSteps.h +0 -70
  355. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConeConstraint.cpp +0 -246
  356. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConeConstraint.h +0 -133
  357. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/Constraint.cpp +0 -73
  358. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/Constraint.h +0 -243
  359. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintManager.cpp +0 -289
  360. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintManager.h +0 -100
  361. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h +0 -257
  362. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h +0 -682
  363. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/DualAxisConstraintPart.h +0 -276
  364. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/GearConstraintPart.h +0 -195
  365. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h +0 -222
  366. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/IndependentAxisConstraintPart.h +0 -246
  367. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h +0 -239
  368. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RackAndPinionConstraintPart.h +0 -196
  369. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h +0 -283
  370. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RotationQuatConstraintPart.h +0 -246
  371. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/SpringPart.h +0 -169
  372. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h +0 -597
  373. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ContactConstraintManager.cpp +0 -1804
  374. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ContactConstraintManager.h +0 -524
  375. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/DistanceConstraint.cpp +0 -266
  376. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/DistanceConstraint.h +0 -120
  377. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/FixedConstraint.cpp +0 -215
  378. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/FixedConstraint.h +0 -96
  379. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/GearConstraint.cpp +0 -188
  380. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/GearConstraint.h +0 -116
  381. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/HingeConstraint.cpp +0 -443
  382. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/HingeConstraint.h +0 -205
  383. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/MotorSettings.cpp +0 -43
  384. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/MotorSettings.h +0 -66
  385. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraint.cpp +0 -458
  386. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraint.h +0 -191
  387. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPath.cpp +0 -85
  388. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPath.h +0 -76
  389. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPathHermite.cpp +0 -308
  390. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPathHermite.h +0 -54
  391. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PointConstraint.cpp +0 -157
  392. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PointConstraint.h +0 -94
  393. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PulleyConstraint.cpp +0 -253
  394. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PulleyConstraint.h +0 -137
  395. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/RackAndPinionConstraint.cpp +0 -189
  396. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/RackAndPinionConstraint.h +0 -118
  397. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SixDOFConstraint.cpp +0 -900
  398. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SixDOFConstraint.h +0 -289
  399. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SliderConstraint.cpp +0 -501
  400. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SliderConstraint.h +0 -198
  401. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SpringSettings.cpp +0 -35
  402. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SpringSettings.h +0 -70
  403. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SwingTwistConstraint.cpp +0 -524
  404. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SwingTwistConstraint.h +0 -197
  405. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/TwoBodyConstraint.cpp +0 -56
  406. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/TwoBodyConstraint.h +0 -65
  407. package/native/third_party/JoltPhysics/Jolt/Physics/DeterminismLog.cpp +0 -17
  408. package/native/third_party/JoltPhysics/Jolt/Physics/DeterminismLog.h +0 -159
  409. package/native/third_party/JoltPhysics/Jolt/Physics/EActivation.h +0 -16
  410. package/native/third_party/JoltPhysics/Jolt/Physics/EPhysicsUpdateError.h +0 -37
  411. package/native/third_party/JoltPhysics/Jolt/Physics/IslandBuilder.cpp +0 -492
  412. package/native/third_party/JoltPhysics/Jolt/Physics/IslandBuilder.h +0 -144
  413. package/native/third_party/JoltPhysics/Jolt/Physics/LargeIslandSplitter.cpp +0 -582
  414. package/native/third_party/JoltPhysics/Jolt/Physics/LargeIslandSplitter.h +0 -187
  415. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsLock.h +0 -169
  416. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsScene.cpp +0 -261
  417. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsScene.h +0 -104
  418. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSettings.h +0 -125
  419. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsStepListener.h +0 -37
  420. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSystem.cpp +0 -2915
  421. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSystem.h +0 -391
  422. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsUpdateContext.cpp +0 -25
  423. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsUpdateContext.h +0 -176
  424. package/native/third_party/JoltPhysics/Jolt/Physics/Ragdoll/Ragdoll.cpp +0 -744
  425. package/native/third_party/JoltPhysics/Jolt/Physics/Ragdoll/Ragdoll.h +0 -245
  426. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyContactListener.h +0 -55
  427. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyCreationSettings.cpp +0 -128
  428. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyCreationSettings.h +0 -75
  429. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyManifold.h +0 -74
  430. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyMotionProperties.cpp +0 -1501
  431. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyMotionProperties.h +0 -333
  432. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyShape.cpp +0 -354
  433. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyShape.h +0 -73
  434. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodySharedSettings.cpp +0 -1487
  435. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodySharedSettings.h +0 -390
  436. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyUpdateContext.h +0 -63
  437. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyVertex.h +0 -36
  438. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorder.h +0 -136
  439. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorderImpl.cpp +0 -90
  440. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorderImpl.h +0 -50
  441. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/MotorcycleController.cpp +0 -306
  442. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/MotorcycleController.h +0 -119
  443. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/TrackedVehicleController.cpp +0 -547
  444. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/TrackedVehicleController.h +0 -169
  445. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleAntiRollBar.cpp +0 -33
  446. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleAntiRollBar.h +0 -33
  447. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleCollisionTester.cpp +0 -376
  448. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleCollisionTester.h +0 -146
  449. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleConstraint.cpp +0 -703
  450. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleConstraint.h +0 -252
  451. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleController.cpp +0 -17
  452. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleController.h +0 -87
  453. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleDifferential.cpp +0 -81
  454. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleDifferential.h +0 -39
  455. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleEngine.cpp +0 -122
  456. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleEngine.h +0 -93
  457. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTrack.cpp +0 -52
  458. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTrack.h +0 -56
  459. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTransmission.cpp +0 -159
  460. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTransmission.h +0 -87
  461. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/Wheel.cpp +0 -93
  462. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/Wheel.h +0 -148
  463. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/WheeledVehicleController.cpp +0 -866
  464. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/WheeledVehicleController.h +0 -205
  465. package/native/third_party/JoltPhysics/Jolt/RegisterTypes.cpp +0 -204
  466. package/native/third_party/JoltPhysics/Jolt/RegisterTypes.h +0 -29
  467. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRenderer.cpp +0 -1107
  468. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRenderer.h +0 -383
  469. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererPlayback.cpp +0 -168
  470. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererPlayback.h +0 -48
  471. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererRecorder.cpp +0 -158
  472. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererRecorder.h +0 -130
  473. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererSimple.cpp +0 -80
  474. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererSimple.h +0 -88
  475. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletalAnimation.cpp +0 -165
  476. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletalAnimation.h +0 -91
  477. package/native/third_party/JoltPhysics/Jolt/Skeleton/Skeleton.cpp +0 -82
  478. package/native/third_party/JoltPhysics/Jolt/Skeleton/Skeleton.h +0 -72
  479. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonMapper.cpp +0 -237
  480. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonMapper.h +0 -145
  481. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonPose.cpp +0 -87
  482. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonPose.h +0 -82
  483. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitter.cpp +0 -73
  484. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitter.h +0 -84
  485. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterBinning.cpp +0 -139
  486. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterBinning.h +0 -52
  487. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterMean.cpp +0 -43
  488. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterMean.h +0 -28
  489. package/native/third_party/JoltPhysics/LICENSE +0 -7
  490. package/native/third_party/JoltPhysics/README.md +0 -173
  491. package/native/third_party/bloom_jolt/CMakeLists.txt +0 -87
  492. package/native/third_party/bloom_jolt/include/bloom_jolt.h +0 -519
  493. package/native/third_party/bloom_jolt/src/bloom_jolt.cpp +0 -1780
@@ -1,1487 +0,0 @@
1
- // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2
- // SPDX-FileCopyrightText: 2023 Jorrit Rouwe
3
- // SPDX-License-Identifier: MIT
4
-
5
- #include <Jolt/Jolt.h>
6
-
7
- #include <Jolt/Physics/SoftBody/SoftBodySharedSettings.h>
8
- #include <Jolt/Physics/SoftBody/SoftBodyUpdateContext.h>
9
- #include <Jolt/ObjectStream/TypeDeclarations.h>
10
- #include <Jolt/Core/StreamIn.h>
11
- #include <Jolt/Core/StreamOut.h>
12
- #include <Jolt/Core/QuickSort.h>
13
- #include <Jolt/Core/UnorderedMap.h>
14
- #include <Jolt/Core/UnorderedSet.h>
15
- #include <Jolt/Core/BinaryHeap.h>
16
-
17
- JPH_NAMESPACE_BEGIN
18
-
19
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::Vertex)
20
- {
21
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Vertex, mPosition)
22
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Vertex, mVelocity)
23
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Vertex, mInvMass)
24
- }
25
-
26
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::Face)
27
- {
28
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Face, mVertex)
29
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Face, mMaterialIndex)
30
- }
31
-
32
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::Edge)
33
- {
34
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Edge, mVertex)
35
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Edge, mRestLength)
36
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Edge, mCompliance)
37
- }
38
-
39
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::RodStretchShear)
40
- {
41
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::RodStretchShear, mVertex)
42
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::RodStretchShear, mLength)
43
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::RodStretchShear, mInvMass)
44
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::RodStretchShear, mCompliance)
45
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::RodStretchShear, mBishop)
46
- }
47
-
48
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::RodBendTwist)
49
- {
50
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::RodBendTwist, mRod)
51
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::RodBendTwist, mCompliance)
52
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::RodBendTwist, mOmega0)
53
- }
54
-
55
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::DihedralBend)
56
- {
57
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::DihedralBend, mVertex)
58
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::DihedralBend, mCompliance)
59
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::DihedralBend, mInitialAngle)
60
- }
61
-
62
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::Volume)
63
- {
64
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Volume, mVertex)
65
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Volume, mSixRestVolume)
66
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Volume, mCompliance)
67
- }
68
-
69
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::InvBind)
70
- {
71
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::InvBind, mJointIndex)
72
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::InvBind, mInvBind)
73
- }
74
-
75
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::SkinWeight)
76
- {
77
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::SkinWeight, mInvBindIndex)
78
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::SkinWeight, mWeight)
79
- }
80
-
81
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::Skinned)
82
- {
83
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Skinned, mVertex)
84
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Skinned, mWeights)
85
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Skinned, mMaxDistance)
86
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Skinned, mBackStopDistance)
87
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::Skinned, mBackStopRadius)
88
- }
89
-
90
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings::LRA)
91
- {
92
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::LRA, mVertex)
93
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings::LRA, mMaxDistance)
94
- }
95
-
96
- JPH_IMPLEMENT_SERIALIZABLE_NON_VIRTUAL(SoftBodySharedSettings)
97
- {
98
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mVertices)
99
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mFaces)
100
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mEdgeConstraints)
101
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mDihedralBendConstraints)
102
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mVolumeConstraints)
103
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mSkinnedConstraints)
104
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mInvBindMatrices)
105
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mLRAConstraints)
106
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mRodStretchShearConstraints)
107
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mRodBendTwistConstraints)
108
- JPH_ADD_ATTRIBUTE(SoftBodySharedSettings, mMaterials)
109
- }
110
-
111
- void SoftBodySharedSettings::CalculateClosestKinematic()
112
- {
113
- // Check if we already calculated this
114
- if (!mClosestKinematic.empty())
115
- return;
116
-
117
- // Reserve output size
118
- mClosestKinematic.resize(mVertices.size());
119
-
120
- // Create a list of connected vertices
121
- Array<Array<uint32>> connectivity;
122
- connectivity.resize(mVertices.size());
123
- for (const Edge &e : mEdgeConstraints)
124
- {
125
- connectivity[e.mVertex[0]].push_back(e.mVertex[1]);
126
- connectivity[e.mVertex[1]].push_back(e.mVertex[0]);
127
- }
128
- for (const RodStretchShear &r : mRodStretchShearConstraints)
129
- {
130
- connectivity[r.mVertex[0]].push_back(r.mVertex[1]);
131
- connectivity[r.mVertex[1]].push_back(r.mVertex[0]);
132
- }
133
-
134
- // Use Dijkstra's algorithm to find the closest kinematic vertex for each vertex
135
- // See: https://en.wikipedia.org/wiki/Dijkstra's_algorithm
136
- //
137
- // An element in the open list
138
- struct Open
139
- {
140
- // Order so that we get the shortest distance first
141
- bool operator < (const Open &inRHS) const
142
- {
143
- return mDistance > inRHS.mDistance;
144
- }
145
-
146
- uint32 mVertex;
147
- float mDistance;
148
- };
149
-
150
- // Start with all kinematic elements
151
- Array<Open> to_visit;
152
- for (uint32 v = 0; v < mVertices.size(); ++v)
153
- if (mVertices[v].mInvMass == 0.0f)
154
- {
155
- mClosestKinematic[v].mVertex = v;
156
- mClosestKinematic[v].mHops = 0;
157
- mClosestKinematic[v].mDistance = 0.0f;
158
- to_visit.push_back({ v, 0.0f });
159
- BinaryHeapPush(to_visit.begin(), to_visit.end(), std::less<Open> { });
160
- }
161
-
162
- // Visit all vertices remembering the closest kinematic vertex and its distance
163
- JPH_IF_ENABLE_ASSERTS(float last_closest = 0.0f;)
164
- while (!to_visit.empty())
165
- {
166
- // Pop element from the open list
167
- BinaryHeapPop(to_visit.begin(), to_visit.end(), std::less<Open> { });
168
- Open current = to_visit.back();
169
- to_visit.pop_back();
170
- JPH_ASSERT(current.mDistance >= last_closest);
171
- JPH_IF_ENABLE_ASSERTS(last_closest = current.mDistance;)
172
-
173
- // Loop through all of its connected vertices
174
- for (uint32 v : connectivity[current.mVertex])
175
- {
176
- // Calculate distance from the current vertex to this target vertex and check if it is smaller
177
- float new_distance = current.mDistance + (Vec3(mVertices[v].mPosition) - Vec3(mVertices[current.mVertex].mPosition)).Length();
178
- if (new_distance < mClosestKinematic[v].mDistance)
179
- {
180
- // Remember new closest vertex
181
- mClosestKinematic[v].mVertex = mClosestKinematic[current.mVertex].mVertex;
182
- mClosestKinematic[v].mHops = mClosestKinematic[current.mVertex].mHops + 1;
183
- mClosestKinematic[v].mDistance = new_distance;
184
- to_visit.push_back({ v, new_distance });
185
- BinaryHeapPush(to_visit.begin(), to_visit.end(), std::less<Open> { });
186
- }
187
- }
188
- }
189
- }
190
-
191
- void SoftBodySharedSettings::CreateConstraints(const VertexAttributes *inVertexAttributes, uint inVertexAttributesLength, EBendType inBendType, float inAngleTolerance)
192
- {
193
- struct EdgeHelper
194
- {
195
- uint32 mVertex[2];
196
- uint32 mEdgeIdx;
197
- };
198
-
199
- // Create list of all edges
200
- Array<EdgeHelper> edges;
201
- edges.reserve(mFaces.size() * 3);
202
- for (const Face &f : mFaces)
203
- for (int i = 0; i < 3; ++i)
204
- {
205
- uint32 v0 = f.mVertex[i];
206
- uint32 v1 = f.mVertex[(i + 1) % 3];
207
-
208
- EdgeHelper e;
209
- e.mVertex[0] = min(v0, v1);
210
- e.mVertex[1] = max(v0, v1);
211
- e.mEdgeIdx = uint32(&f - mFaces.data()) * 3 + i;
212
- edges.push_back(e);
213
- }
214
-
215
- // Sort the edges
216
- QuickSort(edges.begin(), edges.end(), [](const EdgeHelper &inLHS, const EdgeHelper &inRHS) { return inLHS.mVertex[0] < inRHS.mVertex[0] || (inLHS.mVertex[0] == inRHS.mVertex[0] && inLHS.mVertex[1] < inRHS.mVertex[1]); });
217
-
218
- // Only add edges if one of the vertices is movable
219
- auto add_edge = [this](uint32 inVtx1, uint32 inVtx2, float inCompliance1, float inCompliance2) {
220
- if ((mVertices[inVtx1].mInvMass > 0.0f || mVertices[inVtx2].mInvMass > 0.0f)
221
- && inCompliance1 < FLT_MAX && inCompliance2 < FLT_MAX)
222
- {
223
- Edge temp_edge;
224
- temp_edge.mVertex[0] = inVtx1;
225
- temp_edge.mVertex[1] = inVtx2;
226
- temp_edge.mCompliance = 0.5f * (inCompliance1 + inCompliance2);
227
- temp_edge.mRestLength = (Vec3(mVertices[inVtx2].mPosition) - Vec3(mVertices[inVtx1].mPosition)).Length();
228
- JPH_ASSERT(temp_edge.mRestLength > 0.0f);
229
- mEdgeConstraints.push_back(temp_edge);
230
- }
231
- };
232
-
233
- // Helper function to get the attributes of a vertex
234
- auto attr = [inVertexAttributes, inVertexAttributesLength](uint32 inVertex) {
235
- return inVertexAttributes[min(inVertex, inVertexAttributesLength - 1)];
236
- };
237
-
238
- // Create the constraints
239
- float sq_sin_tolerance = Square(Sin(inAngleTolerance));
240
- float sq_cos_tolerance = Square(Cos(inAngleTolerance));
241
- mEdgeConstraints.clear();
242
- mEdgeConstraints.reserve(edges.size());
243
- for (Array<EdgeHelper>::size_type i = 0; i < edges.size(); ++i)
244
- {
245
- const EdgeHelper &e0 = edges[i];
246
-
247
- // Get attributes for the vertices of the edge
248
- const VertexAttributes &a0 = attr(e0.mVertex[0]);
249
- const VertexAttributes &a1 = attr(e0.mVertex[1]);
250
-
251
- // Flag that indicates if this edge is a shear edge (if 2 triangles form a quad-like shape and this edge is on the diagonal)
252
- bool is_shear = false;
253
-
254
- // Test if there are any shared edges
255
- for (Array<EdgeHelper>::size_type j = i + 1; j < edges.size(); ++j)
256
- {
257
- const EdgeHelper &e1 = edges[j];
258
- if (e0.mVertex[0] == e1.mVertex[0] && e0.mVertex[1] == e1.mVertex[1])
259
- {
260
- // Get opposing vertices
261
- const Face &f0 = mFaces[e0.mEdgeIdx / 3];
262
- const Face &f1 = mFaces[e1.mEdgeIdx / 3];
263
- uint32 vopposite0 = f0.mVertex[(e0.mEdgeIdx + 2) % 3];
264
- uint32 vopposite1 = f1.mVertex[(e1.mEdgeIdx + 2) % 3];
265
- const VertexAttributes &a_opposite0 = attr(vopposite0);
266
- const VertexAttributes &a_opposite1 = attr(vopposite1);
267
-
268
- // If the opposite vertices happen to be the same vertex then we have 2 triangles back to back and we skip creating shear / bend constraints
269
- if (vopposite0 == vopposite1)
270
- continue;
271
-
272
- // Faces should be roughly in a plane
273
- Vec3 n0 = (Vec3(mVertices[f0.mVertex[2]].mPosition) - Vec3(mVertices[f0.mVertex[0]].mPosition)).Cross(Vec3(mVertices[f0.mVertex[1]].mPosition) - Vec3(mVertices[f0.mVertex[0]].mPosition));
274
- Vec3 n1 = (Vec3(mVertices[f1.mVertex[2]].mPosition) - Vec3(mVertices[f1.mVertex[0]].mPosition)).Cross(Vec3(mVertices[f1.mVertex[1]].mPosition) - Vec3(mVertices[f1.mVertex[0]].mPosition));
275
- float n0_dot_n1 = n0.Dot(n1);
276
- if (n0_dot_n1 > 0.0f
277
- && Square(n0_dot_n1) > sq_cos_tolerance * n0.LengthSq() * n1.LengthSq())
278
- {
279
- // Faces should approximately form a quad
280
- Vec3 e0_dir = Vec3(mVertices[vopposite0].mPosition) - Vec3(mVertices[e0.mVertex[0]].mPosition);
281
- Vec3 e1_dir = Vec3(mVertices[vopposite1].mPosition) - Vec3(mVertices[e0.mVertex[0]].mPosition);
282
- if (Square(e0_dir.Dot(e1_dir)) < sq_sin_tolerance * e0_dir.LengthSq() * e1_dir.LengthSq())
283
- {
284
- // Shear constraint
285
- add_edge(vopposite0, vopposite1, a_opposite0.mShearCompliance, a_opposite1.mShearCompliance);
286
- is_shear = true;
287
- }
288
- }
289
-
290
- // Bend constraint
291
- switch (inBendType)
292
- {
293
- case EBendType::None:
294
- // Do nothing
295
- break;
296
-
297
- case EBendType::Distance:
298
- // Create an edge constraint to represent the bend constraint
299
- // Use the bend compliance of the shared edge
300
- if (!is_shear)
301
- add_edge(vopposite0, vopposite1, a0.mBendCompliance, a1.mBendCompliance);
302
- break;
303
-
304
- case EBendType::Dihedral:
305
- // Test if both opposite vertices are free to move
306
- if ((mVertices[vopposite0].mInvMass > 0.0f || mVertices[vopposite1].mInvMass > 0.0f)
307
- && a0.mBendCompliance < FLT_MAX && a1.mBendCompliance < FLT_MAX)
308
- {
309
- // Create a bend constraint
310
- // Use the bend compliance of the shared edge
311
- mDihedralBendConstraints.emplace_back(e0.mVertex[0], e0.mVertex[1], vopposite0, vopposite1, 0.5f * (a0.mBendCompliance + a1.mBendCompliance));
312
- }
313
- break;
314
- }
315
- }
316
- else
317
- {
318
- // Start iterating from the first non-shared edge
319
- i = j - 1;
320
- break;
321
- }
322
- }
323
-
324
- // Create a edge constraint for the current edge
325
- add_edge(e0.mVertex[0], e0.mVertex[1], is_shear? a0.mShearCompliance : a0.mCompliance, is_shear? a1.mShearCompliance : a1.mCompliance);
326
- }
327
- mEdgeConstraints.shrink_to_fit();
328
-
329
- // Calculate the initial angle for all bend constraints
330
- CalculateBendConstraintConstants();
331
-
332
- // Check if any vertices have LRA constraints
333
- bool has_lra_constraints = false;
334
- for (const VertexAttributes *va = inVertexAttributes; va < inVertexAttributes + inVertexAttributesLength; ++va)
335
- if (va->mLRAType != ELRAType::None)
336
- {
337
- has_lra_constraints = true;
338
- break;
339
- }
340
- if (has_lra_constraints)
341
- {
342
- // Ensure we have calculated the closest kinematic vertex for each vertex
343
- CalculateClosestKinematic();
344
-
345
- // Find non-kinematic vertices
346
- for (uint32 v = 0; v < (uint32)mVertices.size(); ++v)
347
- if (mVertices[v].mInvMass > 0.0f)
348
- {
349
- // Check if a closest vertex was found
350
- uint32 closest = mClosestKinematic[v].mVertex;
351
- if (closest != 0xffffffff)
352
- {
353
- // Check which LRA constraint to create
354
- const VertexAttributes &va = attr(v);
355
- switch (va.mLRAType)
356
- {
357
- case ELRAType::None:
358
- break;
359
-
360
- case ELRAType::EuclideanDistance:
361
- mLRAConstraints.emplace_back(closest, v, va.mLRAMaxDistanceMultiplier * (Vec3(mVertices[closest].mPosition) - Vec3(mVertices[v].mPosition)).Length());
362
- break;
363
-
364
- case ELRAType::GeodesicDistance:
365
- mLRAConstraints.emplace_back(closest, v, va.mLRAMaxDistanceMultiplier * mClosestKinematic[v].mDistance);
366
- break;
367
- }
368
- }
369
- }
370
- }
371
- }
372
-
373
- void SoftBodySharedSettings::CalculateEdgeLengths()
374
- {
375
- for (Edge &e : mEdgeConstraints)
376
- {
377
- JPH_ASSERT(e.mVertex[0] != e.mVertex[1], "Edges need to connect 2 different vertices");
378
- e.mRestLength = (Vec3(mVertices[e.mVertex[1]].mPosition) - Vec3(mVertices[e.mVertex[0]].mPosition)).Length();
379
- JPH_ASSERT(e.mRestLength > 0.0f);
380
- }
381
- }
382
-
383
- void SoftBodySharedSettings::CalculateRodProperties()
384
- {
385
- // Mark connections through bend twist constraints
386
- Array<Array<uint32>> connections;
387
- connections.resize(mRodStretchShearConstraints.size());
388
- for (const RodBendTwist &c : mRodBendTwistConstraints)
389
- {
390
- JPH_ASSERT(c.mRod[0] != c.mRod[1], "A bend twist constraint needs to be attached to different rods");
391
- connections[c.mRod[1]].push_back(c.mRod[0]);
392
- connections[c.mRod[0]].push_back(c.mRod[1]);
393
- }
394
-
395
- // Now calculate the Bishop frames for all rods
396
- struct Entry
397
- {
398
- uint32 mFrom; // Rod we're coming from
399
- uint32 mTo; // Rod we're going to
400
- };
401
- Array<Entry> stack;
402
- stack.reserve(mRodStretchShearConstraints.size());
403
- for (uint32 r0_idx = 0; r0_idx < mRodStretchShearConstraints.size(); ++r0_idx)
404
- {
405
- RodStretchShear &r0 = mRodStretchShearConstraints[r0_idx];
406
-
407
- // Do not calculate a 2nd time
408
- if (r0.mBishop == Quat::sZero())
409
- {
410
- // Calculate the frame for this rod
411
- {
412
- Vec3 tangent = Vec3(mVertices[r0.mVertex[1]].mPosition) - Vec3(mVertices[r0.mVertex[0]].mPosition);
413
- r0.mLength = tangent.Length();
414
- JPH_ASSERT(r0.mLength > 0.0f, "Rods of zero length are not supported!");
415
- tangent /= r0.mLength;
416
- Vec3 normal = tangent.GetNormalizedPerpendicular();
417
- Vec3 binormal = tangent.Cross(normal);
418
- r0.mBishop = Mat44(Vec4(normal, 0), Vec4(binormal, 0), Vec4(tangent, 0), Vec4(0, 0, 0, 1)).GetQuaternion().Normalized();
419
- }
420
-
421
- // Add connected rods to the stack if they haven't been calculated yet
422
- for (uint32 r1_idx : connections[r0_idx])
423
- if (mRodStretchShearConstraints[r1_idx].mBishop == Quat::sZero())
424
- stack.push_back({ r0_idx, r1_idx });
425
-
426
- // Now connect the bishop frame for all connected rods on the stack
427
- // This follows the procedure outlined in "Discrete Elastic Rods" - M. Bergou et al.
428
- // See: https://www.cs.columbia.edu/cg/pdfs/143-rods.pdf
429
- while (!stack.empty())
430
- {
431
- uint32 r1_idx = stack.back().mFrom;
432
- uint32 r2_idx = stack.back().mTo;
433
- stack.pop_back();
434
-
435
- const RodStretchShear &r1 = mRodStretchShearConstraints[r1_idx];
436
- RodStretchShear &r2 = mRodStretchShearConstraints[r2_idx];
437
-
438
- // Get the normal and tangent of the first rod's Bishop frame (that was already calculated)
439
- Mat44 r1_frame = Mat44::sRotation(r1.mBishop);
440
- Vec3 tangent1 = r1_frame.GetAxisZ();
441
- Vec3 normal1 = r1_frame.GetAxisX();
442
-
443
- // Calculate the Bishop frame for the 2nd rod
444
- Vec3 tangent2 = Vec3(mVertices[r2.mVertex[1]].mPosition) - Vec3(mVertices[r2.mVertex[0]].mPosition);
445
- if (tangent1.Dot(tangent2) < 0.0f)
446
- {
447
- // Edge is oriented in the opposite direction of the previous edge, flip it
448
- std::swap(r2.mVertex[0], r2.mVertex[1]);
449
- tangent2 = -tangent2;
450
- }
451
- r2.mLength = tangent2.Length();
452
- JPH_ASSERT(r2.mLength > 0.0f, "Rods of zero length are not supported!");
453
- tangent2 /= r2.mLength;
454
- Vec3 t1_cross_t2 = tangent1.Cross(tangent2);
455
- float sin_angle = t1_cross_t2.Length();
456
- Vec3 normal2 = normal1;
457
- if (sin_angle > 1.0e-6f)
458
- {
459
- t1_cross_t2 /= sin_angle;
460
- normal2 = Quat::sRotation(t1_cross_t2, ASin(sin_angle)) * normal2;
461
- }
462
- Vec3 binormal2 = tangent2.Cross(normal2);
463
- r2.mBishop = Mat44(Vec4(normal2, 0), Vec4(binormal2, 0), Vec4(tangent2, 0), Vec4(0, 0, 0, 1)).GetQuaternion().Normalized();
464
-
465
- // Add connected rods to the stack if they haven't been calculated yet
466
- for (uint32 r3_idx : connections[r2_idx])
467
- if (mRodStretchShearConstraints[r3_idx].mBishop == Quat::sZero())
468
- stack.push_back({ r2_idx, r3_idx });
469
- }
470
- }
471
- }
472
-
473
- // Calculate inverse mass for all rods by taking the minimum inverse mass (aka the heaviest vertex) of both vertices
474
- for (RodStretchShear &r : mRodStretchShearConstraints)
475
- {
476
- JPH_ASSERT(r.mVertex[0] != r.mVertex[1], "A rod stretch shear constraint requires two different vertices");
477
- r.mInvMass = min(mVertices[r.mVertex[0]].mInvMass, mVertices[r.mVertex[1]].mInvMass);
478
- }
479
-
480
- // Calculate the initial rotation between the rods
481
- for (RodBendTwist &r : mRodBendTwistConstraints)
482
- r.mOmega0 = (mRodStretchShearConstraints[r.mRod[0]].mBishop.Conjugated() * mRodStretchShearConstraints[r.mRod[1]].mBishop).Normalized();
483
- }
484
-
485
- void SoftBodySharedSettings::CalculateLRALengths(float inMaxDistanceMultiplier)
486
- {
487
- for (LRA &l : mLRAConstraints)
488
- {
489
- JPH_ASSERT(l.mVertex[0] != l.mVertex[1], "LRA constraints need to connect 2 different vertices");
490
- l.mMaxDistance = inMaxDistanceMultiplier * (Vec3(mVertices[l.mVertex[1]].mPosition) - Vec3(mVertices[l.mVertex[0]].mPosition)).Length();
491
- JPH_ASSERT(l.mMaxDistance > 0.0f);
492
- }
493
- }
494
-
495
- void SoftBodySharedSettings::CalculateBendConstraintConstants()
496
- {
497
- for (DihedralBend &b : mDihedralBendConstraints)
498
- {
499
- JPH_ASSERT(b.mVertex[0] != b.mVertex[1] && b.mVertex[0] != b.mVertex[2] && b.mVertex[0] != b.mVertex[3]
500
- && b.mVertex[1] != b.mVertex[2] && b.mVertex[1] != b.mVertex[3]
501
- && b.mVertex[2] != b.mVertex[3], "Bend constraints need 4 different vertices");
502
-
503
- // Get positions
504
- Vec3 x0 = Vec3(mVertices[b.mVertex[0]].mPosition);
505
- Vec3 x1 = Vec3(mVertices[b.mVertex[1]].mPosition);
506
- Vec3 x2 = Vec3(mVertices[b.mVertex[2]].mPosition);
507
- Vec3 x3 = Vec3(mVertices[b.mVertex[3]].mPosition);
508
-
509
- /*
510
- x2
511
- e1/ \e3
512
- / \
513
- x0----x1
514
- \ e0 /
515
- e2\ /e4
516
- x3
517
- */
518
-
519
- // Calculate edges
520
- Vec3 e0 = x1 - x0;
521
- Vec3 e1 = x2 - x0;
522
- Vec3 e2 = x3 - x0;
523
-
524
- // Normals of both triangles
525
- Vec3 n1 = e0.Cross(e1);
526
- Vec3 n2 = e2.Cross(e0);
527
- float denom = sqrt(n1.LengthSq() * n2.LengthSq());
528
- if (denom < 1.0e-12f)
529
- b.mInitialAngle = 0.0f;
530
- else
531
- {
532
- float sign = Sign(n2.Cross(n1).Dot(e0));
533
- b.mInitialAngle = sign * ACosApproximate(n1.Dot(n2) / denom); // Runtime uses the approximation too
534
- }
535
- }
536
- }
537
-
538
- void SoftBodySharedSettings::CalculateVolumeConstraintVolumes()
539
- {
540
- for (Volume &v : mVolumeConstraints)
541
- {
542
- JPH_ASSERT(v.mVertex[0] != v.mVertex[1] && v.mVertex[0] != v.mVertex[2] && v.mVertex[0] != v.mVertex[3]
543
- && v.mVertex[1] != v.mVertex[2] && v.mVertex[1] != v.mVertex[3]
544
- && v.mVertex[2] != v.mVertex[3], "Volume constraints need 4 different vertices");
545
-
546
- Vec3 x1(mVertices[v.mVertex[0]].mPosition);
547
- Vec3 x2(mVertices[v.mVertex[1]].mPosition);
548
- Vec3 x3(mVertices[v.mVertex[2]].mPosition);
549
- Vec3 x4(mVertices[v.mVertex[3]].mPosition);
550
-
551
- Vec3 x1x2 = x2 - x1;
552
- Vec3 x1x3 = x3 - x1;
553
- Vec3 x1x4 = x4 - x1;
554
-
555
- v.mSixRestVolume = abs(x1x2.Cross(x1x3).Dot(x1x4));
556
- }
557
- }
558
-
559
- void SoftBodySharedSettings::CalculateSkinnedConstraintNormals()
560
- {
561
- // Clear any previous results
562
- mSkinnedConstraintNormals.clear();
563
-
564
- // If there are no skinned constraints, we're done
565
- if (mSkinnedConstraints.empty())
566
- return;
567
-
568
- // First collect all vertices that are skinned
569
- using VertexIndexSet = UnorderedSet<uint32>;
570
- VertexIndexSet skinned_vertices;
571
- skinned_vertices.reserve(VertexIndexSet::size_type(mSkinnedConstraints.size()));
572
- for (const Skinned &s : mSkinnedConstraints)
573
- skinned_vertices.insert(s.mVertex);
574
-
575
- // Now collect all faces that connect only to skinned vertices
576
- using ConnectedFacesMap = UnorderedMap<uint32, VertexIndexSet>;
577
- ConnectedFacesMap connected_faces;
578
- connected_faces.reserve(ConnectedFacesMap::size_type(mVertices.size()));
579
- for (const Face &f : mFaces)
580
- {
581
- // Must connect to only skinned vertices
582
- bool valid = true;
583
- for (uint32 v : f.mVertex)
584
- valid &= skinned_vertices.find(v) != skinned_vertices.end();
585
- if (!valid)
586
- continue;
587
-
588
- // Store faces that connect to vertices
589
- for (uint32 v : f.mVertex)
590
- connected_faces[v].insert(uint32(&f - mFaces.data()));
591
- }
592
-
593
- // Populate the list of connecting faces per skinned vertex
594
- mSkinnedConstraintNormals.reserve(mFaces.size());
595
- for (Skinned &s : mSkinnedConstraints)
596
- {
597
- uint32 start = uint32(mSkinnedConstraintNormals.size());
598
- JPH_ASSERT((start >> 24) == 0);
599
- ConnectedFacesMap::const_iterator connected_faces_it = connected_faces.find(s.mVertex);
600
- if (connected_faces_it != connected_faces.cend())
601
- {
602
- const VertexIndexSet &faces = connected_faces_it->second;
603
- uint32 num = uint32(faces.size());
604
- JPH_ASSERT(num < 256);
605
- mSkinnedConstraintNormals.insert(mSkinnedConstraintNormals.end(), faces.begin(), faces.end());
606
- QuickSort(mSkinnedConstraintNormals.begin() + start, mSkinnedConstraintNormals.begin() + start + num);
607
- s.mNormalInfo = start + (num << 24);
608
- }
609
- else
610
- s.mNormalInfo = 0;
611
- }
612
- mSkinnedConstraintNormals.shrink_to_fit();
613
- }
614
-
615
- void SoftBodySharedSettings::Optimize(OptimizationResults &outResults)
616
- {
617
- // Clear any previous results
618
- mUpdateGroups.clear();
619
-
620
- // Create a list of connected vertices
621
- struct Connection
622
- {
623
- uint32 mVertex;
624
- uint32 mCount;
625
- };
626
- Array<Array<Connection>> connectivity;
627
- connectivity.resize(mVertices.size());
628
- auto add_connection = [&connectivity](uint inV1, uint inV2) {
629
- for (int i = 0; i < 2; ++i)
630
- {
631
- bool found = false;
632
- for (Connection &c : connectivity[inV1])
633
- if (c.mVertex == inV2)
634
- {
635
- c.mCount++;
636
- found = true;
637
- break;
638
- }
639
- if (!found)
640
- connectivity[inV1].push_back({ inV2, 1 });
641
-
642
- std::swap(inV1, inV2);
643
- }
644
- };
645
- for (const Edge &c : mEdgeConstraints)
646
- add_connection(c.mVertex[0], c.mVertex[1]);
647
- for (const LRA &c : mLRAConstraints)
648
- add_connection(c.mVertex[0], c.mVertex[1]);
649
- for (const RodStretchShear &c : mRodStretchShearConstraints)
650
- add_connection(c.mVertex[0], c.mVertex[1]);
651
- for (const RodBendTwist &c : mRodBendTwistConstraints)
652
- {
653
- add_connection(mRodStretchShearConstraints[c.mRod[0]].mVertex[0], mRodStretchShearConstraints[c.mRod[1]].mVertex[0]);
654
- add_connection(mRodStretchShearConstraints[c.mRod[0]].mVertex[1], mRodStretchShearConstraints[c.mRod[1]].mVertex[0]);
655
- add_connection(mRodStretchShearConstraints[c.mRod[0]].mVertex[0], mRodStretchShearConstraints[c.mRod[1]].mVertex[1]);
656
- add_connection(mRodStretchShearConstraints[c.mRod[0]].mVertex[1], mRodStretchShearConstraints[c.mRod[1]].mVertex[1]);
657
- }
658
- for (const DihedralBend &c : mDihedralBendConstraints)
659
- {
660
- add_connection(c.mVertex[0], c.mVertex[1]);
661
- add_connection(c.mVertex[0], c.mVertex[2]);
662
- add_connection(c.mVertex[0], c.mVertex[3]);
663
- add_connection(c.mVertex[1], c.mVertex[2]);
664
- add_connection(c.mVertex[1], c.mVertex[3]);
665
- add_connection(c.mVertex[2], c.mVertex[3]);
666
- }
667
- for (const Volume &c : mVolumeConstraints)
668
- {
669
- add_connection(c.mVertex[0], c.mVertex[1]);
670
- add_connection(c.mVertex[0], c.mVertex[2]);
671
- add_connection(c.mVertex[0], c.mVertex[3]);
672
- add_connection(c.mVertex[1], c.mVertex[2]);
673
- add_connection(c.mVertex[1], c.mVertex[3]);
674
- add_connection(c.mVertex[2], c.mVertex[3]);
675
- }
676
- // Skinned constraints only update 1 vertex, so we don't need special logic here
677
-
678
- // Maps each of the vertices to a group index
679
- Array<int> group_idx;
680
- group_idx.resize(mVertices.size(), -1);
681
-
682
- // Which group we are currently filling and its vertices
683
- int current_group_idx = 0;
684
- Array<uint> current_group;
685
-
686
- // Start greedy algorithm to group vertices
687
- for (;;)
688
- {
689
- // Find the bounding box of the ungrouped vertices
690
- AABox bounds;
691
- for (uint i = 0; i < (uint)mVertices.size(); ++i)
692
- if (group_idx[i] == -1)
693
- bounds.Encapsulate(Vec3(mVertices[i].mPosition));
694
-
695
- // If the bounds are invalid, it means that there were no ungrouped vertices
696
- if (!bounds.IsValid())
697
- break;
698
-
699
- // Determine longest and shortest axis
700
- Vec3 bounds_size = bounds.GetSize();
701
- uint max_axis = bounds_size.GetHighestComponentIndex();
702
- uint min_axis = bounds_size.GetLowestComponentIndex();
703
- if (min_axis == max_axis)
704
- min_axis = (min_axis + 1) % 3;
705
- uint mid_axis = 3 - min_axis - max_axis;
706
-
707
- // Find the vertex that has the lowest value on the axis with the largest extent
708
- uint current_vertex = UINT_MAX;
709
- Float3 current_vertex_position { FLT_MAX, FLT_MAX, FLT_MAX };
710
- for (uint i = 0; i < (uint)mVertices.size(); ++i)
711
- if (group_idx[i] == -1)
712
- {
713
- const Float3 &vertex_position = mVertices[i].mPosition;
714
- float max_axis_value = vertex_position[max_axis];
715
- float mid_axis_value = vertex_position[mid_axis];
716
- float min_axis_value = vertex_position[min_axis];
717
-
718
- if (max_axis_value < current_vertex_position[max_axis]
719
- || (max_axis_value == current_vertex_position[max_axis]
720
- && (mid_axis_value < current_vertex_position[mid_axis]
721
- || (mid_axis_value == current_vertex_position[mid_axis]
722
- && min_axis_value < current_vertex_position[min_axis]))))
723
- {
724
- current_vertex_position = mVertices[i].mPosition;
725
- current_vertex = i;
726
- }
727
- }
728
- if (current_vertex == UINT_MAX)
729
- break;
730
-
731
- // Initialize the current group with 1 vertex
732
- current_group.push_back(current_vertex);
733
- group_idx[current_vertex] = current_group_idx;
734
-
735
- // Fill up the group
736
- for (;;)
737
- {
738
- // Find the vertex that is most connected to the current group
739
- uint best_vertex = UINT_MAX;
740
- uint best_num_connections = 0;
741
- float best_dist_sq = FLT_MAX;
742
- for (uint i = 0; i < (uint)current_group.size(); ++i) // For all vertices in the current group
743
- for (const Connection &c : connectivity[current_group[i]]) // For all connections to other vertices
744
- {
745
- uint v = c.mVertex;
746
- if (group_idx[v] == -1) // Ungrouped vertices only
747
- {
748
- // Count the number of connections to this group
749
- uint num_connections = 0;
750
- for (const Connection &v2 : connectivity[v])
751
- if (group_idx[v2.mVertex] == current_group_idx)
752
- num_connections += v2.mCount;
753
-
754
- // Calculate distance to group centroid
755
- float dist_sq = (Vec3(mVertices[v].mPosition) - Vec3(mVertices[current_group.front()].mPosition)).LengthSq();
756
-
757
- if (best_vertex == UINT_MAX
758
- || num_connections > best_num_connections
759
- || (num_connections == best_num_connections && dist_sq < best_dist_sq))
760
- {
761
- best_vertex = v;
762
- best_num_connections = num_connections;
763
- best_dist_sq = dist_sq;
764
- }
765
- }
766
- }
767
-
768
- // Add the best vertex to the current group
769
- if (best_vertex != UINT_MAX)
770
- {
771
- current_group.push_back(best_vertex);
772
- group_idx[best_vertex] = current_group_idx;
773
- }
774
-
775
- // Create a new group?
776
- if (current_group.size() >= SoftBodyUpdateContext::cVertexConstraintBatch // If full, yes
777
- || (current_group.size() > SoftBodyUpdateContext::cVertexConstraintBatch / 2 && best_vertex == UINT_MAX)) // If half full and we found no connected vertex, yes
778
- {
779
- current_group.clear();
780
- current_group_idx++;
781
- break;
782
- }
783
-
784
- // If we didn't find a connected vertex, we need to find a new starting vertex
785
- if (best_vertex == UINT_MAX)
786
- break;
787
- }
788
- }
789
-
790
- // If the last group is more than half full, we'll keep it as a separate group, otherwise we merge it with the 'non parallel' group
791
- if (current_group.size() > SoftBodyUpdateContext::cVertexConstraintBatch / 2)
792
- ++current_group_idx;
793
-
794
- // We no longer need the current group array, free the memory
795
- current_group.clear();
796
- current_group.shrink_to_fit();
797
-
798
- // We're done with the connectivity list, free the memory
799
- connectivity.clear();
800
- connectivity.shrink_to_fit();
801
-
802
- // Assign the constraints to their groups
803
- struct Group
804
- {
805
- uint GetSize() const
806
- {
807
- return (uint)mEdgeConstraints.size() + (uint)mLRAConstraints.size() + (uint)mRodStretchShearConstraints.size() + (uint)mRodBendTwistConstraints.size() + (uint)mDihedralBendConstraints.size() + (uint)mVolumeConstraints.size() + (uint)mSkinnedConstraints.size();
808
- }
809
-
810
- Array<uint> mEdgeConstraints;
811
- Array<uint> mLRAConstraints;
812
- Array<uint> mRodStretchShearConstraints;
813
- Array<uint> mRodBendTwistConstraints;
814
- Array<uint> mDihedralBendConstraints;
815
- Array<uint> mVolumeConstraints;
816
- Array<uint> mSkinnedConstraints;
817
- };
818
- Array<Group> groups;
819
- groups.resize(current_group_idx + 1); // + non parallel group
820
- for (const Edge &e : mEdgeConstraints)
821
- {
822
- int g1 = group_idx[e.mVertex[0]];
823
- int g2 = group_idx[e.mVertex[1]];
824
- JPH_ASSERT(g1 >= 0 && g2 >= 0);
825
- if (g1 == g2) // In the same group
826
- groups[g1].mEdgeConstraints.push_back(uint(&e - mEdgeConstraints.data()));
827
- else // In different groups -> parallel group
828
- groups.back().mEdgeConstraints.push_back(uint(&e - mEdgeConstraints.data()));
829
- }
830
- for (const LRA &l : mLRAConstraints)
831
- {
832
- int g1 = group_idx[l.mVertex[0]];
833
- int g2 = group_idx[l.mVertex[1]];
834
- JPH_ASSERT(g1 >= 0 && g2 >= 0);
835
- if (g1 == g2) // In the same group
836
- groups[g1].mLRAConstraints.push_back(uint(&l - mLRAConstraints.data()));
837
- else // In different groups -> parallel group
838
- groups.back().mLRAConstraints.push_back(uint(&l - mLRAConstraints.data()));
839
- }
840
- for (const RodStretchShear &r : mRodStretchShearConstraints)
841
- {
842
- int g1 = group_idx[r.mVertex[0]];
843
- int g2 = group_idx[r.mVertex[1]];
844
- JPH_ASSERT(g1 >= 0 && g2 >= 0);
845
- if (g1 == g2) // In the same group
846
- groups[g1].mRodStretchShearConstraints.push_back(uint(&r - mRodStretchShearConstraints.data()));
847
- else // In different groups -> parallel group
848
- groups.back().mRodStretchShearConstraints.push_back(uint(&r - mRodStretchShearConstraints.data()));
849
- }
850
- for (const RodBendTwist &r : mRodBendTwistConstraints)
851
- {
852
- int g1 = group_idx[mRodStretchShearConstraints[r.mRod[0]].mVertex[0]];
853
- int g2 = group_idx[mRodStretchShearConstraints[r.mRod[0]].mVertex[1]];
854
- int g3 = group_idx[mRodStretchShearConstraints[r.mRod[1]].mVertex[0]];
855
- int g4 = group_idx[mRodStretchShearConstraints[r.mRod[1]].mVertex[1]];
856
- JPH_ASSERT(g1 >= 0 && g2 >= 0 && g3 >= 0 && g4 >= 0);
857
- if (g1 == g2 && g1 == g3 && g1 == g4) // In the same group
858
- groups[g1].mRodBendTwistConstraints.push_back(uint(&r - mRodBendTwistConstraints.data()));
859
- else // In different groups -> parallel group
860
- groups.back().mRodBendTwistConstraints.push_back(uint(&r - mRodBendTwistConstraints.data()));
861
- }
862
- for (const DihedralBend &d : mDihedralBendConstraints)
863
- {
864
- int g1 = group_idx[d.mVertex[0]];
865
- int g2 = group_idx[d.mVertex[1]];
866
- int g3 = group_idx[d.mVertex[2]];
867
- int g4 = group_idx[d.mVertex[3]];
868
- JPH_ASSERT(g1 >= 0 && g2 >= 0 && g3 >= 0 && g4 >= 0);
869
- if (g1 == g2 && g1 == g3 && g1 == g4) // In the same group
870
- groups[g1].mDihedralBendConstraints.push_back(uint(&d - mDihedralBendConstraints.data()));
871
- else // In different groups -> parallel group
872
- groups.back().mDihedralBendConstraints.push_back(uint(&d - mDihedralBendConstraints.data()));
873
- }
874
- for (const Volume &v : mVolumeConstraints)
875
- {
876
- int g1 = group_idx[v.mVertex[0]];
877
- int g2 = group_idx[v.mVertex[1]];
878
- int g3 = group_idx[v.mVertex[2]];
879
- int g4 = group_idx[v.mVertex[3]];
880
- JPH_ASSERT(g1 >= 0 && g2 >= 0 && g3 >= 0 && g4 >= 0);
881
- if (g1 == g2 && g1 == g3 && g1 == g4) // In the same group
882
- groups[g1].mVolumeConstraints.push_back(uint(&v - mVolumeConstraints.data()));
883
- else // In different groups -> parallel group
884
- groups.back().mVolumeConstraints.push_back(uint(&v - mVolumeConstraints.data()));
885
- }
886
- for (const Skinned &s : mSkinnedConstraints)
887
- {
888
- int g1 = group_idx[s.mVertex];
889
- JPH_ASSERT(g1 >= 0);
890
- groups[g1].mSkinnedConstraints.push_back(uint(&s - mSkinnedConstraints.data()));
891
- }
892
-
893
- // Sort the parallel groups from big to small (this means the big groups will be scheduled first and have more time to complete)
894
- QuickSort(groups.begin(), groups.end() - 1, [](const Group &inLHS, const Group &inRHS) { return inLHS.GetSize() > inRHS.GetSize(); });
895
-
896
- // Make sure we know the closest kinematic vertex so we can sort
897
- CalculateClosestKinematic();
898
-
899
- // Sort within each group
900
- for (Group &group : groups)
901
- {
902
- // Sort the edge constraints
903
- QuickSort(group.mEdgeConstraints.begin(), group.mEdgeConstraints.end(), [this](uint inLHS, uint inRHS)
904
- {
905
- const Edge &e1 = mEdgeConstraints[inLHS];
906
- const Edge &e2 = mEdgeConstraints[inRHS];
907
-
908
- // First sort so that the edge with the smallest distance to a kinematic vertex comes first
909
- float d1 = min(mClosestKinematic[e1.mVertex[0]].mDistance, mClosestKinematic[e1.mVertex[1]].mDistance);
910
- float d2 = min(mClosestKinematic[e2.mVertex[0]].mDistance, mClosestKinematic[e2.mVertex[1]].mDistance);
911
- if (d1 != d2)
912
- return d1 < d2;
913
-
914
- // Order the edges so that the ones with the smallest index go first (hoping to get better cache locality when we process the edges).
915
- // Note we could also re-order the vertices but that would be much more of a burden to the end user
916
- uint32 m1 = e1.GetMinVertexIndex();
917
- uint32 m2 = e2.GetMinVertexIndex();
918
- if (m1 != m2)
919
- return m1 < m2;
920
-
921
- return inLHS < inRHS;
922
- });
923
-
924
- // Sort the LRA constraints
925
- QuickSort(group.mLRAConstraints.begin(), group.mLRAConstraints.end(), [this](uint inLHS, uint inRHS)
926
- {
927
- const LRA &l1 = mLRAConstraints[inLHS];
928
- const LRA &l2 = mLRAConstraints[inRHS];
929
-
930
- // First sort so that the longest constraint comes first (meaning the shortest constraint has the most influence on the end result)
931
- // Most of the time there will be a single LRA constraint per vertex and since the LRA constraint only modifies a single vertex,
932
- // updating one constraint will not violate another constraint.
933
- if (l1.mMaxDistance != l2.mMaxDistance)
934
- return l1.mMaxDistance > l2.mMaxDistance;
935
-
936
- // Order constraints so that the ones with the smallest index go first
937
- uint32 m1 = l1.GetMinVertexIndex();
938
- uint32 m2 = l2.GetMinVertexIndex();
939
- if (m1 != m2)
940
- return m1 < m2;
941
-
942
- return inLHS < inRHS;
943
- });
944
-
945
- // Sort the rod stretch shear constraints
946
- QuickSort(group.mRodStretchShearConstraints.begin(), group.mRodStretchShearConstraints.end(), [this](uint inLHS, uint inRHS)
947
- {
948
- const RodStretchShear &r1 = mRodStretchShearConstraints[inLHS];
949
- const RodStretchShear &r2 = mRodStretchShearConstraints[inRHS];
950
-
951
- // First sort so that the rod with the smallest distance to a kinematic vertex comes first
952
- float d1 = min(mClosestKinematic[r1.mVertex[0]].mDistance, mClosestKinematic[r1.mVertex[1]].mDistance);
953
- float d2 = min(mClosestKinematic[r2.mVertex[0]].mDistance, mClosestKinematic[r2.mVertex[1]].mDistance);
954
- if (d1 != d2)
955
- return d1 < d2;
956
-
957
- // Then sort on the rod that connects to the smallest kinematic vertex
958
- uint32 m1 = min(mClosestKinematic[r1.mVertex[0]].mVertex, mClosestKinematic[r1.mVertex[1]].mVertex);
959
- uint32 m2 = min(mClosestKinematic[r2.mVertex[0]].mVertex, mClosestKinematic[r2.mVertex[1]].mVertex);
960
- if (m1 != m2)
961
- return m1 < m2;
962
-
963
- // Order the rods so that the ones with the smallest index go first (hoping to get better cache locality when we process the rods).
964
- m1 = r1.GetMinVertexIndex();
965
- m2 = r2.GetMinVertexIndex();
966
- if (m1 != m2)
967
- return m1 < m2;
968
-
969
- return inLHS < inRHS;
970
- });
971
-
972
- // Sort the rod bend twist constraints
973
- QuickSort(group.mRodBendTwistConstraints.begin(), group.mRodBendTwistConstraints.end(), [this](uint inLHS, uint inRHS)
974
- {
975
- const RodBendTwist &b1 = mRodBendTwistConstraints[inLHS];
976
- const RodStretchShear &b1_r1 = mRodStretchShearConstraints[b1.mRod[0]];
977
- const RodStretchShear &b1_r2 = mRodStretchShearConstraints[b1.mRod[1]];
978
-
979
- const RodBendTwist &b2 = mRodBendTwistConstraints[inRHS];
980
- const RodStretchShear &b2_r1 = mRodStretchShearConstraints[b2.mRod[0]];
981
- const RodStretchShear &b2_r2 = mRodStretchShearConstraints[b2.mRod[1]];
982
-
983
- // First sort so that the rod with the smallest number of hops to a kinematic vertex comes first.
984
- // Note that we don't use distance because of the bilateral interleaving below.
985
- uint32 m1 = min(
986
- min(mClosestKinematic[b1_r1.mVertex[0]].mHops, mClosestKinematic[b1_r1.mVertex[1]].mHops),
987
- min(mClosestKinematic[b1_r2.mVertex[0]].mHops, mClosestKinematic[b1_r2.mVertex[1]].mHops));
988
- uint32 m2 = min(
989
- min(mClosestKinematic[b2_r1.mVertex[0]].mHops, mClosestKinematic[b2_r1.mVertex[1]].mHops),
990
- min(mClosestKinematic[b2_r2.mVertex[0]].mHops, mClosestKinematic[b2_r2.mVertex[1]].mHops));
991
- if (m1 != m2)
992
- return m1 < m2;
993
-
994
- // Then sort on the rod that connects to the kinematic vertex with lowest index.
995
- // This ensures that we consistently order the rods that are attached to other kinematic constraints.
996
- // Again, this helps bilateral interleaving below.
997
- m1 = min(
998
- min(mClosestKinematic[b1_r1.mVertex[0]].mVertex, mClosestKinematic[b1_r1.mVertex[1]].mVertex),
999
- min(mClosestKinematic[b1_r2.mVertex[0]].mVertex, mClosestKinematic[b1_r2.mVertex[1]].mVertex));
1000
- m2 = min(
1001
- min(mClosestKinematic[b2_r1.mVertex[0]].mVertex, mClosestKinematic[b2_r1.mVertex[1]].mVertex),
1002
- min(mClosestKinematic[b2_r2.mVertex[0]].mVertex, mClosestKinematic[b2_r2.mVertex[1]].mVertex));
1003
- if (m1 != m2)
1004
- return m1 < m2;
1005
-
1006
- // Finally order so that the smallest vertex index goes first
1007
- m1 = min(b1_r1.GetMinVertexIndex(), b1_r2.GetMinVertexIndex());
1008
- m2 = min(b2_r1.GetMinVertexIndex(), b2_r2.GetMinVertexIndex());
1009
- if (m1 != m2)
1010
- return m1 < m2;
1011
-
1012
- return inLHS < inRHS;
1013
- });
1014
-
1015
- // Bilateral interleaving, see figure 4 of "Position and Orientation Based Cosserat Rods" - Kugelstadt and Schoemer - SIGGRAPH 2016
1016
- // Keeping the twist constraints sorted often results in an unstable simulation
1017
- for (Array<uint>::size_type i = 1, s = group.mRodBendTwistConstraints.size(), s2 = s >> 1; i < s2; i += 2)
1018
- std::swap(group.mRodBendTwistConstraints[i], group.mRodBendTwistConstraints[s - i]);
1019
-
1020
- // Sort the dihedral bend constraints
1021
- QuickSort(group.mDihedralBendConstraints.begin(), group.mDihedralBendConstraints.end(), [this](uint inLHS, uint inRHS)
1022
- {
1023
- const DihedralBend &b1 = mDihedralBendConstraints[inLHS];
1024
- const DihedralBend &b2 = mDihedralBendConstraints[inRHS];
1025
-
1026
- // First sort so that the constraint with the smallest distance to a kinematic vertex comes first
1027
- float d1 = min(
1028
- min(mClosestKinematic[b1.mVertex[0]].mDistance, mClosestKinematic[b1.mVertex[1]].mDistance),
1029
- min(mClosestKinematic[b1.mVertex[2]].mDistance, mClosestKinematic[b1.mVertex[3]].mDistance));
1030
- float d2 = min(
1031
- min(mClosestKinematic[b2.mVertex[0]].mDistance, mClosestKinematic[b2.mVertex[1]].mDistance),
1032
- min(mClosestKinematic[b2.mVertex[2]].mDistance, mClosestKinematic[b2.mVertex[3]].mDistance));
1033
- if (d1 != d2)
1034
- return d1 < d2;
1035
-
1036
- // Finally order so that the smallest vertex index goes first
1037
- uint32 m1 = b1.GetMinVertexIndex();
1038
- uint32 m2 = b2.GetMinVertexIndex();
1039
- if (m1 != m2)
1040
- return m1 < m2;
1041
-
1042
- return inLHS < inRHS;
1043
- });
1044
-
1045
- // Sort the volume constraints
1046
- QuickSort(group.mVolumeConstraints.begin(), group.mVolumeConstraints.end(), [this](uint inLHS, uint inRHS)
1047
- {
1048
- const Volume &v1 = mVolumeConstraints[inLHS];
1049
- const Volume &v2 = mVolumeConstraints[inRHS];
1050
-
1051
- // First sort so that the constraint with the smallest distance to a kinematic vertex comes first
1052
- float d1 = min(
1053
- min(mClosestKinematic[v1.mVertex[0]].mDistance, mClosestKinematic[v1.mVertex[1]].mDistance),
1054
- min(mClosestKinematic[v1.mVertex[2]].mDistance, mClosestKinematic[v1.mVertex[3]].mDistance));
1055
- float d2 = min(
1056
- min(mClosestKinematic[v2.mVertex[0]].mDistance, mClosestKinematic[v2.mVertex[1]].mDistance),
1057
- min(mClosestKinematic[v2.mVertex[2]].mDistance, mClosestKinematic[v2.mVertex[3]].mDistance));
1058
- if (d1 != d2)
1059
- return d1 < d2;
1060
-
1061
- // Order constraints so that the ones with the smallest index go first
1062
- uint32 m1 = v1.GetMinVertexIndex();
1063
- uint32 m2 = v2.GetMinVertexIndex();
1064
- if (m1 != m2)
1065
- return m1 < m2;
1066
-
1067
- return inLHS < inRHS;
1068
- });
1069
-
1070
- // Sort the skinned constraints
1071
- QuickSort(group.mSkinnedConstraints.begin(), group.mSkinnedConstraints.end(), [this](uint inLHS, uint inRHS)
1072
- {
1073
- const Skinned &s1 = mSkinnedConstraints[inLHS];
1074
- const Skinned &s2 = mSkinnedConstraints[inRHS];
1075
-
1076
- // Order the skinned constraints so that the ones with the smallest index go first (hoping to get better cache locality when we process the edges).
1077
- if (s1.mVertex != s2.mVertex)
1078
- return s1.mVertex < s2.mVertex;
1079
-
1080
- return inLHS < inRHS;
1081
- });
1082
- }
1083
-
1084
- // Temporary store constraints as we reorder them
1085
- Array<Edge> temp_edges;
1086
- temp_edges.swap(mEdgeConstraints);
1087
- mEdgeConstraints.reserve(temp_edges.size());
1088
- outResults.mEdgeRemap.resize(temp_edges.size(), ~uint(0));
1089
-
1090
- Array<LRA> temp_lra;
1091
- temp_lra.swap(mLRAConstraints);
1092
- mLRAConstraints.reserve(temp_lra.size());
1093
- outResults.mLRARemap.resize(temp_lra.size(), ~uint(0));
1094
-
1095
- Array<RodStretchShear> temp_rod_stretch_shear;
1096
- temp_rod_stretch_shear.swap(mRodStretchShearConstraints);
1097
- mRodStretchShearConstraints.reserve(temp_rod_stretch_shear.size());
1098
- outResults.mRodStretchShearConstraintRemap.resize(temp_rod_stretch_shear.size(), ~uint(0));
1099
-
1100
- Array<RodBendTwist> temp_rod_bend_twist;
1101
- temp_rod_bend_twist.swap(mRodBendTwistConstraints);
1102
- mRodBendTwistConstraints.reserve(temp_rod_bend_twist.size());
1103
- outResults.mRodBendTwistConstraintRemap.resize(temp_rod_bend_twist.size(), ~uint(0));
1104
-
1105
- Array<DihedralBend> temp_dihedral_bend;
1106
- temp_dihedral_bend.swap(mDihedralBendConstraints);
1107
- mDihedralBendConstraints.reserve(temp_dihedral_bend.size());
1108
- outResults.mDihedralBendRemap.resize(temp_dihedral_bend.size(), ~uint(0));
1109
-
1110
- Array<Volume> temp_volume;
1111
- temp_volume.swap(mVolumeConstraints);
1112
- mVolumeConstraints.reserve(temp_volume.size());
1113
- outResults.mVolumeRemap.resize(temp_volume.size(), ~uint(0));
1114
-
1115
- Array<Skinned> temp_skinned;
1116
- temp_skinned.swap(mSkinnedConstraints);
1117
- mSkinnedConstraints.reserve(temp_skinned.size());
1118
- outResults.mSkinnedRemap.resize(temp_skinned.size(), ~uint(0));
1119
-
1120
- // Finalize update groups
1121
- for (const Group &group : groups)
1122
- {
1123
- // Reorder edge constraints for this group
1124
- for (uint idx : group.mEdgeConstraints)
1125
- {
1126
- outResults.mEdgeRemap[idx] = (uint)mEdgeConstraints.size();
1127
- mEdgeConstraints.push_back(temp_edges[idx]);
1128
- }
1129
-
1130
- // Reorder LRA constraints for this group
1131
- for (uint idx : group.mLRAConstraints)
1132
- {
1133
- outResults.mLRARemap[idx] = (uint)mLRAConstraints.size();
1134
- mLRAConstraints.push_back(temp_lra[idx]);
1135
- }
1136
-
1137
- // Reorder rod stretch shear constraints for this group
1138
- for (uint idx : group.mRodStretchShearConstraints)
1139
- {
1140
- outResults.mRodStretchShearConstraintRemap[idx] = (uint)mRodStretchShearConstraints.size();
1141
- mRodStretchShearConstraints.push_back(temp_rod_stretch_shear[idx]);
1142
- }
1143
-
1144
- // Reorder rod bend twist constraints for this group
1145
- for (uint idx : group.mRodBendTwistConstraints)
1146
- {
1147
- outResults.mRodBendTwistConstraintRemap[idx] = (uint)mRodBendTwistConstraints.size();
1148
- mRodBendTwistConstraints.push_back(temp_rod_bend_twist[idx]);
1149
- }
1150
-
1151
- // Reorder dihedral bend constraints for this group
1152
- for (uint idx : group.mDihedralBendConstraints)
1153
- {
1154
- outResults.mDihedralBendRemap[idx] = (uint)mDihedralBendConstraints.size();
1155
- mDihedralBendConstraints.push_back(temp_dihedral_bend[idx]);
1156
- }
1157
-
1158
- // Reorder volume constraints for this group
1159
- for (uint idx : group.mVolumeConstraints)
1160
- {
1161
- outResults.mVolumeRemap[idx] = (uint)mVolumeConstraints.size();
1162
- mVolumeConstraints.push_back(temp_volume[idx]);
1163
- }
1164
-
1165
- // Reorder skinned constraints for this group
1166
- for (uint idx : group.mSkinnedConstraints)
1167
- {
1168
- outResults.mSkinnedRemap[idx] = (uint)mSkinnedConstraints.size();
1169
- mSkinnedConstraints.push_back(temp_skinned[idx]);
1170
- }
1171
-
1172
- // Store end indices
1173
- mUpdateGroups.push_back({ (uint)mEdgeConstraints.size(), (uint)mLRAConstraints.size(), (uint)mRodStretchShearConstraints.size(), (uint)mRodBendTwistConstraints.size(), (uint)mDihedralBendConstraints.size(), (uint)mVolumeConstraints.size(), (uint)mSkinnedConstraints.size() });
1174
- }
1175
-
1176
- // Remap bend twist indices because mRodStretchShearConstraints has been reordered
1177
- for (RodBendTwist &r : mRodBendTwistConstraints)
1178
- for (int i = 0; i < 2; ++i)
1179
- r.mRod[i] = outResults.mRodStretchShearConstraintRemap[r.mRod[i]];
1180
-
1181
- // Free closest kinematic buffer
1182
- mClosestKinematic.clear();
1183
- mClosestKinematic.shrink_to_fit();
1184
- }
1185
-
1186
- Ref<SoftBodySharedSettings> SoftBodySharedSettings::Clone() const
1187
- {
1188
- Ref<SoftBodySharedSettings> clone = new SoftBodySharedSettings;
1189
- clone->mVertices = mVertices;
1190
- clone->mFaces = mFaces;
1191
- clone->mEdgeConstraints = mEdgeConstraints;
1192
- clone->mDihedralBendConstraints = mDihedralBendConstraints;
1193
- clone->mVolumeConstraints = mVolumeConstraints;
1194
- clone->mSkinnedConstraints = mSkinnedConstraints;
1195
- clone->mSkinnedConstraintNormals = mSkinnedConstraintNormals;
1196
- clone->mInvBindMatrices = mInvBindMatrices;
1197
- clone->mLRAConstraints = mLRAConstraints;
1198
- clone->mRodStretchShearConstraints = mRodStretchShearConstraints;
1199
- clone->mRodBendTwistConstraints = mRodBendTwistConstraints;
1200
- clone->mMaterials = mMaterials;
1201
- clone->mUpdateGroups = mUpdateGroups;
1202
- return clone;
1203
- }
1204
-
1205
- void SoftBodySharedSettings::SaveBinaryState(StreamOut &inStream) const
1206
- {
1207
- inStream.Write(mVertices);
1208
- inStream.Write(mFaces);
1209
- inStream.Write(mEdgeConstraints);
1210
- inStream.Write(mDihedralBendConstraints);
1211
- inStream.Write(mVolumeConstraints);
1212
- inStream.Write(mSkinnedConstraints);
1213
- inStream.Write(mSkinnedConstraintNormals);
1214
- inStream.Write(mLRAConstraints);
1215
- inStream.Write(mUpdateGroups);
1216
-
1217
- // Can't write mRodStretchShearConstraints directly because the class contains padding
1218
- inStream.Write(mRodStretchShearConstraints, [](const RodStretchShear &inElement, StreamOut &inS) {
1219
- inS.Write(inElement.mVertex);
1220
- inS.Write(inElement.mLength);
1221
- inS.Write(inElement.mInvMass);
1222
- inS.Write(inElement.mCompliance);
1223
- inS.Write(inElement.mBishop);
1224
- });
1225
-
1226
- // Can't write mRodBendTwistConstraints directly because the class contains padding
1227
- inStream.Write(mRodBendTwistConstraints, [](const RodBendTwist &inElement, StreamOut &inS) {
1228
- inS.Write(inElement.mRod);
1229
- inS.Write(inElement.mCompliance);
1230
- inS.Write(inElement.mOmega0);
1231
- });
1232
-
1233
- // Can't write mInvBindMatrices directly because the class contains padding
1234
- inStream.Write(mInvBindMatrices, [](const InvBind &inElement, StreamOut &inS) {
1235
- inS.Write(inElement.mJointIndex);
1236
- inS.Write(inElement.mInvBind);
1237
- });
1238
- }
1239
-
1240
- void SoftBodySharedSettings::RestoreBinaryState(StreamIn &inStream)
1241
- {
1242
- inStream.Read(mVertices);
1243
- inStream.Read(mFaces);
1244
- inStream.Read(mEdgeConstraints);
1245
- inStream.Read(mDihedralBendConstraints);
1246
- inStream.Read(mVolumeConstraints);
1247
- inStream.Read(mSkinnedConstraints);
1248
- inStream.Read(mSkinnedConstraintNormals);
1249
- inStream.Read(mLRAConstraints);
1250
- inStream.Read(mUpdateGroups);
1251
-
1252
- inStream.Read(mRodStretchShearConstraints, [](StreamIn &inS, RodStretchShear &outElement) {
1253
- inS.Read(outElement.mVertex);
1254
- inS.Read(outElement.mLength);
1255
- inS.Read(outElement.mInvMass);
1256
- inS.Read(outElement.mCompliance);
1257
- inS.Read(outElement.mBishop);
1258
- });
1259
-
1260
- inStream.Read(mRodBendTwistConstraints, [](StreamIn &inS, RodBendTwist &outElement) {
1261
- inS.Read(outElement.mRod);
1262
- inS.Read(outElement.mCompliance);
1263
- inS.Read(outElement.mOmega0);
1264
- });
1265
-
1266
- inStream.Read(mInvBindMatrices, [](StreamIn &inS, InvBind &outElement) {
1267
- inS.Read(outElement.mJointIndex);
1268
- inS.Read(outElement.mInvBind);
1269
- });
1270
- }
1271
-
1272
- void SoftBodySharedSettings::SaveWithMaterials(StreamOut &inStream, SharedSettingsToIDMap &ioSettingsMap, MaterialToIDMap &ioMaterialMap) const
1273
- {
1274
- SharedSettingsToIDMap::const_iterator settings_iter = ioSettingsMap.find(this);
1275
- if (settings_iter == ioSettingsMap.end())
1276
- {
1277
- // Write settings ID
1278
- uint32 settings_id = ioSettingsMap.size();
1279
- ioSettingsMap[this] = settings_id;
1280
- inStream.Write(settings_id);
1281
-
1282
- // Write the settings
1283
- SaveBinaryState(inStream);
1284
-
1285
- // Write materials
1286
- StreamUtils::SaveObjectArray(inStream, mMaterials, &ioMaterialMap);
1287
- }
1288
- else
1289
- {
1290
- // Known settings, just write the ID
1291
- inStream.Write(settings_iter->second);
1292
- }
1293
- }
1294
-
1295
- SoftBodySharedSettings::SettingsResult SoftBodySharedSettings::sRestoreWithMaterials(StreamIn &inStream, IDToSharedSettingsMap &ioSettingsMap, IDToMaterialMap &ioMaterialMap)
1296
- {
1297
- SettingsResult result;
1298
-
1299
- // Read settings id
1300
- uint32 settings_id;
1301
- inStream.Read(settings_id);
1302
- if (inStream.IsEOF() || inStream.IsFailed())
1303
- {
1304
- result.SetError("Failed to read settings id");
1305
- return result;
1306
- }
1307
-
1308
- // Check nullptr settings
1309
- if (settings_id == ~uint32(0))
1310
- {
1311
- result.Set(nullptr);
1312
- return result;
1313
- }
1314
-
1315
- // Check if we already read this settings
1316
- if (settings_id < ioSettingsMap.size())
1317
- {
1318
- result.Set(ioSettingsMap[settings_id]);
1319
- return result;
1320
- }
1321
-
1322
- // Create new object
1323
- Ref<SoftBodySharedSettings> settings = new SoftBodySharedSettings;
1324
-
1325
- // Read state
1326
- settings->RestoreBinaryState(inStream);
1327
-
1328
- // Read materials
1329
- Result mlresult = StreamUtils::RestoreObjectArray<PhysicsMaterialList>(inStream, ioMaterialMap);
1330
- if (mlresult.HasError())
1331
- {
1332
- result.SetError(mlresult.GetError());
1333
- return result;
1334
- }
1335
- settings->mMaterials = mlresult.Get();
1336
-
1337
- // Add the settings to the map
1338
- ioSettingsMap.push_back(settings);
1339
-
1340
- result.Set(settings);
1341
- return result;
1342
- }
1343
-
1344
- Ref<SoftBodySharedSettings> SoftBodySharedSettings::sCreateCube(uint inGridSize, float inGridSpacing)
1345
- {
1346
- const Vec3 cOffset = Vec3::sReplicate(-0.5f * inGridSpacing * (inGridSize - 1));
1347
-
1348
- // Create settings
1349
- SoftBodySharedSettings *settings = new SoftBodySharedSettings;
1350
- for (uint z = 0; z < inGridSize; ++z)
1351
- for (uint y = 0; y < inGridSize; ++y)
1352
- for (uint x = 0; x < inGridSize; ++x)
1353
- {
1354
- SoftBodySharedSettings::Vertex v;
1355
- (cOffset + Vec3::sReplicate(inGridSpacing) * Vec3(float(x), float(y), float(z))).StoreFloat3(&v.mPosition);
1356
- settings->mVertices.push_back(v);
1357
- }
1358
-
1359
- // Function to get the vertex index of a point on the cube
1360
- auto vertex_index = [inGridSize](uint inX, uint inY, uint inZ)
1361
- {
1362
- return inX + inY * inGridSize + inZ * inGridSize * inGridSize;
1363
- };
1364
-
1365
- // Create edges
1366
- for (uint z = 0; z < inGridSize; ++z)
1367
- for (uint y = 0; y < inGridSize; ++y)
1368
- for (uint x = 0; x < inGridSize; ++x)
1369
- {
1370
- SoftBodySharedSettings::Edge e;
1371
- e.mVertex[0] = vertex_index(x, y, z);
1372
- if (x < inGridSize - 1)
1373
- {
1374
- e.mVertex[1] = vertex_index(x + 1, y, z);
1375
- settings->mEdgeConstraints.push_back(e);
1376
- }
1377
- if (y < inGridSize - 1)
1378
- {
1379
- e.mVertex[1] = vertex_index(x, y + 1, z);
1380
- settings->mEdgeConstraints.push_back(e);
1381
- }
1382
- if (z < inGridSize - 1)
1383
- {
1384
- e.mVertex[1] = vertex_index(x, y, z + 1);
1385
- settings->mEdgeConstraints.push_back(e);
1386
- }
1387
- }
1388
- settings->CalculateEdgeLengths();
1389
-
1390
- // Tetrahedrons to fill a cube
1391
- const int tetra_indices[6][4][3] = {
1392
- { {0, 0, 0}, {0, 1, 1}, {0, 0, 1}, {1, 1, 1} },
1393
- { {0, 0, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1} },
1394
- { {0, 0, 0}, {0, 0, 1}, {1, 0, 1}, {1, 1, 1} },
1395
- { {0, 0, 0}, {1, 0, 1}, {1, 0, 0}, {1, 1, 1} },
1396
- { {0, 0, 0}, {1, 1, 0}, {0, 1, 0}, {1, 1, 1} },
1397
- { {0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {1, 1, 1} }
1398
- };
1399
-
1400
- // Create volume constraints
1401
- for (uint z = 0; z < inGridSize - 1; ++z)
1402
- for (uint y = 0; y < inGridSize - 1; ++y)
1403
- for (uint x = 0; x < inGridSize - 1; ++x)
1404
- for (uint t = 0; t < 6; ++t)
1405
- {
1406
- SoftBodySharedSettings::Volume v;
1407
- for (uint i = 0; i < 4; ++i)
1408
- v.mVertex[i] = vertex_index(x + tetra_indices[t][i][0], y + tetra_indices[t][i][1], z + tetra_indices[t][i][2]);
1409
- settings->mVolumeConstraints.push_back(v);
1410
- }
1411
-
1412
- settings->CalculateVolumeConstraintVolumes();
1413
-
1414
- // Create faces
1415
- for (uint y = 0; y < inGridSize - 1; ++y)
1416
- for (uint x = 0; x < inGridSize - 1; ++x)
1417
- {
1418
- SoftBodySharedSettings::Face f;
1419
-
1420
- // Face 1
1421
- f.mVertex[0] = vertex_index(x, y, 0);
1422
- f.mVertex[1] = vertex_index(x, y + 1, 0);
1423
- f.mVertex[2] = vertex_index(x + 1, y + 1, 0);
1424
- settings->AddFace(f);
1425
-
1426
- f.mVertex[1] = vertex_index(x + 1, y + 1, 0);
1427
- f.mVertex[2] = vertex_index(x + 1, y, 0);
1428
- settings->AddFace(f);
1429
-
1430
- // Face 2
1431
- f.mVertex[0] = vertex_index(x, y, inGridSize - 1);
1432
- f.mVertex[1] = vertex_index(x + 1, y + 1, inGridSize - 1);
1433
- f.mVertex[2] = vertex_index(x, y + 1, inGridSize - 1);
1434
- settings->AddFace(f);
1435
-
1436
- f.mVertex[1] = vertex_index(x + 1, y, inGridSize - 1);
1437
- f.mVertex[2] = vertex_index(x + 1, y + 1, inGridSize - 1);
1438
- settings->AddFace(f);
1439
-
1440
- // Face 3
1441
- f.mVertex[0] = vertex_index(x, 0, y);
1442
- f.mVertex[1] = vertex_index(x + 1, 0, y + 1);
1443
- f.mVertex[2] = vertex_index(x, 0, y + 1);
1444
- settings->AddFace(f);
1445
-
1446
- f.mVertex[1] = vertex_index(x + 1, 0, y);
1447
- f.mVertex[2] = vertex_index(x + 1, 0, y + 1);
1448
- settings->AddFace(f);
1449
-
1450
- // Face 4
1451
- f.mVertex[0] = vertex_index(x, inGridSize - 1, y);
1452
- f.mVertex[1] = vertex_index(x, inGridSize - 1, y + 1);
1453
- f.mVertex[2] = vertex_index(x + 1, inGridSize - 1, y + 1);
1454
- settings->AddFace(f);
1455
-
1456
- f.mVertex[1] = vertex_index(x + 1, inGridSize - 1, y + 1);
1457
- f.mVertex[2] = vertex_index(x + 1, inGridSize - 1, y);
1458
- settings->AddFace(f);
1459
-
1460
- // Face 5
1461
- f.mVertex[0] = vertex_index(0, x, y);
1462
- f.mVertex[1] = vertex_index(0, x, y + 1);
1463
- f.mVertex[2] = vertex_index(0, x + 1, y + 1);
1464
- settings->AddFace(f);
1465
-
1466
- f.mVertex[1] = vertex_index(0, x + 1, y + 1);
1467
- f.mVertex[2] = vertex_index(0, x + 1, y);
1468
- settings->AddFace(f);
1469
-
1470
- // Face 6
1471
- f.mVertex[0] = vertex_index(inGridSize - 1, x, y);
1472
- f.mVertex[1] = vertex_index(inGridSize - 1, x + 1, y + 1);
1473
- f.mVertex[2] = vertex_index(inGridSize - 1, x, y + 1);
1474
- settings->AddFace(f);
1475
-
1476
- f.mVertex[1] = vertex_index(inGridSize - 1, x + 1, y);
1477
- f.mVertex[2] = vertex_index(inGridSize - 1, x + 1, y + 1);
1478
- settings->AddFace(f);
1479
- }
1480
-
1481
- // Optimize the settings
1482
- settings->Optimize();
1483
-
1484
- return settings;
1485
- }
1486
-
1487
- JPH_NAMESPACE_END