@bloomengine/engine 0.4.0 → 0.4.2

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 (527) hide show
  1. package/native/tvos/metal-patched/Cargo.toml +178 -0
  2. package/native/tvos/metal-patched/LICENSE-APACHE +201 -0
  3. package/native/tvos/metal-patched/LICENSE-MIT +25 -0
  4. package/native/tvos/metal-patched/src/acceleration_structure.rs +667 -0
  5. package/native/tvos/metal-patched/src/acceleration_structure_pass.rs +108 -0
  6. package/native/tvos/metal-patched/src/argument.rs +366 -0
  7. package/native/tvos/metal-patched/src/blitpass.rs +102 -0
  8. package/native/tvos/metal-patched/src/buffer.rs +71 -0
  9. package/native/tvos/metal-patched/src/capturedescriptor.rs +76 -0
  10. package/native/tvos/metal-patched/src/capturemanager.rs +113 -0
  11. package/native/tvos/metal-patched/src/commandbuffer.rs +192 -0
  12. package/native/tvos/metal-patched/src/commandqueue.rs +44 -0
  13. package/native/tvos/metal-patched/src/computepass.rs +107 -0
  14. package/native/tvos/metal-patched/src/constants.rs +152 -0
  15. package/native/tvos/metal-patched/src/counters.rs +119 -0
  16. package/native/tvos/metal-patched/src/depthstencil.rs +190 -0
  17. package/native/tvos/metal-patched/src/device.rs +2134 -0
  18. package/native/tvos/metal-patched/src/drawable.rs +39 -0
  19. package/native/tvos/metal-patched/src/encoder.rs +2041 -0
  20. package/native/tvos/metal-patched/src/heap.rs +281 -0
  21. package/native/tvos/metal-patched/src/indirect_encoder.rs +344 -0
  22. package/native/tvos/metal-patched/src/lib.rs +657 -0
  23. package/native/tvos/metal-patched/src/library.rs +902 -0
  24. package/native/tvos/metal-patched/src/mps.rs +575 -0
  25. package/native/tvos/metal-patched/src/pipeline/compute.rs +475 -0
  26. package/native/tvos/metal-patched/src/pipeline/mod.rs +71 -0
  27. package/native/tvos/metal-patched/src/pipeline/render.rs +762 -0
  28. package/native/tvos/metal-patched/src/renderpass.rs +443 -0
  29. package/native/tvos/metal-patched/src/resource.rs +182 -0
  30. package/native/tvos/metal-patched/src/sampler.rs +165 -0
  31. package/native/tvos/metal-patched/src/sync.rs +178 -0
  32. package/native/tvos/metal-patched/src/texture.rs +352 -0
  33. package/native/tvos/metal-patched/src/types.rs +90 -0
  34. package/native/tvos/metal-patched/src/vertexdescriptor.rs +250 -0
  35. package/package.json +8 -11
  36. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/build.gradle +0 -51
  37. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/src/main/AndroidManifest.xml +0 -20
  38. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/src/main/cpp/CMakeLists.txt +0 -20
  39. package/native/third_party/JoltPhysics/Build/Android/UnitTests/build.gradle +0 -51
  40. package/native/third_party/JoltPhysics/Build/Android/UnitTests/src/main/AndroidManifest.xml +0 -20
  41. package/native/third_party/JoltPhysics/Build/Android/UnitTests/src/main/cpp/CMakeLists.txt +0 -20
  42. package/native/third_party/JoltPhysics/Build/Android/build.gradle +0 -17
  43. package/native/third_party/JoltPhysics/Build/Android/gradle/wrapper/gradle-wrapper.jar +0 -0
  44. package/native/third_party/JoltPhysics/Build/Android/gradle/wrapper/gradle-wrapper.properties +0 -5
  45. package/native/third_party/JoltPhysics/Build/Android/gradle.properties +0 -21
  46. package/native/third_party/JoltPhysics/Build/Android/gradlew +0 -185
  47. package/native/third_party/JoltPhysics/Build/Android/gradlew.bat +0 -89
  48. package/native/third_party/JoltPhysics/Build/Android/settings.gradle +0 -10
  49. package/native/third_party/JoltPhysics/Build/CMakeLists.txt +0 -449
  50. package/native/third_party/JoltPhysics/Build/README.md +0 -250
  51. package/native/third_party/JoltPhysics/Build/cmake_linux_clang_gcc.sh +0 -28
  52. package/native/third_party/JoltPhysics/Build/cmake_linux_emscripten.sh +0 -19
  53. package/native/third_party/JoltPhysics/Build/cmake_linux_mingw.sh +0 -19
  54. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl.bat +0 -3
  55. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_32bit.bat +0 -3
  56. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_arm.bat +0 -3
  57. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_arm_32bit.bat +0 -4
  58. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_cross_platform_deterministic.bat +0 -3
  59. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_double.bat +0 -3
  60. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_no_object_stream.bat +0 -3
  61. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang.bat +0 -10
  62. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang_cross_platform_deterministic.bat +0 -10
  63. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang_double.bat +0 -10
  64. package/native/third_party/JoltPhysics/Build/cmake_vs2022_uwp.bat +0 -5
  65. package/native/third_party/JoltPhysics/Build/cmake_vs2022_uwp_arm.bat +0 -5
  66. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl.bat +0 -3
  67. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl_cross_platform_deterministic.bat +0 -3
  68. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl_double.bat +0 -3
  69. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang.bat +0 -10
  70. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang_cross_platform_deterministic.bat +0 -10
  71. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang_double.bat +0 -10
  72. package/native/third_party/JoltPhysics/Build/cmake_windows_mingw.sh +0 -19
  73. package/native/third_party/JoltPhysics/Build/cmake_xcode_ios.sh +0 -4
  74. package/native/third_party/JoltPhysics/Build/cmake_xcode_macos.sh +0 -4
  75. package/native/third_party/JoltPhysics/Build/iOS/JoltViewerInfo.plist +0 -34
  76. package/native/third_party/JoltPhysics/Build/iOS/SamplesInfo.plist +0 -34
  77. package/native/third_party/JoltPhysics/Build/iOS/UnitTestsInfo.plist +0 -34
  78. package/native/third_party/JoltPhysics/Build/macOS/icon.icns +0 -0
  79. package/native/third_party/JoltPhysics/Build/macos_install_vulkan_sdk.sh +0 -13
  80. package/native/third_party/JoltPhysics/Build/ubuntu24_install_vulkan_sdk.sh +0 -4
  81. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeBuilder.cpp +0 -242
  82. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeBuilder.h +0 -121
  83. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeToBuffer.h +0 -296
  84. package/native/third_party/JoltPhysics/Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h +0 -323
  85. package/native/third_party/JoltPhysics/Jolt/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h +0 -555
  86. package/native/third_party/JoltPhysics/Jolt/ConfigurationString.h +0 -112
  87. package/native/third_party/JoltPhysics/Jolt/Core/ARMNeon.h +0 -94
  88. package/native/third_party/JoltPhysics/Jolt/Core/Array.h +0 -713
  89. package/native/third_party/JoltPhysics/Jolt/Core/Atomics.h +0 -44
  90. package/native/third_party/JoltPhysics/Jolt/Core/BinaryHeap.h +0 -96
  91. package/native/third_party/JoltPhysics/Jolt/Core/ByteBuffer.h +0 -74
  92. package/native/third_party/JoltPhysics/Jolt/Core/Color.cpp +0 -38
  93. package/native/third_party/JoltPhysics/Jolt/Core/Color.h +0 -98
  94. package/native/third_party/JoltPhysics/Jolt/Core/Core.h +0 -652
  95. package/native/third_party/JoltPhysics/Jolt/Core/FPControlWord.h +0 -143
  96. package/native/third_party/JoltPhysics/Jolt/Core/FPException.h +0 -96
  97. package/native/third_party/JoltPhysics/Jolt/Core/FPFlushDenormals.h +0 -43
  98. package/native/third_party/JoltPhysics/Jolt/Core/Factory.cpp +0 -92
  99. package/native/third_party/JoltPhysics/Jolt/Core/Factory.h +0 -54
  100. package/native/third_party/JoltPhysics/Jolt/Core/FixedSizeFreeList.h +0 -122
  101. package/native/third_party/JoltPhysics/Jolt/Core/FixedSizeFreeList.inl +0 -215
  102. package/native/third_party/JoltPhysics/Jolt/Core/HashCombine.h +0 -234
  103. package/native/third_party/JoltPhysics/Jolt/Core/HashTable.h +0 -876
  104. package/native/third_party/JoltPhysics/Jolt/Core/InsertionSort.h +0 -58
  105. package/native/third_party/JoltPhysics/Jolt/Core/IssueReporting.cpp +0 -27
  106. package/native/third_party/JoltPhysics/Jolt/Core/IssueReporting.h +0 -38
  107. package/native/third_party/JoltPhysics/Jolt/Core/JobSystem.h +0 -311
  108. package/native/third_party/JoltPhysics/Jolt/Core/JobSystem.inl +0 -56
  109. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemSingleThreaded.cpp +0 -65
  110. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemSingleThreaded.h +0 -62
  111. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemThreadPool.cpp +0 -364
  112. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemThreadPool.h +0 -101
  113. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemWithBarrier.cpp +0 -230
  114. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemWithBarrier.h +0 -85
  115. package/native/third_party/JoltPhysics/Jolt/Core/LinearCurve.cpp +0 -51
  116. package/native/third_party/JoltPhysics/Jolt/Core/LinearCurve.h +0 -67
  117. package/native/third_party/JoltPhysics/Jolt/Core/LockFreeHashMap.h +0 -182
  118. package/native/third_party/JoltPhysics/Jolt/Core/LockFreeHashMap.inl +0 -351
  119. package/native/third_party/JoltPhysics/Jolt/Core/Memory.cpp +0 -85
  120. package/native/third_party/JoltPhysics/Jolt/Core/Memory.h +0 -85
  121. package/native/third_party/JoltPhysics/Jolt/Core/Mutex.h +0 -223
  122. package/native/third_party/JoltPhysics/Jolt/Core/MutexArray.h +0 -98
  123. package/native/third_party/JoltPhysics/Jolt/Core/NonCopyable.h +0 -18
  124. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.cpp +0 -677
  125. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.h +0 -301
  126. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.inl +0 -90
  127. package/native/third_party/JoltPhysics/Jolt/Core/QuickSort.h +0 -137
  128. package/native/third_party/JoltPhysics/Jolt/Core/RTTI.cpp +0 -149
  129. package/native/third_party/JoltPhysics/Jolt/Core/RTTI.h +0 -436
  130. package/native/third_party/JoltPhysics/Jolt/Core/Reference.h +0 -244
  131. package/native/third_party/JoltPhysics/Jolt/Core/Result.h +0 -174
  132. package/native/third_party/JoltPhysics/Jolt/Core/STLAlignedAllocator.h +0 -72
  133. package/native/third_party/JoltPhysics/Jolt/Core/STLAllocator.h +0 -127
  134. package/native/third_party/JoltPhysics/Jolt/Core/STLLocalAllocator.h +0 -170
  135. package/native/third_party/JoltPhysics/Jolt/Core/STLTempAllocator.h +0 -80
  136. package/native/third_party/JoltPhysics/Jolt/Core/ScopeExit.h +0 -49
  137. package/native/third_party/JoltPhysics/Jolt/Core/Semaphore.cpp +0 -135
  138. package/native/third_party/JoltPhysics/Jolt/Core/Semaphore.h +0 -68
  139. package/native/third_party/JoltPhysics/Jolt/Core/StaticArray.h +0 -329
  140. package/native/third_party/JoltPhysics/Jolt/Core/StreamIn.h +0 -120
  141. package/native/third_party/JoltPhysics/Jolt/Core/StreamOut.h +0 -97
  142. package/native/third_party/JoltPhysics/Jolt/Core/StreamUtils.h +0 -168
  143. package/native/third_party/JoltPhysics/Jolt/Core/StreamWrapper.h +0 -53
  144. package/native/third_party/JoltPhysics/Jolt/Core/StridedPtr.h +0 -63
  145. package/native/third_party/JoltPhysics/Jolt/Core/StringTools.cpp +0 -101
  146. package/native/third_party/JoltPhysics/Jolt/Core/StringTools.h +0 -38
  147. package/native/third_party/JoltPhysics/Jolt/Core/TempAllocator.h +0 -209
  148. package/native/third_party/JoltPhysics/Jolt/Core/TickCounter.cpp +0 -37
  149. package/native/third_party/JoltPhysics/Jolt/Core/TickCounter.h +0 -58
  150. package/native/third_party/JoltPhysics/Jolt/Core/UnorderedMap.h +0 -80
  151. package/native/third_party/JoltPhysics/Jolt/Core/UnorderedSet.h +0 -32
  152. package/native/third_party/JoltPhysics/Jolt/Geometry/AABox.h +0 -313
  153. package/native/third_party/JoltPhysics/Jolt/Geometry/AABox4.h +0 -224
  154. package/native/third_party/JoltPhysics/Jolt/Geometry/ClipPoly.h +0 -200
  155. package/native/third_party/JoltPhysics/Jolt/Geometry/ClosestPoint.h +0 -498
  156. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder.cpp +0 -1467
  157. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder.h +0 -276
  158. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder2D.cpp +0 -335
  159. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder2D.h +0 -105
  160. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexSupport.h +0 -188
  161. package/native/third_party/JoltPhysics/Jolt/Geometry/EPAConvexHullBuilder.h +0 -845
  162. package/native/third_party/JoltPhysics/Jolt/Geometry/EPAPenetrationDepth.h +0 -557
  163. package/native/third_party/JoltPhysics/Jolt/Geometry/Ellipse.h +0 -77
  164. package/native/third_party/JoltPhysics/Jolt/Geometry/GJKClosestPoint.h +0 -945
  165. package/native/third_party/JoltPhysics/Jolt/Geometry/IndexedTriangle.h +0 -130
  166. package/native/third_party/JoltPhysics/Jolt/Geometry/Indexify.cpp +0 -222
  167. package/native/third_party/JoltPhysics/Jolt/Geometry/Indexify.h +0 -19
  168. package/native/third_party/JoltPhysics/Jolt/Geometry/MortonCode.h +0 -40
  169. package/native/third_party/JoltPhysics/Jolt/Geometry/OrientedBox.cpp +0 -178
  170. package/native/third_party/JoltPhysics/Jolt/Geometry/OrientedBox.h +0 -39
  171. package/native/third_party/JoltPhysics/Jolt/Geometry/Plane.h +0 -104
  172. package/native/third_party/JoltPhysics/Jolt/Geometry/RayAABox.h +0 -241
  173. package/native/third_party/JoltPhysics/Jolt/Geometry/RayCapsule.h +0 -37
  174. package/native/third_party/JoltPhysics/Jolt/Geometry/RayCylinder.h +0 -101
  175. package/native/third_party/JoltPhysics/Jolt/Geometry/RaySphere.h +0 -96
  176. package/native/third_party/JoltPhysics/Jolt/Geometry/RayTriangle.h +0 -158
  177. package/native/third_party/JoltPhysics/Jolt/Geometry/Sphere.h +0 -72
  178. package/native/third_party/JoltPhysics/Jolt/Geometry/Triangle.h +0 -34
  179. package/native/third_party/JoltPhysics/Jolt/Jolt.cmake +0 -703
  180. package/native/third_party/JoltPhysics/Jolt/Jolt.h +0 -16
  181. package/native/third_party/JoltPhysics/Jolt/Jolt.natvis +0 -116
  182. package/native/third_party/JoltPhysics/Jolt/Math/BVec16.h +0 -99
  183. package/native/third_party/JoltPhysics/Jolt/Math/BVec16.inl +0 -177
  184. package/native/third_party/JoltPhysics/Jolt/Math/DMat44.h +0 -158
  185. package/native/third_party/JoltPhysics/Jolt/Math/DMat44.inl +0 -310
  186. package/native/third_party/JoltPhysics/Jolt/Math/DVec3.h +0 -291
  187. package/native/third_party/JoltPhysics/Jolt/Math/DVec3.inl +0 -941
  188. package/native/third_party/JoltPhysics/Jolt/Math/Double3.h +0 -48
  189. package/native/third_party/JoltPhysics/Jolt/Math/DynMatrix.h +0 -31
  190. package/native/third_party/JoltPhysics/Jolt/Math/EigenValueSymmetric.h +0 -177
  191. package/native/third_party/JoltPhysics/Jolt/Math/FindRoot.h +0 -42
  192. package/native/third_party/JoltPhysics/Jolt/Math/Float2.h +0 -36
  193. package/native/third_party/JoltPhysics/Jolt/Math/Float3.h +0 -50
  194. package/native/third_party/JoltPhysics/Jolt/Math/Float4.h +0 -44
  195. package/native/third_party/JoltPhysics/Jolt/Math/GaussianElimination.h +0 -102
  196. package/native/third_party/JoltPhysics/Jolt/Math/HalfFloat.h +0 -208
  197. package/native/third_party/JoltPhysics/Jolt/Math/Mat44.h +0 -243
  198. package/native/third_party/JoltPhysics/Jolt/Math/Mat44.inl +0 -952
  199. package/native/third_party/JoltPhysics/Jolt/Math/Math.h +0 -208
  200. package/native/third_party/JoltPhysics/Jolt/Math/MathTypes.h +0 -32
  201. package/native/third_party/JoltPhysics/Jolt/Math/Matrix.h +0 -259
  202. package/native/third_party/JoltPhysics/Jolt/Math/Quat.h +0 -268
  203. package/native/third_party/JoltPhysics/Jolt/Math/Quat.inl +0 -406
  204. package/native/third_party/JoltPhysics/Jolt/Math/Real.h +0 -44
  205. package/native/third_party/JoltPhysics/Jolt/Math/Swizzle.h +0 -19
  206. package/native/third_party/JoltPhysics/Jolt/Math/Trigonometry.h +0 -79
  207. package/native/third_party/JoltPhysics/Jolt/Math/UVec4.h +0 -232
  208. package/native/third_party/JoltPhysics/Jolt/Math/UVec4.inl +0 -636
  209. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.cpp +0 -71
  210. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.h +0 -308
  211. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.inl +0 -942
  212. package/native/third_party/JoltPhysics/Jolt/Math/Vec4.h +0 -320
  213. package/native/third_party/JoltPhysics/Jolt/Math/Vec4.inl +0 -1152
  214. package/native/third_party/JoltPhysics/Jolt/Math/Vector.h +0 -211
  215. package/native/third_party/JoltPhysics/Jolt/ObjectStream/GetPrimitiveTypeOfType.h +0 -54
  216. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStream.cpp +0 -38
  217. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStream.h +0 -337
  218. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryIn.cpp +0 -252
  219. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryIn.h +0 -57
  220. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryOut.cpp +0 -165
  221. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryOut.h +0 -57
  222. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamIn.cpp +0 -635
  223. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamIn.h +0 -148
  224. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamOut.cpp +0 -166
  225. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamOut.h +0 -101
  226. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextIn.cpp +0 -418
  227. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextIn.h +0 -55
  228. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextOut.cpp +0 -255
  229. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextOut.h +0 -62
  230. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTypes.h +0 -26
  231. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttribute.h +0 -111
  232. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttributeEnum.h +0 -67
  233. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttributeTyped.h +0 -60
  234. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableObject.cpp +0 -15
  235. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableObject.h +0 -170
  236. package/native/third_party/JoltPhysics/Jolt/ObjectStream/TypeDeclarations.cpp +0 -70
  237. package/native/third_party/JoltPhysics/Jolt/ObjectStream/TypeDeclarations.h +0 -45
  238. package/native/third_party/JoltPhysics/Jolt/Physics/Body/AllowedDOFs.h +0 -68
  239. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.cpp +0 -426
  240. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.h +0 -452
  241. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.inl +0 -197
  242. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyAccess.h +0 -68
  243. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyActivationListener.h +0 -28
  244. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyCreationSettings.cpp +0 -234
  245. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyCreationSettings.h +0 -124
  246. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyFilter.h +0 -130
  247. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyID.h +0 -101
  248. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyInterface.cpp +0 -1099
  249. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyInterface.h +0 -324
  250. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLock.h +0 -111
  251. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLockInterface.h +0 -134
  252. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLockMulti.h +0 -120
  253. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyManager.cpp +0 -1220
  254. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyManager.h +0 -403
  255. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyPair.h +0 -36
  256. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyType.h +0 -19
  257. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MassProperties.cpp +0 -185
  258. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MassProperties.h +0 -58
  259. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.cpp +0 -92
  260. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.h +0 -308
  261. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.inl +0 -178
  262. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionQuality.h +0 -31
  263. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionType.h +0 -17
  264. package/native/third_party/JoltPhysics/Jolt/Physics/Character/Character.cpp +0 -354
  265. package/native/third_party/JoltPhysics/Jolt/Physics/Character/Character.h +0 -159
  266. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterBase.cpp +0 -59
  267. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterBase.h +0 -157
  268. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterID.h +0 -98
  269. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterVirtual.cpp +0 -1933
  270. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterVirtual.h +0 -752
  271. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/AABoxCast.h +0 -20
  272. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ActiveEdgeMode.h +0 -17
  273. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ActiveEdges.h +0 -114
  274. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BackFaceMode.h +0 -16
  275. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhase.cpp +0 -16
  276. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhase.h +0 -109
  277. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp +0 -313
  278. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h +0 -38
  279. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h +0 -148
  280. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayerInterfaceMask.h +0 -92
  281. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayerInterfaceTable.h +0 -64
  282. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.cpp +0 -629
  283. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h +0 -108
  284. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h +0 -56
  285. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/ObjectVsBroadPhaseLayerFilterMask.h +0 -35
  286. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/ObjectVsBroadPhaseLayerFilterTable.h +0 -66
  287. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/QuadTree.cpp +0 -1768
  288. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/QuadTree.h +0 -389
  289. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp +0 -107
  290. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastConvexVsTriangles.h +0 -46
  291. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastResult.h +0 -37
  292. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastSphereVsTriangles.cpp +0 -223
  293. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastSphereVsTriangles.h +0 -49
  294. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollectFacesMode.h +0 -16
  295. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp +0 -155
  296. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideConvexVsTriangles.h +0 -56
  297. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollidePointResult.h +0 -25
  298. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideShape.h +0 -106
  299. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideShapeVsShapePerLeaf.h +0 -94
  300. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSoftBodyVertexIterator.h +0 -110
  301. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSoftBodyVerticesVsTriangles.h +0 -102
  302. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp +0 -121
  303. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSphereVsTriangles.h +0 -50
  304. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionCollector.h +0 -109
  305. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionCollectorImpl.h +0 -219
  306. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionDispatch.cpp +0 -107
  307. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionDispatch.h +0 -97
  308. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionGroup.cpp +0 -35
  309. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionGroup.h +0 -97
  310. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ContactListener.h +0 -143
  311. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/EstimateCollisionResponse.cpp +0 -213
  312. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/EstimateCollisionResponse.h +0 -48
  313. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilter.cpp +0 -32
  314. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilter.h +0 -46
  315. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilterTable.cpp +0 -38
  316. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilterTable.h +0 -130
  317. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h +0 -279
  318. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.cpp +0 -271
  319. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h +0 -44
  320. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseQuery.cpp +0 -448
  321. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseQuery.h +0 -77
  322. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseStats.cpp +0 -62
  323. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseStats.h +0 -110
  324. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayer.h +0 -111
  325. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayerPairFilterMask.h +0 -52
  326. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayerPairFilterTable.h +0 -78
  327. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterial.cpp +0 -35
  328. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterial.h +0 -57
  329. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterialSimple.cpp +0 -38
  330. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterialSimple.h +0 -37
  331. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/RayCast.h +0 -87
  332. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/BoxShape.cpp +0 -318
  333. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/BoxShape.h +0 -115
  334. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CapsuleShape.cpp +0 -438
  335. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CapsuleShape.h +0 -129
  336. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShape.cpp +0 -433
  337. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShape.h +0 -354
  338. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShapeVisitors.h +0 -461
  339. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexHullShape.cpp +0 -1311
  340. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexHullShape.h +0 -202
  341. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexShape.cpp +0 -566
  342. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexShape.h +0 -150
  343. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CylinderShape.cpp +0 -418
  344. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CylinderShape.h +0 -126
  345. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/DecoratedShape.cpp +0 -87
  346. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/DecoratedShape.h +0 -80
  347. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/EmptyShape.cpp +0 -64
  348. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/EmptyShape.h +0 -75
  349. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/GetTrianglesContext.h +0 -248
  350. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/HeightFieldShape.cpp +0 -2754
  351. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/HeightFieldShape.h +0 -380
  352. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MeshShape.cpp +0 -1305
  353. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MeshShape.h +0 -228
  354. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MutableCompoundShape.cpp +0 -596
  355. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MutableCompoundShape.h +0 -176
  356. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.cpp +0 -217
  357. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h +0 -140
  358. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PlaneShape.cpp +0 -541
  359. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PlaneShape.h +0 -147
  360. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PolyhedronSubmergedVolumeCalculator.h +0 -319
  361. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.cpp +0 -333
  362. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h +0 -161
  363. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaleHelpers.h +0 -83
  364. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaledShape.cpp +0 -238
  365. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaledShape.h +0 -145
  366. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/Shape.cpp +0 -325
  367. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/Shape.h +0 -466
  368. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SphereShape.cpp +0 -347
  369. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SphereShape.h +0 -125
  370. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/StaticCompoundShape.cpp +0 -674
  371. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/StaticCompoundShape.h +0 -139
  372. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SubShapeID.h +0 -138
  373. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SubShapeIDPair.h +0 -65
  374. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.cpp +0 -453
  375. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.gliffy +0 -1
  376. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h +0 -135
  377. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCylinderShape.cpp +0 -691
  378. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCylinderShape.h +0 -132
  379. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TriangleShape.cpp +0 -430
  380. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TriangleShape.h +0 -143
  381. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ShapeCast.h +0 -173
  382. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ShapeFilter.h +0 -73
  383. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SimShapeFilter.h +0 -40
  384. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SimShapeFilterWrapper.h +0 -58
  385. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SortReverseAndStore.h +0 -48
  386. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/TransformedShape.cpp +0 -180
  387. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/TransformedShape.h +0 -194
  388. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/CalculateSolverSteps.h +0 -70
  389. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConeConstraint.cpp +0 -246
  390. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConeConstraint.h +0 -133
  391. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/Constraint.cpp +0 -73
  392. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/Constraint.h +0 -243
  393. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintManager.cpp +0 -289
  394. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintManager.h +0 -100
  395. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h +0 -257
  396. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h +0 -682
  397. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/DualAxisConstraintPart.h +0 -276
  398. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/GearConstraintPart.h +0 -195
  399. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h +0 -222
  400. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/IndependentAxisConstraintPart.h +0 -246
  401. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h +0 -239
  402. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RackAndPinionConstraintPart.h +0 -196
  403. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h +0 -283
  404. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RotationQuatConstraintPart.h +0 -246
  405. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/SpringPart.h +0 -169
  406. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h +0 -597
  407. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ContactConstraintManager.cpp +0 -1804
  408. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ContactConstraintManager.h +0 -524
  409. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/DistanceConstraint.cpp +0 -266
  410. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/DistanceConstraint.h +0 -120
  411. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/FixedConstraint.cpp +0 -215
  412. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/FixedConstraint.h +0 -96
  413. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/GearConstraint.cpp +0 -188
  414. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/GearConstraint.h +0 -116
  415. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/HingeConstraint.cpp +0 -443
  416. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/HingeConstraint.h +0 -205
  417. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/MotorSettings.cpp +0 -43
  418. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/MotorSettings.h +0 -66
  419. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraint.cpp +0 -458
  420. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraint.h +0 -191
  421. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPath.cpp +0 -85
  422. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPath.h +0 -76
  423. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPathHermite.cpp +0 -308
  424. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPathHermite.h +0 -54
  425. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PointConstraint.cpp +0 -157
  426. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PointConstraint.h +0 -94
  427. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PulleyConstraint.cpp +0 -253
  428. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PulleyConstraint.h +0 -137
  429. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/RackAndPinionConstraint.cpp +0 -189
  430. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/RackAndPinionConstraint.h +0 -118
  431. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SixDOFConstraint.cpp +0 -900
  432. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SixDOFConstraint.h +0 -289
  433. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SliderConstraint.cpp +0 -501
  434. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SliderConstraint.h +0 -198
  435. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SpringSettings.cpp +0 -35
  436. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SpringSettings.h +0 -70
  437. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SwingTwistConstraint.cpp +0 -524
  438. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SwingTwistConstraint.h +0 -197
  439. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/TwoBodyConstraint.cpp +0 -56
  440. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/TwoBodyConstraint.h +0 -65
  441. package/native/third_party/JoltPhysics/Jolt/Physics/DeterminismLog.cpp +0 -17
  442. package/native/third_party/JoltPhysics/Jolt/Physics/DeterminismLog.h +0 -159
  443. package/native/third_party/JoltPhysics/Jolt/Physics/EActivation.h +0 -16
  444. package/native/third_party/JoltPhysics/Jolt/Physics/EPhysicsUpdateError.h +0 -37
  445. package/native/third_party/JoltPhysics/Jolt/Physics/IslandBuilder.cpp +0 -492
  446. package/native/third_party/JoltPhysics/Jolt/Physics/IslandBuilder.h +0 -144
  447. package/native/third_party/JoltPhysics/Jolt/Physics/LargeIslandSplitter.cpp +0 -582
  448. package/native/third_party/JoltPhysics/Jolt/Physics/LargeIslandSplitter.h +0 -187
  449. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsLock.h +0 -169
  450. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsScene.cpp +0 -261
  451. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsScene.h +0 -104
  452. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSettings.h +0 -125
  453. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsStepListener.h +0 -37
  454. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSystem.cpp +0 -2915
  455. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSystem.h +0 -391
  456. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsUpdateContext.cpp +0 -25
  457. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsUpdateContext.h +0 -176
  458. package/native/third_party/JoltPhysics/Jolt/Physics/Ragdoll/Ragdoll.cpp +0 -744
  459. package/native/third_party/JoltPhysics/Jolt/Physics/Ragdoll/Ragdoll.h +0 -245
  460. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyContactListener.h +0 -55
  461. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyCreationSettings.cpp +0 -128
  462. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyCreationSettings.h +0 -75
  463. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyManifold.h +0 -74
  464. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyMotionProperties.cpp +0 -1501
  465. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyMotionProperties.h +0 -333
  466. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyShape.cpp +0 -354
  467. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyShape.h +0 -73
  468. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodySharedSettings.cpp +0 -1487
  469. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodySharedSettings.h +0 -390
  470. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyUpdateContext.h +0 -63
  471. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyVertex.h +0 -36
  472. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorder.h +0 -136
  473. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorderImpl.cpp +0 -90
  474. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorderImpl.h +0 -50
  475. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/MotorcycleController.cpp +0 -306
  476. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/MotorcycleController.h +0 -119
  477. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/TrackedVehicleController.cpp +0 -547
  478. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/TrackedVehicleController.h +0 -169
  479. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleAntiRollBar.cpp +0 -33
  480. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleAntiRollBar.h +0 -33
  481. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleCollisionTester.cpp +0 -376
  482. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleCollisionTester.h +0 -146
  483. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleConstraint.cpp +0 -703
  484. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleConstraint.h +0 -252
  485. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleController.cpp +0 -17
  486. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleController.h +0 -87
  487. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleDifferential.cpp +0 -81
  488. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleDifferential.h +0 -39
  489. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleEngine.cpp +0 -122
  490. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleEngine.h +0 -93
  491. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTrack.cpp +0 -52
  492. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTrack.h +0 -56
  493. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTransmission.cpp +0 -159
  494. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTransmission.h +0 -87
  495. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/Wheel.cpp +0 -93
  496. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/Wheel.h +0 -148
  497. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/WheeledVehicleController.cpp +0 -866
  498. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/WheeledVehicleController.h +0 -205
  499. package/native/third_party/JoltPhysics/Jolt/RegisterTypes.cpp +0 -204
  500. package/native/third_party/JoltPhysics/Jolt/RegisterTypes.h +0 -29
  501. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRenderer.cpp +0 -1107
  502. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRenderer.h +0 -383
  503. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererPlayback.cpp +0 -168
  504. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererPlayback.h +0 -48
  505. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererRecorder.cpp +0 -158
  506. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererRecorder.h +0 -130
  507. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererSimple.cpp +0 -80
  508. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererSimple.h +0 -88
  509. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletalAnimation.cpp +0 -165
  510. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletalAnimation.h +0 -91
  511. package/native/third_party/JoltPhysics/Jolt/Skeleton/Skeleton.cpp +0 -82
  512. package/native/third_party/JoltPhysics/Jolt/Skeleton/Skeleton.h +0 -72
  513. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonMapper.cpp +0 -237
  514. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonMapper.h +0 -145
  515. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonPose.cpp +0 -87
  516. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonPose.h +0 -82
  517. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitter.cpp +0 -73
  518. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitter.h +0 -84
  519. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterBinning.cpp +0 -139
  520. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterBinning.h +0 -52
  521. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterMean.cpp +0 -43
  522. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterMean.h +0 -28
  523. package/native/third_party/JoltPhysics/LICENSE +0 -7
  524. package/native/third_party/JoltPhysics/README.md +0 -173
  525. package/native/third_party/bloom_jolt/CMakeLists.txt +0 -87
  526. package/native/third_party/bloom_jolt/include/bloom_jolt.h +0 -519
  527. package/native/third_party/bloom_jolt/src/bloom_jolt.cpp +0 -1780
