@bloomengine/engine 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/package.json +4 -11
  2. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/build.gradle +0 -51
  3. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/src/main/AndroidManifest.xml +0 -20
  4. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/src/main/cpp/CMakeLists.txt +0 -20
  5. package/native/third_party/JoltPhysics/Build/Android/UnitTests/build.gradle +0 -51
  6. package/native/third_party/JoltPhysics/Build/Android/UnitTests/src/main/AndroidManifest.xml +0 -20
  7. package/native/third_party/JoltPhysics/Build/Android/UnitTests/src/main/cpp/CMakeLists.txt +0 -20
  8. package/native/third_party/JoltPhysics/Build/Android/build.gradle +0 -17
  9. package/native/third_party/JoltPhysics/Build/Android/gradle/wrapper/gradle-wrapper.jar +0 -0
  10. package/native/third_party/JoltPhysics/Build/Android/gradle/wrapper/gradle-wrapper.properties +0 -5
  11. package/native/third_party/JoltPhysics/Build/Android/gradle.properties +0 -21
  12. package/native/third_party/JoltPhysics/Build/Android/gradlew +0 -185
  13. package/native/third_party/JoltPhysics/Build/Android/gradlew.bat +0 -89
  14. package/native/third_party/JoltPhysics/Build/Android/settings.gradle +0 -10
  15. package/native/third_party/JoltPhysics/Build/CMakeLists.txt +0 -449
  16. package/native/third_party/JoltPhysics/Build/README.md +0 -250
  17. package/native/third_party/JoltPhysics/Build/cmake_linux_clang_gcc.sh +0 -28
  18. package/native/third_party/JoltPhysics/Build/cmake_linux_emscripten.sh +0 -19
  19. package/native/third_party/JoltPhysics/Build/cmake_linux_mingw.sh +0 -19
  20. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl.bat +0 -3
  21. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_32bit.bat +0 -3
  22. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_arm.bat +0 -3
  23. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_arm_32bit.bat +0 -4
  24. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_cross_platform_deterministic.bat +0 -3
  25. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_double.bat +0 -3
  26. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_no_object_stream.bat +0 -3
  27. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang.bat +0 -10
  28. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang_cross_platform_deterministic.bat +0 -10
  29. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang_double.bat +0 -10
  30. package/native/third_party/JoltPhysics/Build/cmake_vs2022_uwp.bat +0 -5
  31. package/native/third_party/JoltPhysics/Build/cmake_vs2022_uwp_arm.bat +0 -5
  32. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl.bat +0 -3
  33. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl_cross_platform_deterministic.bat +0 -3
  34. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl_double.bat +0 -3
  35. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang.bat +0 -10
  36. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang_cross_platform_deterministic.bat +0 -10
  37. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang_double.bat +0 -10
  38. package/native/third_party/JoltPhysics/Build/cmake_windows_mingw.sh +0 -19
  39. package/native/third_party/JoltPhysics/Build/cmake_xcode_ios.sh +0 -4
  40. package/native/third_party/JoltPhysics/Build/cmake_xcode_macos.sh +0 -4
  41. package/native/third_party/JoltPhysics/Build/iOS/JoltViewerInfo.plist +0 -34
  42. package/native/third_party/JoltPhysics/Build/iOS/SamplesInfo.plist +0 -34
  43. package/native/third_party/JoltPhysics/Build/iOS/UnitTestsInfo.plist +0 -34
  44. package/native/third_party/JoltPhysics/Build/macOS/icon.icns +0 -0
  45. package/native/third_party/JoltPhysics/Build/macos_install_vulkan_sdk.sh +0 -13
  46. package/native/third_party/JoltPhysics/Build/ubuntu24_install_vulkan_sdk.sh +0 -4
  47. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeBuilder.cpp +0 -242
  48. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeBuilder.h +0 -121
  49. package/native/third_party/JoltPhysics/Jolt/AABBTree/AABBTreeToBuffer.h +0 -296
  50. package/native/third_party/JoltPhysics/Jolt/AABBTree/NodeCodec/NodeCodecQuadTreeHalfFloat.h +0 -323
  51. package/native/third_party/JoltPhysics/Jolt/AABBTree/TriangleCodec/TriangleCodecIndexed8BitPackSOA4Flags.h +0 -555
  52. package/native/third_party/JoltPhysics/Jolt/ConfigurationString.h +0 -112
  53. package/native/third_party/JoltPhysics/Jolt/Core/ARMNeon.h +0 -94
  54. package/native/third_party/JoltPhysics/Jolt/Core/Array.h +0 -713
  55. package/native/third_party/JoltPhysics/Jolt/Core/Atomics.h +0 -44
  56. package/native/third_party/JoltPhysics/Jolt/Core/BinaryHeap.h +0 -96
  57. package/native/third_party/JoltPhysics/Jolt/Core/ByteBuffer.h +0 -74
  58. package/native/third_party/JoltPhysics/Jolt/Core/Color.cpp +0 -38
  59. package/native/third_party/JoltPhysics/Jolt/Core/Color.h +0 -98
  60. package/native/third_party/JoltPhysics/Jolt/Core/Core.h +0 -652
  61. package/native/third_party/JoltPhysics/Jolt/Core/FPControlWord.h +0 -143
  62. package/native/third_party/JoltPhysics/Jolt/Core/FPException.h +0 -96
  63. package/native/third_party/JoltPhysics/Jolt/Core/FPFlushDenormals.h +0 -43
  64. package/native/third_party/JoltPhysics/Jolt/Core/Factory.cpp +0 -92
  65. package/native/third_party/JoltPhysics/Jolt/Core/Factory.h +0 -54
  66. package/native/third_party/JoltPhysics/Jolt/Core/FixedSizeFreeList.h +0 -122
  67. package/native/third_party/JoltPhysics/Jolt/Core/FixedSizeFreeList.inl +0 -215
  68. package/native/third_party/JoltPhysics/Jolt/Core/HashCombine.h +0 -234
  69. package/native/third_party/JoltPhysics/Jolt/Core/HashTable.h +0 -876
  70. package/native/third_party/JoltPhysics/Jolt/Core/InsertionSort.h +0 -58
  71. package/native/third_party/JoltPhysics/Jolt/Core/IssueReporting.cpp +0 -27
  72. package/native/third_party/JoltPhysics/Jolt/Core/IssueReporting.h +0 -38
  73. package/native/third_party/JoltPhysics/Jolt/Core/JobSystem.h +0 -311
  74. package/native/third_party/JoltPhysics/Jolt/Core/JobSystem.inl +0 -56
  75. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemSingleThreaded.cpp +0 -65
  76. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemSingleThreaded.h +0 -62
  77. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemThreadPool.cpp +0 -364
  78. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemThreadPool.h +0 -101
  79. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemWithBarrier.cpp +0 -230
  80. package/native/third_party/JoltPhysics/Jolt/Core/JobSystemWithBarrier.h +0 -85
  81. package/native/third_party/JoltPhysics/Jolt/Core/LinearCurve.cpp +0 -51
  82. package/native/third_party/JoltPhysics/Jolt/Core/LinearCurve.h +0 -67
  83. package/native/third_party/JoltPhysics/Jolt/Core/LockFreeHashMap.h +0 -182
  84. package/native/third_party/JoltPhysics/Jolt/Core/LockFreeHashMap.inl +0 -351
  85. package/native/third_party/JoltPhysics/Jolt/Core/Memory.cpp +0 -85
  86. package/native/third_party/JoltPhysics/Jolt/Core/Memory.h +0 -85
  87. package/native/third_party/JoltPhysics/Jolt/Core/Mutex.h +0 -223
  88. package/native/third_party/JoltPhysics/Jolt/Core/MutexArray.h +0 -98
  89. package/native/third_party/JoltPhysics/Jolt/Core/NonCopyable.h +0 -18
  90. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.cpp +0 -677
  91. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.h +0 -301
  92. package/native/third_party/JoltPhysics/Jolt/Core/Profiler.inl +0 -90
  93. package/native/third_party/JoltPhysics/Jolt/Core/QuickSort.h +0 -137
  94. package/native/third_party/JoltPhysics/Jolt/Core/RTTI.cpp +0 -149
  95. package/native/third_party/JoltPhysics/Jolt/Core/RTTI.h +0 -436
  96. package/native/third_party/JoltPhysics/Jolt/Core/Reference.h +0 -244
  97. package/native/third_party/JoltPhysics/Jolt/Core/Result.h +0 -174
  98. package/native/third_party/JoltPhysics/Jolt/Core/STLAlignedAllocator.h +0 -72
  99. package/native/third_party/JoltPhysics/Jolt/Core/STLAllocator.h +0 -127
  100. package/native/third_party/JoltPhysics/Jolt/Core/STLLocalAllocator.h +0 -170
  101. package/native/third_party/JoltPhysics/Jolt/Core/STLTempAllocator.h +0 -80
  102. package/native/third_party/JoltPhysics/Jolt/Core/ScopeExit.h +0 -49
  103. package/native/third_party/JoltPhysics/Jolt/Core/Semaphore.cpp +0 -135
  104. package/native/third_party/JoltPhysics/Jolt/Core/Semaphore.h +0 -68
  105. package/native/third_party/JoltPhysics/Jolt/Core/StaticArray.h +0 -329
  106. package/native/third_party/JoltPhysics/Jolt/Core/StreamIn.h +0 -120
  107. package/native/third_party/JoltPhysics/Jolt/Core/StreamOut.h +0 -97
  108. package/native/third_party/JoltPhysics/Jolt/Core/StreamUtils.h +0 -168
  109. package/native/third_party/JoltPhysics/Jolt/Core/StreamWrapper.h +0 -53
  110. package/native/third_party/JoltPhysics/Jolt/Core/StridedPtr.h +0 -63
  111. package/native/third_party/JoltPhysics/Jolt/Core/StringTools.cpp +0 -101
  112. package/native/third_party/JoltPhysics/Jolt/Core/StringTools.h +0 -38
  113. package/native/third_party/JoltPhysics/Jolt/Core/TempAllocator.h +0 -209
  114. package/native/third_party/JoltPhysics/Jolt/Core/TickCounter.cpp +0 -37
  115. package/native/third_party/JoltPhysics/Jolt/Core/TickCounter.h +0 -58
  116. package/native/third_party/JoltPhysics/Jolt/Core/UnorderedMap.h +0 -80
  117. package/native/third_party/JoltPhysics/Jolt/Core/UnorderedSet.h +0 -32
  118. package/native/third_party/JoltPhysics/Jolt/Geometry/AABox.h +0 -313
  119. package/native/third_party/JoltPhysics/Jolt/Geometry/AABox4.h +0 -224
  120. package/native/third_party/JoltPhysics/Jolt/Geometry/ClipPoly.h +0 -200
  121. package/native/third_party/JoltPhysics/Jolt/Geometry/ClosestPoint.h +0 -498
  122. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder.cpp +0 -1467
  123. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder.h +0 -276
  124. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder2D.cpp +0 -335
  125. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexHullBuilder2D.h +0 -105
  126. package/native/third_party/JoltPhysics/Jolt/Geometry/ConvexSupport.h +0 -188
  127. package/native/third_party/JoltPhysics/Jolt/Geometry/EPAConvexHullBuilder.h +0 -845
  128. package/native/third_party/JoltPhysics/Jolt/Geometry/EPAPenetrationDepth.h +0 -557
  129. package/native/third_party/JoltPhysics/Jolt/Geometry/Ellipse.h +0 -77
  130. package/native/third_party/JoltPhysics/Jolt/Geometry/GJKClosestPoint.h +0 -945
  131. package/native/third_party/JoltPhysics/Jolt/Geometry/IndexedTriangle.h +0 -130
  132. package/native/third_party/JoltPhysics/Jolt/Geometry/Indexify.cpp +0 -222
  133. package/native/third_party/JoltPhysics/Jolt/Geometry/Indexify.h +0 -19
  134. package/native/third_party/JoltPhysics/Jolt/Geometry/MortonCode.h +0 -40
  135. package/native/third_party/JoltPhysics/Jolt/Geometry/OrientedBox.cpp +0 -178
  136. package/native/third_party/JoltPhysics/Jolt/Geometry/OrientedBox.h +0 -39
  137. package/native/third_party/JoltPhysics/Jolt/Geometry/Plane.h +0 -104
  138. package/native/third_party/JoltPhysics/Jolt/Geometry/RayAABox.h +0 -241
  139. package/native/third_party/JoltPhysics/Jolt/Geometry/RayCapsule.h +0 -37
  140. package/native/third_party/JoltPhysics/Jolt/Geometry/RayCylinder.h +0 -101
  141. package/native/third_party/JoltPhysics/Jolt/Geometry/RaySphere.h +0 -96
  142. package/native/third_party/JoltPhysics/Jolt/Geometry/RayTriangle.h +0 -158
  143. package/native/third_party/JoltPhysics/Jolt/Geometry/Sphere.h +0 -72
  144. package/native/third_party/JoltPhysics/Jolt/Geometry/Triangle.h +0 -34
  145. package/native/third_party/JoltPhysics/Jolt/Jolt.cmake +0 -703
  146. package/native/third_party/JoltPhysics/Jolt/Jolt.h +0 -16
  147. package/native/third_party/JoltPhysics/Jolt/Jolt.natvis +0 -116
  148. package/native/third_party/JoltPhysics/Jolt/Math/BVec16.h +0 -99
  149. package/native/third_party/JoltPhysics/Jolt/Math/BVec16.inl +0 -177
  150. package/native/third_party/JoltPhysics/Jolt/Math/DMat44.h +0 -158
  151. package/native/third_party/JoltPhysics/Jolt/Math/DMat44.inl +0 -310
  152. package/native/third_party/JoltPhysics/Jolt/Math/DVec3.h +0 -291
  153. package/native/third_party/JoltPhysics/Jolt/Math/DVec3.inl +0 -941
  154. package/native/third_party/JoltPhysics/Jolt/Math/Double3.h +0 -48
  155. package/native/third_party/JoltPhysics/Jolt/Math/DynMatrix.h +0 -31
  156. package/native/third_party/JoltPhysics/Jolt/Math/EigenValueSymmetric.h +0 -177
  157. package/native/third_party/JoltPhysics/Jolt/Math/FindRoot.h +0 -42
  158. package/native/third_party/JoltPhysics/Jolt/Math/Float2.h +0 -36
  159. package/native/third_party/JoltPhysics/Jolt/Math/Float3.h +0 -50
  160. package/native/third_party/JoltPhysics/Jolt/Math/Float4.h +0 -44
  161. package/native/third_party/JoltPhysics/Jolt/Math/GaussianElimination.h +0 -102
  162. package/native/third_party/JoltPhysics/Jolt/Math/HalfFloat.h +0 -208
  163. package/native/third_party/JoltPhysics/Jolt/Math/Mat44.h +0 -243
  164. package/native/third_party/JoltPhysics/Jolt/Math/Mat44.inl +0 -952
  165. package/native/third_party/JoltPhysics/Jolt/Math/Math.h +0 -208
  166. package/native/third_party/JoltPhysics/Jolt/Math/MathTypes.h +0 -32
  167. package/native/third_party/JoltPhysics/Jolt/Math/Matrix.h +0 -259
  168. package/native/third_party/JoltPhysics/Jolt/Math/Quat.h +0 -268
  169. package/native/third_party/JoltPhysics/Jolt/Math/Quat.inl +0 -406
  170. package/native/third_party/JoltPhysics/Jolt/Math/Real.h +0 -44
  171. package/native/third_party/JoltPhysics/Jolt/Math/Swizzle.h +0 -19
  172. package/native/third_party/JoltPhysics/Jolt/Math/Trigonometry.h +0 -79
  173. package/native/third_party/JoltPhysics/Jolt/Math/UVec4.h +0 -232
  174. package/native/third_party/JoltPhysics/Jolt/Math/UVec4.inl +0 -636
  175. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.cpp +0 -71
  176. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.h +0 -308
  177. package/native/third_party/JoltPhysics/Jolt/Math/Vec3.inl +0 -942
  178. package/native/third_party/JoltPhysics/Jolt/Math/Vec4.h +0 -320
  179. package/native/third_party/JoltPhysics/Jolt/Math/Vec4.inl +0 -1152
  180. package/native/third_party/JoltPhysics/Jolt/Math/Vector.h +0 -211
  181. package/native/third_party/JoltPhysics/Jolt/ObjectStream/GetPrimitiveTypeOfType.h +0 -54
  182. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStream.cpp +0 -38
  183. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStream.h +0 -337
  184. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryIn.cpp +0 -252
  185. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryIn.h +0 -57
  186. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryOut.cpp +0 -165
  187. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamBinaryOut.h +0 -57
  188. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamIn.cpp +0 -635
  189. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamIn.h +0 -148
  190. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamOut.cpp +0 -166
  191. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamOut.h +0 -101
  192. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextIn.cpp +0 -418
  193. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextIn.h +0 -55
  194. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextOut.cpp +0 -255
  195. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTextOut.h +0 -62
  196. package/native/third_party/JoltPhysics/Jolt/ObjectStream/ObjectStreamTypes.h +0 -26
  197. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttribute.h +0 -111
  198. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttributeEnum.h +0 -67
  199. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableAttributeTyped.h +0 -60
  200. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableObject.cpp +0 -15
  201. package/native/third_party/JoltPhysics/Jolt/ObjectStream/SerializableObject.h +0 -170
  202. package/native/third_party/JoltPhysics/Jolt/ObjectStream/TypeDeclarations.cpp +0 -70
  203. package/native/third_party/JoltPhysics/Jolt/ObjectStream/TypeDeclarations.h +0 -45
  204. package/native/third_party/JoltPhysics/Jolt/Physics/Body/AllowedDOFs.h +0 -68
  205. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.cpp +0 -426
  206. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.h +0 -452
  207. package/native/third_party/JoltPhysics/Jolt/Physics/Body/Body.inl +0 -197
  208. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyAccess.h +0 -68
  209. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyActivationListener.h +0 -28
  210. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyCreationSettings.cpp +0 -234
  211. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyCreationSettings.h +0 -124
  212. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyFilter.h +0 -130
  213. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyID.h +0 -101
  214. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyInterface.cpp +0 -1099
  215. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyInterface.h +0 -324
  216. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLock.h +0 -111
  217. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLockInterface.h +0 -134
  218. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyLockMulti.h +0 -120
  219. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyManager.cpp +0 -1220
  220. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyManager.h +0 -403
  221. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyPair.h +0 -36
  222. package/native/third_party/JoltPhysics/Jolt/Physics/Body/BodyType.h +0 -19
  223. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MassProperties.cpp +0 -185
  224. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MassProperties.h +0 -58
  225. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.cpp +0 -92
  226. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.h +0 -308
  227. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionProperties.inl +0 -178
  228. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionQuality.h +0 -31
  229. package/native/third_party/JoltPhysics/Jolt/Physics/Body/MotionType.h +0 -17
  230. package/native/third_party/JoltPhysics/Jolt/Physics/Character/Character.cpp +0 -354
  231. package/native/third_party/JoltPhysics/Jolt/Physics/Character/Character.h +0 -159
  232. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterBase.cpp +0 -59
  233. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterBase.h +0 -157
  234. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterID.h +0 -98
  235. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterVirtual.cpp +0 -1933
  236. package/native/third_party/JoltPhysics/Jolt/Physics/Character/CharacterVirtual.h +0 -752
  237. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/AABoxCast.h +0 -20
  238. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ActiveEdgeMode.h +0 -17
  239. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ActiveEdges.h +0 -114
  240. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BackFaceMode.h +0 -16
  241. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhase.cpp +0 -16
  242. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhase.h +0 -109
  243. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp +0 -313
  244. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.h +0 -38
  245. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h +0 -148
  246. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayerInterfaceMask.h +0 -92
  247. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseLayerInterfaceTable.h +0 -64
  248. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.cpp +0 -629
  249. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h +0 -108
  250. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h +0 -56
  251. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/ObjectVsBroadPhaseLayerFilterMask.h +0 -35
  252. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/ObjectVsBroadPhaseLayerFilterTable.h +0 -66
  253. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/QuadTree.cpp +0 -1768
  254. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/BroadPhase/QuadTree.h +0 -389
  255. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp +0 -107
  256. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastConvexVsTriangles.h +0 -46
  257. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastResult.h +0 -37
  258. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastSphereVsTriangles.cpp +0 -223
  259. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CastSphereVsTriangles.h +0 -49
  260. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollectFacesMode.h +0 -16
  261. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp +0 -155
  262. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideConvexVsTriangles.h +0 -56
  263. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollidePointResult.h +0 -25
  264. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideShape.h +0 -106
  265. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideShapeVsShapePerLeaf.h +0 -94
  266. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSoftBodyVertexIterator.h +0 -110
  267. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSoftBodyVerticesVsTriangles.h +0 -102
  268. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp +0 -121
  269. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollideSphereVsTriangles.h +0 -50
  270. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionCollector.h +0 -109
  271. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionCollectorImpl.h +0 -219
  272. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionDispatch.cpp +0 -107
  273. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionDispatch.h +0 -97
  274. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionGroup.cpp +0 -35
  275. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/CollisionGroup.h +0 -97
  276. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ContactListener.h +0 -143
  277. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/EstimateCollisionResponse.cpp +0 -213
  278. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/EstimateCollisionResponse.h +0 -48
  279. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilter.cpp +0 -32
  280. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilter.h +0 -46
  281. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilterTable.cpp +0 -38
  282. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/GroupFilterTable.h +0 -130
  283. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/InternalEdgeRemovingCollector.h +0 -279
  284. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.cpp +0 -271
  285. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h +0 -44
  286. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseQuery.cpp +0 -448
  287. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseQuery.h +0 -77
  288. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseStats.cpp +0 -62
  289. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/NarrowPhaseStats.h +0 -110
  290. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayer.h +0 -111
  291. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayerPairFilterMask.h +0 -52
  292. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ObjectLayerPairFilterTable.h +0 -78
  293. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterial.cpp +0 -35
  294. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterial.h +0 -57
  295. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterialSimple.cpp +0 -38
  296. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/PhysicsMaterialSimple.h +0 -37
  297. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/RayCast.h +0 -87
  298. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/BoxShape.cpp +0 -318
  299. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/BoxShape.h +0 -115
  300. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CapsuleShape.cpp +0 -438
  301. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CapsuleShape.h +0 -129
  302. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShape.cpp +0 -433
  303. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShape.h +0 -354
  304. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CompoundShapeVisitors.h +0 -461
  305. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexHullShape.cpp +0 -1311
  306. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexHullShape.h +0 -202
  307. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexShape.cpp +0 -566
  308. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ConvexShape.h +0 -150
  309. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CylinderShape.cpp +0 -418
  310. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/CylinderShape.h +0 -126
  311. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/DecoratedShape.cpp +0 -87
  312. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/DecoratedShape.h +0 -80
  313. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/EmptyShape.cpp +0 -64
  314. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/EmptyShape.h +0 -75
  315. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/GetTrianglesContext.h +0 -248
  316. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/HeightFieldShape.cpp +0 -2754
  317. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/HeightFieldShape.h +0 -380
  318. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MeshShape.cpp +0 -1305
  319. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MeshShape.h +0 -228
  320. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MutableCompoundShape.cpp +0 -596
  321. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/MutableCompoundShape.h +0 -176
  322. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.cpp +0 -217
  323. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h +0 -140
  324. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PlaneShape.cpp +0 -541
  325. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PlaneShape.h +0 -147
  326. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/PolyhedronSubmergedVolumeCalculator.h +0 -319
  327. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.cpp +0 -333
  328. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h +0 -161
  329. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaleHelpers.h +0 -83
  330. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaledShape.cpp +0 -238
  331. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/ScaledShape.h +0 -145
  332. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/Shape.cpp +0 -325
  333. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/Shape.h +0 -466
  334. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SphereShape.cpp +0 -347
  335. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SphereShape.h +0 -125
  336. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/StaticCompoundShape.cpp +0 -674
  337. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/StaticCompoundShape.h +0 -139
  338. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SubShapeID.h +0 -138
  339. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/SubShapeIDPair.h +0 -65
  340. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.cpp +0 -453
  341. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.gliffy +0 -1
  342. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCapsuleShape.h +0 -135
  343. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCylinderShape.cpp +0 -691
  344. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TaperedCylinderShape.h +0 -132
  345. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TriangleShape.cpp +0 -430
  346. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/Shape/TriangleShape.h +0 -143
  347. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ShapeCast.h +0 -173
  348. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/ShapeFilter.h +0 -73
  349. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SimShapeFilter.h +0 -40
  350. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SimShapeFilterWrapper.h +0 -58
  351. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/SortReverseAndStore.h +0 -48
  352. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/TransformedShape.cpp +0 -180
  353. package/native/third_party/JoltPhysics/Jolt/Physics/Collision/TransformedShape.h +0 -194
  354. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/CalculateSolverSteps.h +0 -70
  355. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConeConstraint.cpp +0 -246
  356. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConeConstraint.h +0 -133
  357. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/Constraint.cpp +0 -73
  358. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/Constraint.h +0 -243
  359. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintManager.cpp +0 -289
  360. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintManager.h +0 -100
  361. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/AngleConstraintPart.h +0 -257
  362. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/AxisConstraintPart.h +0 -682
  363. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/DualAxisConstraintPart.h +0 -276
  364. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/GearConstraintPart.h +0 -195
  365. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/HingeRotationConstraintPart.h +0 -222
  366. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/IndependentAxisConstraintPart.h +0 -246
  367. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h +0 -239
  368. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RackAndPinionConstraintPart.h +0 -196
  369. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h +0 -283
  370. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/RotationQuatConstraintPart.h +0 -246
  371. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/SpringPart.h +0 -169
  372. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h +0 -597
  373. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ContactConstraintManager.cpp +0 -1804
  374. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/ContactConstraintManager.h +0 -524
  375. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/DistanceConstraint.cpp +0 -266
  376. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/DistanceConstraint.h +0 -120
  377. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/FixedConstraint.cpp +0 -215
  378. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/FixedConstraint.h +0 -96
  379. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/GearConstraint.cpp +0 -188
  380. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/GearConstraint.h +0 -116
  381. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/HingeConstraint.cpp +0 -443
  382. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/HingeConstraint.h +0 -205
  383. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/MotorSettings.cpp +0 -43
  384. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/MotorSettings.h +0 -66
  385. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraint.cpp +0 -458
  386. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraint.h +0 -191
  387. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPath.cpp +0 -85
  388. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPath.h +0 -76
  389. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPathHermite.cpp +0 -308
  390. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PathConstraintPathHermite.h +0 -54
  391. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PointConstraint.cpp +0 -157
  392. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PointConstraint.h +0 -94
  393. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PulleyConstraint.cpp +0 -253
  394. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/PulleyConstraint.h +0 -137
  395. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/RackAndPinionConstraint.cpp +0 -189
  396. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/RackAndPinionConstraint.h +0 -118
  397. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SixDOFConstraint.cpp +0 -900
  398. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SixDOFConstraint.h +0 -289
  399. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SliderConstraint.cpp +0 -501
  400. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SliderConstraint.h +0 -198
  401. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SpringSettings.cpp +0 -35
  402. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SpringSettings.h +0 -70
  403. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SwingTwistConstraint.cpp +0 -524
  404. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/SwingTwistConstraint.h +0 -197
  405. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/TwoBodyConstraint.cpp +0 -56
  406. package/native/third_party/JoltPhysics/Jolt/Physics/Constraints/TwoBodyConstraint.h +0 -65
  407. package/native/third_party/JoltPhysics/Jolt/Physics/DeterminismLog.cpp +0 -17
  408. package/native/third_party/JoltPhysics/Jolt/Physics/DeterminismLog.h +0 -159
  409. package/native/third_party/JoltPhysics/Jolt/Physics/EActivation.h +0 -16
  410. package/native/third_party/JoltPhysics/Jolt/Physics/EPhysicsUpdateError.h +0 -37
  411. package/native/third_party/JoltPhysics/Jolt/Physics/IslandBuilder.cpp +0 -492
  412. package/native/third_party/JoltPhysics/Jolt/Physics/IslandBuilder.h +0 -144
  413. package/native/third_party/JoltPhysics/Jolt/Physics/LargeIslandSplitter.cpp +0 -582
  414. package/native/third_party/JoltPhysics/Jolt/Physics/LargeIslandSplitter.h +0 -187
  415. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsLock.h +0 -169
  416. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsScene.cpp +0 -261
  417. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsScene.h +0 -104
  418. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSettings.h +0 -125
  419. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsStepListener.h +0 -37
  420. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSystem.cpp +0 -2915
  421. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsSystem.h +0 -391
  422. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsUpdateContext.cpp +0 -25
  423. package/native/third_party/JoltPhysics/Jolt/Physics/PhysicsUpdateContext.h +0 -176
  424. package/native/third_party/JoltPhysics/Jolt/Physics/Ragdoll/Ragdoll.cpp +0 -744
  425. package/native/third_party/JoltPhysics/Jolt/Physics/Ragdoll/Ragdoll.h +0 -245
  426. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyContactListener.h +0 -55
  427. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyCreationSettings.cpp +0 -128
  428. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyCreationSettings.h +0 -75
  429. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyManifold.h +0 -74
  430. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyMotionProperties.cpp +0 -1501
  431. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyMotionProperties.h +0 -333
  432. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyShape.cpp +0 -354
  433. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyShape.h +0 -73
  434. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodySharedSettings.cpp +0 -1487
  435. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodySharedSettings.h +0 -390
  436. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyUpdateContext.h +0 -63
  437. package/native/third_party/JoltPhysics/Jolt/Physics/SoftBody/SoftBodyVertex.h +0 -36
  438. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorder.h +0 -136
  439. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorderImpl.cpp +0 -90
  440. package/native/third_party/JoltPhysics/Jolt/Physics/StateRecorderImpl.h +0 -50
  441. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/MotorcycleController.cpp +0 -306
  442. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/MotorcycleController.h +0 -119
  443. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/TrackedVehicleController.cpp +0 -547
  444. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/TrackedVehicleController.h +0 -169
  445. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleAntiRollBar.cpp +0 -33
  446. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleAntiRollBar.h +0 -33
  447. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleCollisionTester.cpp +0 -376
  448. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleCollisionTester.h +0 -146
  449. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleConstraint.cpp +0 -703
  450. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleConstraint.h +0 -252
  451. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleController.cpp +0 -17
  452. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleController.h +0 -87
  453. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleDifferential.cpp +0 -81
  454. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleDifferential.h +0 -39
  455. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleEngine.cpp +0 -122
  456. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleEngine.h +0 -93
  457. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTrack.cpp +0 -52
  458. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTrack.h +0 -56
  459. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTransmission.cpp +0 -159
  460. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/VehicleTransmission.h +0 -87
  461. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/Wheel.cpp +0 -93
  462. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/Wheel.h +0 -148
  463. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/WheeledVehicleController.cpp +0 -866
  464. package/native/third_party/JoltPhysics/Jolt/Physics/Vehicle/WheeledVehicleController.h +0 -205
  465. package/native/third_party/JoltPhysics/Jolt/RegisterTypes.cpp +0 -204
  466. package/native/third_party/JoltPhysics/Jolt/RegisterTypes.h +0 -29
  467. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRenderer.cpp +0 -1107
  468. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRenderer.h +0 -383
  469. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererPlayback.cpp +0 -168
  470. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererPlayback.h +0 -48
  471. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererRecorder.cpp +0 -158
  472. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererRecorder.h +0 -130
  473. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererSimple.cpp +0 -80
  474. package/native/third_party/JoltPhysics/Jolt/Renderer/DebugRendererSimple.h +0 -88
  475. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletalAnimation.cpp +0 -165
  476. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletalAnimation.h +0 -91
  477. package/native/third_party/JoltPhysics/Jolt/Skeleton/Skeleton.cpp +0 -82
  478. package/native/third_party/JoltPhysics/Jolt/Skeleton/Skeleton.h +0 -72
  479. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonMapper.cpp +0 -237
  480. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonMapper.h +0 -145
  481. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonPose.cpp +0 -87
  482. package/native/third_party/JoltPhysics/Jolt/Skeleton/SkeletonPose.h +0 -82
  483. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitter.cpp +0 -73
  484. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitter.h +0 -84
  485. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterBinning.cpp +0 -139
  486. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterBinning.h +0 -52
  487. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterMean.cpp +0 -43
  488. package/native/third_party/JoltPhysics/Jolt/TriangleSplitter/TriangleSplitterMean.h +0 -28
  489. package/native/third_party/JoltPhysics/LICENSE +0 -7
  490. package/native/third_party/JoltPhysics/README.md +0 -173
  491. package/native/third_party/bloom_jolt/CMakeLists.txt +0 -87
  492. package/native/third_party/bloom_jolt/include/bloom_jolt.h +0 -519
  493. package/native/third_party/bloom_jolt/src/bloom_jolt.cpp +0 -1780
