@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,1780 +0,0 @@
1
- /*
2
- * bloom_jolt.cpp — Tier 1 implementation.
3
- *
4
- * Handle encoding:
5
- * bj_world → reinterpret_cast<WorldImpl *>
6
- * bj_shape → reinterpret_cast<const Shape *> (intrusive refcounted)
7
- * bj_body → (BodyID.GetIndexAndSequenceNumber() + 1) — shift by 1
8
- * so Jolt's valid id 0 doesn't collide with BJ_INVALID==0.
9
- * bj_constraint → reinterpret_cast<Constraint *> (intrusive refcounted)
10
- *
11
- * Thread safety: the contact listener is invoked from Jolt job threads.
12
- * We push events into a mutex-guarded queue; user code drains on the main
13
- * thread via bj_world_pop_contacts.
14
- */
15
-
16
- #include "bloom_jolt.h"
17
-
18
- #include <Jolt/Jolt.h>
19
- #include <Jolt/RegisterTypes.h>
20
- #include <Jolt/Core/Factory.h>
21
- #include <Jolt/Core/TempAllocator.h>
22
- #include <Jolt/Core/JobSystemThreadPool.h>
23
- #include <Jolt/Physics/PhysicsSettings.h>
24
- #include <Jolt/Physics/PhysicsSystem.h>
25
- #include <Jolt/Physics/Body/Body.h>
26
- #include <Jolt/Physics/Body/BodyCreationSettings.h>
27
- #include <Jolt/Physics/Body/BodyID.h>
28
- #include <Jolt/Physics/Body/BodyInterface.h>
29
- #include <Jolt/Physics/Body/BodyLock.h>
30
- #include <Jolt/Physics/Body/BodyLockMulti.h>
31
- #include <Jolt/Physics/Body/MotionType.h>
32
- #include <Jolt/Physics/Body/MotionQuality.h>
33
- #include <Jolt/Physics/Body/AllowedDOFs.h>
34
- #include <Jolt/Physics/EActivation.h>
35
- #include <Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h>
36
- #include <Jolt/Physics/Collision/ObjectLayer.h>
37
- #include <Jolt/Physics/Collision/RayCast.h>
38
- #include <Jolt/Physics/Collision/ShapeCast.h>
39
- #include <Jolt/Physics/Collision/CastResult.h>
40
- #include <Jolt/Physics/Collision/CollisionCollectorImpl.h>
41
- #include <Jolt/Physics/Collision/CollidePointResult.h>
42
- #include <Jolt/Physics/Collision/CollideShape.h>
43
- #include <Jolt/Physics/Collision/ContactListener.h>
44
- #include <Jolt/Physics/Collision/NarrowPhaseQuery.h>
45
- #include <Jolt/Physics/Collision/ShapeFilter.h>
46
- #include <Jolt/Physics/Collision/Shape/BoxShape.h>
47
- #include <Jolt/Physics/Collision/Shape/SphereShape.h>
48
- #include <Jolt/Physics/Collision/Shape/CapsuleShape.h>
49
- #include <Jolt/Physics/Collision/Shape/CylinderShape.h>
50
- #include <Jolt/Physics/Collision/Shape/ConvexHullShape.h>
51
- #include <Jolt/Physics/Collision/Shape/MeshShape.h>
52
- #include <Jolt/Physics/Collision/Shape/HeightFieldShape.h>
53
- #include <Jolt/Physics/Collision/Shape/StaticCompoundShape.h>
54
- #include <Jolt/Physics/Collision/Shape/ScaledShape.h>
55
- #include <Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.h>
56
- #include <Jolt/Physics/Constraints/Constraint.h>
57
- #include <Jolt/Physics/Constraints/FixedConstraint.h>
58
- #include <Jolt/Physics/Constraints/PointConstraint.h>
59
- #include <Jolt/Physics/Constraints/HingeConstraint.h>
60
- #include <Jolt/Physics/Constraints/SliderConstraint.h>
61
- #include <Jolt/Physics/Constraints/DistanceConstraint.h>
62
- #include <Jolt/Physics/Constraints/SixDOFConstraint.h>
63
- #include <Jolt/Physics/Character/CharacterVirtual.h>
64
- #include <Jolt/Physics/SoftBody/SoftBodyCreationSettings.h>
65
- #include <Jolt/Physics/SoftBody/SoftBodySharedSettings.h>
66
- #include <Jolt/Physics/SoftBody/SoftBodyMotionProperties.h>
67
- #include <Jolt/Physics/Vehicle/VehicleConstraint.h>
68
- #include <Jolt/Physics/Vehicle/WheeledVehicleController.h>
69
- #include <Jolt/Physics/Vehicle/VehicleCollisionTester.h>
70
- #include <Jolt/Physics/Vehicle/VehicleDifferential.h>
71
-
72
- #include <algorithm>
73
- #include <atomic>
74
- #include <cstring>
75
- #include <mutex>
76
- #include <thread>
77
- #include <vector>
78
-
79
- using namespace JPH;
80
-
81
- /* ================================================================== */
82
- /* Anonymous namespace: helper types */
83
- /* ================================================================== */
84
-
85
- namespace {
86
-
87
- std::atomic<int> g_init_refcount{0};
88
-
89
- /* ---- Broadphase layers ---- */
90
- enum : uint8_t {
91
- BP_NON_MOVING = 0,
92
- BP_MOVING = 1,
93
- BP_COUNT = 2
94
- };
95
-
96
- class BPLayerInterfaceImpl final : public BroadPhaseLayerInterface {
97
- public:
98
- JPH::uint GetNumBroadPhaseLayers() const override { return BP_COUNT; }
99
- BroadPhaseLayer GetBroadPhaseLayer(ObjectLayer layer) const override {
100
- return layer == (ObjectLayer)BJ_LAYER_NON_MOVING
101
- ? BroadPhaseLayer(BP_NON_MOVING)
102
- : BroadPhaseLayer(BP_MOVING);
103
- }
104
- #if defined(JPH_EXTERNAL_PROFILE) || defined(JPH_PROFILE_ENABLED)
105
- const char *GetBroadPhaseLayerName(BroadPhaseLayer layer) const override {
106
- switch ((BroadPhaseLayer::Type)layer) {
107
- case (BroadPhaseLayer::Type)BP_NON_MOVING: return "NON_MOVING";
108
- case (BroadPhaseLayer::Type)BP_MOVING: return "MOVING";
109
- default: return "INVALID";
110
- }
111
- }
112
- #endif
113
- };
114
-
115
- class ObjectVsBPFilter final : public ObjectVsBroadPhaseLayerFilter {
116
- public:
117
- bool ShouldCollide(ObjectLayer object, BroadPhaseLayer broad) const override {
118
- if (object == (ObjectLayer)BJ_LAYER_NON_MOVING) {
119
- return broad == BroadPhaseLayer(BP_MOVING);
120
- }
121
- return true;
122
- }
123
- };
124
-
125
- class ObjectLayerPairFilterMatrix final : public ObjectLayerPairFilter {
126
- public:
127
- ObjectLayerPairFilterMatrix() {
128
- std::memset(m_matrix, 0xFF, sizeof(m_matrix));
129
- set(BJ_LAYER_NON_MOVING, BJ_LAYER_NON_MOVING, false);
130
- }
131
- bool ShouldCollide(ObjectLayer a, ObjectLayer b) const override {
132
- if (a >= BJ_MAX_OBJECT_LAYERS || b >= BJ_MAX_OBJECT_LAYERS) return false;
133
- return (m_matrix[a] & (uint16_t(1) << b)) != 0;
134
- }
135
- void set(uint32_t a, uint32_t b, bool collides) {
136
- if (a >= BJ_MAX_OBJECT_LAYERS || b >= BJ_MAX_OBJECT_LAYERS) return;
137
- if (collides) {
138
- m_matrix[a] |= uint16_t(1) << b;
139
- m_matrix[b] |= uint16_t(1) << a;
140
- } else {
141
- m_matrix[a] &= ~(uint16_t(1) << b);
142
- m_matrix[b] &= ~(uint16_t(1) << a);
143
- }
144
- }
145
- bool get(uint32_t a, uint32_t b) const {
146
- if (a >= BJ_MAX_OBJECT_LAYERS || b >= BJ_MAX_OBJECT_LAYERS) return false;
147
- return (m_matrix[a] & (uint16_t(1) << b)) != 0;
148
- }
149
- private:
150
- uint16_t m_matrix[BJ_MAX_OBJECT_LAYERS];
151
- };
152
-
153
- /* ---- Filter for queries that respect a caller-provided layer mask ---- */
154
-
155
- class LayerMaskObjectFilter final : public ObjectLayerFilter {
156
- public:
157
- explicit LayerMaskObjectFilter(uint32_t mask) : m_mask(mask) {}
158
- bool ShouldCollide(ObjectLayer layer) const override {
159
- if (layer >= 32) return true; /* layers 16-31 not yet partitioned; pass through */
160
- return (m_mask & (uint32_t(1) << layer)) != 0;
161
- }
162
- private:
163
- uint32_t m_mask;
164
- };
165
-
166
- class LayerMaskBPFilter final : public BroadPhaseLayerFilter {
167
- public:
168
- explicit LayerMaskBPFilter(uint32_t mask) : m_mask(mask) {}
169
- bool ShouldCollide(BroadPhaseLayer layer) const override {
170
- /* BP_NON_MOVING contains object layer 0; BP_MOVING contains object layers 1..15. */
171
- uint8_t bp = (BroadPhaseLayer::Type)layer;
172
- if (bp == BP_NON_MOVING) return (m_mask & 0x1u) != 0;
173
- if (bp == BP_MOVING) return (m_mask & 0xFFFEu) != 0;
174
- return true;
175
- }
176
- private:
177
- uint32_t m_mask;
178
- };
179
-
180
- /* ---- Contact listener → drainable event queue ---- */
181
-
182
- struct WorldImpl; /* forward */
183
-
184
- class ContactQueue final : public ContactListener {
185
- public:
186
- void OnContactAdded(const Body &body1, const Body &body2,
187
- const ContactManifold &manifold,
188
- ContactSettings &settings) override
189
- {
190
- push(BJ_CONTACT_ADDED, body1, body2, &manifold, &settings);
191
- }
192
- void OnContactPersisted(const Body &body1, const Body &body2,
193
- const ContactManifold &manifold,
194
- ContactSettings &settings) override
195
- {
196
- push(BJ_CONTACT_PERSISTED, body1, body2, &manifold, &settings);
197
- }
198
- void OnContactRemoved(const SubShapeIDPair &pair) override
199
- {
200
- bj_contact c{};
201
- c.event = BJ_CONTACT_REMOVED;
202
- c.body_a = encode_body_id(pair.GetBody1ID());
203
- c.body_b = encode_body_id(pair.GetBody2ID());
204
- std::lock_guard<std::mutex> lock(m_mutex);
205
- m_events.push_back(c);
206
- }
207
-
208
- uint32_t count() {
209
- std::lock_guard<std::mutex> lock(m_mutex);
210
- return (uint32_t)m_events.size();
211
- }
212
-
213
- uint32_t drain(bj_contact *out, uint32_t max_out) {
214
- if (!out || max_out == 0) return 0;
215
- std::lock_guard<std::mutex> lock(m_mutex);
216
- uint32_t n = std::min<uint32_t>(max_out, (uint32_t)m_events.size());
217
- for (uint32_t i = 0; i < n; ++i) out[i] = m_events[i];
218
- m_events.erase(m_events.begin(), m_events.begin() + n);
219
- return n;
220
- }
221
-
222
- void clear() {
223
- std::lock_guard<std::mutex> lock(m_mutex);
224
- m_events.clear();
225
- }
226
-
227
- private:
228
- static bj_vec3 from_vec3(Vec3 v) { return { v.GetX(), v.GetY(), v.GetZ() }; }
229
- static bj_body encode_body_id(BodyID id) {
230
- uint32_t raw = id.GetIndexAndSequenceNumber();
231
- return raw == BodyID::cInvalidBodyID ? BJ_INVALID : (bj_body)(uint64_t(raw) + 1u);
232
- }
233
- void push(bj_contact_event ev, const Body &b1, const Body &b2,
234
- const ContactManifold *m, const ContactSettings *s)
235
- {
236
- bj_contact c{};
237
- c.event = ev;
238
- c.body_a = encode_body_id(b1.GetID());
239
- c.body_b = encode_body_id(b2.GetID());
240
- if (m) {
241
- Vec3 base(m->mBaseOffset.GetX(), m->mBaseOffset.GetY(), m->mBaseOffset.GetZ());
242
- Vec3 p1 = m->mRelativeContactPointsOn1.empty()
243
- ? base
244
- : base + m->mRelativeContactPointsOn1[0];
245
- Vec3 p2 = m->mRelativeContactPointsOn2.empty()
246
- ? base
247
- : base + m->mRelativeContactPointsOn2[0];
248
- c.point_a = from_vec3(p1);
249
- c.point_b = from_vec3(p2);
250
- c.normal = from_vec3(m->mWorldSpaceNormal);
251
- c.penetration_depth = m->mPenetrationDepth;
252
- }
253
- if (s) {
254
- c.combined_friction = s->mCombinedFriction;
255
- c.combined_restitution = s->mCombinedRestitution;
256
- }
257
- std::lock_guard<std::mutex> lock(m_mutex);
258
- m_events.push_back(c);
259
- }
260
-
261
- std::mutex m_mutex;
262
- std::vector<bj_contact> m_events;
263
- };
264
-
265
- /* ---- World ---- */
266
-
267
- struct WorldImpl {
268
- TempAllocatorImpl *temp_alloc = nullptr;
269
- JobSystemThreadPool *jobs = nullptr;
270
- BPLayerInterfaceImpl bp_layer_interface;
271
- ObjectVsBPFilter object_vs_bp_filter;
272
- ObjectLayerPairFilterMatrix layer_pair_filter;
273
- PhysicsSystem system;
274
- ContactQueue contacts;
275
- };
276
-
277
- /* ---- Encode / decode ---- */
278
-
279
- inline WorldImpl *as_world(bj_world w) { return reinterpret_cast<WorldImpl *>(w); }
280
- inline bj_world as_handle(WorldImpl *w) { return reinterpret_cast<bj_world>(w); }
281
-
282
- inline bj_body encode_body_id(BodyID id) {
283
- uint32_t raw = id.GetIndexAndSequenceNumber();
284
- return raw == BodyID::cInvalidBodyID ? BJ_INVALID : (bj_body)(uint64_t(raw) + 1u);
285
- }
286
- inline BodyID decode_body_id(bj_body b) {
287
- if (b == BJ_INVALID) return BodyID();
288
- return BodyID((uint32_t)(b - 1u));
289
- }
290
-
291
- inline bj_shape encode_shape(const Shape *s) {
292
- if (!s) return BJ_INVALID;
293
- s->AddRef(); /* handle owns one ref */
294
- return reinterpret_cast<bj_shape>(s);
295
- }
296
- inline const Shape *decode_shape(bj_shape h) {
297
- return reinterpret_cast<const Shape *>(h);
298
- }
299
-
300
- inline bj_constraint encode_constraint(Constraint *c) {
301
- if (!c) return BJ_INVALID;
302
- c->AddRef();
303
- return reinterpret_cast<bj_constraint>(c);
304
- }
305
- inline Constraint *decode_constraint(bj_constraint h) {
306
- return reinterpret_cast<Constraint *>(h);
307
- }
308
-
309
- /* ---- Vec3/Quat conversion ---- */
310
-
311
- inline Vec3 to_jph(bj_vec3 v) { return Vec3(v.x, v.y, v.z); }
312
- inline Quat to_jph(bj_quat q) { return Quat(q.x, q.y, q.z, q.w); }
313
- inline bj_vec3 from_jph(Vec3 v) { return { v.GetX(), v.GetY(), v.GetZ() }; }
314
- inline bj_quat from_jph(Quat q) { return { q.GetX(), q.GetY(), q.GetZ(), q.GetW() }; }
315
- /* In single-precision builds RVec3 == Vec3, so to_jph/from_jph cover both. */
316
-
317
- inline EMotionType to_motion(bj_motion_type t) {
318
- switch (t) {
319
- case BJ_MOTION_STATIC: return EMotionType::Static;
320
- case BJ_MOTION_KINEMATIC: return EMotionType::Kinematic;
321
- case BJ_MOTION_DYNAMIC: return EMotionType::Dynamic;
322
- }
323
- return EMotionType::Dynamic;
324
- }
325
- inline bj_motion_type from_motion(EMotionType t) {
326
- switch (t) {
327
- case EMotionType::Static: return BJ_MOTION_STATIC;
328
- case EMotionType::Kinematic: return BJ_MOTION_KINEMATIC;
329
- case EMotionType::Dynamic: return BJ_MOTION_DYNAMIC;
330
- }
331
- return BJ_MOTION_DYNAMIC;
332
- }
333
- inline EActivation to_activation(bj_activation a) {
334
- return a == BJ_ACTIVATE ? EActivation::Activate : EActivation::DontActivate;
335
- }
336
-
337
- /* Run `build` under a multi-body write lock and add the resulting constraint
338
- * to the world. If body_b is BJ_INVALID, the world-fixed body is used. */
339
- template <typename Build>
340
- bj_constraint make_constraint(WorldImpl *w, const bj_constraint_anchors *a, Build &&build) {
341
- BodyID id1 = decode_body_id(a->body_a);
342
- BodyID id2 = (a->body_b != BJ_INVALID) ? decode_body_id(a->body_b) : BodyID();
343
- BodyID ids[2] = { id1, id2 };
344
- const int count = (a->body_b != BJ_INVALID) ? 2 : 1;
345
- BodyLockMultiWrite lock(w->system.GetBodyLockInterface(), ids, count);
346
- Body *b1 = lock.GetBody(0);
347
- Body *b2 = (count == 2) ? lock.GetBody(1) : &Body::sFixedToWorld;
348
- if (!b1 || !b2) return BJ_INVALID;
349
- TwoBodyConstraint *c = build(*b1, *b2);
350
- if (!c) return BJ_INVALID;
351
- w->system.AddConstraint(c);
352
- return encode_constraint(c);
353
- }
354
-
355
- } /* anonymous namespace */
356
-
357
- /* ================================================================== */
358
- /* IMPLEMENTATIONS */
359
- /* ================================================================== */
360
-
361
- extern "C" {
362
-
363
- /* ---- Global ---- */
364
-
365
- bj_result bj_global_init(void) {
366
- if (g_init_refcount.fetch_add(1) == 0) {
367
- RegisterDefaultAllocator();
368
- Factory::sInstance = new Factory();
369
- RegisterTypes();
370
- }
371
- return BJ_OK;
372
- }
373
-
374
- void bj_global_shutdown(void) {
375
- int prev = g_init_refcount.fetch_sub(1);
376
- if (prev == 1) {
377
- UnregisterTypes();
378
- delete Factory::sInstance;
379
- Factory::sInstance = nullptr;
380
- }
381
- }
382
-
383
- const char *bj_version_string(void) {
384
- return "Jolt 5.5.0 / bloom_jolt 0.1";
385
- }
386
-
387
- /* ---- World ---- */
388
-
389
- bj_world bj_world_create(const bj_world_desc *desc) {
390
- if (!desc) return BJ_INVALID;
391
- if (g_init_refcount.load() == 0) return BJ_INVALID;
392
-
393
- const uint32_t max_bodies =
394
- desc->max_bodies ? desc->max_bodies : 65536u;
395
- const uint32_t max_body_pairs =
396
- desc->max_body_pairs ? desc->max_body_pairs : 65536u;
397
- const uint32_t max_contact_constraints =
398
- desc->max_contact_constraints ? desc->max_contact_constraints : 10240u;
399
- const int num_threads = desc->num_threads
400
- ? (int)desc->num_threads
401
- : std::max(1, (int)std::thread::hardware_concurrency() - 1);
402
- const uint32_t temp_alloc_bytes =
403
- desc->temp_allocator_bytes ? desc->temp_allocator_bytes : (10u * 1024u * 1024u);
404
-
405
- auto *w = new WorldImpl();
406
- w->temp_alloc = new TempAllocatorImpl(temp_alloc_bytes);
407
- w->jobs = new JobSystemThreadPool(cMaxPhysicsJobs, cMaxPhysicsBarriers, num_threads);
408
-
409
- w->system.Init(
410
- max_bodies, /*numBodyMutexes=*/0,
411
- max_body_pairs, max_contact_constraints,
412
- w->bp_layer_interface, w->object_vs_bp_filter, w->layer_pair_filter
413
- );
414
- w->system.SetGravity(to_jph(desc->gravity));
415
- w->system.SetContactListener(&w->contacts);
416
- return as_handle(w);
417
- }
418
-
419
- void bj_world_destroy(bj_world world) {
420
- WorldImpl *w = as_world(world);
421
- if (!w) return;
422
- delete w->jobs;
423
- delete w->temp_alloc;
424
- delete w;
425
- }
426
-
427
- void bj_world_set_gravity(bj_world world, bj_vec3 gravity) {
428
- if (auto *w = as_world(world)) w->system.SetGravity(to_jph(gravity));
429
- }
430
-
431
- void bj_world_get_gravity(bj_world world, bj_vec3 *out) {
432
- if (!out) return;
433
- if (auto *w = as_world(world)) *out = from_jph(w->system.GetGravity());
434
- else *out = { 0.0f, 0.0f, 0.0f };
435
- }
436
-
437
- void bj_world_optimize_broadphase(bj_world world) {
438
- if (auto *w = as_world(world)) w->system.OptimizeBroadPhase();
439
- }
440
-
441
- bj_result bj_world_step(bj_world world, float delta_time, uint32_t collision_steps) {
442
- WorldImpl *w = as_world(world);
443
- if (!w) return BJ_ERR_INVALID_HANDLE;
444
- const int steps = collision_steps ? (int)collision_steps : 1;
445
- EPhysicsUpdateError err = w->system.Update(delta_time, steps, w->temp_alloc, w->jobs);
446
- return err == EPhysicsUpdateError::None ? BJ_OK : BJ_ERR_OUT_OF_MEMORY;
447
- }
448
-
449
- void bj_world_set_layer_collides(bj_world world, uint32_t a, uint32_t b, uint8_t collides) {
450
- if (auto *w = as_world(world)) w->layer_pair_filter.set(a, b, collides != 0);
451
- }
452
-
453
- uint8_t bj_world_get_layer_collides(bj_world world, uint32_t a, uint32_t b) {
454
- if (auto *w = as_world(world)) return w->layer_pair_filter.get(a, b) ? 1 : 0;
455
- return 0;
456
- }
457
-
458
- uint32_t bj_world_body_count(bj_world world) {
459
- if (auto *w = as_world(world)) return w->system.GetNumBodies();
460
- return 0;
461
- }
462
-
463
- uint32_t bj_world_active_body_count(bj_world world) {
464
- if (auto *w = as_world(world)) return w->system.GetNumActiveBodies(EBodyType::RigidBody);
465
- return 0;
466
- }
467
-
468
- /* ================================================================== */
469
- /* Shapes */
470
- /* ================================================================== */
471
-
472
- bj_shape bj_shape_box(bj_vec3 half_extents, float convex_radius) {
473
- BoxShapeSettings settings(to_jph(half_extents), convex_radius);
474
- auto result = settings.Create();
475
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
476
- }
477
-
478
- bj_shape bj_shape_sphere(float radius) {
479
- SphereShapeSettings settings(radius);
480
- auto result = settings.Create();
481
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
482
- }
483
-
484
- bj_shape bj_shape_capsule(float half_height, float radius) {
485
- CapsuleShapeSettings settings(half_height, radius);
486
- auto result = settings.Create();
487
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
488
- }
489
-
490
- bj_shape bj_shape_cylinder(float half_height, float radius, float convex_radius) {
491
- CylinderShapeSettings settings(half_height, radius, convex_radius);
492
- auto result = settings.Create();
493
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
494
- }
495
-
496
- bj_shape bj_shape_convex_hull(const bj_vec3 *points, uint32_t count, float convex_radius) {
497
- if (!points || count < 3) return BJ_INVALID;
498
- Array<Vec3> pts;
499
- pts.reserve(count);
500
- for (uint32_t i = 0; i < count; ++i) pts.push_back(to_jph(points[i]));
501
- ConvexHullShapeSettings settings(pts, convex_radius);
502
- auto result = settings.Create();
503
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
504
- }
505
-
506
- bj_shape bj_shape_mesh(const bj_vec3 *vertices, uint32_t vertex_count,
507
- const uint32_t *indices, uint32_t triangle_count)
508
- {
509
- if (!vertices || !indices || vertex_count == 0 || triangle_count == 0) return BJ_INVALID;
510
- VertexList v_list;
511
- v_list.reserve(vertex_count);
512
- for (uint32_t i = 0; i < vertex_count; ++i) {
513
- v_list.push_back(Float3(vertices[i].x, vertices[i].y, vertices[i].z));
514
- }
515
- IndexedTriangleList t_list;
516
- t_list.reserve(triangle_count);
517
- for (uint32_t i = 0; i < triangle_count; ++i) {
518
- t_list.push_back(IndexedTriangle(indices[i*3+0], indices[i*3+1], indices[i*3+2], 0));
519
- }
520
- MeshShapeSettings settings(std::move(v_list), std::move(t_list));
521
- settings.Sanitize();
522
- auto result = settings.Create();
523
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
524
- }
525
-
526
- bj_shape bj_shape_heightfield(const float *samples, uint32_t sample_count,
527
- bj_vec3 offset, bj_vec3 scale, uint32_t block_size)
528
- {
529
- if (!samples || sample_count < 2) return BJ_INVALID;
530
- HeightFieldShapeSettings settings(
531
- samples,
532
- to_jph(offset),
533
- to_jph(scale),
534
- sample_count
535
- );
536
- settings.mBlockSize = block_size ? block_size : 4u;
537
- auto result = settings.Create();
538
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
539
- }
540
-
541
- bj_shape bj_shape_compound_static(const bj_shape *shapes,
542
- const bj_transform *local_transforms,
543
- uint32_t count)
544
- {
545
- if (!shapes || !local_transforms || count == 0) return BJ_INVALID;
546
- StaticCompoundShapeSettings settings;
547
- for (uint32_t i = 0; i < count; ++i) {
548
- const Shape *child = decode_shape(shapes[i]);
549
- if (!child) return BJ_INVALID;
550
- settings.AddShape(
551
- to_jph(local_transforms[i].position),
552
- to_jph(local_transforms[i].rotation),
553
- child
554
- );
555
- }
556
- /* StaticCompoundShape::Create needs a temp allocator + job system for parallel BVH build.
557
- * For simplicity we use the default (nullptr = single-threaded build). */
558
- auto result = settings.Create();
559
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
560
- }
561
-
562
- bj_shape bj_shape_scaled(bj_shape base, bj_vec3 scale) {
563
- const Shape *inner = decode_shape(base);
564
- if (!inner) return BJ_INVALID;
565
- ScaledShapeSettings settings(inner, to_jph(scale));
566
- auto result = settings.Create();
567
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
568
- }
569
-
570
- bj_shape bj_shape_offset_com(bj_shape base, bj_vec3 offset) {
571
- const Shape *inner = decode_shape(base);
572
- if (!inner) return BJ_INVALID;
573
- OffsetCenterOfMassShapeSettings settings(to_jph(offset), inner);
574
- auto result = settings.Create();
575
- return result.IsValid() ? encode_shape(result.Get().GetPtr()) : BJ_INVALID;
576
- }
577
-
578
- void bj_shape_add_ref(bj_shape h) { if (auto *s = decode_shape(h)) s->AddRef(); }
579
- void bj_shape_release(bj_shape h) { if (auto *s = decode_shape(h)) s->Release(); }
580
-
581
- void bj_shape_get_local_bounds(bj_shape h, bj_vec3 *out_min, bj_vec3 *out_max) {
582
- if (auto *s = decode_shape(h)) {
583
- AABox b = s->GetLocalBounds();
584
- if (out_min) *out_min = from_jph(b.mMin);
585
- if (out_max) *out_max = from_jph(b.mMax);
586
- } else {
587
- if (out_min) *out_min = { 0, 0, 0 };
588
- if (out_max) *out_max = { 0, 0, 0 };
589
- }
590
- }
591
-
592
- float bj_shape_get_volume(bj_shape h) {
593
- if (auto *s = decode_shape(h)) return s->GetVolume();
594
- return 0.0f;
595
- }
596
-
597
- /* ================================================================== */
598
- /* Bodies */
599
- /* ================================================================== */
600
-
601
- bj_body bj_body_create(bj_world world, bj_shape shape, const bj_body_desc *desc) {
602
- WorldImpl *w = as_world(world);
603
- if (!w || !desc) return BJ_INVALID;
604
- const Shape *s = decode_shape(shape);
605
- if (!s) return BJ_INVALID;
606
-
607
- BodyCreationSettings settings(
608
- s,
609
- to_jph(desc->position),
610
- to_jph(desc->rotation),
611
- to_motion(desc->motion_type),
612
- (ObjectLayer)desc->object_layer
613
- );
614
- settings.mLinearVelocity = to_jph(desc->linear_velocity);
615
- settings.mAngularVelocity = to_jph(desc->angular_velocity);
616
- settings.mGravityFactor = desc->gravity_factor;
617
- settings.mLinearDamping = desc->linear_damping;
618
- settings.mAngularDamping = desc->angular_damping;
619
- settings.mFriction = desc->friction;
620
- settings.mRestitution = desc->restitution;
621
- settings.mIsSensor = desc->is_sensor != 0;
622
- settings.mAllowSleeping = desc->allow_sleeping != 0;
623
- settings.mMotionQuality =
624
- desc->use_ccd ? EMotionQuality::LinearCast : EMotionQuality::Discrete;
625
- settings.mUserData = desc->user_data;
626
-
627
- if (desc->mass_override > 0.0f) {
628
- settings.mOverrideMassProperties = EOverrideMassProperties::MassAndInertiaProvided;
629
- settings.mMassPropertiesOverride.mMass = desc->mass_override;
630
- Vec3 inertia_diag = to_jph(desc->inertia_diag_override);
631
- if (inertia_diag.LengthSq() > 0.0f) {
632
- settings.mMassPropertiesOverride.mInertia =
633
- Mat44::sScale(inertia_diag);
634
- } else {
635
- /* Auto-compute inertia from shape but scale by the mass ratio. */
636
- settings.mOverrideMassProperties =
637
- EOverrideMassProperties::CalculateInertia;
638
- settings.mMassPropertiesOverride.mMass = desc->mass_override;
639
- }
640
- }
641
-
642
- BodyInterface &bi = w->system.GetBodyInterface();
643
- EActivation act = desc->start_awake ? EActivation::Activate : EActivation::DontActivate;
644
- BodyID id = bi.CreateAndAddBody(settings, act);
645
- return encode_body_id(id);
646
- }
647
-
648
- void bj_body_destroy(bj_world world, bj_body body) {
649
- WorldImpl *w = as_world(world);
650
- if (!w || body == BJ_INVALID) return;
651
- BodyInterface &bi = w->system.GetBodyInterface();
652
- BodyID id = decode_body_id(body);
653
- if (bi.IsAdded(id)) bi.RemoveBody(id);
654
- bi.DestroyBody(id);
655
- }
656
-
657
- void bj_body_activate(bj_world world, bj_body body) {
658
- WorldImpl *w = as_world(world);
659
- if (!w || body == BJ_INVALID) return;
660
- w->system.GetBodyInterface().ActivateBody(decode_body_id(body));
661
- }
662
-
663
- void bj_body_deactivate(bj_world world, bj_body body) {
664
- WorldImpl *w = as_world(world);
665
- if (!w || body == BJ_INVALID) return;
666
- w->system.GetBodyInterface().DeactivateBody(decode_body_id(body));
667
- }
668
-
669
- uint8_t bj_body_is_active(bj_world world, bj_body body) {
670
- WorldImpl *w = as_world(world);
671
- if (!w || body == BJ_INVALID) return 0;
672
- return w->system.GetBodyInterface().IsActive(decode_body_id(body)) ? 1 : 0;
673
- }
674
-
675
- uint8_t bj_body_is_valid(bj_world world, bj_body body) {
676
- WorldImpl *w = as_world(world);
677
- if (!w || body == BJ_INVALID) return 0;
678
- return w->system.GetBodyInterface().IsAdded(decode_body_id(body)) ? 1 : 0;
679
- }
680
-
681
- void bj_body_get_transform(bj_world world, bj_body body, bj_transform *out) {
682
- if (!out) return;
683
- WorldImpl *w = as_world(world);
684
- if (!w || body == BJ_INVALID) {
685
- *out = { { 0, 0, 0 }, { 0, 0, 0, 1 } };
686
- return;
687
- }
688
- RVec3 p;
689
- Quat q;
690
- w->system.GetBodyInterface().GetPositionAndRotation(decode_body_id(body), p, q);
691
- out->position = from_jph(p);
692
- out->rotation = from_jph(q);
693
- }
694
-
695
- void bj_body_set_transform(bj_world world, bj_body body, const bj_transform *xform, bj_activation act) {
696
- WorldImpl *w = as_world(world);
697
- if (!w || !xform || body == BJ_INVALID) return;
698
- w->system.GetBodyInterface().SetPositionAndRotation(
699
- decode_body_id(body),
700
- to_jph(xform->position),
701
- to_jph(xform->rotation),
702
- to_activation(act)
703
- );
704
- }
705
-
706
- void bj_body_get_position(bj_world world, bj_body body, bj_vec3 *out) {
707
- if (!out) return;
708
- WorldImpl *w = as_world(world);
709
- if (!w || body == BJ_INVALID) { *out = { 0, 0, 0 }; return; }
710
- *out = from_jph(w->system.GetBodyInterface().GetPosition(decode_body_id(body)));
711
- }
712
-
713
- void bj_body_get_rotation(bj_world world, bj_body body, bj_quat *out) {
714
- if (!out) return;
715
- WorldImpl *w = as_world(world);
716
- if (!w || body == BJ_INVALID) { *out = { 0, 0, 0, 1 }; return; }
717
- *out = from_jph(w->system.GetBodyInterface().GetRotation(decode_body_id(body)));
718
- }
719
-
720
- void bj_body_set_position(bj_world world, bj_body body, bj_vec3 pos, bj_activation act) {
721
- WorldImpl *w = as_world(world);
722
- if (!w || body == BJ_INVALID) return;
723
- w->system.GetBodyInterface().SetPosition(decode_body_id(body), to_jph(pos), to_activation(act));
724
- }
725
-
726
- void bj_body_set_rotation(bj_world world, bj_body body, bj_quat rot, bj_activation act) {
727
- WorldImpl *w = as_world(world);
728
- if (!w || body == BJ_INVALID) return;
729
- w->system.GetBodyInterface().SetRotation(decode_body_id(body), to_jph(rot), to_activation(act));
730
- }
731
-
732
- void bj_body_move_kinematic(bj_world world, bj_body body, const bj_transform *target, float dt) {
733
- WorldImpl *w = as_world(world);
734
- if (!w || !target || body == BJ_INVALID || dt <= 0.0f) return;
735
- w->system.GetBodyInterface().MoveKinematic(
736
- decode_body_id(body), to_jph(target->position), to_jph(target->rotation), dt
737
- );
738
- }
739
-
740
- void bj_body_get_linear_velocity(bj_world world, bj_body body, bj_vec3 *out) {
741
- if (!out) return;
742
- WorldImpl *w = as_world(world);
743
- if (!w || body == BJ_INVALID) { *out = { 0, 0, 0 }; return; }
744
- *out = from_jph(w->system.GetBodyInterface().GetLinearVelocity(decode_body_id(body)));
745
- }
746
-
747
- void bj_body_get_angular_velocity(bj_world world, bj_body body, bj_vec3 *out) {
748
- if (!out) return;
749
- WorldImpl *w = as_world(world);
750
- if (!w || body == BJ_INVALID) { *out = { 0, 0, 0 }; return; }
751
- *out = from_jph(w->system.GetBodyInterface().GetAngularVelocity(decode_body_id(body)));
752
- }
753
-
754
- void bj_body_set_linear_velocity(bj_world world, bj_body body, bj_vec3 v) {
755
- WorldImpl *w = as_world(world);
756
- if (!w || body == BJ_INVALID) return;
757
- w->system.GetBodyInterface().SetLinearVelocity(decode_body_id(body), to_jph(v));
758
- }
759
-
760
- void bj_body_set_angular_velocity(bj_world world, bj_body body, bj_vec3 v) {
761
- WorldImpl *w = as_world(world);
762
- if (!w || body == BJ_INVALID) return;
763
- w->system.GetBodyInterface().SetAngularVelocity(decode_body_id(body), to_jph(v));
764
- }
765
-
766
- void bj_body_get_point_velocity(bj_world world, bj_body body, bj_vec3 world_point, bj_vec3 *out) {
767
- if (!out) return;
768
- WorldImpl *w = as_world(world);
769
- if (!w || body == BJ_INVALID) { *out = { 0, 0, 0 }; return; }
770
- *out = from_jph(w->system.GetBodyInterface().GetPointVelocity(decode_body_id(body), to_jph(world_point)));
771
- }
772
-
773
- void bj_body_add_force(bj_world world, bj_body body, bj_vec3 f) {
774
- WorldImpl *w = as_world(world);
775
- if (!w || body == BJ_INVALID) return;
776
- w->system.GetBodyInterface().AddForce(decode_body_id(body), to_jph(f));
777
- }
778
-
779
- void bj_body_add_impulse(bj_world world, bj_body body, bj_vec3 i) {
780
- WorldImpl *w = as_world(world);
781
- if (!w || body == BJ_INVALID) return;
782
- w->system.GetBodyInterface().AddImpulse(decode_body_id(body), to_jph(i));
783
- }
784
-
785
- void bj_body_add_torque(bj_world world, bj_body body, bj_vec3 t) {
786
- WorldImpl *w = as_world(world);
787
- if (!w || body == BJ_INVALID) return;
788
- w->system.GetBodyInterface().AddTorque(decode_body_id(body), to_jph(t));
789
- }
790
-
791
- void bj_body_add_angular_impulse(bj_world world, bj_body body, bj_vec3 i) {
792
- WorldImpl *w = as_world(world);
793
- if (!w || body == BJ_INVALID) return;
794
- w->system.GetBodyInterface().AddAngularImpulse(decode_body_id(body), to_jph(i));
795
- }
796
-
797
- void bj_body_add_force_at(bj_world world, bj_body body, bj_vec3 f, bj_vec3 p) {
798
- WorldImpl *w = as_world(world);
799
- if (!w || body == BJ_INVALID) return;
800
- w->system.GetBodyInterface().AddForce(decode_body_id(body), to_jph(f), to_jph(p));
801
- }
802
-
803
- void bj_body_add_impulse_at(bj_world world, bj_body body, bj_vec3 i, bj_vec3 p) {
804
- WorldImpl *w = as_world(world);
805
- if (!w || body == BJ_INVALID) return;
806
- w->system.GetBodyInterface().AddImpulse(decode_body_id(body), to_jph(i), to_jph(p));
807
- }
808
-
809
- void bj_body_set_friction(bj_world world, bj_body body, float f) {
810
- WorldImpl *w = as_world(world);
811
- if (!w || body == BJ_INVALID) return;
812
- w->system.GetBodyInterface().SetFriction(decode_body_id(body), f);
813
- }
814
-
815
- void bj_body_set_restitution(bj_world world, bj_body body, float r) {
816
- WorldImpl *w = as_world(world);
817
- if (!w || body == BJ_INVALID) return;
818
- w->system.GetBodyInterface().SetRestitution(decode_body_id(body), r);
819
- }
820
-
821
- void bj_body_set_linear_damping(bj_world world, bj_body body, float d) {
822
- WorldImpl *w = as_world(world);
823
- if (!w || body == BJ_INVALID) return;
824
- BodyLockWrite lock(w->system.GetBodyLockInterface(), decode_body_id(body));
825
- if (lock.Succeeded()) {
826
- if (MotionProperties *mp = lock.GetBody().GetMotionPropertiesUnchecked()) {
827
- mp->SetLinearDamping(d);
828
- }
829
- }
830
- }
831
-
832
- void bj_body_set_angular_damping(bj_world world, bj_body body, float d) {
833
- WorldImpl *w = as_world(world);
834
- if (!w || body == BJ_INVALID) return;
835
- BodyLockWrite lock(w->system.GetBodyLockInterface(), decode_body_id(body));
836
- if (lock.Succeeded()) {
837
- if (MotionProperties *mp = lock.GetBody().GetMotionPropertiesUnchecked()) {
838
- mp->SetAngularDamping(d);
839
- }
840
- }
841
- }
842
-
843
- void bj_body_set_gravity_factor(bj_world world, bj_body body, float factor) {
844
- WorldImpl *w = as_world(world);
845
- if (!w || body == BJ_INVALID) return;
846
- w->system.GetBodyInterface().SetGravityFactor(decode_body_id(body), factor);
847
- }
848
-
849
- void bj_body_set_ccd(bj_world world, bj_body body, uint8_t enabled) {
850
- WorldImpl *w = as_world(world);
851
- if (!w || body == BJ_INVALID) return;
852
- w->system.GetBodyInterface().SetMotionQuality(
853
- decode_body_id(body),
854
- enabled ? EMotionQuality::LinearCast : EMotionQuality::Discrete
855
- );
856
- }
857
-
858
- void bj_body_set_motion_type(bj_world world, bj_body body, bj_motion_type t, bj_activation act) {
859
- WorldImpl *w = as_world(world);
860
- if (!w || body == BJ_INVALID) return;
861
- w->system.GetBodyInterface().SetMotionType(decode_body_id(body), to_motion(t), to_activation(act));
862
- }
863
-
864
- void bj_body_set_object_layer(bj_world world, bj_body body, uint32_t layer) {
865
- WorldImpl *w = as_world(world);
866
- if (!w || body == BJ_INVALID) return;
867
- w->system.GetBodyInterface().SetObjectLayer(decode_body_id(body), (ObjectLayer)layer);
868
- }
869
-
870
- void bj_body_set_is_sensor(bj_world world, bj_body body, uint8_t enabled) {
871
- WorldImpl *w = as_world(world);
872
- if (!w || body == BJ_INVALID) return;
873
- BodyLockWrite lock(w->system.GetBodyLockInterface(), decode_body_id(body));
874
- if (lock.Succeeded()) lock.GetBody().SetIsSensor(enabled != 0);
875
- }
876
-
877
- void bj_body_set_allow_sleeping(bj_world world, bj_body body, uint8_t enabled) {
878
- WorldImpl *w = as_world(world);
879
- if (!w || body == BJ_INVALID) return;
880
- BodyLockWrite lock(w->system.GetBodyLockInterface(), decode_body_id(body));
881
- if (lock.Succeeded()) lock.GetBody().SetAllowSleeping(enabled != 0);
882
- }
883
-
884
- void bj_body_set_shape(bj_world world, bj_body body, bj_shape shape, uint8_t update_mass, bj_activation act) {
885
- WorldImpl *w = as_world(world);
886
- if (!w || body == BJ_INVALID) return;
887
- const Shape *s = decode_shape(shape);
888
- if (!s) return;
889
- w->system.GetBodyInterface().SetShape(decode_body_id(body), s, update_mass != 0, to_activation(act));
890
- }
891
-
892
- void bj_body_lock_rotation_axes(bj_world world, bj_body body, uint8_t lx, uint8_t ly, uint8_t lz) {
893
- WorldImpl *w = as_world(world);
894
- if (!w || body == BJ_INVALID) return;
895
- /* AllowedDOFs: bit 0-2 = translation X/Y/Z, bit 3-5 = rotation X/Y/Z. */
896
- uint8_t dofs = (uint8_t)EAllowedDOFs::All;
897
- if (lx) dofs &= ~(uint8_t)EAllowedDOFs::RotationX;
898
- if (ly) dofs &= ~(uint8_t)EAllowedDOFs::RotationY;
899
- if (lz) dofs &= ~(uint8_t)EAllowedDOFs::RotationZ;
900
- BodyLockWrite lock(w->system.GetBodyLockInterface(), decode_body_id(body));
901
- if (lock.Succeeded()) {
902
- if (MotionProperties *mp = lock.GetBody().GetMotionPropertiesUnchecked()) {
903
- /* Note: we preserve translation DOFs — lock_translation_axes is separate. */
904
- EAllowedDOFs existing = mp->GetAllowedDOFs();
905
- uint8_t trans_bits = (uint8_t)existing & 0x07u;
906
- mp->SetInverseInertia(
907
- mp->GetInverseInertiaDiagonal(),
908
- mp->GetInertiaRotation()
909
- ); /* keep inertia; Jolt has no direct AllowedDOFs setter post-create */
910
- /* Fall-back: zero the inverse inertia on locked axes. */
911
- Vec3 inv = mp->GetInverseInertiaDiagonal();
912
- if (lx) inv.SetX(0.0f);
913
- if (ly) inv.SetY(0.0f);
914
- if (lz) inv.SetZ(0.0f);
915
- mp->SetInverseInertia(inv, mp->GetInertiaRotation());
916
- (void)trans_bits;
917
- (void)dofs;
918
- }
919
- }
920
- }
921
-
922
- void bj_body_lock_translation_axes(bj_world world, bj_body body, uint8_t lx, uint8_t ly, uint8_t lz) {
923
- WorldImpl *w = as_world(world);
924
- if (!w || body == BJ_INVALID) return;
925
- BodyLockWrite lock(w->system.GetBodyLockInterface(), decode_body_id(body));
926
- if (lock.Succeeded()) {
927
- if (MotionProperties *mp = lock.GetBody().GetMotionPropertiesUnchecked()) {
928
- /* Zero the inverse mass on locked translation axes via a motion-type-like hack:
929
- * we cannot change AllowedDOFs post-create in 5.5, so we clamp velocity each step.
930
- * For now we simply zero the current linear velocity component; full fidelity
931
- * requires re-creating the body. Tier 2 will add a proper API. */
932
- Vec3 v = lock.GetBody().GetLinearVelocity();
933
- if (lx) v.SetX(0.0f);
934
- if (ly) v.SetY(0.0f);
935
- if (lz) v.SetZ(0.0f);
936
- lock.GetBody().SetLinearVelocity(v);
937
- }
938
- }
939
- }
940
-
941
- float bj_body_get_mass(bj_world world, bj_body body) {
942
- WorldImpl *w = as_world(world);
943
- if (!w || body == BJ_INVALID) return 0.0f;
944
- BodyLockRead lock(w->system.GetBodyLockInterface(), decode_body_id(body));
945
- if (!lock.Succeeded()) return 0.0f;
946
- const MotionProperties *mp = lock.GetBody().GetMotionPropertiesUnchecked();
947
- if (!mp) return 0.0f;
948
- float inv = mp->GetInverseMass();
949
- return inv > 0.0f ? 1.0f / inv : 0.0f;
950
- }
951
-
952
- float bj_body_get_friction(bj_world world, bj_body body) {
953
- WorldImpl *w = as_world(world);
954
- if (!w || body == BJ_INVALID) return 0.0f;
955
- return w->system.GetBodyInterface().GetFriction(decode_body_id(body));
956
- }
957
-
958
- float bj_body_get_restitution(bj_world world, bj_body body) {
959
- WorldImpl *w = as_world(world);
960
- if (!w || body == BJ_INVALID) return 0.0f;
961
- return w->system.GetBodyInterface().GetRestitution(decode_body_id(body));
962
- }
963
-
964
- uint32_t bj_body_get_object_layer(bj_world world, bj_body body) {
965
- WorldImpl *w = as_world(world);
966
- if (!w || body == BJ_INVALID) return 0;
967
- return (uint32_t)w->system.GetBodyInterface().GetObjectLayer(decode_body_id(body));
968
- }
969
-
970
- void bj_body_set_user_data(bj_world world, bj_body body, uint64_t user_data) {
971
- WorldImpl *w = as_world(world);
972
- if (!w || body == BJ_INVALID) return;
973
- w->system.GetBodyInterface().SetUserData(decode_body_id(body), user_data);
974
- }
975
-
976
- uint64_t bj_body_get_user_data(bj_world world, bj_body body) {
977
- WorldImpl *w = as_world(world);
978
- if (!w || body == BJ_INVALID) return 0;
979
- return w->system.GetBodyInterface().GetUserData(decode_body_id(body));
980
- }
981
-
982
- uint32_t bj_world_sync_transforms(bj_world world, const bj_body *bodies, uint32_t count, bj_transform *out) {
983
- WorldImpl *w = as_world(world);
984
- if (!w || !bodies || !out || count == 0) return 0;
985
- const BodyLockInterface &lock_if = w->system.GetBodyLockInterface();
986
- uint32_t valid = 0;
987
- for (uint32_t i = 0; i < count; ++i) {
988
- out[i] = { { 0, 0, 0 }, { 0, 0, 0, 1 } };
989
- if (bodies[i] == BJ_INVALID) continue;
990
- BodyLockRead lock(lock_if, decode_body_id(bodies[i]));
991
- if (!lock.Succeeded()) continue;
992
- RVec3 p = lock.GetBody().GetPosition();
993
- Quat q = lock.GetBody().GetRotation();
994
- out[i].position = from_jph(p);
995
- out[i].rotation = from_jph(q);
996
- ++valid;
997
- }
998
- return valid;
999
- }
1000
-
1001
- /* ================================================================== */
1002
- /* Queries */
1003
- /* ================================================================== */
1004
-
1005
- uint8_t bj_query_raycast_closest(bj_world world,
1006
- bj_vec3 origin, bj_vec3 direction, float max_distance,
1007
- uint32_t layer_mask, bj_ray_hit *out_hit)
1008
- {
1009
- WorldImpl *w = as_world(world);
1010
- if (!w || !out_hit) return 0;
1011
-
1012
- Vec3 dir = to_jph(direction);
1013
- if (dir.LengthSq() == 0.0f) return 0;
1014
- dir = dir.Normalized() * max_distance;
1015
-
1016
- RRayCast ray(to_jph(origin), dir);
1017
- RayCastResult hit;
1018
- LayerMaskBPFilter bp_filter(layer_mask);
1019
- LayerMaskObjectFilter obj_filter(layer_mask);
1020
-
1021
- bool any = w->system.GetNarrowPhaseQuery().CastRay(ray, hit, bp_filter, obj_filter);
1022
- if (!any) return 0;
1023
-
1024
- Vec3 point = Vec3(ray.mOrigin) + ray.mDirection * hit.mFraction;
1025
- out_hit->body = encode_body_id(hit.mBodyID);
1026
- out_hit->point = from_jph(point);
1027
- /* Compute normal via body lock */
1028
- {
1029
- BodyLockRead lock(w->system.GetBodyLockInterface(), hit.mBodyID);
1030
- if (lock.Succeeded()) {
1031
- Vec3 n = lock.GetBody().GetWorldSpaceSurfaceNormal(hit.mSubShapeID2, RVec3(point));
1032
- out_hit->normal = from_jph(n);
1033
- } else {
1034
- out_hit->normal = { 0.0f, 1.0f, 0.0f };
1035
- }
1036
- }
1037
- out_hit->fraction = hit.mFraction;
1038
- out_hit->sub_shape_id = hit.mSubShapeID2.GetValue();
1039
- return 1;
1040
- }
1041
-
1042
- uint32_t bj_query_raycast_all(bj_world world,
1043
- bj_vec3 origin, bj_vec3 direction, float max_distance,
1044
- uint32_t layer_mask,
1045
- bj_ray_hit *out_hits, uint32_t max_hits)
1046
- {
1047
- WorldImpl *w = as_world(world);
1048
- if (!w || !out_hits || max_hits == 0) return 0;
1049
-
1050
- Vec3 dir = to_jph(direction);
1051
- if (dir.LengthSq() == 0.0f) return 0;
1052
- dir = dir.Normalized() * max_distance;
1053
-
1054
- RRayCast ray(to_jph(origin), dir);
1055
- RayCastSettings settings;
1056
- settings.mBackFaceModeTriangles = EBackFaceMode::CollideWithBackFaces;
1057
- AllHitCollisionCollector<CastRayCollector> collector;
1058
- LayerMaskBPFilter bp_filter(layer_mask);
1059
- LayerMaskObjectFilter obj_filter(layer_mask);
1060
-
1061
- w->system.GetNarrowPhaseQuery().CastRay(ray, settings, collector, bp_filter, obj_filter);
1062
- collector.Sort();
1063
-
1064
- uint32_t n = std::min<uint32_t>(max_hits, (uint32_t)collector.mHits.size());
1065
- for (uint32_t i = 0; i < n; ++i) {
1066
- const RayCastResult &h = collector.mHits[i];
1067
- Vec3 point = Vec3(ray.mOrigin) + ray.mDirection * h.mFraction;
1068
- out_hits[i].body = encode_body_id(h.mBodyID);
1069
- out_hits[i].point = from_jph(point);
1070
- BodyLockRead lock(w->system.GetBodyLockInterface(), h.mBodyID);
1071
- if (lock.Succeeded()) {
1072
- Vec3 nrm = lock.GetBody().GetWorldSpaceSurfaceNormal(h.mSubShapeID2, RVec3(point));
1073
- out_hits[i].normal = from_jph(nrm);
1074
- } else {
1075
- out_hits[i].normal = { 0, 1, 0 };
1076
- }
1077
- out_hits[i].fraction = h.mFraction;
1078
- out_hits[i].sub_shape_id = h.mSubShapeID2.GetValue();
1079
- }
1080
- return n;
1081
- }
1082
-
1083
- uint8_t bj_query_shape_cast_closest(bj_world world, bj_shape shape,
1084
- const bj_transform *start, bj_vec3 direction,
1085
- uint32_t layer_mask, bj_ray_hit *out_hit)
1086
- {
1087
- WorldImpl *w = as_world(world);
1088
- if (!w || !start || !out_hit) return 0;
1089
- const Shape *s = decode_shape(shape);
1090
- if (!s) return 0;
1091
-
1092
- RShapeCast cast = RShapeCast::sFromWorldTransform(
1093
- s, Vec3::sOne(),
1094
- RMat44::sRotationTranslation(to_jph(start->rotation), to_jph(start->position)),
1095
- to_jph(direction)
1096
- );
1097
- ClosestHitCollisionCollector<CastShapeCollector> collector;
1098
- ShapeCastSettings settings;
1099
- LayerMaskBPFilter bp_filter(layer_mask);
1100
- LayerMaskObjectFilter obj_filter(layer_mask);
1101
-
1102
- w->system.GetNarrowPhaseQuery().CastShape(cast, settings, cast.mCenterOfMassStart.GetTranslation(), collector, bp_filter, obj_filter);
1103
- if (!collector.HadHit()) return 0;
1104
-
1105
- const ShapeCastResult &h = collector.mHit;
1106
- out_hit->body = encode_body_id(h.mBodyID2);
1107
- out_hit->point = from_jph(h.mContactPointOn2);
1108
- out_hit->normal = from_jph(-h.mPenetrationAxis.Normalized());
1109
- out_hit->fraction = h.mFraction;
1110
- out_hit->sub_shape_id = h.mSubShapeID2.GetValue();
1111
- return 1;
1112
- }
1113
-
1114
- namespace {
1115
- class BodyCollector final : public CollideShapeBodyCollector {
1116
- public:
1117
- BodyCollector(bj_body *out, uint32_t max_out) : m_out(out), m_max(max_out) {}
1118
- void AddHit(const BodyID &id) override {
1119
- if (m_count < m_max) {
1120
- m_out[m_count++] = encode_body_id(id);
1121
- }
1122
- }
1123
- uint32_t count() const { return m_count; }
1124
- private:
1125
- bj_body *m_out;
1126
- uint32_t m_max;
1127
- uint32_t m_count = 0;
1128
- };
1129
- } /* namespace */
1130
-
1131
- uint32_t bj_query_overlap_sphere(bj_world world, bj_vec3 center, float radius,
1132
- uint32_t layer_mask, bj_body *out_bodies, uint32_t max_results)
1133
- {
1134
- WorldImpl *w = as_world(world);
1135
- if (!w || !out_bodies || max_results == 0) return 0;
1136
- BodyCollector collector(out_bodies, max_results);
1137
- LayerMaskBPFilter bp_filter(layer_mask);
1138
- LayerMaskObjectFilter obj_filter(layer_mask);
1139
- w->system.GetBroadPhaseQuery().CollideSphere(to_jph(center), radius, collector, bp_filter, obj_filter);
1140
- return collector.count();
1141
- }
1142
-
1143
- uint32_t bj_query_overlap_box(bj_world world, const bj_transform *xform, bj_vec3 half_extents,
1144
- uint32_t layer_mask, bj_body *out_bodies, uint32_t max_results)
1145
- {
1146
- WorldImpl *w = as_world(world);
1147
- if (!w || !xform || !out_bodies || max_results == 0) return 0;
1148
- /* Approximate by AABB around the rotated box. */
1149
- Vec3 he = to_jph(half_extents);
1150
- Mat44 rot = Mat44::sRotation(to_jph(xform->rotation));
1151
- Vec3 r0 = rot * Vec3(he.GetX(), 0, 0);
1152
- Vec3 r1 = rot * Vec3(0, he.GetY(), 0);
1153
- Vec3 r2 = rot * Vec3(0, 0, he.GetZ());
1154
- Vec3 extent = r0.Abs() + r1.Abs() + r2.Abs();
1155
- AABox box(to_jph(xform->position) - extent, to_jph(xform->position) + extent);
1156
- BodyCollector collector(out_bodies, max_results);
1157
- LayerMaskBPFilter bp_filter(layer_mask);
1158
- LayerMaskObjectFilter obj_filter(layer_mask);
1159
- w->system.GetBroadPhaseQuery().CollideAABox(box, collector, bp_filter, obj_filter);
1160
- return collector.count();
1161
- }
1162
-
1163
- uint32_t bj_query_overlap_point(bj_world world, bj_vec3 point,
1164
- uint32_t layer_mask, bj_body *out_bodies, uint32_t max_results)
1165
- {
1166
- WorldImpl *w = as_world(world);
1167
- if (!w || !out_bodies || max_results == 0) return 0;
1168
- BodyCollector collector(out_bodies, max_results);
1169
- LayerMaskBPFilter bp_filter(layer_mask);
1170
- LayerMaskObjectFilter obj_filter(layer_mask);
1171
- w->system.GetBroadPhaseQuery().CollidePoint(to_jph(point), collector, bp_filter, obj_filter);
1172
- return collector.count();
1173
- }
1174
-
1175
- /* ================================================================== */
1176
- /* Constraints */
1177
- /* ================================================================== */
1178
-
1179
- bj_constraint bj_constraint_fixed(bj_world world, const bj_constraint_anchors *a) {
1180
- WorldImpl *w = as_world(world);
1181
- if (!w || !a) return BJ_INVALID;
1182
- return make_constraint(w, a, [&](Body &b1, Body &b2) -> TwoBodyConstraint * {
1183
- FixedConstraintSettings s;
1184
- s.mSpace = a->use_world_space ? EConstraintSpace::WorldSpace : EConstraintSpace::LocalToBodyCOM;
1185
- s.mPoint1 = to_jph(a->anchor_a);
1186
- s.mPoint2 = to_jph(a->anchor_b);
1187
- s.mAutoDetectPoint = false;
1188
- return s.Create(b1, b2);
1189
- });
1190
- }
1191
-
1192
- bj_constraint bj_constraint_point(bj_world world, const bj_constraint_anchors *a) {
1193
- WorldImpl *w = as_world(world);
1194
- if (!w || !a) return BJ_INVALID;
1195
- return make_constraint(w, a, [&](Body &b1, Body &b2) -> TwoBodyConstraint * {
1196
- PointConstraintSettings s;
1197
- s.mSpace = a->use_world_space ? EConstraintSpace::WorldSpace : EConstraintSpace::LocalToBodyCOM;
1198
- s.mPoint1 = to_jph(a->anchor_a);
1199
- s.mPoint2 = to_jph(a->anchor_b);
1200
- return s.Create(b1, b2);
1201
- });
1202
- }
1203
-
1204
- bj_constraint bj_constraint_hinge(bj_world world, const bj_constraint_anchors *a,
1205
- bj_vec3 axis, float limit_min, float limit_max)
1206
- {
1207
- WorldImpl *w = as_world(world);
1208
- if (!w || !a) return BJ_INVALID;
1209
- return make_constraint(w, a, [&](Body &b1, Body &b2) -> TwoBodyConstraint * {
1210
- HingeConstraintSettings s;
1211
- s.mSpace = a->use_world_space ? EConstraintSpace::WorldSpace : EConstraintSpace::LocalToBodyCOM;
1212
- s.mPoint1 = to_jph(a->anchor_a);
1213
- s.mPoint2 = to_jph(a->anchor_b);
1214
- Vec3 ax = to_jph(axis);
1215
- s.mHingeAxis1 = ax;
1216
- s.mHingeAxis2 = ax;
1217
- Vec3 perp = ax.GetNormalizedPerpendicular();
1218
- s.mNormalAxis1 = perp;
1219
- s.mNormalAxis2 = perp;
1220
- if (limit_min < limit_max) {
1221
- s.mLimitsMin = limit_min;
1222
- s.mLimitsMax = limit_max;
1223
- }
1224
- return s.Create(b1, b2);
1225
- });
1226
- }
1227
-
1228
- bj_constraint bj_constraint_slider(bj_world world, const bj_constraint_anchors *a,
1229
- bj_vec3 axis, float limit_min, float limit_max)
1230
- {
1231
- WorldImpl *w = as_world(world);
1232
- if (!w || !a) return BJ_INVALID;
1233
- return make_constraint(w, a, [&](Body &b1, Body &b2) -> TwoBodyConstraint * {
1234
- SliderConstraintSettings s;
1235
- s.mSpace = a->use_world_space ? EConstraintSpace::WorldSpace : EConstraintSpace::LocalToBodyCOM;
1236
- s.mPoint1 = to_jph(a->anchor_a);
1237
- s.mPoint2 = to_jph(a->anchor_b);
1238
- Vec3 ax = to_jph(axis).Normalized();
1239
- s.mSliderAxis1 = ax;
1240
- s.mSliderAxis2 = ax;
1241
- Vec3 perp = ax.GetNormalizedPerpendicular();
1242
- s.mNormalAxis1 = perp;
1243
- s.mNormalAxis2 = perp;
1244
- if (limit_min < limit_max) {
1245
- s.mLimitsMin = limit_min;
1246
- s.mLimitsMax = limit_max;
1247
- }
1248
- return s.Create(b1, b2);
1249
- });
1250
- }
1251
-
1252
- bj_constraint bj_constraint_distance(bj_world world, const bj_constraint_anchors *a,
1253
- float min_distance, float max_distance)
1254
- {
1255
- WorldImpl *w = as_world(world);
1256
- if (!w || !a) return BJ_INVALID;
1257
- return make_constraint(w, a, [&](Body &b1, Body &b2) -> TwoBodyConstraint * {
1258
- DistanceConstraintSettings s;
1259
- s.mSpace = a->use_world_space ? EConstraintSpace::WorldSpace : EConstraintSpace::LocalToBodyCOM;
1260
- s.mPoint1 = to_jph(a->anchor_a);
1261
- s.mPoint2 = to_jph(a->anchor_b);
1262
- s.mMinDistance = min_distance;
1263
- s.mMaxDistance = max_distance;
1264
- return s.Create(b1, b2);
1265
- });
1266
- }
1267
-
1268
- bj_constraint bj_constraint_six_dof(bj_world world, const bj_constraint_anchors *a,
1269
- const float *trans_limits, const float *rot_limits)
1270
- {
1271
- WorldImpl *w = as_world(world);
1272
- if (!w || !a) return BJ_INVALID;
1273
- return make_constraint(w, a, [&](Body &b1, Body &b2) -> TwoBodyConstraint * {
1274
- SixDOFConstraintSettings s;
1275
- s.mSpace = a->use_world_space ? EConstraintSpace::WorldSpace : EConstraintSpace::LocalToBodyCOM;
1276
- s.mPosition1 = to_jph(a->anchor_a);
1277
- s.mPosition2 = to_jph(a->anchor_b);
1278
- s.mAxisX1 = s.mAxisX2 = Vec3(1, 0, 0);
1279
- s.mAxisY1 = s.mAxisY2 = Vec3(0, 1, 0);
1280
- if (trans_limits) {
1281
- using EAxis = SixDOFConstraintSettings::EAxis;
1282
- EAxis axes[3] = { EAxis::TranslationX, EAxis::TranslationY, EAxis::TranslationZ };
1283
- for (int i = 0; i < 3; ++i) {
1284
- float lo = trans_limits[i*2 + 0], hi = trans_limits[i*2 + 1];
1285
- if (lo >= hi) { s.MakeFixedAxis(axes[i]); }
1286
- else { s.SetLimitedAxis(axes[i], lo, hi); }
1287
- }
1288
- }
1289
- if (rot_limits) {
1290
- using EAxis = SixDOFConstraintSettings::EAxis;
1291
- EAxis axes[3] = { EAxis::RotationX, EAxis::RotationY, EAxis::RotationZ };
1292
- for (int i = 0; i < 3; ++i) {
1293
- float lo = rot_limits[i*2 + 0], hi = rot_limits[i*2 + 1];
1294
- if (lo >= hi) { s.MakeFixedAxis(axes[i]); }
1295
- else { s.SetLimitedAxis(axes[i], lo, hi); }
1296
- }
1297
- }
1298
- return s.Create(b1, b2);
1299
- });
1300
- }
1301
-
1302
- void bj_constraint_destroy(bj_world world, bj_constraint c) {
1303
- WorldImpl *w = as_world(world);
1304
- if (!w || c == BJ_INVALID) return;
1305
- Constraint *cp = decode_constraint(c);
1306
- w->system.RemoveConstraint(cp);
1307
- cp->Release(); /* release our handle's ref */
1308
- }
1309
-
1310
- void bj_constraint_set_enabled(bj_world world, bj_constraint c, uint8_t enabled) {
1311
- (void)world;
1312
- if (c == BJ_INVALID) return;
1313
- decode_constraint(c)->SetEnabled(enabled != 0);
1314
- }
1315
-
1316
- /* ================================================================== */
1317
- /* Contact events */
1318
- /* ================================================================== */
1319
-
1320
- uint32_t bj_world_contact_count(bj_world world) {
1321
- WorldImpl *w = as_world(world);
1322
- return w ? w->contacts.count() : 0;
1323
- }
1324
-
1325
- uint32_t bj_world_pop_contacts(bj_world world, bj_contact *out, uint32_t max_out) {
1326
- WorldImpl *w = as_world(world);
1327
- return w ? w->contacts.drain(out, max_out) : 0;
1328
- }
1329
-
1330
- void bj_world_clear_contacts(bj_world world) {
1331
- if (auto *w = as_world(world)) w->contacts.clear();
1332
- }
1333
-
1334
- /* ================================================================== */
1335
- /* Character controller (CharacterVirtual) */
1336
- /* ================================================================== */
1337
- /* CharacterVirtual doesn't store its own layer so we wrap it in a */
1338
- /* CharacterEntry that retains both the object + its configured layer. */
1339
-
1340
- namespace {
1341
- struct CharacterEntry {
1342
- Ref<CharacterVirtual> character;
1343
- ObjectLayer layer;
1344
- };
1345
- } /* namespace */
1346
-
1347
- static inline CharacterEntry *decode_character(bj_character h) {
1348
- return reinterpret_cast<CharacterEntry *>(h);
1349
- }
1350
-
1351
- bj_character bj_character_create(bj_world world, bj_shape shape, const bj_character_desc *desc,
1352
- bj_vec3 position, bj_quat rotation)
1353
- {
1354
- WorldImpl *w = as_world(world);
1355
- if (!w || !desc) return BJ_INVALID;
1356
- const Shape *s = decode_shape(shape);
1357
- if (!s) return BJ_INVALID;
1358
-
1359
- Ref<CharacterVirtualSettings> settings = new CharacterVirtualSettings();
1360
- settings->mShape = s;
1361
- settings->mMaxSlopeAngle = desc->max_slope_angle;
1362
- settings->mCharacterPadding = desc->character_padding;
1363
- settings->mPenetrationRecoverySpeed = desc->penetration_recovery_speed;
1364
- settings->mPredictiveContactDistance = desc->predictive_contact_distance;
1365
- settings->mMaxStrength = desc->max_strength;
1366
- settings->mMass = desc->mass;
1367
- settings->mUp = to_jph(desc->up);
1368
- /* Supporting-volume plane points up through feet; matches Jolt samples. */
1369
- settings->mSupportingVolume = Plane(to_jph(desc->up), -0.3f);
1370
-
1371
- CharacterVirtual *c = new CharacterVirtual(
1372
- settings,
1373
- to_jph(position), to_jph(rotation),
1374
- /*user_data=*/0,
1375
- &w->system
1376
- );
1377
- auto *entry = new CharacterEntry();
1378
- entry->character = c; /* Ref<> AddRefs internally */
1379
- entry->layer = (ObjectLayer)desc->object_layer;
1380
- return reinterpret_cast<bj_character>(entry);
1381
- }
1382
-
1383
- void bj_character_destroy(bj_world /*world*/, bj_character h) {
1384
- if (h == BJ_INVALID) return;
1385
- delete decode_character(h); /* Ref<> drops + deletes character */
1386
- }
1387
-
1388
- void bj_character_update(bj_world world, bj_character h, float delta_time, bj_vec3 gravity) {
1389
- WorldImpl *w = as_world(world);
1390
- if (!w || h == BJ_INVALID) return;
1391
- CharacterEntry *e = decode_character(h);
1392
-
1393
- /* Jolt's ExtendedUpdate uses `gravity` only for slope/direction decisions —
1394
- * it does NOT integrate gravity into velocity. We do that here so the FFI
1395
- * matches player intuition ("set move direction, update handles falling"). */
1396
- Vec3 v = e->character->GetLinearVelocity();
1397
- v += to_jph(gravity) * delta_time;
1398
- e->character->SetLinearVelocity(v);
1399
-
1400
- CharacterVirtual::ExtendedUpdateSettings settings; /* Jolt defaults */
1401
- BodyFilter body_filter;
1402
- ShapeFilter shape_filter;
1403
- e->character->ExtendedUpdate(
1404
- delta_time, to_jph(gravity),
1405
- settings,
1406
- w->system.GetDefaultBroadPhaseLayerFilter(e->layer),
1407
- w->system.GetDefaultLayerFilter(e->layer),
1408
- body_filter, shape_filter,
1409
- *w->temp_alloc
1410
- );
1411
- }
1412
-
1413
- void bj_character_get_position(bj_world /*world*/, bj_character h, bj_vec3 *out) {
1414
- if (!out) return;
1415
- if (h == BJ_INVALID) { *out = { 0, 0, 0 }; return; }
1416
- *out = from_jph(decode_character(h)->character->GetPosition());
1417
- }
1418
- void bj_character_get_rotation(bj_world /*world*/, bj_character h, bj_quat *out) {
1419
- if (!out) return;
1420
- if (h == BJ_INVALID) { *out = { 0, 0, 0, 1 }; return; }
1421
- *out = from_jph(decode_character(h)->character->GetRotation());
1422
- }
1423
- void bj_character_set_position(bj_world /*world*/, bj_character h, bj_vec3 p) {
1424
- if (h == BJ_INVALID) return;
1425
- decode_character(h)->character->SetPosition(to_jph(p));
1426
- }
1427
- void bj_character_set_rotation(bj_world /*world*/, bj_character h, bj_quat q) {
1428
- if (h == BJ_INVALID) return;
1429
- decode_character(h)->character->SetRotation(to_jph(q));
1430
- }
1431
-
1432
- void bj_character_get_linear_velocity(bj_world /*world*/, bj_character h, bj_vec3 *out) {
1433
- if (!out) return;
1434
- if (h == BJ_INVALID) { *out = { 0, 0, 0 }; return; }
1435
- *out = from_jph(decode_character(h)->character->GetLinearVelocity());
1436
- }
1437
- void bj_character_set_linear_velocity(bj_world /*world*/, bj_character h, bj_vec3 v) {
1438
- if (h == BJ_INVALID) return;
1439
- decode_character(h)->character->SetLinearVelocity(to_jph(v));
1440
- }
1441
-
1442
- bj_ground_state bj_character_get_ground_state(bj_world /*world*/, bj_character h) {
1443
- if (h == BJ_INVALID) return BJ_GROUND_IN_AIR;
1444
- switch (decode_character(h)->character->GetGroundState()) {
1445
- case CharacterBase::EGroundState::OnGround: return BJ_GROUND_ON_GROUND;
1446
- case CharacterBase::EGroundState::OnSteepGround: return BJ_GROUND_ON_STEEP;
1447
- case CharacterBase::EGroundState::NotSupported: return BJ_GROUND_NOT_SUPPORTED;
1448
- case CharacterBase::EGroundState::InAir: return BJ_GROUND_IN_AIR;
1449
- }
1450
- return BJ_GROUND_IN_AIR;
1451
- }
1452
- void bj_character_get_ground_normal(bj_world /*world*/, bj_character h, bj_vec3 *out) {
1453
- if (!out) return;
1454
- if (h == BJ_INVALID) { *out = { 0, 1, 0 }; return; }
1455
- *out = from_jph(decode_character(h)->character->GetGroundNormal());
1456
- }
1457
- void bj_character_get_ground_position(bj_world /*world*/, bj_character h, bj_vec3 *out) {
1458
- if (!out) return;
1459
- if (h == BJ_INVALID) { *out = { 0, 0, 0 }; return; }
1460
- *out = from_jph(decode_character(h)->character->GetGroundPosition());
1461
- }
1462
- bj_body bj_character_get_ground_body(bj_world /*world*/, bj_character h) {
1463
- if (h == BJ_INVALID) return BJ_INVALID;
1464
- return encode_body_id(decode_character(h)->character->GetGroundBodyID());
1465
- }
1466
-
1467
- /* ================================================================== */
1468
- /* Wheeled vehicles */
1469
- /* ================================================================== */
1470
- /* A VehicleEntry owns the chassis body + the VehicleConstraint + its */
1471
- /* collision tester. Jolt's constraint stores a bare pointer to the */
1472
- /* tester; it must outlive the constraint — that's why we wrap both. */
1473
-
1474
- namespace {
1475
- struct VehicleEntry {
1476
- BodyID chassis_id;
1477
- Ref<VehicleConstraint> constraint;
1478
- Ref<VehicleCollisionTesterRay> tester;
1479
- };
1480
- } /* namespace */
1481
-
1482
- static inline VehicleEntry *decode_vehicle(bj_vehicle h) {
1483
- return reinterpret_cast<VehicleEntry *>(h);
1484
- }
1485
-
1486
- bj_vehicle bj_vehicle_create(bj_world world, bj_shape chassis_shape,
1487
- const bj_vehicle_desc *desc,
1488
- bj_vec3 position, bj_quat rotation)
1489
- {
1490
- WorldImpl *w = as_world(world);
1491
- if (!w || !desc) return BJ_INVALID;
1492
- const Shape *shape = decode_shape(chassis_shape);
1493
- if (!shape) return BJ_INVALID;
1494
-
1495
- BodyInterface &bi = w->system.GetBodyInterface();
1496
-
1497
- /* Create the chassis body — a regular dynamic body the vehicle constraint
1498
- * drives via wheel forces. */
1499
- BodyCreationSettings chassis_settings(
1500
- shape,
1501
- to_jph(position), to_jph(rotation),
1502
- EMotionType::Dynamic, (ObjectLayer)desc->object_layer
1503
- );
1504
- chassis_settings.mOverrideMassProperties = EOverrideMassProperties::CalculateInertia;
1505
- chassis_settings.mMassPropertiesOverride.mMass = 1500.0f; /* typical car mass */
1506
- BodyID chassis_id = bi.CreateAndAddBody(chassis_settings, EActivation::Activate);
1507
-
1508
- /* Vehicle constraint settings. */
1509
- VehicleConstraintSettings vcs;
1510
- vcs.mUp = to_jph(desc->up);
1511
- vcs.mForward = to_jph(desc->forward);
1512
- vcs.mMaxPitchRollAngle = desc->max_pitch_roll_angle;
1513
-
1514
- /* Four wheels — indices 0..3 matching bj_vehicle_desc::wheel_positions.
1515
- * Front wheels steer; rear wheels drive. */
1516
- for (int i = 0; i < 4; ++i) {
1517
- auto *wheel = new WheelSettingsWV();
1518
- wheel->mPosition = to_jph(desc->wheel_positions[i]);
1519
- wheel->mRadius = desc->wheel_radius;
1520
- wheel->mWidth = desc->wheel_width;
1521
- wheel->mSuspensionMinLength = desc->suspension_min_length;
1522
- wheel->mSuspensionMaxLength = desc->suspension_max_length;
1523
- wheel->mMaxSteerAngle = (i < 2) ? desc->max_steer_angle : 0.0f;
1524
- wheel->mMaxBrakeTorque = desc->max_brake_torque;
1525
- wheel->mMaxHandBrakeTorque = (i >= 2) ? desc->max_handbrake_torque : 0.0f;
1526
- vcs.mWheels.push_back(wheel);
1527
- }
1528
-
1529
- /* Wheeled controller: one engine, automatic transmission defaults,
1530
- * one differential driving the rear axle. */
1531
- auto *controller = new WheeledVehicleControllerSettings();
1532
- controller->mEngine.mMaxTorque = desc->engine_max_torque;
1533
- VehicleDifferentialSettings diff;
1534
- diff.mLeftWheel = 2; /* rear-left */
1535
- diff.mRightWheel = 3; /* rear-right */
1536
- controller->mDifferentials.push_back(diff);
1537
- vcs.mController = controller;
1538
-
1539
- /* Ray collision tester — one ray per wheel. Use non-moving layer for the
1540
- * ground it collides against; for multi-layer setups, expose it later. */
1541
- Ref<VehicleCollisionTesterRay> tester = new VehicleCollisionTesterRay(
1542
- (ObjectLayer)BJ_LAYER_NON_MOVING,
1543
- to_jph(desc->up)
1544
- );
1545
-
1546
- /* Create the constraint against the (locked) chassis body. */
1547
- VehicleConstraint *constraint = nullptr;
1548
- {
1549
- BodyLockWrite lock(w->system.GetBodyLockInterface(), chassis_id);
1550
- if (!lock.Succeeded()) {
1551
- bi.RemoveBody(chassis_id);
1552
- bi.DestroyBody(chassis_id);
1553
- return BJ_INVALID;
1554
- }
1555
- constraint = new VehicleConstraint(lock.GetBody(), vcs);
1556
- }
1557
- constraint->SetVehicleCollisionTester(tester);
1558
-
1559
- w->system.AddConstraint(constraint);
1560
- /* Crucial: register as step-listener so the vehicle updates each physics step. */
1561
- w->system.AddStepListener(constraint);
1562
-
1563
- auto *entry = new VehicleEntry();
1564
- entry->chassis_id = chassis_id;
1565
- entry->constraint = constraint;
1566
- entry->tester = tester;
1567
- return reinterpret_cast<bj_vehicle>(entry);
1568
- }
1569
-
1570
- void bj_vehicle_destroy(bj_world world, bj_vehicle h) {
1571
- WorldImpl *w = as_world(world);
1572
- if (!w || h == BJ_INVALID) return;
1573
- VehicleEntry *e = decode_vehicle(h);
1574
- w->system.RemoveStepListener(e->constraint);
1575
- w->system.RemoveConstraint(e->constraint);
1576
- BodyInterface &bi = w->system.GetBodyInterface();
1577
- if (bi.IsAdded(e->chassis_id)) bi.RemoveBody(e->chassis_id);
1578
- bi.DestroyBody(e->chassis_id);
1579
- delete e; /* Ref<> drops constraint + tester */
1580
- }
1581
-
1582
- bj_body bj_vehicle_get_chassis(bj_world /*world*/, bj_vehicle h) {
1583
- if (h == BJ_INVALID) return BJ_INVALID;
1584
- return encode_body_id(decode_vehicle(h)->chassis_id);
1585
- }
1586
-
1587
- void bj_vehicle_set_input(bj_world world, bj_vehicle h,
1588
- float forward, float right, float brake, float handbrake)
1589
- {
1590
- WorldImpl *w = as_world(world);
1591
- if (!w || h == BJ_INVALID) return;
1592
- VehicleEntry *e = decode_vehicle(h);
1593
- auto *ctrl = static_cast<WheeledVehicleController *>(e->constraint->GetController());
1594
- ctrl->SetDriverInput(forward, right, brake, handbrake);
1595
- /* Wake the chassis body so throttle/brake take effect even after it's slept
1596
- * on the suspension. Without this a car that came to rest ignores input. */
1597
- if (forward != 0.0f || brake != 0.0f || handbrake != 0.0f || right != 0.0f) {
1598
- w->system.GetBodyInterface().ActivateBody(e->chassis_id);
1599
- }
1600
- }
1601
-
1602
- float bj_vehicle_get_wheel_transform(bj_world world, bj_vehicle h,
1603
- uint32_t wheel_index, uint32_t axis)
1604
- {
1605
- WorldImpl *w = as_world(world);
1606
- if (!w || h == BJ_INVALID || wheel_index >= 4) return 0.0f;
1607
- VehicleEntry *e = decode_vehicle(h);
1608
- /* GetWheelWorldTransform needs wheel-local up + right axes. Jolt uses
1609
- * the wheel's mWheelUp (default = chassis up) and mWheelForward for
1610
- * orientation. Right-handed: we pick X as the wheel rotation axis. */
1611
- Mat44 xform = e->constraint->GetWheelWorldTransform(
1612
- wheel_index, Vec3::sAxisY(), Vec3::sAxisX()
1613
- );
1614
- if (axis < 3) {
1615
- Vec3 pos = xform.GetTranslation();
1616
- switch (axis) {
1617
- case 0: return pos.GetX();
1618
- case 1: return pos.GetY();
1619
- default: return pos.GetZ();
1620
- }
1621
- } else if (axis < 7) {
1622
- Quat rot = xform.GetQuaternion();
1623
- switch (axis - 3) {
1624
- case 0: return rot.GetX();
1625
- case 1: return rot.GetY();
1626
- case 2: return rot.GetZ();
1627
- default: return rot.GetW();
1628
- }
1629
- }
1630
- return 0.0f;
1631
- }
1632
-
1633
- float bj_vehicle_get_engine_rpm(bj_world /*world*/, bj_vehicle h) {
1634
- if (h == BJ_INVALID) return 0.0f;
1635
- VehicleEntry *e = decode_vehicle(h);
1636
- auto *ctrl = static_cast<WheeledVehicleController *>(e->constraint->GetController());
1637
- return ctrl->GetEngine().GetCurrentRPM();
1638
- }
1639
-
1640
- float bj_vehicle_get_wheel_angular_velocity(bj_world /*world*/, bj_vehicle h, uint32_t idx) {
1641
- if (h == BJ_INVALID || idx >= 4) return 0.0f;
1642
- VehicleEntry *e = decode_vehicle(h);
1643
- const WheelWV *wheel = static_cast<const WheelWV *>(e->constraint->GetWheel(idx));
1644
- return wheel ? wheel->GetAngularVelocity() : 0.0f;
1645
- }
1646
-
1647
- /* ================================================================== */
1648
- /* Soft bodies */
1649
- /* ================================================================== */
1650
-
1651
- bj_body bj_soft_body_create(
1652
- bj_world world,
1653
- const float *vertex_data, uint32_t vertex_count,
1654
- const uint32_t *indices, uint32_t triangle_count,
1655
- bj_vec3 position, bj_quat rotation,
1656
- uint32_t object_layer,
1657
- float edge_compliance, float gravity_factor, float linear_damping, float pressure)
1658
- {
1659
- WorldImpl *w = as_world(world);
1660
- if (!w || !vertex_data || !indices || vertex_count < 3 || triangle_count == 0) return BJ_INVALID;
1661
-
1662
- Ref<SoftBodySharedSettings> shared = new SoftBodySharedSettings();
1663
-
1664
- for (uint32_t i = 0; i < vertex_count; ++i) {
1665
- SoftBodySharedSettings::Vertex v;
1666
- v.mPosition = Float3(
1667
- vertex_data[i * 4 + 0],
1668
- vertex_data[i * 4 + 1],
1669
- vertex_data[i * 4 + 2]
1670
- );
1671
- v.mVelocity = Float3(0.0f, 0.0f, 0.0f);
1672
- v.mInvMass = vertex_data[i * 4 + 3];
1673
- shared->mVertices.push_back(v);
1674
- }
1675
- for (uint32_t i = 0; i < triangle_count; ++i) {
1676
- SoftBodySharedSettings::Face f(indices[i * 3 + 0], indices[i * 3 + 1], indices[i * 3 + 2], 0);
1677
- shared->AddFace(f);
1678
- }
1679
- /* Auto-generate edge + shear + bend constraints from the triangle topology. */
1680
- SoftBodySharedSettings::VertexAttributes attrs;
1681
- attrs.mCompliance = edge_compliance;
1682
- attrs.mShearCompliance = edge_compliance;
1683
- attrs.mBendCompliance = edge_compliance;
1684
- attrs.mLRAType = SoftBodySharedSettings::ELRAType::None;
1685
- shared->CreateConstraints(&attrs, 1, SoftBodySharedSettings::EBendType::Distance);
1686
- shared->Optimize();
1687
-
1688
- SoftBodyCreationSettings bcs(
1689
- shared.GetPtr(),
1690
- to_jph(position), to_jph(rotation),
1691
- (ObjectLayer)object_layer
1692
- );
1693
- bcs.mGravityFactor = gravity_factor;
1694
- bcs.mLinearDamping = linear_damping;
1695
- bcs.mPressure = pressure;
1696
- bcs.mUpdatePosition = true;
1697
-
1698
- BodyID id = w->system.GetBodyInterface().CreateAndAddSoftBody(bcs, EActivation::Activate);
1699
- return encode_body_id(id);
1700
- }
1701
-
1702
- static const SoftBodyMotionProperties *get_soft_mp(WorldImpl *w, bj_body h) {
1703
- if (!w || h == BJ_INVALID) return nullptr;
1704
- BodyLockRead lock(w->system.GetBodyLockInterface(), decode_body_id(h));
1705
- if (!lock.Succeeded()) return nullptr;
1706
- const Body &body = lock.GetBody();
1707
- if (!body.IsSoftBody()) return nullptr;
1708
- return static_cast<const SoftBodyMotionProperties *>(body.GetMotionPropertiesUnchecked());
1709
- }
1710
-
1711
- uint32_t bj_soft_body_vertex_count(bj_world world, bj_body h) {
1712
- WorldImpl *w = as_world(world);
1713
- const SoftBodyMotionProperties *mp = get_soft_mp(w, h);
1714
- return mp ? (uint32_t)mp->GetVertices().size() : 0;
1715
- }
1716
-
1717
- void bj_soft_body_get_vertex(bj_world world, bj_body h, uint32_t idx, bj_vec3 *out) {
1718
- if (!out) return;
1719
- *out = { 0.0f, 0.0f, 0.0f };
1720
- WorldImpl *w = as_world(world);
1721
- if (!w || h == BJ_INVALID) return;
1722
- BodyLockRead lock(w->system.GetBodyLockInterface(), decode_body_id(h));
1723
- if (!lock.Succeeded()) return;
1724
- const Body &body = lock.GetBody();
1725
- if (!body.IsSoftBody()) return;
1726
- const auto *mp = static_cast<const SoftBodyMotionProperties *>(body.GetMotionPropertiesUnchecked());
1727
- if (!mp || idx >= mp->GetVertices().size()) return;
1728
- /* SoftBody vertex positions are stored in body-local space; transform to world. */
1729
- Vec3 local = mp->GetVertex(idx).mPosition;
1730
- RMat44 xform = body.GetWorldTransform();
1731
- Vec3 world_pos = Vec3(xform * RVec3(local));
1732
- *out = from_jph(world_pos);
1733
- }
1734
-
1735
- void bj_soft_body_set_vertex(bj_world world, bj_body h, uint32_t idx, bj_vec3 position) {
1736
- WorldImpl *w = as_world(world);
1737
- if (!w || h == BJ_INVALID) return;
1738
- BodyLockWrite lock(w->system.GetBodyLockInterface(), decode_body_id(h));
1739
- if (!lock.Succeeded()) return;
1740
- Body &body = lock.GetBody();
1741
- if (!body.IsSoftBody()) return;
1742
- auto *mp = static_cast<SoftBodyMotionProperties *>(body.GetMotionPropertiesUnchecked());
1743
- if (!mp || idx >= mp->GetVertices().size()) return;
1744
- RMat44 xform = body.GetWorldTransform();
1745
- RMat44 inv = xform.Inversed();
1746
- Vec3 local = Vec3(inv * RVec3(to_jph(position)));
1747
- mp->GetVertex(idx).mPosition = local;
1748
- }
1749
-
1750
- void bj_soft_body_set_vertex_inv_mass(bj_world world, bj_body h, uint32_t idx, float inv_mass) {
1751
- WorldImpl *w = as_world(world);
1752
- if (!w || h == BJ_INVALID) return;
1753
- BodyLockWrite lock(w->system.GetBodyLockInterface(), decode_body_id(h));
1754
- if (!lock.Succeeded()) return;
1755
- Body &body = lock.GetBody();
1756
- if (!body.IsSoftBody()) return;
1757
- auto *mp = static_cast<SoftBodyMotionProperties *>(body.GetMotionPropertiesUnchecked());
1758
- if (!mp || idx >= mp->GetVertices().size()) return;
1759
- mp->GetVertex(idx).mInvMass = inv_mass;
1760
- }
1761
-
1762
- void bj_character_set_shape(bj_world world, bj_character h, bj_shape shape) {
1763
- WorldImpl *w = as_world(world);
1764
- if (!w || h == BJ_INVALID) return;
1765
- const Shape *s = decode_shape(shape);
1766
- if (!s) return;
1767
- CharacterEntry *e = decode_character(h);
1768
- BodyFilter body_filter;
1769
- ShapeFilter shape_filter;
1770
- e->character->SetShape(
1771
- s,
1772
- /*max_penetration_depth=*/FLT_MAX,
1773
- w->system.GetDefaultBroadPhaseLayerFilter(e->layer),
1774
- w->system.GetDefaultLayerFilter(e->layer),
1775
- body_filter, shape_filter,
1776
- *w->temp_alloc
1777
- );
1778
- }
1779
-
1780
- } /* extern "C" */