@@ -1,1305 +0,0 @@
1
- // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2
- // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3
- // SPDX-License-Identifier: MIT
4
-
5
- #include <Jolt/Jolt.h>
6
-
7
- #include <Jolt/Physics/Collision/Shape/MeshShape.h>
8
- #include <Jolt/Physics/Collision/Shape/ConvexShape.h>
9
- #include <Jolt/Physics/Collision/Shape/ScaleHelpers.h>
10
- #include <Jolt/Physics/Collision/Shape/SphereShape.h>
11
- #include <Jolt/Physics/Collision/RayCast.h>
12
- #include <Jolt/Physics/Collision/ShapeCast.h>
13
- #include <Jolt/Physics/Collision/ShapeFilter.h>
14
- #include <Jolt/Physics/Collision/CastResult.h>
15
- #include <Jolt/Physics/Collision/CollideConvexVsTriangles.h>
16
- #include <Jolt/Physics/Collision/CollideSphereVsTriangles.h>
17
- #include <Jolt/Physics/Collision/CastConvexVsTriangles.h>
18
- #include <Jolt/Physics/Collision/CastSphereVsTriangles.h>
19
- #include <Jolt/Physics/Collision/TransformedShape.h>
20
- #include <Jolt/Physics/Collision/ActiveEdges.h>
21
- #include <Jolt/Physics/Collision/CollisionDispatch.h>
22
- #include <Jolt/Physics/Collision/SortReverseAndStore.h>
23
- #include <Jolt/Physics/Collision/CollideSoftBodyVerticesVsTriangles.h>
24
- #include <Jolt/Core/StringTools.h>
25
- #include <Jolt/Core/StreamIn.h>
26
- #include <Jolt/Core/StreamOut.h>
27
- #include <Jolt/Core/Profiler.h>
28
- #include <Jolt/Core/UnorderedMap.h>
29
- #include <Jolt/Geometry/AABox4.h>
30
- #include <Jolt/Geometry/RayAABox.h>
31
- #include <Jolt/Geometry/Indexify.h>
32
- #include <Jolt/Geometry/Plane.h>
33
- #include <Jolt/Geometry/OrientedBox.h>
34
- #include <Jolt/TriangleSplitter/TriangleSplitterBinning.h>
35
- #include <Jolt/TriangleSplitter/TriangleSplitterMean.h>
36
- #include <Jolt/AABBTree/AABBTreeBuilder.h>
37
- #include <Jolt/AABBTree/AABBTreeToBuffer.h>
38
- #include <Jolt/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h>
39
- #include <Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h>
40
- #include <Jolt/ObjectStream/TypeDeclarations.h>
41
-
42
- JPH_NAMESPACE_BEGIN
43
-
44
- #ifdef JPH_DEBUG_RENDERER
45
- bool MeshShape::sDrawTriangleGroups = false;
46
- bool MeshShape::sDrawTriangleOutlines = false;
47
- #endif // JPH_DEBUG_RENDERER
48
-
49
- JPH_IMPLEMENT_SERIALIZABLE_VIRTUAL(MeshShapeSettings)
50
- {
51
- JPH_ADD_BASE_CLASS(MeshShapeSettings, ShapeSettings)
52
-
53
- JPH_ADD_ATTRIBUTE(MeshShapeSettings, mTriangleVertices)
54
- JPH_ADD_ATTRIBUTE(MeshShapeSettings, mIndexedTriangles)
55
- JPH_ADD_ATTRIBUTE(MeshShapeSettings, mMaterials)
56
- JPH_ADD_ATTRIBUTE(MeshShapeSettings, mMaxTrianglesPerLeaf)
57
- JPH_ADD_ATTRIBUTE(MeshShapeSettings, mActiveEdgeCosThresholdAngle)
58
- JPH_ADD_ATTRIBUTE(MeshShapeSettings, mPerTriangleUserData)
59
- JPH_ADD_ENUM_ATTRIBUTE(MeshShapeSettings, mBuildQuality)
60
- }
61
-
62
- // Codecs this mesh shape is using
63
- using TriangleCodec = TriangleCodecIndexed8BitPackSOA4Flags;
64
- using NodeCodec = NodeCodecQuadTreeHalfFloat;
65
-
66
- // Get header for tree
67
- static JPH_INLINE const NodeCodec::Header *sGetNodeHeader(const ByteBuffer &inTree)
68
- {
69
- return inTree.Get<NodeCodec::Header>(0);
70
- }
71
-
72
- // Get header for triangles
73
- static JPH_INLINE const TriangleCodec::TriangleHeader *sGetTriangleHeader(const ByteBuffer &inTree)
74
- {
75
- return inTree.Get<TriangleCodec::TriangleHeader>(NodeCodec::HeaderSize);
76
- }
77
-
78
- MeshShapeSettings::MeshShapeSettings(const TriangleList &inTriangles, PhysicsMaterialList inMaterials) :
79
- mMaterials(std::move(inMaterials))
80
- {
81
- Indexify(inTriangles, mTriangleVertices, mIndexedTriangles);
82
-
83
- Sanitize();
84
- }
85
-
86
- MeshShapeSettings::MeshShapeSettings(VertexList inVertices, IndexedTriangleList inTriangles, PhysicsMaterialList inMaterials) :
87
- mTriangleVertices(std::move(inVertices)),
88
- mIndexedTriangles(std::move(inTriangles)),
89
- mMaterials(std::move(inMaterials))
90
- {
91
- Sanitize();
92
- }
93
-
94
- void MeshShapeSettings::Sanitize()
95
- {
96
- // Remove degenerate and duplicate triangles
97
- UnorderedSet<IndexedTriangle> triangles;
98
- triangles.reserve(UnorderedSet<IndexedTriangle>::size_type(mIndexedTriangles.size()));
99
- TriangleCodec::ValidationContext validation_ctx(mIndexedTriangles, mTriangleVertices);
100
- for (int t = (int)mIndexedTriangles.size() - 1; t >= 0; --t)
101
- {
102
- const IndexedTriangle &tri = mIndexedTriangles[t];
103
-
104
- if (tri.IsDegenerate(mTriangleVertices) // Degenerate triangle
105
- || validation_ctx.IsDegenerate(tri) // Triangle is degenerate in the quantized space
106
- || !triangles.insert(tri.GetLowestIndexFirst()).second) // Duplicate triangle
107
- {
108
- // The order of triangles doesn't matter (gets reordered while building the tree), so we can just swap the last triangle into this slot
109
- mIndexedTriangles[t] = mIndexedTriangles.back();
110
- mIndexedTriangles.pop_back();
111
- }
112
- }
113
- }
114
-
115
- ShapeSettings::ShapeResult MeshShapeSettings::Create() const
116
- {
117
- if (mCachedResult.IsEmpty())
118
- Ref<Shape> shape = new MeshShape(*this, mCachedResult);
119
- return mCachedResult;
120
- }
121
-
122
- MeshShape::MeshShape(const MeshShapeSettings &inSettings, ShapeResult &outResult) :
123
- Shape(EShapeType::Mesh, EShapeSubType::Mesh, inSettings, outResult)
124
- {
125
- // Check if there are any triangles
126
- if (inSettings.mIndexedTriangles.empty())
127
- {
128
- outResult.SetError("Need triangles to create a mesh shape!");
129
- return;
130
- }
131
-
132
- // Check triangles
133
- TriangleCodec::ValidationContext validation_ctx(inSettings.mIndexedTriangles, inSettings.mTriangleVertices);
134
- for (int t = (int)inSettings.mIndexedTriangles.size() - 1; t >= 0; --t)
135
- {
136
- const IndexedTriangle &triangle = inSettings.mIndexedTriangles[t];
137
- if (triangle.IsDegenerate(inSettings.mTriangleVertices)
138
- || validation_ctx.IsDegenerate(triangle))
139
- {
140
- outResult.SetError(StringFormat("Triangle %d is degenerate!", t));
141
- return;
142
- }
143
- else
144
- {
145
- // Check vertex indices
146
- for (uint32 idx : triangle.mIdx)
147
- if (idx >= inSettings.mTriangleVertices.size())
148
- {
149
- outResult.SetError(StringFormat("Vertex index %u is beyond vertex list (size: %u)", idx, (uint)inSettings.mTriangleVertices.size()));
150
- return;
151
- }
152
- }
153
- }
154
-
155
- // Copy materials
156
- mMaterials = inSettings.mMaterials;
157
- if (!mMaterials.empty())
158
- {
159
- // Validate materials
160
- if (mMaterials.size() > (1 << FLAGS_MATERIAL_BITS))
161
- {
162
- outResult.SetError(StringFormat("Supporting max %d materials per mesh", 1 << FLAGS_MATERIAL_BITS));
163
- return;
164
- }
165
- for (const IndexedTriangle &t : inSettings.mIndexedTriangles)
166
- if (t.mMaterialIndex >= mMaterials.size())
167
- {
168
- outResult.SetError(StringFormat("Triangle material %u is beyond material list (size: %u)", t.mMaterialIndex, (uint)mMaterials.size()));
169
- return;
170
- }
171
- }
172
- else
173
- {
174
- // No materials assigned, validate that all triangles use material index 0
175
- for (const IndexedTriangle &t : inSettings.mIndexedTriangles)
176
- if (t.mMaterialIndex != 0)
177
- {
178
- outResult.SetError("No materials present, all triangles should have material index 0");
179
- return;
180
- }
181
- }
182
-
183
- // Check max triangles
184
- if (inSettings.mMaxTrianglesPerLeaf < 1 || inSettings.mMaxTrianglesPerLeaf > MaxTrianglesPerLeaf)
185
- {
186
- outResult.SetError("Invalid max triangles per leaf");
187
- return;
188
- }
189
-
190
- // Fill in active edge bits
191
- IndexedTriangleList indexed_triangles = inSettings.mIndexedTriangles; // Copy indices since we're adding the 'active edge' flag
192
- sFindActiveEdges(inSettings, indexed_triangles);
193
-
194
- // Create triangle splitter
195
- union Storage
196
- {
197
- Storage() { }
198
- ~Storage() { }
199
-
200
- TriangleSplitterBinning mBinning;
201
- TriangleSplitterMean mMean;
202
- };
203
- Storage storage;
204
- TriangleSplitter *splitter = nullptr;
205
- switch (inSettings.mBuildQuality)
206
- {
207
- case MeshShapeSettings::EBuildQuality::FavorRuntimePerformance:
208
- splitter = new (&storage.mBinning) TriangleSplitterBinning(inSettings.mTriangleVertices, indexed_triangles);
209
- break;
210
-
211
- case MeshShapeSettings::EBuildQuality::FavorBuildSpeed:
212
- splitter = new (&storage.mMean) TriangleSplitterMean(inSettings.mTriangleVertices, indexed_triangles);
213
- break;
214
-
215
- default:
216
- JPH_ASSERT(false);
217
- break;
218
- }
219
-
220
- // Build tree
221
- AABBTreeBuilder builder(*splitter, inSettings.mMaxTrianglesPerLeaf);
222
- AABBTreeBuilderStats builder_stats;
223
- const AABBTreeBuilder::Node *root = builder.Build(builder_stats);
224
- splitter->~TriangleSplitter();
225
-
226
- // Convert to buffer
227
- AABBTreeToBuffer<TriangleCodec, NodeCodec> buffer;
228
- const char *error = nullptr;
229
- if (!buffer.Convert(builder.GetTriangles(), builder.GetNodes(), inSettings.mTriangleVertices, root, inSettings.mPerTriangleUserData, error))
230
- {
231
- outResult.SetError(error);
232
- return;
233
- }
234
-
235
- // Move data to this class
236
- mTree.swap(buffer.GetBuffer());
237
-
238
- // Check if we're not exceeding the amount of sub shape id bits
239
- if (GetSubShapeIDBitsRecursive() > SubShapeID::MaxBits)
240
- {
241
- outResult.SetError("Mesh is too big and exceeds the amount of available sub shape ID bits");
242
- return;
243
- }
244
-
245
- outResult.Set(this);
246
- }
247
-
248
- void MeshShape::sFindActiveEdges(const MeshShapeSettings &inSettings, IndexedTriangleList &ioIndices)
249
- {
250
- // Check if we're requested to make all edges active
251
- if (inSettings.mActiveEdgeCosThresholdAngle < 0.0f)
252
- {
253
- for (IndexedTriangle &triangle : ioIndices)
254
- triangle.mMaterialIndex |= 0b111 << FLAGS_ACTIVE_EGDE_SHIFT;
255
- return;
256
- }
257
-
258
- // A struct to hold the two vertex indices of an edge
259
- struct Edge
260
- {
261
- Edge(int inIdx1, int inIdx2) : mIdx1(min(inIdx1, inIdx2)), mIdx2(max(inIdx1, inIdx2)) { }
262
-
263
- uint GetIndexInTriangle(const IndexedTriangle &inTriangle) const
264
- {
265
- for (uint edge_idx = 0; edge_idx < 3; ++edge_idx)
266
- {
267
- Edge edge(inTriangle.mIdx[edge_idx], inTriangle.mIdx[(edge_idx + 1) % 3]);
268
- if (*this == edge)
269
- return edge_idx;
270
- }
271
-
272
- JPH_ASSERT(false);
273
- return ~uint(0);
274
- }
275
-
276
- bool operator == (const Edge &inRHS) const
277
- {
278
- return mIdx1 == inRHS.mIdx1 && mIdx2 == inRHS.mIdx2;
279
- }
280
-
281
- uint64 GetHash() const
282
- {
283
- static_assert(sizeof(*this) == 2 * sizeof(int), "No padding expected");
284
- return HashBytes(this, sizeof(*this));
285
- }
286
-
287
- int mIdx1;
288
- int mIdx2;
289
- };
290
-
291
- // A struct to hold the triangles that are connected to an edge
292
- struct TriangleIndices
293
- {
294
- uint mNumTriangles = 0;
295
- uint mTriangleIndices[2];
296
- };
297
-
298
- // Build a list of edge to triangles
299
- using EdgeToTriangle = UnorderedMap<Edge, TriangleIndices>;
300
- EdgeToTriangle edge_to_triangle;
301
- edge_to_triangle.reserve(EdgeToTriangle::size_type(ioIndices.size() * 3));
302
- for (uint triangle_idx = 0; triangle_idx < ioIndices.size(); ++triangle_idx)
303
- {
304
- IndexedTriangle &triangle = ioIndices[triangle_idx];
305
- for (uint edge_idx = 0; edge_idx < 3; ++edge_idx)
306
- {
307
- Edge edge(triangle.mIdx[edge_idx], triangle.mIdx[(edge_idx + 1) % 3]);
308
- EdgeToTriangle::iterator edge_to_triangle_it = edge_to_triangle.try_emplace(edge, TriangleIndices()).first;
309
- TriangleIndices &indices = edge_to_triangle_it->second;
310
- if (indices.mNumTriangles < 2)
311
- {
312
- // Store index of triangle that connects to this edge
313
- indices.mTriangleIndices[indices.mNumTriangles] = triangle_idx;
314
- indices.mNumTriangles++;
315
- }
316
- else
317
- {
318
- // 3 or more triangles share an edge, mark this edge as active
319
- uint32 mask = 1 << (edge_idx + FLAGS_ACTIVE_EGDE_SHIFT);
320
- JPH_ASSERT((triangle.mMaterialIndex & mask) == 0);
321
- triangle.mMaterialIndex |= mask;
322
- indices.mNumTriangles = 3; // Indicate that we have 3 or more triangles
323
- }
324
- }
325
- }
326
-
327
- // Walk over all edges and determine which ones are active
328
- for (const EdgeToTriangle::value_type &edge : edge_to_triangle)
329
- {
330
- uint num_active = 0;
331
- if (edge.second.mNumTriangles == 1)
332
- {
333
- // Edge is not shared, it is an active edge
334
- num_active = 1;
335
- }
336
- else if (edge.second.mNumTriangles == 2)
337
- {
338
- // Simple shared edge, determine if edge is active based on the two adjacent triangles
339
- const IndexedTriangle &triangle1 = ioIndices[edge.second.mTriangleIndices[0]];
340
- const IndexedTriangle &triangle2 = ioIndices[edge.second.mTriangleIndices[1]];
341
-
342
- // Find which edge this is for both triangles
343
- uint edge_idx1 = edge.first.GetIndexInTriangle(triangle1);
344
- uint edge_idx2 = edge.first.GetIndexInTriangle(triangle2);
345
-
346
- // Construct a plane for triangle 1 (e1 = edge vertex 1, e2 = edge vertex 2, op = opposing vertex)
347
- Vec3 triangle1_e1 = Vec3(inSettings.mTriangleVertices[triangle1.mIdx[edge_idx1]]);
348
- Vec3 triangle1_e2 = Vec3(inSettings.mTriangleVertices[triangle1.mIdx[(edge_idx1 + 1) % 3]]);
349
- Vec3 triangle1_op = Vec3(inSettings.mTriangleVertices[triangle1.mIdx[(edge_idx1 + 2) % 3]]);
350
- Plane triangle1_plane = Plane::sFromPointsCCW(triangle1_e1, triangle1_e2, triangle1_op);
351
-
352
- // Construct a plane for triangle 2
353
- Vec3 triangle2_e1 = Vec3(inSettings.mTriangleVertices[triangle2.mIdx[edge_idx2]]);
354
- Vec3 triangle2_e2 = Vec3(inSettings.mTriangleVertices[triangle2.mIdx[(edge_idx2 + 1) % 3]]);
355
- Vec3 triangle2_op = Vec3(inSettings.mTriangleVertices[triangle2.mIdx[(edge_idx2 + 2) % 3]]);
356
- Plane triangle2_plane = Plane::sFromPointsCCW(triangle2_e1, triangle2_e2, triangle2_op);
357
-
358
- // Determine if the edge is active
359
- num_active = ActiveEdges::IsEdgeActive(triangle1_plane.GetNormal(), triangle2_plane.GetNormal(), triangle1_e2 - triangle1_e1, inSettings.mActiveEdgeCosThresholdAngle)? 2 : 0;
360
- }
361
- else
362
- {
363
- // More edges incoming, we've already marked all edges beyond the 2nd as active
364
- num_active = 2;
365
- }
366
-
367
- // Mark edges of all original triangles active
368
- for (uint i = 0; i < num_active; ++i)
369
- {
370
- uint triangle_idx = edge.second.mTriangleIndices[i];
371
- IndexedTriangle &triangle = ioIndices[triangle_idx];
372
- uint edge_idx = edge.first.GetIndexInTriangle(triangle);
373
- uint32 mask = 1 << (edge_idx + FLAGS_ACTIVE_EGDE_SHIFT);
374
- JPH_ASSERT((triangle.mMaterialIndex & mask) == 0);
375
- triangle.mMaterialIndex |= mask;
376
- }
377
- }
378
- }
379
-
380
- MassProperties MeshShape::GetMassProperties() const
381
- {
382
- // We cannot calculate the volume for an arbitrary mesh, so we return invalid mass properties.
383
- // If you want your mesh to be dynamic, then you should provide the mass properties yourself when
384
- // creating a Body:
385
- //
386
- // BodyCreationSettings::mOverrideMassProperties = EOverrideMassProperties::MassAndInertiaProvided;
387
- // BodyCreationSettings::mMassPropertiesOverride.SetMassAndInertiaOfSolidBox(Vec3::sOne(), 1000.0f);
388
- //
389
- // Note that for a mesh shape to simulate properly, it is best if the mesh is manifold
390
- // (i.e. closed, all edges shared by only two triangles, consistent winding order).
391
- return MassProperties();
392
- }
393
-
394
- void MeshShape::DecodeSubShapeID(const SubShapeID &inSubShapeID, const void *&outTriangleBlock, uint32 &outTriangleIndex) const
395
- {
396
- // Get block
397
- SubShapeID triangle_idx_subshape_id;
398
- uint32 block_id = inSubShapeID.PopID(NodeCodec::DecodingContext::sTriangleBlockIDBits(sGetNodeHeader(mTree)), triangle_idx_subshape_id);
399
- outTriangleBlock = NodeCodec::DecodingContext::sGetTriangleBlockStart(&mTree[0], block_id);
400
-
401
- // Fetch the triangle index
402
- SubShapeID remainder;
403
- outTriangleIndex = triangle_idx_subshape_id.PopID(NumTriangleBits, remainder);
404
- JPH_ASSERT(remainder.IsEmpty(), "Invalid subshape ID");
405
- }
406
-
407
- uint MeshShape::GetMaterialIndex(const SubShapeID &inSubShapeID) const
408
- {
409
- // Decode ID
410
- const void *block_start;
411
- uint32 triangle_idx;
412
- DecodeSubShapeID(inSubShapeID, block_start, triangle_idx);
413
-
414
- // Fetch the flags
415
- uint8 flags = TriangleCodec::DecodingContext::sGetFlags(block_start, triangle_idx);
416
- return flags & FLAGS_MATERIAL_MASK;
417
- }
418
-
419
- const PhysicsMaterial *MeshShape::GetMaterial(const SubShapeID &inSubShapeID) const
420
- {
421
- // Return the default material if there are no materials on this shape
422
- if (mMaterials.empty())
423
- return PhysicsMaterial::sDefault;
424
-
425
- return mMaterials[GetMaterialIndex(inSubShapeID)];
426
- }
427
-
428
- Vec3 MeshShape::GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const
429
- {
430
- // Decode ID
431
- const void *block_start;
432
- uint32 triangle_idx;
433
- DecodeSubShapeID(inSubShapeID, block_start, triangle_idx);
434
-
435
- // Decode triangle
436
- Vec3 v1, v2, v3;
437
- const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
438
- triangle_ctx.GetTriangle(block_start, triangle_idx, v1, v2, v3);
439
-
440
- // Calculate normal
441
- return (v3 - v2).Cross(v1 - v2).Normalized();
442
- }
443
-
444
- void MeshShape::GetSupportingFace(const SubShapeID &inSubShapeID, Vec3Arg inDirection, Vec3Arg inScale, Mat44Arg inCenterOfMassTransform, SupportingFace &outVertices) const
445
- {
446
- // Decode ID
447
- const void *block_start;
448
- uint32 triangle_idx;
449
- DecodeSubShapeID(inSubShapeID, block_start, triangle_idx);
450
-
451
- // Decode triangle
452
- const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
453
- outVertices.resize(3);
454
- triangle_ctx.GetTriangle(block_start, triangle_idx, outVertices[0], outVertices[1], outVertices[2]);
455
-
456
- // Flip triangle if scaled inside out
457
- if (ScaleHelpers::IsInsideOut(inScale))
458
- std::swap(outVertices[1], outVertices[2]);
459
-
460
- // Calculate transform with scale
461
- Mat44 transform = inCenterOfMassTransform.PreScaled(inScale);
462
-
463
- // Transform to world space
464
- for (Vec3 &v : outVertices)
465
- v = transform * v;
466
- }
467
-
468
- AABox MeshShape::GetLocalBounds() const
469
- {
470
- const NodeCodec::Header *header = sGetNodeHeader(mTree);
471
- return AABox(Vec3::sLoadFloat3Unsafe(header->mRootBoundsMin), Vec3::sLoadFloat3Unsafe(header->mRootBoundsMax));
472
- }
473
-
474
- uint MeshShape::GetSubShapeIDBitsRecursive() const
475
- {
476
- return NodeCodec::DecodingContext::sTriangleBlockIDBits(sGetNodeHeader(mTree)) + NumTriangleBits;
477
- }
478
-
479
- template <class Visitor>
480
- JPH_INLINE void MeshShape::WalkTree(Visitor &ioVisitor) const
481
- {
482
- const NodeCodec::Header *header = sGetNodeHeader(mTree);
483
- NodeCodec::DecodingContext node_ctx(header);
484
-
485
- const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
486
- const uint8 *buffer_start = &mTree[0];
487
- node_ctx.WalkTree(buffer_start, triangle_ctx, ioVisitor);
488
- }
489
-
490
- template <class Visitor>
491
- JPH_INLINE void MeshShape::WalkTreePerTriangle(const SubShapeIDCreator &inSubShapeIDCreator2, Visitor &ioVisitor) const
492
- {
493
- struct ChainedVisitor
494
- {
495
- JPH_INLINE ChainedVisitor(Visitor &ioVisitor, const SubShapeIDCreator &inSubShapeIDCreator2, uint inTriangleBlockIDBits) :
496
- mVisitor(ioVisitor),
497
- mSubShapeIDCreator2(inSubShapeIDCreator2),
498
- mTriangleBlockIDBits(inTriangleBlockIDBits)
499
- {
500
- }
501
-
502
- JPH_INLINE bool ShouldAbort() const
503
- {
504
- return mVisitor.ShouldAbort();
505
- }
506
-
507
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
508
- {
509
- return mVisitor.ShouldVisitNode(inStackTop);
510
- }
511
-
512
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
513
- {
514
- return mVisitor.VisitNodes(inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, ioProperties, inStackTop);
515
- }
516
-
517
- JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID)
518
- {
519
- // Create ID for triangle block
520
- SubShapeIDCreator block_sub_shape_id = mSubShapeIDCreator2.PushID(inTriangleBlockID, mTriangleBlockIDBits);
521
-
522
- // Decode vertices and flags
523
- JPH_ASSERT(inNumTriangles <= MaxTrianglesPerLeaf);
524
- Vec3 vertices[MaxTrianglesPerLeaf * 3];
525
- uint8 flags[MaxTrianglesPerLeaf];
526
- ioContext.Unpack(inTriangles, inNumTriangles, vertices, flags);
527
-
528
- int triangle_idx = 0;
529
- for (const Vec3 *v = vertices, *v_end = vertices + inNumTriangles * 3; v < v_end; v += 3, triangle_idx++)
530
- {
531
- // Determine active edges
532
- uint8 active_edges = (flags[triangle_idx] >> FLAGS_ACTIVE_EGDE_SHIFT) & FLAGS_ACTIVE_EDGE_MASK;
533
-
534
- // Create ID for triangle
535
- SubShapeIDCreator triangle_sub_shape_id = block_sub_shape_id.PushID(triangle_idx, NumTriangleBits);
536
-
537
- mVisitor.VisitTriangle(v[0], v[1], v[2], active_edges, triangle_sub_shape_id.GetID());
538
-
539
- // Check if we should early out now
540
- if (mVisitor.ShouldAbort())
541
- break;
542
- }
543
- }
544
-
545
- Visitor & mVisitor;
546
- SubShapeIDCreator mSubShapeIDCreator2;
547
- uint mTriangleBlockIDBits;
548
- };
549
-
550
- ChainedVisitor visitor(ioVisitor, inSubShapeIDCreator2, NodeCodec::DecodingContext::sTriangleBlockIDBits(sGetNodeHeader(mTree)));
551
- WalkTree(visitor);
552
- }
553
-
554
- #ifdef JPH_DEBUG_RENDERER
555
- void MeshShape::Draw(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inUseMaterialColors, bool inDrawWireframe) const
556
- {
557
- // Reset the batch if we switch coloring mode
558
- if (mCachedTrianglesColoredPerGroup != sDrawTriangleGroups || mCachedUseMaterialColors != inUseMaterialColors)
559
- {
560
- mGeometry = nullptr;
561
- mCachedTrianglesColoredPerGroup = sDrawTriangleGroups;
562
- mCachedUseMaterialColors = inUseMaterialColors;
563
- }
564
-
565
- if (mGeometry == nullptr)
566
- {
567
- struct Visitor
568
- {
569
- JPH_INLINE bool ShouldAbort() const
570
- {
571
- return false;
572
- }
573
-
574
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
575
- {
576
- return true;
577
- }
578
-
579
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
580
- {
581
- UVec4 valid = UVec4::sOr(UVec4::sOr(Vec4::sLess(inBoundsMinX, inBoundsMaxX), Vec4::sLess(inBoundsMinY, inBoundsMaxY)), Vec4::sLess(inBoundsMinZ, inBoundsMaxZ));
582
- return CountAndSortTrues(valid, ioProperties);
583
- }
584
-
585
- JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, [[maybe_unused]] uint32 inTriangleBlockID)
586
- {
587
- JPH_ASSERT(inNumTriangles <= MaxTrianglesPerLeaf);
588
- Vec3 vertices[MaxTrianglesPerLeaf * 3];
589
- ioContext.Unpack(inTriangles, inNumTriangles, vertices);
590
-
591
- if (mDrawTriangleGroups || !mUseMaterialColors || mMaterials.empty())
592
- {
593
- // Single color for mesh
594
- Color color = mDrawTriangleGroups? Color::sGetDistinctColor(mColorIdx++) : (mUseMaterialColors? PhysicsMaterial::sDefault->GetDebugColor() : Color::sWhite);
595
- for (const Vec3 *v = vertices, *v_end = vertices + inNumTriangles * 3; v < v_end; v += 3)
596
- mTriangles.push_back({ v[0], v[1], v[2], color });
597
- }
598
- else
599
- {
600
- // Per triangle color
601
- uint8 flags[MaxTrianglesPerLeaf];
602
- TriangleCodec::DecodingContext::sGetFlags(inTriangles, inNumTriangles, flags);
603
-
604
- const uint8 *f = flags;
605
- for (const Vec3 *v = vertices, *v_end = vertices + inNumTriangles * 3; v < v_end; v += 3, f++)
606
- mTriangles.push_back({ v[0], v[1], v[2], mMaterials[*f & FLAGS_MATERIAL_MASK]->GetDebugColor() });
607
- }
608
- }
609
-
610
- Array<DebugRenderer::Triangle> & mTriangles;
611
- const PhysicsMaterialList & mMaterials;
612
- bool mUseMaterialColors;
613
- bool mDrawTriangleGroups;
614
- int mColorIdx = 0;
615
- };
616
-
617
- Array<DebugRenderer::Triangle> triangles;
618
- Visitor visitor { triangles, mMaterials, mCachedUseMaterialColors, mCachedTrianglesColoredPerGroup };
619
- WalkTree(visitor);
620
- mGeometry = new DebugRenderer::Geometry(inRenderer->CreateTriangleBatch(triangles), GetLocalBounds());
621
- }
622
-
623
- // Test if the shape is scaled inside out
624
- DebugRenderer::ECullMode cull_mode = ScaleHelpers::IsInsideOut(inScale)? DebugRenderer::ECullMode::CullFrontFace : DebugRenderer::ECullMode::CullBackFace;
625
-
626
- // Determine the draw mode
627
- DebugRenderer::EDrawMode draw_mode = inDrawWireframe? DebugRenderer::EDrawMode::Wireframe : DebugRenderer::EDrawMode::Solid;
628
-
629
- // Draw the geometry
630
- inRenderer->DrawGeometry(inCenterOfMassTransform * Mat44::sScale(inScale), inColor, mGeometry, cull_mode, DebugRenderer::ECastShadow::On, draw_mode);
631
-
632
- if (sDrawTriangleOutlines)
633
- {
634
- struct Visitor
635
- {
636
- JPH_INLINE Visitor(DebugRenderer *inRenderer, RMat44Arg inTransform) :
637
- mRenderer(inRenderer),
638
- mTransform(inTransform)
639
- {
640
- }
641
-
642
- JPH_INLINE bool ShouldAbort() const
643
- {
644
- return false;
645
- }
646
-
647
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
648
- {
649
- return true;
650
- }
651
-
652
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
653
- {
654
- UVec4 valid = UVec4::sOr(UVec4::sOr(Vec4::sLess(inBoundsMinX, inBoundsMaxX), Vec4::sLess(inBoundsMinY, inBoundsMaxY)), Vec4::sLess(inBoundsMinZ, inBoundsMaxZ));
655
- return CountAndSortTrues(valid, ioProperties);
656
- }
657
-
658
- JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID)
659
- {
660
- // Decode vertices and flags
661
- JPH_ASSERT(inNumTriangles <= MaxTrianglesPerLeaf);
662
- Vec3 vertices[MaxTrianglesPerLeaf * 3];
663
- uint8 flags[MaxTrianglesPerLeaf];
664
- ioContext.Unpack(inTriangles, inNumTriangles, vertices, flags);
665
-
666
- // Loop through triangles
667
- const uint8 *f = flags;
668
- for (Vec3 *v = vertices, *v_end = vertices + inNumTriangles * 3; v < v_end; v += 3, ++f)
669
- {
670
- // Loop through edges
671
- for (uint edge_idx = 0; edge_idx < 3; ++edge_idx)
672
- {
673
- RVec3 v1 = mTransform * v[edge_idx];
674
- RVec3 v2 = mTransform * v[(edge_idx + 1) % 3];
675
-
676
- // Draw active edge as a green arrow, other edges as grey
677
- if (*f & (1 << (edge_idx + FLAGS_ACTIVE_EGDE_SHIFT)))
678
- mRenderer->DrawArrow(v1, v2, Color::sGreen, 0.01f);
679
- else
680
- mRenderer->DrawLine(v1, v2, Color::sGrey);
681
- }
682
- }
683
- }
684
-
685
- DebugRenderer * mRenderer;
686
- RMat44 mTransform;
687
- };
688
-
689
- Visitor visitor { inRenderer, inCenterOfMassTransform.PreScaled(inScale) };
690
- WalkTree(visitor);
691
- }
692
- }
693
- #endif // JPH_DEBUG_RENDERER
694
-
695
- bool MeshShape::CastRay(const RayCast &inRay, const SubShapeIDCreator &inSubShapeIDCreator, RayCastResult &ioHit) const
696
- {
697
- JPH_PROFILE_FUNCTION();
698
-
699
- struct Visitor
700
- {
701
- JPH_INLINE explicit Visitor(RayCastResult &ioHit) :
702
- mHit(ioHit)
703
- {
704
- }
705
-
706
- JPH_INLINE bool ShouldAbort() const
707
- {
708
- return mHit.mFraction <= 0.0f;
709
- }
710
-
711
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
712
- {
713
- return mDistanceStack[inStackTop] < mHit.mFraction;
714
- }
715
-
716
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
717
- {
718
- // Test bounds of 4 children
719
- Vec4 distance = RayAABox4(mRayOrigin, mRayInvDirection, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
720
-
721
- // Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
722
- return SortReverseAndStore(distance, mHit.mFraction, ioProperties, &mDistanceStack[inStackTop]);
723
- }
724
-
725
- JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, uint32 inTriangleBlockID)
726
- {
727
- // Test against triangles
728
- uint32 triangle_idx;
729
- float fraction = ioContext.TestRay(mRayOrigin, mRayDirection, inTriangles, inNumTriangles, mHit.mFraction, triangle_idx);
730
- if (fraction < mHit.mFraction)
731
- {
732
- mHit.mFraction = fraction;
733
- mHit.mSubShapeID2 = mSubShapeIDCreator.PushID(inTriangleBlockID, mTriangleBlockIDBits).PushID(triangle_idx, NumTriangleBits).GetID();
734
- mReturnValue = true;
735
- }
736
- }
737
-
738
- RayCastResult & mHit;
739
- Vec3 mRayOrigin;
740
- Vec3 mRayDirection;
741
- RayInvDirection mRayInvDirection;
742
- uint mTriangleBlockIDBits;
743
- SubShapeIDCreator mSubShapeIDCreator;
744
- bool mReturnValue = false;
745
- float mDistanceStack[NodeCodec::StackSize];
746
- };
747
-
748
- Visitor visitor(ioHit);
749
- visitor.mRayOrigin = inRay.mOrigin;
750
- visitor.mRayDirection = inRay.mDirection;
751
- visitor.mRayInvDirection.Set(inRay.mDirection);
752
- visitor.mTriangleBlockIDBits = NodeCodec::DecodingContext::sTriangleBlockIDBits(sGetNodeHeader(mTree));
753
- visitor.mSubShapeIDCreator = inSubShapeIDCreator;
754
- WalkTree(visitor);
755
-
756
- return visitor.mReturnValue;
757
- }
758
-
759
- void MeshShape::CastRay(const RayCast &inRay, const RayCastSettings &inRayCastSettings, const SubShapeIDCreator &inSubShapeIDCreator, CastRayCollector &ioCollector, const ShapeFilter &inShapeFilter) const
760
- {
761
- JPH_PROFILE_FUNCTION();
762
-
763
- // Test shape filter
764
- if (!inShapeFilter.ShouldCollide(this, inSubShapeIDCreator.GetID()))
765
- return;
766
-
767
- struct Visitor
768
- {
769
- JPH_INLINE explicit Visitor(CastRayCollector &ioCollector) :
770
- mCollector(ioCollector)
771
- {
772
- }
773
-
774
- JPH_INLINE bool ShouldAbort() const
775
- {
776
- return mCollector.ShouldEarlyOut();
777
- }
778
-
779
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
780
- {
781
- return mDistanceStack[inStackTop] < mCollector.GetEarlyOutFraction();
782
- }
783
-
784
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
785
- {
786
- // Test bounds of 4 children
787
- Vec4 distance = RayAABox4(mRayOrigin, mRayInvDirection, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
788
-
789
- // Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
790
- return SortReverseAndStore(distance, mCollector.GetEarlyOutFraction(), ioProperties, &mDistanceStack[inStackTop]);
791
- }
792
-
793
- JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, [[maybe_unused]] uint8 inActiveEdges, SubShapeID inSubShapeID2)
794
- {
795
- // Back facing check
796
- if (mBackFaceMode == EBackFaceMode::IgnoreBackFaces && (inV2 - inV0).Cross(inV1 - inV0).Dot(mRayDirection) < 0)
797
- return;
798
-
799
- // Check the triangle
800
- float fraction = RayTriangle(mRayOrigin, mRayDirection, inV0, inV1, inV2);
801
- if (fraction < mCollector.GetEarlyOutFraction())
802
- {
803
- RayCastResult hit;
804
- hit.mBodyID = TransformedShape::sGetBodyID(mCollector.GetContext());
805
- hit.mFraction = fraction;
806
- hit.mSubShapeID2 = inSubShapeID2;
807
- mCollector.AddHit(hit);
808
- }
809
- }
810
-
811
- CastRayCollector & mCollector;
812
- Vec3 mRayOrigin;
813
- Vec3 mRayDirection;
814
- RayInvDirection mRayInvDirection;
815
- EBackFaceMode mBackFaceMode;
816
- float mDistanceStack[NodeCodec::StackSize];
817
- };
818
-
819
- Visitor visitor(ioCollector);
820
- visitor.mBackFaceMode = inRayCastSettings.mBackFaceModeTriangles;
821
- visitor.mRayOrigin = inRay.mOrigin;
822
- visitor.mRayDirection = inRay.mDirection;
823
- visitor.mRayInvDirection.Set(inRay.mDirection);
824
- WalkTreePerTriangle(inSubShapeIDCreator, visitor);
825
- }
826
-
827
- void MeshShape::CollidePoint(Vec3Arg inPoint, const SubShapeIDCreator &inSubShapeIDCreator, CollidePointCollector &ioCollector, const ShapeFilter &inShapeFilter) const
828
- {
829
- sCollidePointUsingRayCast(*this, inPoint, inSubShapeIDCreator, ioCollector, inShapeFilter);
830
- }
831
-
832
- void MeshShape::CollideSoftBodyVertices(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const CollideSoftBodyVertexIterator &inVertices, uint inNumVertices, int inCollidingShapeIndex) const
833
- {
834
- JPH_PROFILE_FUNCTION();
835
-
836
- struct Visitor : public CollideSoftBodyVerticesVsTriangles
837
- {
838
- using CollideSoftBodyVerticesVsTriangles::CollideSoftBodyVerticesVsTriangles;
839
-
840
- JPH_INLINE bool ShouldAbort() const
841
- {
842
- return false;
843
- }
844
-
845
- JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
846
- {
847
- return mDistanceStack[inStackTop] < mClosestDistanceSq;
848
- }
849
-
850
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
851
- {
852
- // Scale the bounding boxes of this node
853
- Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
854
- AABox4Scale(mScale, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
855
-
856
- // Get distance to vertex
857
- Vec4 dist_sq = AABox4DistanceSqToPoint(mLocalPosition, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
858
-
859
- // Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
860
- return SortReverseAndStore(dist_sq, mClosestDistanceSq, ioProperties, &mDistanceStack[inStackTop]);
861
- }
862
-
863
- JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, [[maybe_unused]] uint8 inActiveEdges, [[maybe_unused]] SubShapeID inSubShapeID2)
864
- {
865
- ProcessTriangle(inV0, inV1, inV2);
866
- }
867
-
868
- float mDistanceStack[NodeCodec::StackSize];
869
- };
870
-
871
- Visitor visitor(inCenterOfMassTransform, inScale);
872
-
873
- for (CollideSoftBodyVertexIterator v = inVertices, sbv_end = inVertices + inNumVertices; v != sbv_end; ++v)
874
- if (v.GetInvMass() > 0.0f)
875
- {
876
- visitor.StartVertex(v);
877
- WalkTreePerTriangle(SubShapeIDCreator(), visitor);
878
- visitor.FinishVertex(v, inCollidingShapeIndex);
879
- }
880
- }
881
-
882
- void MeshShape::sCastConvexVsMesh(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, [[maybe_unused]] const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)
883
- {
884
- JPH_PROFILE_FUNCTION();
885
-
886
- struct Visitor : public CastConvexVsTriangles
887
- {
888
- using CastConvexVsTriangles::CastConvexVsTriangles;
889
-
890
- JPH_INLINE bool ShouldAbort() const
891
- {
892
- return mCollector.ShouldEarlyOut();
893
- }
894
-
895
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
896
- {
897
- return mDistanceStack[inStackTop] < mCollector.GetPositiveEarlyOutFraction();
898
- }
899
-
900
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
901
- {
902
- // Scale the bounding boxes of this node
903
- Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
904
- AABox4Scale(mScale, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
905
-
906
- // Enlarge them by the casted shape's box extents
907
- AABox4EnlargeWithExtent(mBoxExtent, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
908
-
909
- // Test bounds of 4 children
910
- Vec4 distance = RayAABox4(mBoxCenter, mInvDirection, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
911
-
912
- // Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
913
- return SortReverseAndStore(distance, mCollector.GetPositiveEarlyOutFraction(), ioProperties, &mDistanceStack[inStackTop]);
914
- }
915
-
916
- JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, SubShapeID inSubShapeID2)
917
- {
918
- Cast(inV0, inV1, inV2, inActiveEdges, inSubShapeID2);
919
- }
920
-
921
- RayInvDirection mInvDirection;
922
- Vec3 mBoxCenter;
923
- Vec3 mBoxExtent;
924
- float mDistanceStack[NodeCodec::StackSize];
925
- };
926
-
927
- JPH_ASSERT(inShape->GetSubType() == EShapeSubType::Mesh);
928
- const MeshShape *shape = static_cast<const MeshShape *>(inShape);
929
-
930
- Visitor visitor(inShapeCast, inShapeCastSettings, inScale, inCenterOfMassTransform2, inSubShapeIDCreator1, ioCollector);
931
- visitor.mInvDirection.Set(inShapeCast.mDirection);
932
- visitor.mBoxCenter = inShapeCast.mShapeWorldBounds.GetCenter();
933
- visitor.mBoxExtent = inShapeCast.mShapeWorldBounds.GetExtent();
934
- shape->WalkTreePerTriangle(inSubShapeIDCreator2, visitor);
935
- }
936
-
937
- void MeshShape::sCastSphereVsMesh(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, [[maybe_unused]] const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)
938
- {
939
- JPH_PROFILE_FUNCTION();
940
-
941
- struct Visitor : public CastSphereVsTriangles
942
- {
943
- using CastSphereVsTriangles::CastSphereVsTriangles;
944
-
945
- JPH_INLINE bool ShouldAbort() const
946
- {
947
- return mCollector.ShouldEarlyOut();
948
- }
949
-
950
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
951
- {
952
- return mDistanceStack[inStackTop] < mCollector.GetPositiveEarlyOutFraction();
953
- }
954
-
955
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, int inStackTop)
956
- {
957
- // Scale the bounding boxes of this node
958
- Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
959
- AABox4Scale(mScale, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
960
-
961
- // Enlarge them by the radius of the sphere
962
- AABox4EnlargeWithExtent(Vec3::sReplicate(mRadius), bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
963
-
964
- // Test bounds of 4 children
965
- Vec4 distance = RayAABox4(mStart, mInvDirection, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
966
-
967
- // Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
968
- return SortReverseAndStore(distance, mCollector.GetPositiveEarlyOutFraction(), ioProperties, &mDistanceStack[inStackTop]);
969
- }
970
-
971
- JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, SubShapeID inSubShapeID2)
972
- {
973
- Cast(inV0, inV1, inV2, inActiveEdges, inSubShapeID2);
974
- }
975
-
976
- RayInvDirection mInvDirection;
977
- float mDistanceStack[NodeCodec::StackSize];
978
- };
979
-
980
- JPH_ASSERT(inShape->GetSubType() == EShapeSubType::Mesh);
981
- const MeshShape *shape = static_cast<const MeshShape *>(inShape);
982
-
983
- Visitor visitor(inShapeCast, inShapeCastSettings, inScale, inCenterOfMassTransform2, inSubShapeIDCreator1, ioCollector);
984
- visitor.mInvDirection.Set(inShapeCast.mDirection);
985
- shape->WalkTreePerTriangle(inSubShapeIDCreator2, visitor);
986
- }
987
-
988
- struct MeshShape::MSGetTrianglesContext
989
- {
990
- JPH_INLINE MSGetTrianglesContext(const MeshShape *inShape, const AABox &inBox, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale) :
991
- mDecodeCtx(sGetNodeHeader(inShape->mTree)),
992
- mShape(inShape),
993
- mLocalBox(Mat44::sInverseRotationTranslation(inRotation, inPositionCOM), inBox),
994
- mMeshScale(inScale),
995
- mLocalToWorld(Mat44::sRotationTranslation(inRotation, inPositionCOM) * Mat44::sScale(inScale)),
996
- mIsInsideOut(ScaleHelpers::IsInsideOut(inScale))
997
- {
998
- }
999
-
1000
- JPH_INLINE bool ShouldAbort() const
1001
- {
1002
- return mShouldAbort;
1003
- }
1004
-
1005
- JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
1006
- {
1007
- return true;
1008
- }
1009
-
1010
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, [[maybe_unused]] int inStackTop) const
1011
- {
1012
- // Scale the bounding boxes of this node
1013
- Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
1014
- AABox4Scale(mMeshScale, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
1015
-
1016
- // Test which nodes collide
1017
- UVec4 collides = AABox4VsBox(mLocalBox, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
1018
- return CountAndSortTrues(collides, ioProperties);
1019
- }
1020
-
1021
- JPH_INLINE void VisitTriangles(const TriangleCodec::DecodingContext &ioContext, const void *inTriangles, int inNumTriangles, [[maybe_unused]] uint32 inTriangleBlockID)
1022
- {
1023
- // When the buffer is full and we cannot process the triangles, abort the tree walk. The next time GetTrianglesNext is called we will continue here.
1024
- if (mNumTrianglesFound + inNumTriangles > mMaxTrianglesRequested)
1025
- {
1026
- mShouldAbort = true;
1027
- return;
1028
- }
1029
-
1030
- // Decode vertices
1031
- JPH_ASSERT(inNumTriangles <= MaxTrianglesPerLeaf);
1032
- Vec3 vertices[MaxTrianglesPerLeaf * 3];
1033
- ioContext.Unpack(inTriangles, inNumTriangles, vertices);
1034
-
1035
- // Store vertices as Float3
1036
- if (mIsInsideOut)
1037
- {
1038
- // Scaled inside out, flip the triangles
1039
- for (const Vec3 *v = vertices, *v_end = v + 3 * inNumTriangles; v < v_end; v += 3)
1040
- {
1041
- (mLocalToWorld * v[0]).StoreFloat3(mTriangleVertices++);
1042
- (mLocalToWorld * v[2]).StoreFloat3(mTriangleVertices++);
1043
- (mLocalToWorld * v[1]).StoreFloat3(mTriangleVertices++);
1044
- }
1045
- }
1046
- else
1047
- {
1048
- // Normal scale
1049
- for (const Vec3 *v = vertices, *v_end = v + 3 * inNumTriangles; v < v_end; ++v)
1050
- (mLocalToWorld * *v).StoreFloat3(mTriangleVertices++);
1051
- }
1052
-
1053
- if (mMaterials != nullptr)
1054
- {
1055
- if (mShape->mMaterials.empty())
1056
- {
1057
- // No materials, output default
1058
- const PhysicsMaterial *default_material = PhysicsMaterial::sDefault;
1059
- for (int m = 0; m < inNumTriangles; ++m)
1060
- *mMaterials++ = default_material;
1061
- }
1062
- else
1063
- {
1064
- // Decode triangle flags
1065
- uint8 flags[MaxTrianglesPerLeaf];
1066
- TriangleCodec::DecodingContext::sGetFlags(inTriangles, inNumTriangles, flags);
1067
-
1068
- // Store materials
1069
- for (const uint8 *f = flags, *f_end = f + inNumTriangles; f < f_end; ++f)
1070
- *mMaterials++ = mShape->mMaterials[*f & FLAGS_MATERIAL_MASK].GetPtr();
1071
- }
1072
- }
1073
-
1074
- // Accumulate triangles found
1075
- mNumTrianglesFound += inNumTriangles;
1076
- }
1077
-
1078
- NodeCodec::DecodingContext mDecodeCtx;
1079
- const MeshShape * mShape;
1080
- OrientedBox mLocalBox;
1081
- Vec3 mMeshScale;
1082
- Mat44 mLocalToWorld;
1083
- int mMaxTrianglesRequested;
1084
- Float3 * mTriangleVertices;
1085
- int mNumTrianglesFound;
1086
- const PhysicsMaterial ** mMaterials;
1087
- bool mShouldAbort;
1088
- bool mIsInsideOut;
1089
- };
1090
-
1091
- void MeshShape::GetTrianglesStart(GetTrianglesContext &ioContext, const AABox &inBox, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale) const
1092
- {
1093
- static_assert(sizeof(MSGetTrianglesContext) <= sizeof(GetTrianglesContext), "GetTrianglesContext too small");
1094
- JPH_ASSERT(IsAligned(&ioContext, alignof(MSGetTrianglesContext)));
1095
-
1096
- new (&ioContext) MSGetTrianglesContext(this, inBox, inPositionCOM, inRotation, inScale);
1097
- }
1098
-
1099
- int MeshShape::GetTrianglesNext(GetTrianglesContext &ioContext, int inMaxTrianglesRequested, Float3 *outTriangleVertices, const PhysicsMaterial **outMaterials) const
1100
- {
1101
- static_assert(cGetTrianglesMinTrianglesRequested >= MaxTrianglesPerLeaf, "cGetTrianglesMinTrianglesRequested is too small");
1102
- JPH_ASSERT(inMaxTrianglesRequested >= cGetTrianglesMinTrianglesRequested);
1103
-
1104
- // Check if we're done
1105
- MSGetTrianglesContext &context = (MSGetTrianglesContext &)ioContext;
1106
- if (context.mDecodeCtx.IsDoneWalking())
1107
- return 0;
1108
-
1109
- // Store parameters on context
1110
- context.mMaxTrianglesRequested = inMaxTrianglesRequested;
1111
- context.mTriangleVertices = outTriangleVertices;
1112
- context.mMaterials = outMaterials;
1113
- context.mShouldAbort = false; // Reset the abort flag
1114
- context.mNumTrianglesFound = 0;
1115
-
1116
- // Continue (or start) walking the tree
1117
- const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
1118
- const uint8 *buffer_start = &mTree[0];
1119
- context.mDecodeCtx.WalkTree(buffer_start, triangle_ctx, context);
1120
- return context.mNumTrianglesFound;
1121
- }
1122
-
1123
- void MeshShape::sCollideConvexVsMesh(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, [[maybe_unused]] const ShapeFilter &inShapeFilter)
1124
- {
1125
- JPH_PROFILE_FUNCTION();
1126
-
1127
- // Get the shapes
1128
- JPH_ASSERT(inShape1->GetType() == EShapeType::Convex);
1129
- JPH_ASSERT(inShape2->GetType() == EShapeType::Mesh);
1130
- const ConvexShape *shape1 = static_cast<const ConvexShape *>(inShape1);
1131
- const MeshShape *shape2 = static_cast<const MeshShape *>(inShape2);
1132
-
1133
- struct Visitor : public CollideConvexVsTriangles
1134
- {
1135
- using CollideConvexVsTriangles::CollideConvexVsTriangles;
1136
-
1137
- JPH_INLINE bool ShouldAbort() const
1138
- {
1139
- return mCollector.ShouldEarlyOut();
1140
- }
1141
-
1142
- JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
1143
- {
1144
- return true;
1145
- }
1146
-
1147
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, [[maybe_unused]] int inStackTop) const
1148
- {
1149
- // Scale the bounding boxes of this node
1150
- Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
1151
- AABox4Scale(mScale2, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
1152
-
1153
- // Test which nodes collide
1154
- UVec4 collides = AABox4VsBox(mBoundsOf1InSpaceOf2, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
1155
- return CountAndSortTrues(collides, ioProperties);
1156
- }
1157
-
1158
- JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, SubShapeID inSubShapeID2)
1159
- {
1160
- Collide(inV0, inV1, inV2, inActiveEdges, inSubShapeID2);
1161
- }
1162
- };
1163
-
1164
- Visitor visitor(shape1, inScale1, inScale2, inCenterOfMassTransform1, inCenterOfMassTransform2, inSubShapeIDCreator1.GetID(), inCollideShapeSettings, ioCollector);
1165
- shape2->WalkTreePerTriangle(inSubShapeIDCreator2, visitor);
1166
- }
1167
-
1168
- void MeshShape::sCollideSphereVsMesh(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, [[maybe_unused]] const ShapeFilter &inShapeFilter)
1169
- {
1170
- JPH_PROFILE_FUNCTION();
1171
-
1172
- // Get the shapes
1173
- JPH_ASSERT(inShape1->GetSubType() == EShapeSubType::Sphere);
1174
- JPH_ASSERT(inShape2->GetType() == EShapeType::Mesh);
1175
- const SphereShape *shape1 = static_cast<const SphereShape *>(inShape1);
1176
- const MeshShape *shape2 = static_cast<const MeshShape *>(inShape2);
1177
-
1178
- struct Visitor : public CollideSphereVsTriangles
1179
- {
1180
- using CollideSphereVsTriangles::CollideSphereVsTriangles;
1181
-
1182
- JPH_INLINE bool ShouldAbort() const
1183
- {
1184
- return mCollector.ShouldEarlyOut();
1185
- }
1186
-
1187
- JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
1188
- {
1189
- return true;
1190
- }
1191
-
1192
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, [[maybe_unused]] int inStackTop) const
1193
- {
1194
- // Scale the bounding boxes of this node
1195
- Vec4 bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z;
1196
- AABox4Scale(mScale2, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
1197
-
1198
- // Test which nodes collide
1199
- UVec4 collides = AABox4VsSphere(mSphereCenterIn2, mRadiusPlusMaxSeparationSq, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
1200
- return CountAndSortTrues(collides, ioProperties);
1201
- }
1202
-
1203
- JPH_INLINE void VisitTriangle(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, SubShapeID inSubShapeID2)
1204
- {
1205
- Collide(inV0, inV1, inV2, inActiveEdges, inSubShapeID2);
1206
- }
1207
- };
1208
-
1209
- Visitor visitor(shape1, inScale1, inScale2, inCenterOfMassTransform1, inCenterOfMassTransform2, inSubShapeIDCreator1.GetID(), inCollideShapeSettings, ioCollector);
1210
- shape2->WalkTreePerTriangle(inSubShapeIDCreator2, visitor);
1211
- }
1212
-
1213
- void MeshShape::SaveBinaryState(StreamOut &inStream) const
1214
- {
1215
- Shape::SaveBinaryState(inStream);
1216
-
1217
- inStream.Write(static_cast<const ByteBufferVector &>(mTree)); // Make sure we use the Array<> overload
1218
- }
1219
-
1220
- void MeshShape::RestoreBinaryState(StreamIn &inStream)
1221
- {
1222
- Shape::RestoreBinaryState(inStream);
1223
-
1224
- inStream.Read(static_cast<ByteBufferVector &>(mTree)); // Make sure we use the Array<> overload
1225
- }
1226
-
1227
- void MeshShape::SaveMaterialState(PhysicsMaterialList &outMaterials) const
1228
- {
1229
- outMaterials = mMaterials;
1230
- }
1231
-
1232
- void MeshShape::RestoreMaterialState(const PhysicsMaterialRefC *inMaterials, uint inNumMaterials)
1233
- {
1234
- mMaterials.assign(inMaterials, inMaterials + inNumMaterials);
1235
- }
1236
-
1237
- Shape::Stats MeshShape::GetStats() const
1238
- {
1239
- // Walk the tree to count the triangles
1240
- struct Visitor
1241
- {
1242
- JPH_INLINE bool ShouldAbort() const
1243
- {
1244
- return false;
1245
- }
1246
-
1247
- JPH_INLINE bool ShouldVisitNode([[maybe_unused]] int inStackTop) const
1248
- {
1249
- return true;
1250
- }
1251
-
1252
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioProperties, [[maybe_unused]] int inStackTop) const
1253
- {
1254
- // Visit all valid children
1255
- UVec4 valid = UVec4::sOr(UVec4::sOr(Vec4::sLess(inBoundsMinX, inBoundsMaxX), Vec4::sLess(inBoundsMinY, inBoundsMaxY)), Vec4::sLess(inBoundsMinZ, inBoundsMaxZ));
1256
- return CountAndSortTrues(valid, ioProperties);
1257
- }
1258
-
1259
- JPH_INLINE void VisitTriangles([[maybe_unused]] const TriangleCodec::DecodingContext &ioContext, [[maybe_unused]] const void *inTriangles, int inNumTriangles, [[maybe_unused]] uint32 inTriangleBlockID)
1260
- {
1261
- mNumTriangles += inNumTriangles;
1262
- }
1263
-
1264
- uint mNumTriangles = 0;
1265
- };
1266
-
1267
- Visitor visitor;
1268
- WalkTree(visitor);
1269
-
1270
- return Stats(sizeof(*this) + mMaterials.size() * sizeof(Ref<PhysicsMaterial>) + mTree.size() * sizeof(uint8), visitor.mNumTriangles);
1271
- }
1272
-
1273
- uint32 MeshShape::GetTriangleUserData(const SubShapeID &inSubShapeID) const
1274
- {
1275
- // Decode ID
1276
- const void *block_start;
1277
- uint32 triangle_idx;
1278
- DecodeSubShapeID(inSubShapeID, block_start, triangle_idx);
1279
-
1280
- // Decode triangle
1281
- const TriangleCodec::DecodingContext triangle_ctx(sGetTriangleHeader(mTree));
1282
- return triangle_ctx.GetUserData(block_start, triangle_idx);
1283
- }
1284
-
1285
- void MeshShape::sRegister()
1286
- {
1287
- ShapeFunctions &f = ShapeFunctions::sGet(EShapeSubType::Mesh);
1288
- f.mConstruct = []() -> Shape * { return new MeshShape; };
1289
- f.mColor = Color::sRed;
1290
-
1291
- for (EShapeSubType s : sConvexSubShapeTypes)
1292
- {
1293
- CollisionDispatch::sRegisterCollideShape(s, EShapeSubType::Mesh, sCollideConvexVsMesh);
1294
- CollisionDispatch::sRegisterCastShape(s, EShapeSubType::Mesh, sCastConvexVsMesh);
1295
-
1296
- CollisionDispatch::sRegisterCastShape(EShapeSubType::Mesh, s, CollisionDispatch::sReversedCastShape);
1297
- CollisionDispatch::sRegisterCollideShape(EShapeSubType::Mesh, s, CollisionDispatch::sReversedCollideShape);
1298
- }
1299
-
1300
- // Specialized collision functions
1301
- CollisionDispatch::sRegisterCollideShape(EShapeSubType::Sphere, EShapeSubType::Mesh, sCollideSphereVsMesh);
1302
- CollisionDispatch::sRegisterCastShape(EShapeSubType::Sphere, EShapeSubType::Mesh, sCastSphereVsMesh);
1303
- }
1304
-
1305
- JPH_NAMESPACE_END