@@ -1,1768 +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/BroadPhase/QuadTree.h>
8
- #include <Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h>
9
- #include <Jolt/Physics/Collision/RayCast.h>
10
- #include <Jolt/Physics/Collision/AABoxCast.h>
11
- #include <Jolt/Physics/Collision/CastResult.h>
12
- #include <Jolt/Physics/Collision/SortReverseAndStore.h>
13
- #include <Jolt/Physics/Body/BodyPair.h>
14
- #include <Jolt/Physics/PhysicsLock.h>
15
- #include <Jolt/Geometry/AABox4.h>
16
- #include <Jolt/Geometry/RayAABox.h>
17
- #include <Jolt/Geometry/OrientedBox.h>
18
- #include <Jolt/Core/STLLocalAllocator.h>
19
-
20
- #ifdef JPH_DUMP_BROADPHASE_TREE
21
- JPH_SUPPRESS_WARNINGS_STD_BEGIN
22
- #include <fstream>
23
- JPH_SUPPRESS_WARNINGS_STD_END
24
- #endif // JPH_DUMP_BROADPHASE_TREE
25
-
26
- JPH_NAMESPACE_BEGIN
27
-
28
- ////////////////////////////////////////////////////////////////////////////////////////////////////////
29
- // QuadTree::Node
30
- ////////////////////////////////////////////////////////////////////////////////////////////////////////
31
-
32
- QuadTree::Node::Node(bool inIsChanged) :
33
- mIsChanged(inIsChanged)
34
- {
35
- // First reset bounds
36
- Vec4 val = Vec4::sReplicate(cLargeFloat);
37
- val.StoreFloat4((Float4 *)&mBoundsMinX);
38
- val.StoreFloat4((Float4 *)&mBoundsMinY);
39
- val.StoreFloat4((Float4 *)&mBoundsMinZ);
40
- val = Vec4::sReplicate(-cLargeFloat);
41
- val.StoreFloat4((Float4 *)&mBoundsMaxX);
42
- val.StoreFloat4((Float4 *)&mBoundsMaxY);
43
- val.StoreFloat4((Float4 *)&mBoundsMaxZ);
44
-
45
- // Reset child node ids
46
- mChildNodeID[0] = NodeID::sInvalid();
47
- mChildNodeID[1] = NodeID::sInvalid();
48
- mChildNodeID[2] = NodeID::sInvalid();
49
- mChildNodeID[3] = NodeID::sInvalid();
50
- }
51
-
52
- void QuadTree::Node::GetChildBounds(int inChildIndex, AABox &outBounds) const
53
- {
54
- // Read bounding box in order min -> max
55
- outBounds.mMin = Vec3(mBoundsMinX[inChildIndex], mBoundsMinY[inChildIndex], mBoundsMinZ[inChildIndex]);
56
- outBounds.mMax = Vec3(mBoundsMaxX[inChildIndex], mBoundsMaxY[inChildIndex], mBoundsMaxZ[inChildIndex]);
57
- }
58
-
59
- void QuadTree::Node::SetChildBounds(int inChildIndex, const AABox &inBounds)
60
- {
61
- // Bounding boxes provided to the quad tree should never be larger than cLargeFloat because this may trigger overflow exceptions
62
- // e.g. when squaring the value while testing sphere overlaps
63
- JPH_ASSERT(inBounds.mMin.GetX() >= -cLargeFloat && inBounds.mMin.GetX() <= cLargeFloat
64
- && inBounds.mMin.GetY() >= -cLargeFloat && inBounds.mMin.GetY() <= cLargeFloat
65
- && inBounds.mMin.GetZ() >= -cLargeFloat && inBounds.mMin.GetZ() <= cLargeFloat
66
- && inBounds.mMax.GetX() >= -cLargeFloat && inBounds.mMax.GetX() <= cLargeFloat
67
- && inBounds.mMax.GetY() >= -cLargeFloat && inBounds.mMax.GetY() <= cLargeFloat
68
- && inBounds.mMax.GetZ() >= -cLargeFloat && inBounds.mMax.GetZ() <= cLargeFloat);
69
-
70
- // Set max first (this keeps the bounding box invalid for reading threads)
71
- mBoundsMaxZ[inChildIndex] = inBounds.mMax.GetZ();
72
- mBoundsMaxY[inChildIndex] = inBounds.mMax.GetY();
73
- mBoundsMaxX[inChildIndex] = inBounds.mMax.GetX();
74
-
75
- // Then set min (and make box valid)
76
- mBoundsMinZ[inChildIndex] = inBounds.mMin.GetZ();
77
- mBoundsMinY[inChildIndex] = inBounds.mMin.GetY();
78
- mBoundsMinX[inChildIndex] = inBounds.mMin.GetX(); // Min X becomes valid last
79
- }
80
-
81
- void QuadTree::Node::InvalidateChildBounds(int inChildIndex)
82
- {
83
- // First we make the box invalid by setting the min to cLargeFloat
84
- mBoundsMinX[inChildIndex] = cLargeFloat; // Min X becomes invalid first
85
- mBoundsMinY[inChildIndex] = cLargeFloat;
86
- mBoundsMinZ[inChildIndex] = cLargeFloat;
87
-
88
- // Then we reset the max values too
89
- mBoundsMaxX[inChildIndex] = -cLargeFloat;
90
- mBoundsMaxY[inChildIndex] = -cLargeFloat;
91
- mBoundsMaxZ[inChildIndex] = -cLargeFloat;
92
- }
93
-
94
- void QuadTree::Node::GetNodeBounds(AABox &outBounds) const
95
- {
96
- // Get first child bounds
97
- GetChildBounds(0, outBounds);
98
-
99
- // Encapsulate other child bounds
100
- for (int child_idx = 1; child_idx < 4; ++child_idx)
101
- {
102
- AABox tmp;
103
- GetChildBounds(child_idx, tmp);
104
- outBounds.Encapsulate(tmp);
105
- }
106
- }
107
-
108
- bool QuadTree::Node::EncapsulateChildBounds(int inChildIndex, const AABox &inBounds)
109
- {
110
- bool changed = AtomicMin(mBoundsMinX[inChildIndex], inBounds.mMin.GetX());
111
- changed |= AtomicMin(mBoundsMinY[inChildIndex], inBounds.mMin.GetY());
112
- changed |= AtomicMin(mBoundsMinZ[inChildIndex], inBounds.mMin.GetZ());
113
- changed |= AtomicMax(mBoundsMaxX[inChildIndex], inBounds.mMax.GetX());
114
- changed |= AtomicMax(mBoundsMaxY[inChildIndex], inBounds.mMax.GetY());
115
- changed |= AtomicMax(mBoundsMaxZ[inChildIndex], inBounds.mMax.GetZ());
116
- return changed;
117
- }
118
-
119
- ////////////////////////////////////////////////////////////////////////////////////////////////////////
120
- // QuadTree
121
- ////////////////////////////////////////////////////////////////////////////////////////////////////////
122
-
123
- const AABox QuadTree::cInvalidBounds(Vec3::sReplicate(cLargeFloat), Vec3::sReplicate(-cLargeFloat));
124
-
125
- static inline void sQuadTreePerformanceWarning()
126
- {
127
- #ifdef JPH_ENABLE_ASSERTS
128
- static atomic<bool> triggered_report { false };
129
- bool expected = false;
130
- if (triggered_report.compare_exchange_strong(expected, true))
131
- Trace("QuadTree: Performance warning: Stack full!\n"
132
- "This must be a very deep tree. Are you batch adding bodies through BodyInterface::AddBodiesPrepare/AddBodiesFinalize?\n"
133
- "If you add lots of bodies through BodyInterface::AddBody you may need to call PhysicsSystem::OptimizeBroadPhase to rebuild the tree.");
134
- #endif
135
- }
136
-
137
- void QuadTree::GetBodyLocation(const TrackingVector &inTracking, BodyID inBodyID, uint32 &outNodeIdx, uint32 &outChildIdx) const
138
- {
139
- uint32 body_location = inTracking[inBodyID.GetIndex()].mBodyLocation;
140
- JPH_ASSERT(body_location != Tracking::cInvalidBodyLocation);
141
- outNodeIdx = body_location & 0x3fffffff;
142
- outChildIdx = body_location >> 30;
143
- JPH_ASSERT(mAllocator->Get(outNodeIdx).mChildNodeID[outChildIdx] == inBodyID, "Make sure that the body is in the node where it should be");
144
- }
145
-
146
- void QuadTree::SetBodyLocation(TrackingVector &ioTracking, BodyID inBodyID, uint32 inNodeIdx, uint32 inChildIdx) const
147
- {
148
- JPH_ASSERT(inNodeIdx <= 0x3fffffff);
149
- JPH_ASSERT(inChildIdx < 4);
150
- JPH_ASSERT(mAllocator->Get(inNodeIdx).mChildNodeID[inChildIdx] == inBodyID, "Make sure that the body is in the node where it should be");
151
- ioTracking[inBodyID.GetIndex()].mBodyLocation = inNodeIdx + (inChildIdx << 30);
152
-
153
- #ifdef JPH_ENABLE_ASSERTS
154
- uint32 v1, v2;
155
- GetBodyLocation(ioTracking, inBodyID, v1, v2);
156
- JPH_ASSERT(v1 == inNodeIdx);
157
- JPH_ASSERT(v2 == inChildIdx);
158
- #endif
159
- }
160
-
161
- void QuadTree::sInvalidateBodyLocation(TrackingVector &ioTracking, BodyID inBodyID)
162
- {
163
- ioTracking[inBodyID.GetIndex()].mBodyLocation = Tracking::cInvalidBodyLocation;
164
- }
165
-
166
- QuadTree::~QuadTree()
167
- {
168
- // Get rid of any nodes that are still to be freed
169
- DiscardOldTree();
170
-
171
- // Get the current root node
172
- const RootNode &root_node = GetCurrentRoot();
173
-
174
- // Collect all bodies
175
- Allocator::Batch free_batch;
176
- Array<NodeID, STLLocalAllocator<NodeID, cStackSize>> node_stack;
177
- node_stack.reserve(cStackSize);
178
- node_stack.push_back(root_node.GetNodeID());
179
- JPH_ASSERT(node_stack.front().IsValid());
180
- if (node_stack.front().IsNode())
181
- {
182
- do
183
- {
184
- // Process node
185
- NodeID node_id = node_stack.back();
186
- node_stack.pop_back();
187
- JPH_ASSERT(!node_id.IsBody());
188
- uint32 node_idx = node_id.GetNodeIndex();
189
- const Node &node = mAllocator->Get(node_idx);
190
-
191
- // Recurse and get all child nodes
192
- for (NodeID child_node_id : node.mChildNodeID)
193
- if (child_node_id.IsValid() && child_node_id.IsNode())
194
- node_stack.push_back(child_node_id);
195
-
196
- // Mark node to be freed
197
- mAllocator->AddObjectToBatch(free_batch, node_idx);
198
- }
199
- while (!node_stack.empty());
200
- }
201
-
202
- // Now free all nodes
203
- mAllocator->DestructObjectBatch(free_batch);
204
- }
205
-
206
- uint32 QuadTree::AllocateNode(bool inIsChanged)
207
- {
208
- uint32 index = mAllocator->ConstructObject(inIsChanged);
209
- if (index == Allocator::cInvalidObjectIndex)
210
- {
211
- // If you're running out of nodes, you're most likely adding too many individual bodies to the tree.
212
- // Because of the lock free nature of this tree, any individual body is added to the root of the tree.
213
- // This means that if you add a lot of bodies individually, you will end up with a very deep tree and you'll be
214
- // using a lot more nodes than you would if you added them in batches.
215
- // Please look at BodyInterface::AddBodiesPrepare/AddBodiesFinalize.
216
- //
217
- // If you have created a wrapper around Jolt then a possible solution is to activate a mode during loading
218
- // that queues up any bodies that need to be added. When loading is done, insert all of them as a single batch.
219
- // This could be implemented as a 'start batching' / 'end batching' call to switch in and out of that mode.
220
- // The rest of the code can then just use the regular 'add single body' call on your wrapper and doesn't need to know
221
- // if this mode is active or not.
222
- //
223
- // Calling PhysicsSystem::Update or PhysicsSystem::OptimizeBroadPhase will perform maintenance
224
- // on the tree and will make it efficient again. If you're not calling these functions and are adding a lot of bodies
225
- // you could still be running out of nodes because the tree is not being maintained. If your application is paused,
226
- // consider still calling PhysicsSystem::Update with a delta time of 0 to keep the tree in good shape.
227
- //
228
- // The number of nodes that is allocated is related to the max number of bodies that is passed in PhysicsSystem::Init.
229
- // For normal situations there are plenty of nodes available. If all else fails, you can increase the number of nodes
230
- // by increasing the maximum number of bodies.
231
- Trace("QuadTree: Out of nodes!");
232
- std::abort();
233
- }
234
- return index;
235
- }
236
-
237
- void QuadTree::Init(Allocator &inAllocator)
238
- {
239
- // Store allocator
240
- mAllocator = &inAllocator;
241
-
242
- // Allocate root node
243
- mRootNode[mRootNodeIndex].mIndex = AllocateNode(false);
244
- }
245
-
246
- void QuadTree::DiscardOldTree()
247
- {
248
- // Check if there is an old tree
249
- RootNode &old_root_node = mRootNode[mRootNodeIndex ^ 1];
250
- if (old_root_node.mIndex != cInvalidNodeIndex)
251
- {
252
- // Clear the root
253
- old_root_node.mIndex = cInvalidNodeIndex;
254
-
255
- // Now free all old nodes
256
- mAllocator->DestructObjectBatch(mFreeNodeBatch);
257
-
258
- // Clear the batch
259
- mFreeNodeBatch = Allocator::Batch();
260
- }
261
- }
262
-
263
- AABox QuadTree::GetBounds() const
264
- {
265
- uint32 node_idx = GetCurrentRoot().mIndex;
266
- JPH_ASSERT(node_idx != cInvalidNodeIndex);
267
- const Node &node = mAllocator->Get(node_idx);
268
-
269
- AABox bounds;
270
- node.GetNodeBounds(bounds);
271
- return bounds;
272
- }
273
-
274
- void QuadTree::UpdatePrepare(const BodyVector &inBodies, TrackingVector &ioTracking, UpdateState &outUpdateState, bool inFullRebuild)
275
- {
276
- #ifdef JPH_ENABLE_ASSERTS
277
- // We only read positions
278
- BodyAccess::Grant grant(BodyAccess::EAccess::None, BodyAccess::EAccess::Read);
279
- #endif
280
-
281
- // Assert we have no nodes pending deletion, this means DiscardOldTree wasn't called yet
282
- JPH_ASSERT(mFreeNodeBatch.mNumObjects == 0);
283
-
284
- // Mark tree non-dirty
285
- mIsDirty = false;
286
-
287
- // Get the current root node
288
- const RootNode &root_node = GetCurrentRoot();
289
-
290
- #ifdef JPH_DUMP_BROADPHASE_TREE
291
- DumpTree(root_node.GetNodeID(), StringFormat("%s_PRE", mName).c_str());
292
- #endif
293
-
294
- // Assert sane data
295
- #ifdef JPH_DEBUG
296
- ValidateTree(inBodies, ioTracking, root_node.mIndex, mNumBodies);
297
- #endif
298
-
299
- // Create space for all body ID's
300
- NodeID *node_ids = mNumBodies > 0? new NodeID [mNumBodies] : nullptr;
301
- NodeID *cur_node_id = node_ids;
302
-
303
- // Collect all bodies
304
- Array<NodeID, STLLocalAllocator<NodeID, cStackSize>> node_stack;
305
- node_stack.reserve(cStackSize);
306
- node_stack.push_back(root_node.GetNodeID());
307
- JPH_ASSERT(node_stack.front().IsValid());
308
- do
309
- {
310
- // Pop node from stack
311
- NodeID node_id = node_stack.back();
312
- node_stack.pop_back();
313
-
314
- // Check if node is a body
315
- if (node_id.IsBody())
316
- {
317
- // Validate that we're still in the right layer
318
- #ifdef JPH_ENABLE_ASSERTS
319
- uint32 body_index = node_id.GetBodyID().GetIndex();
320
- JPH_ASSERT(ioTracking[body_index].mObjectLayer == inBodies[body_index]->GetObjectLayer());
321
- #endif
322
-
323
- // Store body
324
- *cur_node_id = node_id;
325
- ++cur_node_id;
326
- }
327
- else
328
- {
329
- // Process normal node
330
- uint32 node_idx = node_id.GetNodeIndex();
331
- const Node &node = mAllocator->Get(node_idx);
332
-
333
- if (!node.mIsChanged && !inFullRebuild)
334
- {
335
- // Node is unchanged, treat it as a whole
336
- *cur_node_id = node_id;
337
- ++cur_node_id;
338
- }
339
- else
340
- {
341
- // Node is changed, recurse and get all children
342
- for (NodeID child_node_id : node.mChildNodeID)
343
- if (child_node_id.IsValid())
344
- node_stack.push_back(child_node_id);
345
-
346
- // Mark node to be freed
347
- mAllocator->AddObjectToBatch(mFreeNodeBatch, node_idx);
348
- }
349
- }
350
- }
351
- while (!node_stack.empty());
352
-
353
- // Check that our book keeping matches
354
- uint32 num_node_ids = uint32(cur_node_id - node_ids);
355
- JPH_ASSERT(inFullRebuild? num_node_ids == mNumBodies : num_node_ids <= mNumBodies);
356
-
357
- // This will be the new root node id
358
- NodeID root_node_id;
359
-
360
- if (num_node_ids > 0)
361
- {
362
- // We mark the first 5 levels (max 1024 nodes) of the newly built tree as 'changed' so that
363
- // those nodes get recreated every time when we rebuild the tree. This balances the amount of
364
- // time we spend on rebuilding the tree ('unchanged' nodes will be put in the new tree as a whole)
365
- // vs the quality of the built tree.
366
- constexpr uint cMaxDepthMarkChanged = 5;
367
-
368
- // Build new tree
369
- AABox root_bounds;
370
- root_node_id = BuildTree(inBodies, ioTracking, node_ids, num_node_ids, cMaxDepthMarkChanged, root_bounds);
371
-
372
- if (root_node_id.IsBody())
373
- {
374
- // For a single body we need to allocate a new root node
375
- uint32 root_idx = AllocateNode(false);
376
- Node &root = mAllocator->Get(root_idx);
377
- root.SetChildBounds(0, root_bounds);
378
- root.mChildNodeID[0] = root_node_id;
379
- SetBodyLocation(ioTracking, root_node_id.GetBodyID(), root_idx, 0);
380
- root_node_id = NodeID::sFromNodeIndex(root_idx);
381
- }
382
- }
383
- else
384
- {
385
- // Empty tree, create root node
386
- uint32 root_idx = AllocateNode(false);
387
- root_node_id = NodeID::sFromNodeIndex(root_idx);
388
- }
389
-
390
- // Delete temporary data
391
- delete [] node_ids;
392
-
393
- outUpdateState.mRootNodeID = root_node_id;
394
- }
395
-
396
- void QuadTree::UpdateFinalize([[maybe_unused]] const BodyVector &inBodies, [[maybe_unused]] const TrackingVector &inTracking, const UpdateState &inUpdateState)
397
- {
398
- // Tree building is complete, now we switch the old with the new tree
399
- uint32 new_root_idx = mRootNodeIndex ^ 1;
400
- RootNode &new_root_node = mRootNode[new_root_idx];
401
- {
402
- // Note: We don't need to lock here as the old tree stays available so any queries
403
- // that use it can continue using it until DiscardOldTree is called. This slot
404
- // should be empty and unused at this moment.
405
- JPH_ASSERT(new_root_node.mIndex == cInvalidNodeIndex);
406
- new_root_node.mIndex = inUpdateState.mRootNodeID.GetNodeIndex();
407
- }
408
-
409
- // All queries that start from now on will use this new tree
410
- mRootNodeIndex = new_root_idx;
411
-
412
- #ifdef JPH_DUMP_BROADPHASE_TREE
413
- DumpTree(new_root_node.GetNodeID(), StringFormat("%s_POST", mName).c_str());
414
- #endif
415
-
416
- #ifdef JPH_DEBUG
417
- ValidateTree(inBodies, inTracking, new_root_node.mIndex, mNumBodies);
418
- #endif
419
- }
420
-
421
- void QuadTree::sPartition(NodeID *ioNodeIDs, Vec3 *ioNodeCenters, int inNumber, int &outMidPoint)
422
- {
423
- // Handle trivial case
424
- if (inNumber <= 4)
425
- {
426
- outMidPoint = inNumber / 2;
427
- return;
428
- }
429
-
430
- // Calculate bounding box of box centers
431
- Vec3 center_min = Vec3::sReplicate(cLargeFloat);
432
- Vec3 center_max = Vec3::sReplicate(-cLargeFloat);
433
- for (const Vec3 *c = ioNodeCenters, *c_end = ioNodeCenters + inNumber; c < c_end; ++c)
434
- {
435
- Vec3 center = *c;
436
- center_min = Vec3::sMin(center_min, center);
437
- center_max = Vec3::sMax(center_max, center);
438
- }
439
-
440
- // Calculate split plane
441
- int dimension = (center_max - center_min).GetHighestComponentIndex();
442
- float split = 0.5f * (center_min + center_max)[dimension];
443
-
444
- // Divide bodies
445
- int start = 0, end = inNumber;
446
- while (start < end)
447
- {
448
- // Search for first element that is on the right hand side of the split plane
449
- while (start < end && ioNodeCenters[start][dimension] < split)
450
- ++start;
451
-
452
- // Search for the first element that is on the left hand side of the split plane
453
- while (start < end && ioNodeCenters[end - 1][dimension] >= split)
454
- --end;
455
-
456
- if (start < end)
457
- {
458
- // Swap the two elements
459
- std::swap(ioNodeIDs[start], ioNodeIDs[end - 1]);
460
- std::swap(ioNodeCenters[start], ioNodeCenters[end - 1]);
461
- ++start;
462
- --end;
463
- }
464
- }
465
- JPH_ASSERT(start == end);
466
-
467
- if (start > 0 && start < inNumber)
468
- {
469
- // Success!
470
- outMidPoint = start;
471
- }
472
- else
473
- {
474
- // Failed to divide bodies
475
- outMidPoint = inNumber / 2;
476
- }
477
- }
478
-
479
- void QuadTree::sPartition4(NodeID *ioNodeIDs, Vec3 *ioNodeCenters, int inBegin, int inEnd, int *outSplit)
480
- {
481
- NodeID *node_ids = ioNodeIDs + inBegin;
482
- Vec3 *node_centers = ioNodeCenters + inBegin;
483
- int number = inEnd - inBegin;
484
-
485
- // Partition entire range
486
- sPartition(node_ids, node_centers, number, outSplit[2]);
487
-
488
- // Partition lower half
489
- sPartition(node_ids, node_centers, outSplit[2], outSplit[1]);
490
-
491
- // Partition upper half
492
- sPartition(node_ids + outSplit[2], node_centers + outSplit[2], number - outSplit[2], outSplit[3]);
493
-
494
- // Convert to proper range
495
- outSplit[0] = inBegin;
496
- outSplit[1] += inBegin;
497
- outSplit[2] += inBegin;
498
- outSplit[3] += outSplit[2];
499
- outSplit[4] = inEnd;
500
- }
501
-
502
- AABox QuadTree::GetNodeOrBodyBounds(const BodyVector &inBodies, NodeID inNodeID) const
503
- {
504
- if (inNodeID.IsNode())
505
- {
506
- // It is a node
507
- uint32 node_idx = inNodeID.GetNodeIndex();
508
- const Node &node = mAllocator->Get(node_idx);
509
-
510
- AABox bounds;
511
- node.GetNodeBounds(bounds);
512
- return bounds;
513
- }
514
- else
515
- {
516
- // It is a body
517
- return inBodies[inNodeID.GetBodyID().GetIndex()]->GetWorldSpaceBounds();
518
- }
519
- }
520
-
521
- QuadTree::NodeID QuadTree::BuildTree(const BodyVector &inBodies, TrackingVector &ioTracking, NodeID *ioNodeIDs, int inNumber, uint inMaxDepthMarkChanged, AABox &outBounds)
522
- {
523
- // Trivial case: No bodies in tree
524
- if (inNumber == 0)
525
- {
526
- outBounds = cInvalidBounds;
527
- return NodeID::sInvalid();
528
- }
529
-
530
- // Trivial case: When we have 1 body or node, return it
531
- if (inNumber == 1)
532
- {
533
- if (ioNodeIDs->IsNode())
534
- {
535
- // When returning an existing node as root, ensure that no parent has been set
536
- Node &node = mAllocator->Get(ioNodeIDs->GetNodeIndex());
537
- node.mParentNodeIndex = cInvalidNodeIndex;
538
- }
539
- outBounds = GetNodeOrBodyBounds(inBodies, *ioNodeIDs);
540
- return *ioNodeIDs;
541
- }
542
-
543
- // Calculate centers of all bodies that are to be inserted
544
- Vec3 *centers = new Vec3 [inNumber];
545
- JPH_ASSERT(IsAligned(centers, JPH_VECTOR_ALIGNMENT));
546
- Vec3 *c = centers;
547
- for (const NodeID *n = ioNodeIDs, *n_end = ioNodeIDs + inNumber; n < n_end; ++n, ++c)
548
- *c = GetNodeOrBodyBounds(inBodies, *n).GetCenter();
549
-
550
- // The algorithm is a recursive tree build, but to avoid the call overhead we keep track of a stack here
551
- struct StackEntry
552
- {
553
- uint32 mNodeIdx; // Node index of node that is generated
554
- int mChildIdx; // Index of child that we're currently processing
555
- int mSplit[5]; // Indices where the node ID's have been split to form 4 partitions
556
- uint32 mDepth; // Depth of this node in the tree
557
- Vec3 mNodeBoundsMin; // Bounding box of this node, accumulated while iterating over children
558
- Vec3 mNodeBoundsMax;
559
- };
560
- static_assert(sizeof(StackEntry) == 64);
561
- StackEntry stack[cStackSize / 4]; // We don't process 4 at a time in this loop but 1, so the stack can be 4x as small
562
- int top = 0;
563
-
564
- // Create root node
565
- stack[0].mNodeIdx = AllocateNode(inMaxDepthMarkChanged > 0);
566
- stack[0].mChildIdx = -1;
567
- stack[0].mDepth = 0;
568
- stack[0].mNodeBoundsMin = Vec3::sReplicate(cLargeFloat);
569
- stack[0].mNodeBoundsMax = Vec3::sReplicate(-cLargeFloat);
570
- sPartition4(ioNodeIDs, centers, 0, inNumber, stack[0].mSplit);
571
-
572
- for (;;)
573
- {
574
- StackEntry &cur_stack = stack[top];
575
-
576
- // Next child
577
- cur_stack.mChildIdx++;
578
-
579
- // Check if all children processed
580
- if (cur_stack.mChildIdx >= 4)
581
- {
582
- // Terminate if there's nothing left to pop
583
- if (top <= 0)
584
- break;
585
-
586
- // Add our bounds to our parents bounds
587
- StackEntry &prev_stack = stack[top - 1];
588
- prev_stack.mNodeBoundsMin = Vec3::sMin(prev_stack.mNodeBoundsMin, cur_stack.mNodeBoundsMin);
589
- prev_stack.mNodeBoundsMax = Vec3::sMax(prev_stack.mNodeBoundsMax, cur_stack.mNodeBoundsMax);
590
-
591
- // Store parent node
592
- Node &node = mAllocator->Get(cur_stack.mNodeIdx);
593
- node.mParentNodeIndex = prev_stack.mNodeIdx;
594
-
595
- // Store this node's properties in the parent node
596
- Node &parent_node = mAllocator->Get(prev_stack.mNodeIdx);
597
- parent_node.mChildNodeID[prev_stack.mChildIdx] = NodeID::sFromNodeIndex(cur_stack.mNodeIdx);
598
- parent_node.SetChildBounds(prev_stack.mChildIdx, AABox(cur_stack.mNodeBoundsMin, cur_stack.mNodeBoundsMax));
599
-
600
- // Pop entry from stack
601
- --top;
602
- }
603
- else
604
- {
605
- // Get low and high index to bodies to process
606
- int low = cur_stack.mSplit[cur_stack.mChildIdx];
607
- int high = cur_stack.mSplit[cur_stack.mChildIdx + 1];
608
- int num_bodies = high - low;
609
-
610
- if (num_bodies == 1)
611
- {
612
- // Get body info
613
- NodeID child_node_id = ioNodeIDs[low];
614
- AABox bounds = GetNodeOrBodyBounds(inBodies, child_node_id);
615
-
616
- // Update node
617
- Node &node = mAllocator->Get(cur_stack.mNodeIdx);
618
- node.mChildNodeID[cur_stack.mChildIdx] = child_node_id;
619
- node.SetChildBounds(cur_stack.mChildIdx, bounds);
620
-
621
- if (child_node_id.IsNode())
622
- {
623
- // Update parent for this node
624
- Node &child_node = mAllocator->Get(child_node_id.GetNodeIndex());
625
- child_node.mParentNodeIndex = cur_stack.mNodeIdx;
626
- }
627
- else
628
- {
629
- // Set location in tracking
630
- SetBodyLocation(ioTracking, child_node_id.GetBodyID(), cur_stack.mNodeIdx, cur_stack.mChildIdx);
631
- }
632
-
633
- // Encapsulate bounding box in parent
634
- cur_stack.mNodeBoundsMin = Vec3::sMin(cur_stack.mNodeBoundsMin, bounds.mMin);
635
- cur_stack.mNodeBoundsMax = Vec3::sMax(cur_stack.mNodeBoundsMax, bounds.mMax);
636
- }
637
- else if (num_bodies > 1)
638
- {
639
- // Allocate new node
640
- StackEntry &new_stack = stack[++top];
641
- JPH_ASSERT(top < cStackSize / 4);
642
- uint32 next_depth = cur_stack.mDepth + 1;
643
- new_stack.mNodeIdx = AllocateNode(inMaxDepthMarkChanged > next_depth);
644
- new_stack.mChildIdx = -1;
645
- new_stack.mDepth = next_depth;
646
- new_stack.mNodeBoundsMin = Vec3::sReplicate(cLargeFloat);
647
- new_stack.mNodeBoundsMax = Vec3::sReplicate(-cLargeFloat);
648
- sPartition4(ioNodeIDs, centers, low, high, new_stack.mSplit);
649
- }
650
- }
651
- }
652
-
653
- // Delete temporary data
654
- delete [] centers;
655
-
656
- // Store bounding box of root
657
- outBounds.mMin = stack[0].mNodeBoundsMin;
658
- outBounds.mMax = stack[0].mNodeBoundsMax;
659
-
660
- // Return root
661
- return NodeID::sFromNodeIndex(stack[0].mNodeIdx);
662
- }
663
-
664
- void QuadTree::MarkNodeAndParentsChanged(uint32 inNodeIndex)
665
- {
666
- uint32 node_idx = inNodeIndex;
667
-
668
- do
669
- {
670
- // If node has changed, parent will be too
671
- Node &node = mAllocator->Get(node_idx);
672
- if (node.mIsChanged)
673
- break;
674
-
675
- // Mark node as changed
676
- node.mIsChanged = true;
677
-
678
- // Get our parent
679
- node_idx = node.mParentNodeIndex;
680
- }
681
- while (node_idx != cInvalidNodeIndex);
682
- }
683
-
684
- void QuadTree::WidenAndMarkNodeAndParentsChanged(uint32 inNodeIndex, const AABox &inNewBounds)
685
- {
686
- uint32 node_idx = inNodeIndex;
687
-
688
- for (;;)
689
- {
690
- // Mark node as changed
691
- Node &node = mAllocator->Get(node_idx);
692
- node.mIsChanged = true;
693
-
694
- // Get our parent
695
- uint32 parent_idx = node.mParentNodeIndex;
696
- if (parent_idx == cInvalidNodeIndex)
697
- break;
698
-
699
- // Find which child of the parent we're in
700
- Node &parent_node = mAllocator->Get(parent_idx);
701
- NodeID node_id = NodeID::sFromNodeIndex(node_idx);
702
- int child_idx = -1;
703
- for (int i = 0; i < 4; ++i)
704
- if (parent_node.mChildNodeID[i] == node_id)
705
- {
706
- // Found one, set the node index and child index and update the bounding box too
707
- child_idx = i;
708
- break;
709
- }
710
- JPH_ASSERT(child_idx != -1, "Nodes don't get removed from the tree, we must have found it");
711
-
712
- // To avoid any race conditions with other threads we only enlarge bounding boxes
713
- if (!parent_node.EncapsulateChildBounds(child_idx, inNewBounds))
714
- {
715
- // No changes to bounding box, only marking as changed remains to be done
716
- if (!parent_node.mIsChanged)
717
- MarkNodeAndParentsChanged(parent_idx);
718
- break;
719
- }
720
-
721
- // Update node index
722
- node_idx = parent_idx;
723
- }
724
- }
725
-
726
- bool QuadTree::TryInsertLeaf(TrackingVector &ioTracking, int inNodeIndex, NodeID inLeafID, const AABox &inLeafBounds, int inLeafNumBodies)
727
- {
728
- // Tentatively assign the node as parent
729
- bool leaf_is_node = inLeafID.IsNode();
730
- if (leaf_is_node)
731
- {
732
- uint32 leaf_idx = inLeafID.GetNodeIndex();
733
- mAllocator->Get(leaf_idx).mParentNodeIndex = inNodeIndex;
734
- }
735
-
736
- // Fetch node that we're adding to
737
- Node &node = mAllocator->Get(inNodeIndex);
738
-
739
- // Find an empty child
740
- for (uint32 child_idx = 0; child_idx < 4; ++child_idx)
741
- if (node.mChildNodeID[child_idx].CompareExchange(NodeID::sInvalid(), inLeafID)) // Check if we can claim it
742
- {
743
- // We managed to add it to the node
744
-
745
- // If leaf was a body, we need to update its bookkeeping
746
- if (!leaf_is_node)
747
- SetBodyLocation(ioTracking, inLeafID.GetBodyID(), inNodeIndex, child_idx);
748
-
749
- // Now set the bounding box making the child valid for queries
750
- node.SetChildBounds(child_idx, inLeafBounds);
751
-
752
- // Widen the bounds for our parents too
753
- WidenAndMarkNodeAndParentsChanged(inNodeIndex, inLeafBounds);
754
-
755
- // Update body counter
756
- mNumBodies += inLeafNumBodies;
757
-
758
- // And we're done
759
- return true;
760
- }
761
-
762
- return false;
763
- }
764
-
765
- bool QuadTree::TryCreateNewRoot(TrackingVector &ioTracking, atomic<uint32> &ioRootNodeIndex, NodeID inLeafID, const AABox &inLeafBounds, int inLeafNumBodies)
766
- {
767
- // Fetch old root
768
- uint32 root_idx = ioRootNodeIndex;
769
- Node &root = mAllocator->Get(root_idx);
770
-
771
- // Create new root, mark this new root as changed as we're not creating a very efficient tree at this point
772
- uint32 new_root_idx = AllocateNode(true);
773
- Node &new_root = mAllocator->Get(new_root_idx);
774
-
775
- // First child is current root, note that since the tree may be modified concurrently we cannot assume that the bounds of our child will be correct so we set a very large bounding box
776
- new_root.mChildNodeID[0] = NodeID::sFromNodeIndex(root_idx);
777
- new_root.SetChildBounds(0, AABox(Vec3::sReplicate(-cLargeFloat), Vec3::sReplicate(cLargeFloat)));
778
-
779
- // Second child is new leaf
780
- new_root.mChildNodeID[1] = inLeafID;
781
- new_root.SetChildBounds(1, inLeafBounds);
782
-
783
- // Tentatively assign new root as parent
784
- bool leaf_is_node = inLeafID.IsNode();
785
- if (leaf_is_node)
786
- {
787
- uint32 leaf_idx = inLeafID.GetNodeIndex();
788
- mAllocator->Get(leaf_idx).mParentNodeIndex = new_root_idx;
789
- }
790
-
791
- // Try to swap it
792
- if (ioRootNodeIndex.compare_exchange_strong(root_idx, new_root_idx))
793
- {
794
- // We managed to set the new root
795
-
796
- // If leaf was a body, we need to update its bookkeeping
797
- if (!leaf_is_node)
798
- SetBodyLocation(ioTracking, inLeafID.GetBodyID(), new_root_idx, 1);
799
-
800
- // Store parent node for old root
801
- root.mParentNodeIndex = new_root_idx;
802
-
803
- // Update body counter
804
- mNumBodies += inLeafNumBodies;
805
-
806
- // And we're done
807
- return true;
808
- }
809
-
810
- // Failed to swap, someone else must have created a new root, try again
811
- mAllocator->DestructObject(new_root_idx);
812
- return false;
813
- }
814
-
815
- void QuadTree::AddBodiesPrepare(const BodyVector &inBodies, TrackingVector &ioTracking, BodyID *ioBodyIDs, int inNumber, AddState &outState)
816
- {
817
- // Assert sane input
818
- JPH_ASSERT(ioBodyIDs != nullptr);
819
- JPH_ASSERT(inNumber > 0);
820
-
821
- #ifdef JPH_ENABLE_ASSERTS
822
- // Below we just cast the body ID's to node ID's, check here that that is valid
823
- for (const BodyID *b = ioBodyIDs, *b_end = ioBodyIDs + inNumber; b < b_end; ++b)
824
- NodeID::sFromBodyID(*b);
825
- #endif
826
-
827
- // Build subtree for the new bodies, note that we mark all nodes as 'not changed'
828
- // so they will stay together as a batch and will make the tree rebuild cheaper
829
- outState.mLeafID = BuildTree(inBodies, ioTracking, (NodeID *)ioBodyIDs, inNumber, 0, outState.mLeafBounds);
830
-
831
- #ifdef JPH_DEBUG
832
- if (outState.mLeafID.IsNode())
833
- ValidateTree(inBodies, ioTracking, outState.mLeafID.GetNodeIndex(), inNumber);
834
- #endif
835
- }
836
-
837
- void QuadTree::AddBodiesFinalize(TrackingVector &ioTracking, int inNumberBodies, const AddState &inState)
838
- {
839
- // Assert sane input
840
- JPH_ASSERT(inNumberBodies > 0);
841
-
842
- // Mark tree dirty
843
- mIsDirty = true;
844
-
845
- // Get the current root node
846
- RootNode &root_node = GetCurrentRoot();
847
-
848
- for (;;)
849
- {
850
- // Check if we can insert the body in the root
851
- if (TryInsertLeaf(ioTracking, root_node.mIndex, inState.mLeafID, inState.mLeafBounds, inNumberBodies))
852
- return;
853
-
854
- // Check if we can create a new root
855
- if (TryCreateNewRoot(ioTracking, root_node.mIndex, inState.mLeafID, inState.mLeafBounds, inNumberBodies))
856
- return;
857
- }
858
- }
859
-
860
- void QuadTree::AddBodiesAbort(TrackingVector &ioTracking, const AddState &inState)
861
- {
862
- // Collect all bodies
863
- Allocator::Batch free_batch;
864
- NodeID node_stack[cStackSize];
865
- node_stack[0] = inState.mLeafID;
866
- JPH_ASSERT(node_stack[0].IsValid());
867
- int top = 0;
868
- do
869
- {
870
- // Check if node is a body
871
- NodeID child_node_id = node_stack[top];
872
- if (child_node_id.IsBody())
873
- {
874
- // Reset location of body
875
- sInvalidateBodyLocation(ioTracking, child_node_id.GetBodyID());
876
- }
877
- else
878
- {
879
- // Process normal node
880
- uint32 node_idx = child_node_id.GetNodeIndex();
881
- const Node &node = mAllocator->Get(node_idx);
882
- for (NodeID sub_child_node_id : node.mChildNodeID)
883
- if (sub_child_node_id.IsValid())
884
- {
885
- JPH_ASSERT(top < cStackSize);
886
- node_stack[top] = sub_child_node_id;
887
- top++;
888
- }
889
-
890
- // Mark it to be freed
891
- mAllocator->AddObjectToBatch(free_batch, node_idx);
892
- }
893
- --top;
894
- }
895
- while (top >= 0);
896
-
897
- // Now free all nodes as a single batch
898
- mAllocator->DestructObjectBatch(free_batch);
899
- }
900
-
901
- void QuadTree::RemoveBodies([[maybe_unused]] const BodyVector &inBodies, TrackingVector &ioTracking, const BodyID *ioBodyIDs, int inNumber)
902
- {
903
- // Assert sane input
904
- JPH_ASSERT(ioBodyIDs != nullptr);
905
- JPH_ASSERT(inNumber > 0);
906
-
907
- // Mark tree dirty
908
- mIsDirty = true;
909
-
910
- for (const BodyID *cur = ioBodyIDs, *end = ioBodyIDs + inNumber; cur < end; ++cur)
911
- {
912
- // Check if BodyID is correct
913
- JPH_ASSERT(inBodies[cur->GetIndex()]->GetID() == *cur, "Provided BodyID doesn't match BodyID in body manager");
914
-
915
- // Get location of body
916
- uint32 node_idx, child_idx;
917
- GetBodyLocation(ioTracking, *cur, node_idx, child_idx);
918
-
919
- // First we reset our internal bookkeeping
920
- sInvalidateBodyLocation(ioTracking, *cur);
921
-
922
- // Then we make the bounding box invalid, no queries can find this node anymore
923
- Node &node = mAllocator->Get(node_idx);
924
- node.InvalidateChildBounds(child_idx);
925
-
926
- // Finally we reset the child id, this makes the node available for adds again
927
- node.mChildNodeID[child_idx] = NodeID::sInvalid();
928
-
929
- // We don't need to bubble up our bounding box changes to our parents since we never make volumes smaller, only bigger
930
- // But we do need to mark the nodes as changed so that the tree can be rebuilt
931
- MarkNodeAndParentsChanged(node_idx);
932
- }
933
-
934
- mNumBodies -= inNumber;
935
- }
936
-
937
- void QuadTree::NotifyBodiesAABBChanged(const BodyVector &inBodies, const TrackingVector &inTracking, const BodyID *ioBodyIDs, int inNumber)
938
- {
939
- // Assert sane input
940
- JPH_ASSERT(ioBodyIDs != nullptr);
941
- JPH_ASSERT(inNumber > 0);
942
-
943
- for (const BodyID *cur = ioBodyIDs, *end = ioBodyIDs + inNumber; cur < end; ++cur)
944
- {
945
- // Check if BodyID is correct
946
- const Body *body = inBodies[cur->GetIndex()];
947
- JPH_ASSERT(body->GetID() == *cur, "Provided BodyID doesn't match BodyID in body manager");
948
-
949
- // Get the new bounding box
950
- const AABox &new_bounds = body->GetWorldSpaceBounds();
951
-
952
- // Get location of body
953
- uint32 node_idx, child_idx;
954
- GetBodyLocation(inTracking, *cur, node_idx, child_idx);
955
-
956
- // Widen bounds for node
957
- Node &node = mAllocator->Get(node_idx);
958
- if (node.EncapsulateChildBounds(child_idx, new_bounds))
959
- {
960
- // Mark tree dirty
961
- mIsDirty = true;
962
-
963
- // If bounds changed, widen the bounds for our parents too
964
- WidenAndMarkNodeAndParentsChanged(node_idx, new_bounds);
965
- }
966
- }
967
- }
968
-
969
- template <class Visitor>
970
- JPH_INLINE void QuadTree::WalkTree(const ObjectLayerFilter &inObjectLayerFilter, const TrackingVector &inTracking, Visitor &ioVisitor JPH_IF_TRACK_BROADPHASE_STATS(, LayerToStats &ioStats)) const
971
- {
972
- // Get the root
973
- const RootNode &root_node = GetCurrentRoot();
974
-
975
- #ifdef JPH_TRACK_BROADPHASE_STATS
976
- // Start tracking stats
977
- int bodies_visited = 0;
978
- int hits_collected = 0;
979
- int nodes_visited = 0;
980
- uint64 collector_ticks = 0;
981
-
982
- uint64 start = GetProcessorTickCount();
983
- #endif // JPH_TRACK_BROADPHASE_STATS
984
-
985
- Array<NodeID, STLLocalAllocator<NodeID, cStackSize>> node_stack_array;
986
- node_stack_array.resize(cStackSize);
987
- NodeID *node_stack = node_stack_array.data();
988
- node_stack[0] = root_node.GetNodeID();
989
- int top = 0;
990
- do
991
- {
992
- // Check if node is a body
993
- NodeID child_node_id = node_stack[top];
994
- if (child_node_id.IsBody())
995
- {
996
- // Track amount of bodies visited
997
- JPH_IF_TRACK_BROADPHASE_STATS(++bodies_visited;)
998
-
999
- BodyID body_id = child_node_id.GetBodyID();
1000
- ObjectLayer object_layer = inTracking[body_id.GetIndex()].mObjectLayer; // We're not taking a lock on the body, so it may be in the process of being removed so check if the object layer is invalid
1001
- if (object_layer != cObjectLayerInvalid && inObjectLayerFilter.ShouldCollide(object_layer))
1002
- {
1003
- JPH_PROFILE("VisitBody");
1004
-
1005
- // Track amount of hits
1006
- JPH_IF_TRACK_BROADPHASE_STATS(++hits_collected;)
1007
-
1008
- // Start track time the collector takes
1009
- JPH_IF_TRACK_BROADPHASE_STATS(uint64 collector_start = GetProcessorTickCount();)
1010
-
1011
- // We found a body we collide with, call our visitor
1012
- ioVisitor.VisitBody(body_id, top);
1013
-
1014
- // End track time the collector takes
1015
- JPH_IF_TRACK_BROADPHASE_STATS(collector_ticks += GetProcessorTickCount() - collector_start;)
1016
-
1017
- // Check if we're done
1018
- if (ioVisitor.ShouldAbort())
1019
- break;
1020
- }
1021
- }
1022
- else if (child_node_id.IsValid())
1023
- {
1024
- JPH_IF_TRACK_BROADPHASE_STATS(++nodes_visited;)
1025
-
1026
- // Ensure there is space on the stack (falls back to heap if there isn't)
1027
- if (top + 4 >= (int)node_stack_array.size())
1028
- {
1029
- sQuadTreePerformanceWarning();
1030
- node_stack_array.resize(node_stack_array.size() << 1);
1031
- node_stack = node_stack_array.data();
1032
- ioVisitor.OnStackResized(node_stack_array.size());
1033
- }
1034
-
1035
- // Process normal node
1036
- const Node &node = mAllocator->Get(child_node_id.GetNodeIndex());
1037
- JPH_ASSERT(IsAligned(&node, JPH_CACHE_LINE_SIZE));
1038
-
1039
- // Load bounds of 4 children
1040
- Vec4 bounds_minx = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMinX);
1041
- Vec4 bounds_miny = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMinY);
1042
- Vec4 bounds_minz = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMinZ);
1043
- Vec4 bounds_maxx = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMaxX);
1044
- Vec4 bounds_maxy = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMaxY);
1045
- Vec4 bounds_maxz = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMaxZ);
1046
-
1047
- // Load ids for 4 children
1048
- UVec4 child_ids = UVec4::sLoadInt4Aligned((const uint32 *)&node.mChildNodeID[0]);
1049
-
1050
- // Check which sub nodes to visit
1051
- int num_results = ioVisitor.VisitNodes(bounds_minx, bounds_miny, bounds_minz, bounds_maxx, bounds_maxy, bounds_maxz, child_ids, top);
1052
- child_ids.StoreInt4((uint32 *)&node_stack[top]);
1053
- top += num_results;
1054
- }
1055
-
1056
- // Fetch next node until we find one that the visitor wants to see
1057
- do
1058
- --top;
1059
- while (top >= 0 && !ioVisitor.ShouldVisitNode(top));
1060
- }
1061
- while (top >= 0);
1062
-
1063
- #ifdef JPH_TRACK_BROADPHASE_STATS
1064
- // Calculate total time the broadphase walk took
1065
- uint64 total_ticks = GetProcessorTickCount() - start;
1066
-
1067
- // Update stats under lock protection (slow!)
1068
- {
1069
- unique_lock lock(mStatsMutex);
1070
- Stat &s = ioStats[inObjectLayerFilter.GetDescription()];
1071
- s.mNumQueries++;
1072
- s.mNodesVisited += nodes_visited;
1073
- s.mBodiesVisited += bodies_visited;
1074
- s.mHitsReported += hits_collected;
1075
- s.mTotalTicks += total_ticks;
1076
- s.mCollectorTicks += collector_ticks;
1077
- }
1078
- #endif // JPH_TRACK_BROADPHASE_STATS
1079
- }
1080
-
1081
- void QuadTree::CastRay(const RayCast &inRay, RayCastBodyCollector &ioCollector, const ObjectLayerFilter &inObjectLayerFilter, const TrackingVector &inTracking) const
1082
- {
1083
- class Visitor
1084
- {
1085
- public:
1086
- /// Constructor
1087
- JPH_INLINE Visitor(const RayCast &inRay, RayCastBodyCollector &ioCollector) :
1088
- mOrigin(inRay.mOrigin),
1089
- mInvDirection(inRay.mDirection),
1090
- mCollector(ioCollector)
1091
- {
1092
- mFractionStack.resize(cStackSize);
1093
- mFractionStack[0] = -1;
1094
- }
1095
-
1096
- /// Returns true if further processing of the tree should be aborted
1097
- JPH_INLINE bool ShouldAbort() const
1098
- {
1099
- return mCollector.ShouldEarlyOut();
1100
- }
1101
-
1102
- /// Returns true if this node / body should be visited, false if no hit can be generated
1103
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
1104
- {
1105
- return mFractionStack[inStackTop] < mCollector.GetEarlyOutFraction();
1106
- }
1107
-
1108
- /// Visit nodes, returns number of hits found and sorts ioChildNodeIDs so that they are at the beginning of the vector.
1109
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioChildNodeIDs, int inStackTop)
1110
- {
1111
- // Test the ray against 4 bounding boxes
1112
- Vec4 fraction = RayAABox4(mOrigin, mInvDirection, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
1113
-
1114
- // Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
1115
- return SortReverseAndStore(fraction, mCollector.GetEarlyOutFraction(), ioChildNodeIDs, &mFractionStack[inStackTop]);
1116
- }
1117
-
1118
- /// Visit a body, returns false if the algorithm should terminate because no hits can be generated anymore
1119
- JPH_INLINE void VisitBody(const BodyID &inBodyID, int inStackTop)
1120
- {
1121
- // Store potential hit with body
1122
- BroadPhaseCastResult result { inBodyID, mFractionStack[inStackTop] };
1123
- mCollector.AddHit(result);
1124
- }
1125
-
1126
- /// Called when the stack is resized, this allows us to resize the fraction stack to match the new stack size
1127
- JPH_INLINE void OnStackResized(size_t inNewStackSize)
1128
- {
1129
- mFractionStack.resize(inNewStackSize);
1130
- }
1131
-
1132
- private:
1133
- Vec3 mOrigin;
1134
- RayInvDirection mInvDirection;
1135
- RayCastBodyCollector & mCollector;
1136
- Array<float, STLLocalAllocator<float, cStackSize>> mFractionStack;
1137
- };
1138
-
1139
- Visitor visitor(inRay, ioCollector);
1140
- WalkTree(inObjectLayerFilter, inTracking, visitor JPH_IF_TRACK_BROADPHASE_STATS(, mCastRayStats));
1141
- }
1142
-
1143
- void QuadTree::CollideAABox(const AABox &inBox, CollideShapeBodyCollector &ioCollector, const ObjectLayerFilter &inObjectLayerFilter, const TrackingVector &inTracking) const
1144
- {
1145
- class Visitor
1146
- {
1147
- public:
1148
- /// Constructor
1149
- JPH_INLINE Visitor(const AABox &inBox, CollideShapeBodyCollector &ioCollector) :
1150
- mBox(inBox),
1151
- mCollector(ioCollector)
1152
- {
1153
- }
1154
-
1155
- /// Returns true if further processing of the tree should be aborted
1156
- JPH_INLINE bool ShouldAbort() const
1157
- {
1158
- return mCollector.ShouldEarlyOut();
1159
- }
1160
-
1161
- /// Returns true if this node / body should be visited, false if no hit can be generated
1162
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
1163
- {
1164
- return true;
1165
- }
1166
-
1167
- /// Visit nodes, returns number of hits found and sorts ioChildNodeIDs so that they are at the beginning of the vector.
1168
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioChildNodeIDs, int inStackTop) const
1169
- {
1170
- // Test the box vs 4 boxes
1171
- UVec4 hitting = AABox4VsBox(mBox, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
1172
- return CountAndSortTrues(hitting, ioChildNodeIDs);
1173
- }
1174
-
1175
- /// Visit a body, returns false if the algorithm should terminate because no hits can be generated anymore
1176
- JPH_INLINE void VisitBody(const BodyID &inBodyID, int inStackTop)
1177
- {
1178
- // Store potential hit with body
1179
- mCollector.AddHit(inBodyID);
1180
- }
1181
-
1182
- /// Called when the stack is resized
1183
- JPH_INLINE void OnStackResized([[maybe_unused]] size_t inNewStackSize) const
1184
- {
1185
- // Nothing to do
1186
- }
1187
-
1188
- private:
1189
- const AABox & mBox;
1190
- CollideShapeBodyCollector & mCollector;
1191
- };
1192
-
1193
- Visitor visitor(inBox, ioCollector);
1194
- WalkTree(inObjectLayerFilter, inTracking, visitor JPH_IF_TRACK_BROADPHASE_STATS(, mCollideAABoxStats));
1195
- }
1196
-
1197
- void QuadTree::CollideSphere(Vec3Arg inCenter, float inRadius, CollideShapeBodyCollector &ioCollector, const ObjectLayerFilter &inObjectLayerFilter, const TrackingVector &inTracking) const
1198
- {
1199
- class Visitor
1200
- {
1201
- public:
1202
- /// Constructor
1203
- JPH_INLINE Visitor(Vec3Arg inCenter, float inRadius, CollideShapeBodyCollector &ioCollector) :
1204
- mCenterX(inCenter.SplatX()),
1205
- mCenterY(inCenter.SplatY()),
1206
- mCenterZ(inCenter.SplatZ()),
1207
- mRadiusSq(Vec4::sReplicate(Square(inRadius))),
1208
- mCollector(ioCollector)
1209
- {
1210
- }
1211
-
1212
- /// Returns true if further processing of the tree should be aborted
1213
- JPH_INLINE bool ShouldAbort() const
1214
- {
1215
- return mCollector.ShouldEarlyOut();
1216
- }
1217
-
1218
- /// Returns true if this node / body should be visited, false if no hit can be generated
1219
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
1220
- {
1221
- return true;
1222
- }
1223
-
1224
- /// Visit nodes, returns number of hits found and sorts ioChildNodeIDs so that they are at the beginning of the vector.
1225
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioChildNodeIDs, int inStackTop) const
1226
- {
1227
- // Test 4 boxes vs sphere
1228
- UVec4 hitting = AABox4VsSphere(mCenterX, mCenterY, mCenterZ, mRadiusSq, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
1229
- return CountAndSortTrues(hitting, ioChildNodeIDs);
1230
- }
1231
-
1232
- /// Visit a body, returns false if the algorithm should terminate because no hits can be generated anymore
1233
- JPH_INLINE void VisitBody(const BodyID &inBodyID, int inStackTop)
1234
- {
1235
- // Store potential hit with body
1236
- mCollector.AddHit(inBodyID);
1237
- }
1238
-
1239
- /// Called when the stack is resized
1240
- JPH_INLINE void OnStackResized([[maybe_unused]] size_t inNewStackSize) const
1241
- {
1242
- // Nothing to do
1243
- }
1244
-
1245
- private:
1246
- Vec4 mCenterX;
1247
- Vec4 mCenterY;
1248
- Vec4 mCenterZ;
1249
- Vec4 mRadiusSq;
1250
- CollideShapeBodyCollector & mCollector;
1251
- };
1252
-
1253
- Visitor visitor(inCenter, inRadius, ioCollector);
1254
- WalkTree(inObjectLayerFilter, inTracking, visitor JPH_IF_TRACK_BROADPHASE_STATS(, mCollideSphereStats));
1255
- }
1256
-
1257
- void QuadTree::CollidePoint(Vec3Arg inPoint, CollideShapeBodyCollector &ioCollector, const ObjectLayerFilter &inObjectLayerFilter, const TrackingVector &inTracking) const
1258
- {
1259
- class Visitor
1260
- {
1261
- public:
1262
- /// Constructor
1263
- JPH_INLINE Visitor(Vec3Arg inPoint, CollideShapeBodyCollector &ioCollector) :
1264
- mPoint(inPoint),
1265
- mCollector(ioCollector)
1266
- {
1267
- }
1268
-
1269
- /// Returns true if further processing of the tree should be aborted
1270
- JPH_INLINE bool ShouldAbort() const
1271
- {
1272
- return mCollector.ShouldEarlyOut();
1273
- }
1274
-
1275
- /// Returns true if this node / body should be visited, false if no hit can be generated
1276
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
1277
- {
1278
- return true;
1279
- }
1280
-
1281
- /// Visit nodes, returns number of hits found and sorts ioChildNodeIDs so that they are at the beginning of the vector.
1282
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioChildNodeIDs, int inStackTop) const
1283
- {
1284
- // Test if point overlaps with box
1285
- UVec4 hitting = AABox4VsPoint(mPoint, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
1286
- return CountAndSortTrues(hitting, ioChildNodeIDs);
1287
- }
1288
-
1289
- /// Visit a body, returns false if the algorithm should terminate because no hits can be generated anymore
1290
- JPH_INLINE void VisitBody(const BodyID &inBodyID, int inStackTop)
1291
- {
1292
- // Store potential hit with body
1293
- mCollector.AddHit(inBodyID);
1294
- }
1295
-
1296
- /// Called when the stack is resized
1297
- JPH_INLINE void OnStackResized([[maybe_unused]] size_t inNewStackSize) const
1298
- {
1299
- // Nothing to do
1300
- }
1301
-
1302
- private:
1303
- Vec3 mPoint;
1304
- CollideShapeBodyCollector & mCollector;
1305
- };
1306
-
1307
- Visitor visitor(inPoint, ioCollector);
1308
- WalkTree(inObjectLayerFilter, inTracking, visitor JPH_IF_TRACK_BROADPHASE_STATS(, mCollidePointStats));
1309
- }
1310
-
1311
- void QuadTree::CollideOrientedBox(const OrientedBox &inBox, CollideShapeBodyCollector &ioCollector, const ObjectLayerFilter &inObjectLayerFilter, const TrackingVector &inTracking) const
1312
- {
1313
- class Visitor
1314
- {
1315
- public:
1316
- /// Constructor
1317
- JPH_INLINE Visitor(const OrientedBox &inBox, CollideShapeBodyCollector &ioCollector) :
1318
- mBox(inBox),
1319
- mCollector(ioCollector)
1320
- {
1321
- }
1322
-
1323
- /// Returns true if further processing of the tree should be aborted
1324
- JPH_INLINE bool ShouldAbort() const
1325
- {
1326
- return mCollector.ShouldEarlyOut();
1327
- }
1328
-
1329
- /// Returns true if this node / body should be visited, false if no hit can be generated
1330
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
1331
- {
1332
- return true;
1333
- }
1334
-
1335
- /// Visit nodes, returns number of hits found and sorts ioChildNodeIDs so that they are at the beginning of the vector.
1336
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioChildNodeIDs, int inStackTop) const
1337
- {
1338
- // Test if point overlaps with box
1339
- UVec4 hitting = AABox4VsBox(mBox, inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
1340
- return CountAndSortTrues(hitting, ioChildNodeIDs);
1341
- }
1342
-
1343
- /// Visit a body, returns false if the algorithm should terminate because no hits can be generated anymore
1344
- JPH_INLINE void VisitBody(const BodyID &inBodyID, int inStackTop)
1345
- {
1346
- // Store potential hit with body
1347
- mCollector.AddHit(inBodyID);
1348
- }
1349
-
1350
- /// Called when the stack is resized
1351
- JPH_INLINE void OnStackResized([[maybe_unused]] size_t inNewStackSize) const
1352
- {
1353
- // Nothing to do
1354
- }
1355
-
1356
- private:
1357
- OrientedBox mBox;
1358
- CollideShapeBodyCollector & mCollector;
1359
- };
1360
-
1361
- Visitor visitor(inBox, ioCollector);
1362
- WalkTree(inObjectLayerFilter, inTracking, visitor JPH_IF_TRACK_BROADPHASE_STATS(, mCollideOrientedBoxStats));
1363
- }
1364
-
1365
- void QuadTree::CastAABox(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector, const ObjectLayerFilter &inObjectLayerFilter, const TrackingVector &inTracking) const
1366
- {
1367
- class Visitor
1368
- {
1369
- public:
1370
- /// Constructor
1371
- JPH_INLINE Visitor(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector) :
1372
- mOrigin(inBox.mBox.GetCenter()),
1373
- mExtent(inBox.mBox.GetExtent()),
1374
- mInvDirection(inBox.mDirection),
1375
- mCollector(ioCollector)
1376
- {
1377
- mFractionStack.resize(cStackSize);
1378
- mFractionStack[0] = -1;
1379
- }
1380
-
1381
- /// Returns true if further processing of the tree should be aborted
1382
- JPH_INLINE bool ShouldAbort() const
1383
- {
1384
- return mCollector.ShouldEarlyOut();
1385
- }
1386
-
1387
- /// Returns true if this node / body should be visited, false if no hit can be generated
1388
- JPH_INLINE bool ShouldVisitNode(int inStackTop) const
1389
- {
1390
- return mFractionStack[inStackTop] < mCollector.GetPositiveEarlyOutFraction();
1391
- }
1392
-
1393
- /// Visit nodes, returns number of hits found and sorts ioChildNodeIDs so that they are at the beginning of the vector.
1394
- JPH_INLINE int VisitNodes(Vec4Arg inBoundsMinX, Vec4Arg inBoundsMinY, Vec4Arg inBoundsMinZ, Vec4Arg inBoundsMaxX, Vec4Arg inBoundsMaxY, Vec4Arg inBoundsMaxZ, UVec4 &ioChildNodeIDs, int inStackTop)
1395
- {
1396
- // Enlarge them by the casted aabox extents
1397
- Vec4 bounds_min_x = inBoundsMinX, bounds_min_y = inBoundsMinY, bounds_min_z = inBoundsMinZ, bounds_max_x = inBoundsMaxX, bounds_max_y = inBoundsMaxY, bounds_max_z = inBoundsMaxZ;
1398
- AABox4EnlargeWithExtent(mExtent, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
1399
-
1400
- // Test 4 children
1401
- Vec4 fraction = RayAABox4(mOrigin, mInvDirection, bounds_min_x, bounds_min_y, bounds_min_z, bounds_max_x, bounds_max_y, bounds_max_z);
1402
-
1403
- // Sort so that highest values are first (we want to first process closer hits and we process stack top to bottom)
1404
- return SortReverseAndStore(fraction, mCollector.GetPositiveEarlyOutFraction(), ioChildNodeIDs, &mFractionStack[inStackTop]);
1405
- }
1406
-
1407
- /// Visit a body, returns false if the algorithm should terminate because no hits can be generated anymore
1408
- JPH_INLINE void VisitBody(const BodyID &inBodyID, int inStackTop)
1409
- {
1410
- // Store potential hit with body
1411
- BroadPhaseCastResult result { inBodyID, mFractionStack[inStackTop] };
1412
- mCollector.AddHit(result);
1413
- }
1414
-
1415
- /// Called when the stack is resized, this allows us to resize the fraction stack to match the new stack size
1416
- JPH_INLINE void OnStackResized(size_t inNewStackSize)
1417
- {
1418
- mFractionStack.resize(inNewStackSize);
1419
- }
1420
-
1421
- private:
1422
- Vec3 mOrigin;
1423
- Vec3 mExtent;
1424
- RayInvDirection mInvDirection;
1425
- CastShapeBodyCollector & mCollector;
1426
- Array<float, STLLocalAllocator<float, cStackSize>> mFractionStack;
1427
- };
1428
-
1429
- Visitor visitor(inBox, ioCollector);
1430
- WalkTree(inObjectLayerFilter, inTracking, visitor JPH_IF_TRACK_BROADPHASE_STATS(, mCastAABoxStats));
1431
- }
1432
-
1433
- void QuadTree::FindCollidingPairs(const BodyVector &inBodies, const BodyID *inActiveBodies, int inNumActiveBodies, float inSpeculativeContactDistance, BodyPairCollector &ioPairCollector, const ObjectLayerPairFilter &inObjectLayerPairFilter) const
1434
- {
1435
- // Note that we don't lock the tree at this point. We know that the tree is not going to be swapped or deleted while finding collision pairs due to the way the jobs are scheduled in the PhysicsSystem::Update.
1436
- // We double check this at the end of the function.
1437
- const RootNode &root_node = GetCurrentRoot();
1438
- JPH_ASSERT(root_node.mIndex != cInvalidNodeIndex);
1439
-
1440
- // Assert sane input
1441
- JPH_ASSERT(inActiveBodies != nullptr);
1442
- JPH_ASSERT(inNumActiveBodies > 0);
1443
-
1444
- Array<NodeID, STLLocalAllocator<NodeID, cStackSize>> node_stack_array;
1445
- node_stack_array.resize(cStackSize);
1446
- NodeID *node_stack = node_stack_array.data();
1447
-
1448
- // Loop over all active bodies
1449
- for (int b1 = 0; b1 < inNumActiveBodies; ++b1)
1450
- {
1451
- BodyID b1_id = inActiveBodies[b1];
1452
- const Body &body1 = *inBodies[b1_id.GetIndex()];
1453
- JPH_ASSERT(!body1.IsStatic());
1454
-
1455
- #ifdef JPH_TRACK_SIMULATION_STATS
1456
- uint64 start_tick = GetProcessorTickCount();
1457
- #endif
1458
-
1459
- // Expand the bounding box by the speculative contact distance
1460
- AABox bounds1 = body1.GetWorldSpaceBounds();
1461
- bounds1.ExpandBy(Vec3::sReplicate(inSpeculativeContactDistance));
1462
-
1463
- // Test each body with the tree
1464
- node_stack[0] = root_node.GetNodeID();
1465
- int top = 0;
1466
- do
1467
- {
1468
- // Check if node is a body
1469
- NodeID child_node_id = node_stack[top];
1470
- if (child_node_id.IsBody())
1471
- {
1472
- // Don't collide with self
1473
- BodyID b2_id = child_node_id.GetBodyID();
1474
- if (b1_id != b2_id)
1475
- {
1476
- // Collision between dynamic pairs need to be picked up only once
1477
- const Body &body2 = *inBodies[b2_id.GetIndex()];
1478
- if (inObjectLayerPairFilter.ShouldCollide(body1.GetObjectLayer(), body2.GetObjectLayer())
1479
- && Body::sFindCollidingPairsCanCollide(body1, body2)
1480
- && bounds1.Overlaps(body2.GetWorldSpaceBounds())) // In the broadphase we widen the bounding box when a body moves, do a final check to see if the bounding boxes actually overlap
1481
- {
1482
- // Store potential hit between bodies
1483
- ioPairCollector.AddHit({ b1_id, b2_id });
1484
- }
1485
- }
1486
- }
1487
- else if (child_node_id.IsValid())
1488
- {
1489
- // Process normal node
1490
- const Node &node = mAllocator->Get(child_node_id.GetNodeIndex());
1491
- JPH_ASSERT(IsAligned(&node, JPH_CACHE_LINE_SIZE));
1492
-
1493
- // Get bounds of 4 children
1494
- Vec4 bounds_minx = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMinX);
1495
- Vec4 bounds_miny = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMinY);
1496
- Vec4 bounds_minz = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMinZ);
1497
- Vec4 bounds_maxx = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMaxX);
1498
- Vec4 bounds_maxy = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMaxY);
1499
- Vec4 bounds_maxz = Vec4::sLoadFloat4Aligned((const Float4 *)&node.mBoundsMaxZ);
1500
-
1501
- // Test overlap
1502
- UVec4 overlap = AABox4VsBox(bounds1, bounds_minx, bounds_miny, bounds_minz, bounds_maxx, bounds_maxy, bounds_maxz);
1503
- int num_results = overlap.CountTrues();
1504
- if (num_results > 0)
1505
- {
1506
- // Load ids for 4 children
1507
- UVec4 child_ids = UVec4::sLoadInt4Aligned((const uint32 *)&node.mChildNodeID[0]);
1508
-
1509
- // Sort so that overlaps are first
1510
- child_ids = UVec4::sSort4True(overlap, child_ids);
1511
-
1512
- // Ensure there is space on the stack (falls back to heap if there isn't)
1513
- if (top + 4 >= (int)node_stack_array.size())
1514
- {
1515
- sQuadTreePerformanceWarning();
1516
- node_stack_array.resize(node_stack_array.size() << 1);
1517
- node_stack = node_stack_array.data();
1518
- }
1519
-
1520
- // Push them onto the stack
1521
- child_ids.StoreInt4((uint32 *)&node_stack[top]);
1522
- top += num_results;
1523
- }
1524
- }
1525
- --top;
1526
- }
1527
- while (top >= 0);
1528
-
1529
- #ifdef JPH_TRACK_SIMULATION_STATS
1530
- uint64 num_ticks = GetProcessorTickCount() - start_tick;
1531
- const_cast<MotionProperties::SimulationStats &>(body1.GetMotionPropertiesUnchecked()->GetSimulationStats()).mBroadPhaseTicks += num_ticks;
1532
- #endif
1533
- }
1534
-
1535
- // Test that the root node was not swapped while finding collision pairs.
1536
- // This would mean that UpdateFinalize/DiscardOldTree ran during collision detection which should not be possible due to the way the jobs are scheduled.
1537
- JPH_ASSERT(root_node.mIndex != cInvalidNodeIndex);
1538
- JPH_ASSERT(&root_node == &GetCurrentRoot());
1539
- }
1540
-
1541
- #ifdef JPH_DEBUG
1542
-
1543
- void QuadTree::ValidateTree(const BodyVector &inBodies, const TrackingVector &inTracking, uint32 inNodeIndex, uint32 inNumExpectedBodies) const
1544
- {
1545
- JPH_PROFILE_FUNCTION();
1546
-
1547
- // Root should be valid
1548
- JPH_ASSERT(inNodeIndex != cInvalidNodeIndex);
1549
-
1550
- // To avoid call overhead, create a stack in place
1551
- JPH_SUPPRESS_WARNING_PUSH
1552
- JPH_CLANG_SUPPRESS_WARNING("-Wunused-member-function") // The default constructor of StackEntry is unused when using Jolt's Array class but not when using std::vector
1553
- struct StackEntry
1554
- {
1555
- StackEntry() = default;
1556
- inline StackEntry(uint32 inNodeIndex, uint32 inParentNodeIndex) : mNodeIndex(inNodeIndex), mParentNodeIndex(inParentNodeIndex) { }
1557
-
1558
- uint32 mNodeIndex;
1559
- uint32 mParentNodeIndex;
1560
- };
1561
- JPH_SUPPRESS_WARNING_POP
1562
- Array<StackEntry, STLLocalAllocator<StackEntry, cStackSize>> stack;
1563
- stack.reserve(cStackSize);
1564
- stack.emplace_back(inNodeIndex, cInvalidNodeIndex);
1565
-
1566
- uint32 num_bodies = 0;
1567
-
1568
- do
1569
- {
1570
- // Copy entry from the stack
1571
- StackEntry cur_stack = stack.back();
1572
- stack.pop_back();
1573
-
1574
- // Validate parent
1575
- const Node &node = mAllocator->Get(cur_stack.mNodeIndex);
1576
- JPH_ASSERT(node.mParentNodeIndex == cur_stack.mParentNodeIndex);
1577
-
1578
- // Validate that when a parent is not-changed that all of its children are also
1579
- JPH_ASSERT(cur_stack.mParentNodeIndex == cInvalidNodeIndex || mAllocator->Get(cur_stack.mParentNodeIndex).mIsChanged || !node.mIsChanged);
1580
-
1581
- // Loop children
1582
- for (uint32 i = 0; i < 4; ++i)
1583
- {
1584
- NodeID child_node_id = node.mChildNodeID[i];
1585
- if (child_node_id.IsValid())
1586
- {
1587
- if (child_node_id.IsNode())
1588
- {
1589
- // Child is a node, recurse
1590
- uint32 child_idx = child_node_id.GetNodeIndex();
1591
- stack.emplace_back(child_idx, cur_stack.mNodeIndex);
1592
-
1593
- // Validate that the bounding box is bigger or equal to the bounds in the tree
1594
- // Bounding box could also be invalid if all children of our child were removed
1595
- AABox child_bounds;
1596
- node.GetChildBounds(i, child_bounds);
1597
- AABox real_child_bounds;
1598
- mAllocator->Get(child_idx).GetNodeBounds(real_child_bounds);
1599
- JPH_ASSERT(child_bounds.Contains(real_child_bounds) || !real_child_bounds.IsValid());
1600
- }
1601
- else
1602
- {
1603
- // Increment number of bodies found
1604
- ++num_bodies;
1605
-
1606
- // Check if tracker matches position of body
1607
- uint32 node_idx, child_idx;
1608
- GetBodyLocation(inTracking, child_node_id.GetBodyID(), node_idx, child_idx);
1609
- JPH_ASSERT(node_idx == cur_stack.mNodeIndex);
1610
- JPH_ASSERT(child_idx == i);
1611
-
1612
- // Validate that the body cached bounds still match the actual bounds
1613
- const Body *body = inBodies[child_node_id.GetBodyID().GetIndex()];
1614
- body->ValidateCachedBounds();
1615
-
1616
- // Validate that the node bounds are bigger or equal to the body bounds
1617
- AABox body_bounds;
1618
- node.GetChildBounds(i, body_bounds);
1619
- JPH_ASSERT(body_bounds.Contains(body->GetWorldSpaceBounds()));
1620
- }
1621
- }
1622
- }
1623
- }
1624
- while (!stack.empty());
1625
-
1626
- // Check that the amount of bodies in the tree matches our counter
1627
- JPH_ASSERT(num_bodies == inNumExpectedBodies);
1628
- }
1629
-
1630
- #endif
1631
-
1632
- #ifdef JPH_DUMP_BROADPHASE_TREE
1633
-
1634
- void QuadTree::DumpTree(const NodeID &inRoot, const char *inFileNamePrefix) const
1635
- {
1636
- // Open DOT file
1637
- std::ofstream f;
1638
- f.open(StringFormat("%s.dot", inFileNamePrefix).c_str(), std::ofstream::out | std::ofstream::trunc);
1639
- if (!f.is_open())
1640
- return;
1641
-
1642
- // Write header
1643
- f << "digraph {\n";
1644
-
1645
- // Iterate the entire tree
1646
- Array<NodeID, STLLocalAllocator<NodeID, cStackSize>> node_stack;
1647
- node_stack.reserve(cStackSize);
1648
- node_stack.push_back(inRoot);
1649
- JPH_ASSERT(inRoot.IsValid());
1650
- do
1651
- {
1652
- // Check if node is a body
1653
- NodeID node_id = node_stack.back();
1654
- node_stack.pop_back();
1655
- if (node_id.IsBody())
1656
- {
1657
- // Output body
1658
- String body_id = ConvertToString(node_id.GetBodyID().GetIndex());
1659
- f << "body" << body_id << "[label = \"Body " << body_id << "\"]\n";
1660
- }
1661
- else
1662
- {
1663
- // Process normal node
1664
- uint32 node_idx = node_id.GetNodeIndex();
1665
- const Node &node = mAllocator->Get(node_idx);
1666
-
1667
- // Get bounding box
1668
- AABox bounds;
1669
- node.GetNodeBounds(bounds);
1670
-
1671
- // Output node
1672
- String node_str = ConvertToString(node_idx);
1673
- f << "node" << node_str << "[label = \"Node " << node_str << "\nVolume: " << ConvertToString(bounds.GetVolume()) << "\" color=" << (node.mIsChanged? "red" : "black") << "]\n";
1674
-
1675
- // Recurse and get all children
1676
- for (NodeID child_node_id : node.mChildNodeID)
1677
- if (child_node_id.IsValid())
1678
- {
1679
- node_stack.push_back(child_node_id);
1680
-
1681
- // Output link
1682
- f << "node" << node_str << " -> ";
1683
- if (child_node_id.IsBody())
1684
- f << "body" << ConvertToString(child_node_id.GetBodyID().GetIndex());
1685
- else
1686
- f << "node" << ConvertToString(child_node_id.GetNodeIndex());
1687
- f << "\n";
1688
- }
1689
- }
1690
- }
1691
- while (!node_stack.empty());
1692
-
1693
- // Finish DOT file
1694
- f << "}\n";
1695
- f.close();
1696
-
1697
- // Convert to svg file
1698
- String cmd = StringFormat("dot %s.dot -Tsvg -o %s.svg", inFileNamePrefix, inFileNamePrefix);
1699
- system(cmd.c_str());
1700
- }
1701
-
1702
- #endif // JPH_DUMP_BROADPHASE_TREE
1703
-
1704
- #ifdef JPH_TRACK_BROADPHASE_STATS
1705
-
1706
- uint64 QuadTree::GetTicks100Pct(const LayerToStats &inLayer) const
1707
- {
1708
- uint64 total_ticks = 0;
1709
- for (const LayerToStats::value_type &kv : inLayer)
1710
- total_ticks += kv.second.mTotalTicks;
1711
- return total_ticks;
1712
- }
1713
-
1714
- void QuadTree::ReportStats(const char *inName, const LayerToStats &inLayer, uint64 inTicks100Pct) const
1715
- {
1716
- for (const LayerToStats::value_type &kv : inLayer)
1717
- {
1718
- double total_pct = 100.0 * double(kv.second.mTotalTicks) / double(inTicks100Pct);
1719
- double total_pct_excl_collector = 100.0 * double(kv.second.mTotalTicks - kv.second.mCollectorTicks) / double(inTicks100Pct);
1720
- double hits_reported_vs_bodies_visited = kv.second.mBodiesVisited > 0? 100.0 * double(kv.second.mHitsReported) / double(kv.second.mBodiesVisited) : 100.0;
1721
- double hits_reported_vs_nodes_visited = kv.second.mNodesVisited > 0? double(kv.second.mHitsReported) / double(kv.second.mNodesVisited) : -1.0;
1722
-
1723
- std::stringstream str;
1724
- str << inName << ", " << kv.first << ", " << mName << ", " << kv.second.mNumQueries << ", " << total_pct << ", " << total_pct_excl_collector << ", " << kv.second.mNodesVisited << ", " << kv.second.mBodiesVisited << ", " << kv.second.mHitsReported << ", " << hits_reported_vs_bodies_visited << ", " << hits_reported_vs_nodes_visited;
1725
- Trace(str.str().c_str());
1726
- }
1727
- }
1728
-
1729
- uint64 QuadTree::GetTicks100Pct() const
1730
- {
1731
- uint64 total_ticks = 0;
1732
- total_ticks += GetTicks100Pct(mCastRayStats);
1733
- total_ticks += GetTicks100Pct(mCollideAABoxStats);
1734
- total_ticks += GetTicks100Pct(mCollideSphereStats);
1735
- total_ticks += GetTicks100Pct(mCollidePointStats);
1736
- total_ticks += GetTicks100Pct(mCollideOrientedBoxStats);
1737
- total_ticks += GetTicks100Pct(mCastAABoxStats);
1738
- return total_ticks;
1739
- }
1740
-
1741
- void QuadTree::ReportStats(uint64 inTicks100Pct) const
1742
- {
1743
- unique_lock lock(mStatsMutex);
1744
- ReportStats("RayCast", mCastRayStats, inTicks100Pct);
1745
- ReportStats("CollideAABox", mCollideAABoxStats, inTicks100Pct);
1746
- ReportStats("CollideSphere", mCollideSphereStats, inTicks100Pct);
1747
- ReportStats("CollidePoint", mCollidePointStats, inTicks100Pct);
1748
- ReportStats("CollideOrientedBox", mCollideOrientedBoxStats, inTicks100Pct);
1749
- ReportStats("CastAABox", mCastAABoxStats, inTicks100Pct);
1750
- }
1751
-
1752
- #endif // JPH_TRACK_BROADPHASE_STATS
1753
-
1754
- uint QuadTree::GetMaxTreeDepth(const NodeID &inNodeID) const
1755
- {
1756
- // Reached a leaf?
1757
- if (!inNodeID.IsValid() || inNodeID.IsBody())
1758
- return 0;
1759
-
1760
- // Recurse to children
1761
- uint max_depth = 0;
1762
- const Node &node = mAllocator->Get(inNodeID.GetNodeIndex());
1763
- for (NodeID child_node_id : node.mChildNodeID)
1764
- max_depth = max(max_depth, GetMaxTreeDepth(child_node_id));
1765
- return max_depth + 1;
1766
- }
1767
-
1768
- JPH_NAMESPACE_END