@onerjs/core 8.52.8 → 8.52.9

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 (1058) hide show
  1. package/Actions/actionManager.d.ts +1 -1
  2. package/Actions/actionManager.js +8 -5
  3. package/Actions/actionManager.js.map +1 -1
  4. package/Animations/animatable.core.d.ts +1 -1
  5. package/Animations/animatable.core.js +2 -2
  6. package/Animations/animatable.core.js.map +1 -1
  7. package/Animations/animationPropertiesOverride.js +1 -1
  8. package/Animations/animationPropertiesOverride.js.map +1 -1
  9. package/Animations/animatorAvatar.d.ts +2 -2
  10. package/Animations/animatorAvatar.js +3 -3
  11. package/Animations/animatorAvatar.js.map +1 -1
  12. package/Animations/pathCursor.d.ts +1 -1
  13. package/Animations/pathCursor.js +1 -1
  14. package/Animations/pathCursor.js.map +1 -1
  15. package/Animations/runtimeAnimation.d.ts +1 -1
  16. package/Animations/runtimeAnimation.js +2 -2
  17. package/Animations/runtimeAnimation.js.map +1 -1
  18. package/Audio/analyser.js +1 -1
  19. package/Audio/analyser.js.map +1 -1
  20. package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +1 -1
  21. package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -1
  22. package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.d.ts +2 -0
  23. package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js.map +1 -1
  24. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.d.ts +13 -3
  25. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js +16 -0
  26. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js.map +1 -1
  27. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +1 -1
  28. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +1 -1
  29. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
  30. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +1 -1
  31. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js +1 -1
  32. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
  33. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.d.ts +4 -0
  34. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js +22 -0
  35. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js.map +1 -1
  36. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +1 -1
  37. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +1 -1
  38. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
  39. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.d.ts +6 -0
  40. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js +22 -5
  41. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js.map +1 -1
  42. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +1 -1
  43. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
  44. package/AudioV2/webAudio/webAudioStreamingSound.js +1 -1
  45. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  46. package/BakedVertexAnimation/bakedVertexAnimationManager.d.ts +1 -1
  47. package/BakedVertexAnimation/bakedVertexAnimationManager.js +1 -1
  48. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  49. package/BakedVertexAnimation/vertexAnimationBaker.js +1 -1
  50. package/BakedVertexAnimation/vertexAnimationBaker.js.map +1 -1
  51. package/Behaviors/Cameras/bouncingBehavior.js +1 -1
  52. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  53. package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
  54. package/Behaviors/Cameras/framingBehavior.js +2 -2
  55. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  56. package/Behaviors/Cameras/interpolatingBehavior.d.ts +13 -1
  57. package/Behaviors/Cameras/interpolatingBehavior.js +13 -1
  58. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  59. package/Behaviors/Meshes/attachToBoxBehavior.js +1 -1
  60. package/Behaviors/Meshes/attachToBoxBehavior.js.map +1 -1
  61. package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +3 -3
  62. package/Behaviors/Meshes/baseSixDofDragBehavior.js +4 -4
  63. package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
  64. package/Behaviors/Meshes/followBehavior.js +1 -1
  65. package/Behaviors/Meshes/followBehavior.js.map +1 -1
  66. package/Behaviors/Meshes/handConstraintBehavior.js +2 -2
  67. package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
  68. package/Behaviors/Meshes/multiPointerScaleBehavior.js +1 -1
  69. package/Behaviors/Meshes/multiPointerScaleBehavior.js.map +1 -1
  70. package/Behaviors/Meshes/pointerDragBehavior.d.ts +3 -3
  71. package/Behaviors/Meshes/pointerDragBehavior.js +5 -5
  72. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  73. package/Behaviors/Meshes/sixDofDragBehavior.d.ts +1 -1
  74. package/Behaviors/Meshes/sixDofDragBehavior.js +2 -2
  75. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  76. package/Behaviors/Meshes/surfaceMagnetismBehavior.js +1 -1
  77. package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
  78. package/Bones/boneIKController.d.ts +1 -1
  79. package/Bones/boneIKController.js +1 -1
  80. package/Bones/boneIKController.js.map +1 -1
  81. package/Bones/boneLookController.d.ts +1 -1
  82. package/Bones/boneLookController.js +1 -1
  83. package/Bones/boneLookController.js.map +1 -1
  84. package/Bones/skeleton.d.ts +2 -2
  85. package/Bones/skeleton.functions.d.ts +1 -1
  86. package/Bones/skeleton.functions.js +3 -3
  87. package/Bones/skeleton.functions.js.map +1 -1
  88. package/Bones/skeleton.js +3 -4
  89. package/Bones/skeleton.js.map +1 -1
  90. package/Buffers/buffer.align.pure.js +6 -0
  91. package/Buffers/buffer.align.pure.js.map +1 -1
  92. package/Buffers/buffer.nonFloatVertexBuffers.js +2 -1
  93. package/Buffers/buffer.nonFloatVertexBuffers.js.map +1 -1
  94. package/Buffers/buffer.pure.d.ts +8 -0
  95. package/Buffers/buffer.pure.js +31 -2
  96. package/Buffers/buffer.pure.js.map +1 -1
  97. package/Buffers/bufferUtils.js +17 -5
  98. package/Buffers/bufferUtils.js.map +1 -1
  99. package/Cameras/Inputs/BaseCameraMouseWheelInput.js +1 -1
  100. package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
  101. package/Cameras/Inputs/BaseCameraPointersInput.js +1 -1
  102. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  103. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +1 -1
  104. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
  105. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +2 -2
  106. package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
  107. package/Cameras/Inputs/flyCameraKeyboardInput.js +2 -2
  108. package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
  109. package/Cameras/Inputs/flyCameraMouseInput.js +2 -2
  110. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  111. package/Cameras/Inputs/followCameraKeyboardMoveInput.js +1 -1
  112. package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
  113. package/Cameras/Inputs/followCameraMouseWheelInput.js +1 -1
  114. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  115. package/Cameras/Inputs/freeCameraGamepadInput.js +1 -1
  116. package/Cameras/Inputs/freeCameraGamepadInput.js.map +1 -1
  117. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +2 -2
  118. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  119. package/Cameras/Inputs/freeCameraMouseInput.js +1 -1
  120. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  121. package/Cameras/Inputs/freeCameraMouseWheelInput.js +1 -1
  122. package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
  123. package/Cameras/Inputs/freeCameraTouchInput.js +2 -2
  124. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  125. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +1 -1
  126. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
  127. package/Cameras/Limits/geospatialLimits.d.ts +1 -1
  128. package/Cameras/Limits/geospatialLimits.js +1 -1
  129. package/Cameras/Limits/geospatialLimits.js.map +1 -1
  130. package/Cameras/RigModes/stereoscopicAnaglyphRigMode.js +2 -2
  131. package/Cameras/RigModes/stereoscopicAnaglyphRigMode.js.map +1 -1
  132. package/Cameras/RigModes/stereoscopicRigMode.d.ts +1 -1
  133. package/Cameras/RigModes/stereoscopicRigMode.js +3 -3
  134. package/Cameras/RigModes/stereoscopicRigMode.js.map +1 -1
  135. package/Cameras/RigModes/vrRigMode.js +2 -2
  136. package/Cameras/RigModes/vrRigMode.js.map +1 -1
  137. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.d.ts +3 -3
  138. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +5 -5
  139. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  140. package/Cameras/VR/vrCameraMetrics.d.ts +1 -1
  141. package/Cameras/VR/vrCameraMetrics.js +1 -1
  142. package/Cameras/VR/vrCameraMetrics.js.map +1 -1
  143. package/Cameras/cameraInputsManager.d.ts +1 -1
  144. package/Cameras/cameraInputsManager.js +1 -1
  145. package/Cameras/cameraInputsManager.js.map +1 -1
  146. package/Collisions/collider.d.ts +1 -1
  147. package/Collisions/collider.js +1 -1
  148. package/Collisions/collider.js.map +1 -1
  149. package/Collisions/gpuPicker.d.ts +1 -1
  150. package/Collisions/gpuPicker.js +5 -5
  151. package/Collisions/gpuPicker.js.map +1 -1
  152. package/Collisions/meshCollisionData.d.ts +1 -1
  153. package/Collisions/meshCollisionData.js +1 -1
  154. package/Collisions/meshCollisionData.js.map +1 -1
  155. package/Collisions/pickingInfo.d.ts +1 -1
  156. package/Collisions/pickingInfo.js +2 -2
  157. package/Collisions/pickingInfo.js.map +1 -1
  158. package/Compute/computeEffect.d.ts +6 -0
  159. package/Compute/computeEffect.js +3 -0
  160. package/Compute/computeEffect.js.map +1 -1
  161. package/Compute/computeShader.pure.d.ts +4 -0
  162. package/Compute/computeShader.pure.js +1 -0
  163. package/Compute/computeShader.pure.js.map +1 -1
  164. package/Culling/Octrees/octreeBlock.d.ts +1 -1
  165. package/Culling/Octrees/octreeBlock.js +1 -1
  166. package/Culling/Octrees/octreeBlock.js.map +1 -1
  167. package/Culling/boundingBox.d.ts +1 -1
  168. package/Culling/boundingBox.js +1 -1
  169. package/Culling/boundingBox.js.map +1 -1
  170. package/Culling/boundingInfo.d.ts +1 -1
  171. package/Culling/boundingInfo.js +1 -1
  172. package/Culling/boundingInfo.js.map +1 -1
  173. package/Culling/boundingSphere.d.ts +1 -1
  174. package/Culling/boundingSphere.js +1 -1
  175. package/Culling/boundingSphere.js.map +1 -1
  176. package/Culling/ray.core.d.ts +1 -1
  177. package/Culling/ray.core.js +1 -1
  178. package/Culling/ray.core.js.map +1 -1
  179. package/Debug/axesViewer.d.ts +1 -1
  180. package/Debug/axesViewer.js +3 -3
  181. package/Debug/axesViewer.js.map +1 -1
  182. package/Debug/boneAxesViewer.d.ts +1 -1
  183. package/Debug/boneAxesViewer.js +1 -1
  184. package/Debug/boneAxesViewer.js.map +1 -1
  185. package/Debug/directionalLightFrustumViewer.d.ts +1 -1
  186. package/Debug/directionalLightFrustumViewer.js +6 -6
  187. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  188. package/Debug/rayHelper.d.ts +1 -1
  189. package/Debug/rayHelper.js +2 -2
  190. package/Debug/rayHelper.js.map +1 -1
  191. package/Debug/skeletonViewer.d.ts +2 -2
  192. package/Debug/skeletonViewer.js +10 -10
  193. package/Debug/skeletonViewer.js.map +1 -1
  194. package/DeviceInput/internalDeviceSourceManager.d.ts +1 -1
  195. package/DeviceInput/internalDeviceSourceManager.js +0 -1
  196. package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
  197. package/DeviceInput/webDeviceInputSystem.js +1 -1
  198. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  199. package/Engines/Extensions/engine.views.d.ts +1 -1
  200. package/Engines/Extensions/engine.views.js +1 -1
  201. package/Engines/Extensions/engine.views.js.map +1 -1
  202. package/Engines/Native/nativeHelpers.js +4 -1
  203. package/Engines/Native/nativeHelpers.js.map +1 -1
  204. package/Engines/WebGPU/Extensions/engine.computeShader.pure.js +154 -2
  205. package/Engines/WebGPU/Extensions/engine.computeShader.pure.js.map +1 -1
  206. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -1
  207. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +11 -1
  208. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  209. package/Engines/WebGPU/webgpuComputeContext.d.ts +1 -1
  210. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  211. package/Engines/WebGPU/webgpuTintWASM.js +1 -1
  212. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  213. package/Engines/abstractEngine.pure.d.ts +7 -1
  214. package/Engines/abstractEngine.pure.js +34 -4
  215. package/Engines/abstractEngine.pure.js.map +1 -1
  216. package/Engines/constants.d.ts +4 -0
  217. package/Engines/constants.js +4 -0
  218. package/Engines/constants.js.map +1 -1
  219. package/Engines/engine.pure.d.ts +0 -7
  220. package/Engines/engine.pure.js +0 -34
  221. package/Engines/engine.pure.js.map +1 -1
  222. package/Engines/engineFactory.d.ts +2 -2
  223. package/Engines/engineFactory.js +3 -3
  224. package/Engines/engineFactory.js.map +1 -1
  225. package/Engines/thinNativeEngine.pure.js +2 -2
  226. package/Engines/thinNativeEngine.pure.js.map +1 -1
  227. package/Events/pointerEvents.d.ts +1 -1
  228. package/Events/pointerEvents.js +1 -1
  229. package/Events/pointerEvents.js.map +1 -1
  230. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js +1 -1
  231. package/FlowGraph/Blocks/Data/Utils/flowGraphCodeExecutionBlock.js.map +1 -1
  232. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +1 -1
  233. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +1 -1
  234. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  235. package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.js +1 -1
  236. package/FlowGraph/Blocks/Event/flowGraphKeyboardEventBlock.js.map +1 -1
  237. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.pure.d.ts +1 -1
  238. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.pure.js +3 -3
  239. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.pure.js.map +1 -1
  240. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +1 -1
  241. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  242. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +1 -1
  243. package/FlowGraph/CustomTypes/flowGraphMatrix.js +1 -1
  244. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  245. package/FlowGraph/flowGraphBlock.d.ts +1 -1
  246. package/FlowGraph/flowGraphBlock.js +1 -1
  247. package/FlowGraph/flowGraphBlock.js.map +1 -1
  248. package/FlowGraph/flowGraphExecutionBlock.d.ts +1 -1
  249. package/FlowGraph/flowGraphExecutionBlock.js +1 -1
  250. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  251. package/FlowGraph/flowGraphMath.d.ts +1 -1
  252. package/FlowGraph/flowGraphMath.js +1 -1
  253. package/FlowGraph/flowGraphMath.js.map +1 -1
  254. package/FlowGraph/flowGraphParser.js +1 -1
  255. package/FlowGraph/flowGraphParser.js.map +1 -1
  256. package/FlowGraph/flowGraphPathConverterComponent.d.ts +1 -1
  257. package/FlowGraph/flowGraphPathConverterComponent.js +2 -2
  258. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  259. package/FlowGraph/flowGraphValidator.js.map +1 -1
  260. package/FlowGraph/serialization.js +4 -4
  261. package/FlowGraph/serialization.js.map +1 -1
  262. package/FlowGraph/utils.js.map +1 -1
  263. package/FrameGraph/Node/nodeRenderGraph.d.ts +2 -2
  264. package/FrameGraph/Node/nodeRenderGraph.js +7 -7
  265. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  266. package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +30 -0
  267. package/FrameGraph/Tasks/Layers/baseLayerTask.js +28 -1
  268. package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
  269. package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +2 -2
  270. package/FrameGraph/Tasks/Misc/computeShaderTask.js +2 -2
  271. package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -1
  272. package/FrameGraph/Tasks/Misc/lightingVolumeTask.d.ts +1 -1
  273. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +2 -2
  274. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -1
  275. package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +7 -0
  276. package/FrameGraph/Tasks/PostProcesses/blurTask.js +8 -1
  277. package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
  278. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +1 -1
  279. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
  280. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +1 -1
  281. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -1
  282. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.d.ts +1 -1
  283. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js +1 -1
  284. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js.map +1 -1
  285. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +2 -2
  286. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +3 -3
  287. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -1
  288. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +1 -1
  289. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +2 -2
  290. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
  291. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +6 -0
  292. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +14 -5
  293. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  294. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +1 -1
  295. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +1 -1
  296. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
  297. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.d.ts +1 -1
  298. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.js +1 -1
  299. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.js.map +1 -1
  300. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.d.ts +1 -1
  301. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.js +2 -2
  302. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.js.map +1 -1
  303. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.d.ts +1 -1
  304. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.js +2 -2
  305. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.js.map +1 -1
  306. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +7 -1
  307. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +7 -1
  308. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  309. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -1
  310. package/FrameGraph/Tasks/Texture/clearTextureTask.js +1 -1
  311. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  312. package/FrameGraph/frameGraphRenderContext.js +1 -1
  313. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  314. package/FrameGraph/frameGraphTextureManager.d.ts +1 -1
  315. package/FrameGraph/frameGraphTextureManager.js +1 -1
  316. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  317. package/Gamepads/gamepadManager.js +1 -1
  318. package/Gamepads/gamepadManager.js.map +1 -1
  319. package/Gizmos/axisDragGizmo.d.ts +5 -5
  320. package/Gizmos/axisDragGizmo.js +6 -6
  321. package/Gizmos/axisDragGizmo.js.map +1 -1
  322. package/Gizmos/axisScaleGizmo.d.ts +4 -4
  323. package/Gizmos/axisScaleGizmo.js +6 -6
  324. package/Gizmos/axisScaleGizmo.js.map +1 -1
  325. package/Gizmos/boundingBoxGizmo.d.ts +5 -5
  326. package/Gizmos/boundingBoxGizmo.js +7 -7
  327. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  328. package/Gizmos/cameraGizmo.d.ts +3 -3
  329. package/Gizmos/cameraGizmo.js +7 -7
  330. package/Gizmos/cameraGizmo.js.map +1 -1
  331. package/Gizmos/gizmo.d.ts +2 -2
  332. package/Gizmos/gizmo.js +3 -3
  333. package/Gizmos/gizmo.js.map +1 -1
  334. package/Gizmos/gizmoManager.d.ts +2 -2
  335. package/Gizmos/gizmoManager.js +2 -2
  336. package/Gizmos/gizmoManager.js.map +1 -1
  337. package/Gizmos/lightGizmo.d.ts +4 -4
  338. package/Gizmos/lightGizmo.js +11 -11
  339. package/Gizmos/lightGizmo.js.map +1 -1
  340. package/Gizmos/planeDragGizmo.d.ts +4 -4
  341. package/Gizmos/planeDragGizmo.js +5 -5
  342. package/Gizmos/planeDragGizmo.js.map +1 -1
  343. package/Gizmos/positionGizmo.d.ts +1 -1
  344. package/Gizmos/positionGizmo.js +2 -2
  345. package/Gizmos/positionGizmo.js.map +1 -1
  346. package/Gizmos/rotationGizmo.d.ts +3 -3
  347. package/Gizmos/rotationGizmo.js +3 -3
  348. package/Gizmos/rotationGizmo.js.map +1 -1
  349. package/Gizmos/scaleGizmo.d.ts +2 -2
  350. package/Gizmos/scaleGizmo.js +4 -4
  351. package/Gizmos/scaleGizmo.js.map +1 -1
  352. package/Gizmos/spatialAudioGizmo.d.ts +2 -2
  353. package/Gizmos/spatialAudioGizmo.js +6 -6
  354. package/Gizmos/spatialAudioGizmo.js.map +1 -1
  355. package/Helpers/environmentHelper.d.ts +6 -6
  356. package/Helpers/environmentHelper.js +12 -12
  357. package/Helpers/environmentHelper.js.map +1 -1
  358. package/Helpers/materialConversionHelper.d.ts +1 -1
  359. package/Helpers/materialConversionHelper.js +1 -1
  360. package/Helpers/materialConversionHelper.js.map +1 -1
  361. package/Helpers/photoDome.d.ts +1 -1
  362. package/Helpers/photoDome.js +1 -1
  363. package/Helpers/photoDome.js.map +1 -1
  364. package/Helpers/textureDome.d.ts +4 -4
  365. package/Helpers/textureDome.js +6 -6
  366. package/Helpers/textureDome.js.map +1 -1
  367. package/Helpers/videoDome.d.ts +1 -1
  368. package/Helpers/videoDome.js +2 -2
  369. package/Helpers/videoDome.js.map +1 -1
  370. package/Inputs/scene.inputManager.d.ts +1 -1
  371. package/Inputs/scene.inputManager.js +1 -1
  372. package/Inputs/scene.inputManager.js.map +1 -1
  373. package/Instrumentation/sceneInstrumentation.js +1 -1
  374. package/Instrumentation/sceneInstrumentation.js.map +1 -1
  375. package/Layers/effectLayer.d.ts +1 -1
  376. package/Layers/effectLayer.js +3 -3
  377. package/Layers/effectLayer.js.map +1 -1
  378. package/Layers/layer.d.ts +2 -2
  379. package/Layers/layer.js +4 -4
  380. package/Layers/layer.js.map +1 -1
  381. package/Layers/thinEffectLayer.d.ts +2 -2
  382. package/Layers/thinEffectLayer.js +3 -3
  383. package/Layers/thinEffectLayer.js.map +1 -1
  384. package/Layers/thinGlowLayer.d.ts +1 -1
  385. package/Layers/thinGlowLayer.js +3 -3
  386. package/Layers/thinGlowLayer.js.map +1 -1
  387. package/Layers/thinHighlightLayer.d.ts +1 -1
  388. package/Layers/thinHighlightLayer.js +3 -3
  389. package/Layers/thinHighlightLayer.js.map +1 -1
  390. package/Layers/thinSelectionOutlineLayer.d.ts +1 -1
  391. package/Layers/thinSelectionOutlineLayer.js +3 -3
  392. package/Layers/thinSelectionOutlineLayer.js.map +1 -1
  393. package/Legacy/legacy.js +12 -1
  394. package/Legacy/legacy.js.map +1 -1
  395. package/LensFlares/lensFlare.d.ts +2 -2
  396. package/LensFlares/lensFlare.js +3 -3
  397. package/LensFlares/lensFlare.js.map +1 -1
  398. package/LensFlares/lensFlareSystem.d.ts +1 -1
  399. package/LensFlares/lensFlareSystem.js +6 -6
  400. package/LensFlares/lensFlareSystem.js.map +1 -1
  401. package/Lights/LTC/ltcTextureTool.js +1 -1
  402. package/Lights/LTC/ltcTextureTool.js.map +1 -1
  403. package/Lights/Shadows/cascadedShadowGenerator.d.ts +1 -285
  404. package/Lights/Shadows/cascadedShadowGenerator.js +3 -857
  405. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  406. package/Lights/Shadows/cascadedShadowGenerator.pure.d.ts +290 -0
  407. package/Lights/Shadows/cascadedShadowGenerator.pure.js +868 -0
  408. package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -0
  409. package/Lights/Shadows/pure.d.ts +1 -0
  410. package/Lights/Shadows/pure.js +1 -0
  411. package/Lights/Shadows/pure.js.map +1 -1
  412. package/Lights/Shadows/shadowGenerator.d.ts +3 -3
  413. package/Lights/Shadows/shadowGenerator.js +7 -7
  414. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  415. package/Lights/areaLight.d.ts +1 -1
  416. package/Lights/areaLight.js +0 -1
  417. package/Lights/areaLight.js.map +1 -1
  418. package/Lights/light.d.ts +2 -2
  419. package/Lights/light.js +2 -2
  420. package/Lights/light.js.map +1 -1
  421. package/Lights/shadowLight.d.ts +1 -1
  422. package/Lights/shadowLight.js +1 -1
  423. package/Lights/shadowLight.js.map +1 -1
  424. package/Loading/sceneLoader.d.ts +2 -2
  425. package/Loading/sceneLoader.js +3 -3
  426. package/Loading/sceneLoader.js.map +1 -1
  427. package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +1 -1
  428. package/Materials/GreasedLine/greasedLineMaterialDefaults.js +1 -1
  429. package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -1
  430. package/Materials/GreasedLine/greasedLineSimpleMaterial.d.ts +3 -3
  431. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +3 -3
  432. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  433. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js +6 -6
  434. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.pure.js.map +1 -1
  435. package/Materials/Node/nodeMaterial.pure.d.ts +12 -0
  436. package/Materials/Node/nodeMaterial.pure.js +68 -13
  437. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  438. package/Materials/Node/nodeMaterialDefault.js +14 -14
  439. package/Materials/Node/nodeMaterialDefault.js.map +1 -1
  440. package/Materials/PBR/openpbrMaterial.pure.js +19 -4
  441. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  442. package/Materials/PBR/pbrAnisotropicConfiguration.d.ts +40 -2
  443. package/Materials/PBR/pbrAnisotropicConfiguration.js +41 -3
  444. package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
  445. package/Materials/PBR/pbrBRDFConfiguration.d.ts +5 -1
  446. package/Materials/PBR/pbrBRDFConfiguration.js +5 -1
  447. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  448. package/Materials/PBR/pbrBaseSimpleMaterial.d.ts +2 -2
  449. package/Materials/PBR/pbrBaseSimpleMaterial.js +2 -2
  450. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  451. package/Materials/PBR/pbrClearCoatConfiguration.d.ts +42 -2
  452. package/Materials/PBR/pbrClearCoatConfiguration.js +42 -2
  453. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  454. package/Materials/PBR/pbrIridescenceConfiguration.d.ts +38 -1
  455. package/Materials/PBR/pbrIridescenceConfiguration.js +38 -1
  456. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  457. package/Materials/PBR/pbrMaterial.pure.d.ts +6 -0
  458. package/Materials/PBR/pbrMaterial.pure.js +8 -0
  459. package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
  460. package/Materials/PBR/pbrSheenConfiguration.d.ts +41 -2
  461. package/Materials/PBR/pbrSheenConfiguration.js +41 -2
  462. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  463. package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +41 -2
  464. package/Materials/PBR/pbrSubSurfaceConfiguration.js +42 -3
  465. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  466. package/Materials/Textures/Filtering/hdrFiltering.js +1 -1
  467. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  468. package/Materials/Textures/Filtering/hdrIrradianceFiltering.d.ts +1 -1
  469. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +2 -2
  470. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
  471. package/Materials/Textures/Loaders/EXR/exrLoader.core.d.ts +1 -1
  472. package/Materials/Textures/Loaders/EXR/exrLoader.core.js +5 -109
  473. package/Materials/Textures/Loaders/EXR/exrLoader.core.js.map +1 -1
  474. package/Materials/Textures/Loaders/EXR/exrLoader.decoder.js +1 -1
  475. package/Materials/Textures/Loaders/EXR/exrLoader.decoder.js.map +1 -1
  476. package/Materials/Textures/Loaders/basisTextureLoader.js +2 -2
  477. package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
  478. package/Materials/Textures/Loaders/ddsTextureLoader.js +1 -1
  479. package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
  480. package/Materials/Textures/Loaders/envTextureLoader.js +3 -1
  481. package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
  482. package/Materials/Textures/Loaders/ktxTextureLoader.js +11 -2
  483. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  484. package/Materials/Textures/MultiviewRenderTarget.d.ts +1 -1
  485. package/Materials/Textures/MultiviewRenderTarget.js +1 -1
  486. package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
  487. package/Materials/Textures/Packer/packer.d.ts +1 -1
  488. package/Materials/Textures/Packer/packer.js +6 -6
  489. package/Materials/Textures/Packer/packer.js.map +1 -1
  490. package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -2
  491. package/Materials/Textures/Procedurals/customProceduralTexture.js +4 -4
  492. package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
  493. package/Materials/Textures/Procedurals/noiseProceduralTexture.pure.js +17 -5
  494. package/Materials/Textures/Procedurals/noiseProceduralTexture.pure.js.map +1 -1
  495. package/Materials/Textures/Procedurals/proceduralTexture.pure.js +4 -1
  496. package/Materials/Textures/Procedurals/proceduralTexture.pure.js.map +1 -1
  497. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js +1 -1
  498. package/Materials/Textures/Procedurals/proceduralTextureSceneComponent.js.map +1 -1
  499. package/Materials/Textures/prePassRenderTarget.d.ts +1 -1
  500. package/Materials/Textures/prePassRenderTarget.js +1 -1
  501. package/Materials/Textures/prePassRenderTarget.js.map +1 -1
  502. package/Materials/Textures/rawCubeTexture.d.ts +1 -1
  503. package/Materials/Textures/rawCubeTexture.js +2 -2
  504. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  505. package/Materials/Textures/rawTexture.d.ts +1 -1
  506. package/Materials/Textures/rawTexture.js +1 -1
  507. package/Materials/Textures/rawTexture.js.map +1 -1
  508. package/Materials/Textures/rawTexture2DArray.d.ts +1 -1
  509. package/Materials/Textures/rawTexture2DArray.js +1 -1
  510. package/Materials/Textures/rawTexture2DArray.js.map +1 -1
  511. package/Materials/Textures/rawTexture3D.d.ts +1 -1
  512. package/Materials/Textures/rawTexture3D.js +1 -1
  513. package/Materials/Textures/rawTexture3D.js.map +1 -1
  514. package/Materials/Textures/refractionTexture.d.ts +1 -1
  515. package/Materials/Textures/refractionTexture.js +1 -1
  516. package/Materials/Textures/refractionTexture.js.map +1 -1
  517. package/Materials/Textures/textureMerger.d.ts +1 -1
  518. package/Materials/Textures/textureMerger.js +1 -1
  519. package/Materials/Textures/textureMerger.js.map +1 -1
  520. package/Materials/Textures/textureProcessor.d.ts +1 -1
  521. package/Materials/Textures/textureProcessor.js +2 -2
  522. package/Materials/Textures/textureProcessor.js.map +1 -1
  523. package/Materials/clipPlaneMaterialHelper.js +1 -1
  524. package/Materials/clipPlaneMaterialHelper.js.map +1 -1
  525. package/Materials/effect.pure.d.ts +2 -2
  526. package/Materials/effect.pure.js +12 -6
  527. package/Materials/effect.pure.js.map +1 -1
  528. package/Materials/effectRenderer.pure.js +4 -2
  529. package/Materials/effectRenderer.pure.js.map +1 -1
  530. package/Materials/floatingOriginMatrixOverrides.d.ts +1 -1
  531. package/Materials/floatingOriginMatrixOverrides.js +1 -1
  532. package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
  533. package/Materials/material.detailMapConfiguration.d.ts +39 -1
  534. package/Materials/material.detailMapConfiguration.js +39 -1
  535. package/Materials/material.detailMapConfiguration.js.map +1 -1
  536. package/Materials/materialHelper.geometryrendering.d.ts +1 -1
  537. package/Materials/materialHelper.geometryrendering.js +1 -1
  538. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  539. package/Materials/materialPluginFactoryExport.js +2 -2
  540. package/Materials/materialPluginFactoryExport.js.map +1 -1
  541. package/Materials/meshDebugPluginMaterial.pure.js +15 -13
  542. package/Materials/meshDebugPluginMaterial.pure.js.map +1 -1
  543. package/Materials/pushMaterial.d.ts +7 -1
  544. package/Materials/pushMaterial.js +7 -1
  545. package/Materials/pushMaterial.js.map +1 -1
  546. package/Materials/uniformBuffer.js +1 -1
  547. package/Materials/uniformBuffer.js.map +1 -1
  548. package/Maths/math.axis.d.ts +1 -1
  549. package/Maths/math.axis.js +1 -1
  550. package/Maths/math.axis.js.map +1 -1
  551. package/Maths/math.d.ts +2 -2
  552. package/Maths/math.functions.d.ts +1 -1
  553. package/Maths/math.functions.js +1 -1
  554. package/Maths/math.functions.js.map +1 -1
  555. package/Maths/math.isovector.d.ts +1 -1
  556. package/Maths/math.isovector.js +1 -1
  557. package/Maths/math.isovector.js.map +1 -1
  558. package/Maths/math.js +2 -2
  559. package/Maths/math.js.map +1 -1
  560. package/Maths/math.path.d.ts +1 -1
  561. package/Maths/math.path.js +1 -1
  562. package/Maths/math.path.js.map +1 -1
  563. package/Maths/math.plane.d.ts +1 -1
  564. package/Maths/math.plane.js +1 -1
  565. package/Maths/math.plane.js.map +1 -1
  566. package/Maths/math.polar.d.ts +1 -1
  567. package/Maths/math.polar.js +1 -1
  568. package/Maths/math.polar.js.map +1 -1
  569. package/Maths/math.vertexFormat.d.ts +1 -1
  570. package/Maths/math.vertexFormat.js +1 -1
  571. package/Maths/math.vertexFormat.js.map +1 -1
  572. package/Maths/pure.d.ts +1 -0
  573. package/Maths/pure.js +1 -0
  574. package/Maths/pure.js.map +1 -1
  575. package/Meshes/Builders/geodesicBuilder.js +1 -1
  576. package/Meshes/Builders/geodesicBuilder.js.map +1 -1
  577. package/Meshes/Builders/goldbergBuilder.d.ts +1 -1
  578. package/Meshes/Builders/goldbergBuilder.js +4 -4
  579. package/Meshes/Builders/goldbergBuilder.js.map +1 -1
  580. package/Meshes/Builders/greasedLineBuilder.d.ts +4 -4
  581. package/Meshes/Builders/greasedLineBuilder.js +5 -5
  582. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  583. package/Meshes/Builders/textBuilder.d.ts +2 -2
  584. package/Meshes/Builders/textBuilder.js +4 -4
  585. package/Meshes/Builders/textBuilder.js.map +1 -1
  586. package/Meshes/Builders/tiledBoxBuilder.d.ts +3 -3
  587. package/Meshes/Builders/tiledBoxBuilder.js +3 -3
  588. package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
  589. package/Meshes/Builders/tiledPlaneBuilder.d.ts +1 -1
  590. package/Meshes/Builders/tiledPlaneBuilder.js +1 -1
  591. package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
  592. package/Meshes/Compression/dracoCodec.js +1 -1
  593. package/Meshes/Compression/dracoCodec.js.map +1 -1
  594. package/Meshes/Compression/dracoDecoder.js +1 -1
  595. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  596. package/Meshes/Compression/dracoEncoder.d.ts +1 -1
  597. package/Meshes/Compression/dracoEncoder.js +2 -2
  598. package/Meshes/Compression/dracoEncoder.js.map +1 -1
  599. package/Meshes/Compression/meshoptCompression.js +1 -1
  600. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  601. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +9 -3
  602. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  603. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +2 -2
  604. package/Meshes/GreasedLine/greasedLineBaseMesh.js +3 -3
  605. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  606. package/Meshes/Node/nodeGeometry.d.ts +2 -2
  607. package/Meshes/Node/nodeGeometry.js +4 -4
  608. package/Meshes/Node/nodeGeometry.js.map +1 -1
  609. package/Meshes/Node/nodeGeometryBuildState.d.ts +1 -1
  610. package/Meshes/Node/nodeGeometryBuildState.js +1 -1
  611. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  612. package/Meshes/abstractMesh.hotSpot.d.ts +1 -1
  613. package/Meshes/abstractMesh.hotSpot.js +2 -2
  614. package/Meshes/abstractMesh.hotSpot.js.map +1 -1
  615. package/Meshes/abstractMesh.pure.js +2 -13
  616. package/Meshes/abstractMesh.pure.js.map +1 -1
  617. package/Meshes/buffer.d.ts +1 -1
  618. package/Meshes/buffer.js +1 -1
  619. package/Meshes/buffer.js.map +1 -1
  620. package/Meshes/csg.d.ts +3 -3
  621. package/Meshes/csg.js +4 -4
  622. package/Meshes/csg.js.map +1 -1
  623. package/Meshes/csg2.d.ts +1 -1
  624. package/Meshes/csg2.js +4 -4
  625. package/Meshes/csg2.js.map +1 -1
  626. package/Meshes/geodesicMesh.d.ts +1 -1
  627. package/Meshes/geodesicMesh.js +1 -1
  628. package/Meshes/geodesicMesh.js.map +1 -1
  629. package/Meshes/geometry.d.ts +2 -2
  630. package/Meshes/geometry.js +4 -4
  631. package/Meshes/geometry.js.map +1 -1
  632. package/Meshes/lattice.d.ts +1 -1
  633. package/Meshes/lattice.js +1 -1
  634. package/Meshes/lattice.js.map +1 -1
  635. package/Meshes/lattice.material.d.ts +1 -1
  636. package/Meshes/lattice.material.js +1 -1
  637. package/Meshes/lattice.material.js.map +1 -1
  638. package/Meshes/mesh.vertexData.d.ts +2 -2
  639. package/Meshes/mesh.vertexData.js +3 -4
  640. package/Meshes/mesh.vertexData.js.map +1 -1
  641. package/Meshes/mesh.vertexData.subdivide.js +1 -1
  642. package/Meshes/mesh.vertexData.subdivide.js.map +1 -1
  643. package/Meshes/meshBuilder.d.ts +18 -18
  644. package/Meshes/meshBuilder.js +18 -18
  645. package/Meshes/meshBuilder.js.map +1 -1
  646. package/Meshes/meshSimplification.d.ts +1 -1
  647. package/Meshes/meshSimplification.js +4 -4
  648. package/Meshes/meshSimplification.js.map +1 -1
  649. package/Meshes/meshUVSpaceRenderer.d.ts +1 -1
  650. package/Meshes/meshUVSpaceRenderer.js +0 -1
  651. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  652. package/Meshes/meshUtils.d.ts +1 -1
  653. package/Meshes/meshUtils.js +2 -2
  654. package/Meshes/meshUtils.js.map +1 -1
  655. package/Meshes/polygonMesh.d.ts +2 -2
  656. package/Meshes/polygonMesh.js +3 -3
  657. package/Meshes/polygonMesh.js.map +1 -1
  658. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -2
  659. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  660. package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
  661. package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
  662. package/Misc/PerformanceViewer/performanceViewerCollector.js +1 -1
  663. package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
  664. package/Misc/areaLightsTextureTools.d.ts +1 -1
  665. package/Misc/areaLightsTextureTools.js +3 -3
  666. package/Misc/areaLightsTextureTools.js.map +1 -1
  667. package/Misc/assetsManager.d.ts +4 -4
  668. package/Misc/assetsManager.js +5 -5
  669. package/Misc/assetsManager.js.map +1 -1
  670. package/Misc/basisWorker.js +1 -1
  671. package/Misc/basisWorker.js.map +1 -1
  672. package/Misc/brdfTextureTools.js +1 -1
  673. package/Misc/brdfTextureTools.js.map +1 -1
  674. package/Misc/copyTextureToTexture.d.ts +1 -1
  675. package/Misc/copyTextureToTexture.js +1 -1
  676. package/Misc/copyTextureToTexture.js.map +1 -1
  677. package/Misc/decorators.serialization.js +2 -2
  678. package/Misc/decorators.serialization.js.map +1 -1
  679. package/Misc/depthReducer.d.ts +2 -2
  680. package/Misc/depthReducer.js +2 -2
  681. package/Misc/depthReducer.js.map +1 -1
  682. package/Misc/gradients.d.ts +1 -1
  683. package/Misc/gradients.js +1 -1
  684. package/Misc/gradients.js.map +1 -1
  685. package/Misc/greasedLineTools.d.ts +1 -1
  686. package/Misc/greasedLineTools.js +3 -3
  687. package/Misc/greasedLineTools.js.map +1 -1
  688. package/Misc/halfFloat.d.ts +17 -0
  689. package/Misc/halfFloat.js +131 -0
  690. package/Misc/halfFloat.js.map +1 -0
  691. package/Misc/khronosTextureContainer2.js +1 -1
  692. package/Misc/khronosTextureContainer2.js.map +1 -1
  693. package/Misc/meshExploder.js +1 -1
  694. package/Misc/meshExploder.js.map +1 -1
  695. package/Misc/pivotTools.js +1 -1
  696. package/Misc/pivotTools.js.map +1 -1
  697. package/Misc/rgbdTextureTools.js +1 -1
  698. package/Misc/rgbdTextureTools.js.map +1 -1
  699. package/Misc/sceneOptimizer.js +1 -1
  700. package/Misc/sceneOptimizer.js.map +1 -1
  701. package/Misc/sceneRecorder.js +7 -7
  702. package/Misc/sceneRecorder.js.map +1 -1
  703. package/Misc/sceneSerializer.js +3 -3
  704. package/Misc/sceneSerializer.js.map +1 -1
  705. package/Misc/snapshotRenderingHelper.js +1 -1
  706. package/Misc/snapshotRenderingHelper.js.map +1 -1
  707. package/Misc/textureTools.d.ts +3 -13
  708. package/Misc/textureTools.js +6 -64
  709. package/Misc/textureTools.js.map +1 -1
  710. package/Misc/thinMinMaxReducer.d.ts +1 -1
  711. package/Misc/thinMinMaxReducer.js +1 -1
  712. package/Misc/thinMinMaxReducer.js.map +1 -1
  713. package/Misc/tools.internals.js +1 -1
  714. package/Misc/tools.internals.js.map +1 -1
  715. package/Misc/tools.pure.js +11 -4
  716. package/Misc/tools.pure.js.map +1 -1
  717. package/Misc/trajectoryClassifier.d.ts +1 -1
  718. package/Misc/trajectoryClassifier.js +1 -1
  719. package/Misc/trajectoryClassifier.js.map +1 -1
  720. package/Misc/videoRecorder.js +1 -1
  721. package/Misc/videoRecorder.js.map +1 -1
  722. package/Misc/virtualJoystick.d.ts +1 -1
  723. package/Misc/virtualJoystick.js +1 -1
  724. package/Misc/virtualJoystick.js.map +1 -1
  725. package/Morph/morphTarget.js +1 -1
  726. package/Morph/morphTarget.js.map +1 -1
  727. package/Navigation/Plugins/recastJSPlugin.d.ts +1 -1
  728. package/Navigation/Plugins/recastJSPlugin.js +2 -2
  729. package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
  730. package/Particles/EmitterTypes/boxParticleEmitter.d.ts +1 -1
  731. package/Particles/EmitterTypes/boxParticleEmitter.js +1 -1
  732. package/Particles/EmitterTypes/boxParticleEmitter.js.map +1 -1
  733. package/Particles/EmitterTypes/coneParticleEmitter.d.ts +1 -1
  734. package/Particles/EmitterTypes/coneParticleEmitter.js +1 -1
  735. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  736. package/Particles/EmitterTypes/customParticleEmitter.d.ts +1 -1
  737. package/Particles/EmitterTypes/customParticleEmitter.js +1 -1
  738. package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
  739. package/Particles/EmitterTypes/cylinderParticleEmitter.d.ts +1 -1
  740. package/Particles/EmitterTypes/cylinderParticleEmitter.js +1 -1
  741. package/Particles/EmitterTypes/cylinderParticleEmitter.js.map +1 -1
  742. package/Particles/EmitterTypes/hemisphericParticleEmitter.d.ts +1 -1
  743. package/Particles/EmitterTypes/hemisphericParticleEmitter.js +1 -1
  744. package/Particles/EmitterTypes/hemisphericParticleEmitter.js.map +1 -1
  745. package/Particles/EmitterTypes/meshParticleEmitter.d.ts +1 -1
  746. package/Particles/EmitterTypes/meshParticleEmitter.js +2 -2
  747. package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
  748. package/Particles/EmitterTypes/pointParticleEmitter.d.ts +1 -1
  749. package/Particles/EmitterTypes/pointParticleEmitter.js +1 -1
  750. package/Particles/EmitterTypes/pointParticleEmitter.js.map +1 -1
  751. package/Particles/EmitterTypes/sphereParticleEmitter.d.ts +1 -1
  752. package/Particles/EmitterTypes/sphereParticleEmitter.js +1 -1
  753. package/Particles/EmitterTypes/sphereParticleEmitter.js.map +1 -1
  754. package/Particles/Node/nodeParticleBuildState.d.ts +4 -4
  755. package/Particles/Node/nodeParticleBuildState.js +2 -2
  756. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  757. package/Particles/Node/nodeParticleSystemSet.d.ts +2 -2
  758. package/Particles/Node/nodeParticleSystemSet.helper.js +31 -31
  759. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  760. package/Particles/Node/nodeParticleSystemSet.js +8 -8
  761. package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
  762. package/Particles/attractor.d.ts +1 -1
  763. package/Particles/attractor.js +1 -1
  764. package/Particles/attractor.js.map +1 -1
  765. package/Particles/computeShaderParticleSystem.pure.js +5 -1
  766. package/Particles/computeShaderParticleSystem.pure.js.map +1 -1
  767. package/Particles/flowMap.d.ts +7 -1
  768. package/Particles/flowMap.js +7 -1
  769. package/Particles/flowMap.js.map +1 -1
  770. package/Particles/gpuParticleSystem.pure.d.ts +1 -0
  771. package/Particles/gpuParticleSystem.pure.js +17 -1
  772. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  773. package/Particles/particle.d.ts +2 -2
  774. package/Particles/particle.js +2 -2
  775. package/Particles/particle.js.map +1 -1
  776. package/Particles/particleHelper.js +5 -5
  777. package/Particles/particleHelper.js.map +1 -1
  778. package/Particles/particleSystem.functions.d.ts +1 -1
  779. package/Particles/particleSystem.functions.js +1 -1
  780. package/Particles/particleSystem.functions.js.map +1 -1
  781. package/Particles/particleSystemSet.d.ts +1 -1
  782. package/Particles/particleSystemSet.js +5 -5
  783. package/Particles/particleSystemSet.js.map +1 -1
  784. package/Particles/pointsCloudSystem.d.ts +1 -1
  785. package/Particles/pointsCloudSystem.js +6 -6
  786. package/Particles/pointsCloudSystem.js.map +1 -1
  787. package/Particles/solidParticle.d.ts +2 -2
  788. package/Particles/solidParticle.js +3 -3
  789. package/Particles/solidParticle.js.map +1 -1
  790. package/Particles/solidParticleSystem.d.ts +4 -4
  791. package/Particles/solidParticleSystem.js +7 -7
  792. package/Particles/solidParticleSystem.js.map +1 -1
  793. package/Particles/subEmitter.js +1 -1
  794. package/Particles/subEmitter.js.map +1 -1
  795. package/Particles/thinParticleSystem.function.js +2 -2
  796. package/Particles/thinParticleSystem.function.js.map +1 -1
  797. package/Physics/Plugins/cannonJSPlugin.d.ts +1 -1
  798. package/Physics/Plugins/cannonJSPlugin.js +1 -1
  799. package/Physics/Plugins/cannonJSPlugin.js.map +1 -1
  800. package/Physics/castingResult.d.ts +1 -1
  801. package/Physics/castingResult.js +1 -1
  802. package/Physics/castingResult.js.map +1 -1
  803. package/Physics/physicsHelper.d.ts +1 -1
  804. package/Physics/physicsHelper.js +4 -4
  805. package/Physics/physicsHelper.js.map +1 -1
  806. package/Physics/physicsImpostor.d.ts +1 -1
  807. package/Physics/physicsImpostor.js +1 -1
  808. package/Physics/physicsImpostor.js.map +1 -1
  809. package/Physics/physicsRaycastResult.d.ts +1 -1
  810. package/Physics/physicsRaycastResult.js +1 -1
  811. package/Physics/physicsRaycastResult.js.map +1 -1
  812. package/Physics/v1/Plugins/ammoJSPlugin.d.ts +2 -2
  813. package/Physics/v1/Plugins/ammoJSPlugin.js +5 -5
  814. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
  815. package/Physics/v1/Plugins/oimoJSPlugin.d.ts +2 -2
  816. package/Physics/v1/Plugins/oimoJSPlugin.js +2 -2
  817. package/Physics/v1/Plugins/oimoJSPlugin.js.map +1 -1
  818. package/Physics/v1/physicsEngine.d.ts +1 -1
  819. package/Physics/v1/physicsEngine.js +1 -1
  820. package/Physics/v1/physicsEngine.js.map +1 -1
  821. package/Physics/v2/Plugins/havokPlugin.d.ts +14 -2
  822. package/Physics/v2/Plugins/havokPlugin.js +45 -7
  823. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  824. package/Physics/v2/characterController.d.ts +2 -2
  825. package/Physics/v2/characterController.js +2 -2
  826. package/Physics/v2/characterController.js.map +1 -1
  827. package/Physics/v2/physicsAggregate.d.ts +1 -1
  828. package/Physics/v2/physicsAggregate.js +1 -1
  829. package/Physics/v2/physicsAggregate.js.map +1 -1
  830. package/Physics/v2/physicsBody.d.ts +1 -1
  831. package/Physics/v2/physicsBody.js +1 -1
  832. package/Physics/v2/physicsBody.js.map +1 -1
  833. package/Physics/v2/physicsEngine.d.ts +1 -1
  834. package/Physics/v2/physicsEngine.js +1 -1
  835. package/Physics/v2/physicsEngine.js.map +1 -1
  836. package/Physics/v2/physicsShape.d.ts +1 -1
  837. package/Physics/v2/physicsShape.js +1 -1
  838. package/Physics/v2/physicsShape.js.map +1 -1
  839. package/Physics/v2/ragdoll.d.ts +2 -2
  840. package/Physics/v2/ragdoll.js +2 -2
  841. package/Physics/v2/ragdoll.js.map +1 -1
  842. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.d.ts +1 -0
  843. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js +8 -6
  844. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js.map +1 -1
  845. package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js +1 -1
  846. package/PostProcesses/RenderPipeline/Pipelines/thinSSRRenderingPipeline.js.map +1 -1
  847. package/PostProcesses/RenderPipeline/postProcessRenderEffect.js +1 -1
  848. package/PostProcesses/RenderPipeline/postProcessRenderEffect.js.map +1 -1
  849. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +3 -2
  850. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  851. package/PostProcesses/bloomEffect.d.ts +1 -1
  852. package/PostProcesses/bloomEffect.js +4 -4
  853. package/PostProcesses/bloomEffect.js.map +1 -1
  854. package/PostProcesses/depthOfFieldEffect.d.ts +1 -1
  855. package/PostProcesses/depthOfFieldEffect.js +3 -3
  856. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  857. package/PostProcesses/depthOfFieldMergePostProcess.d.ts +1 -1
  858. package/PostProcesses/depthOfFieldMergePostProcess.js +1 -1
  859. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  860. package/PostProcesses/highlightsPostProcess.d.ts +1 -1
  861. package/PostProcesses/highlightsPostProcess.js +1 -1
  862. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  863. package/PostProcesses/imageProcessingPostProcess.d.ts +1 -1
  864. package/PostProcesses/imageProcessingPostProcess.js +1 -1
  865. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  866. package/PostProcesses/postProcessManager.d.ts +3 -0
  867. package/PostProcesses/postProcessManager.js +4 -1
  868. package/PostProcesses/postProcessManager.js.map +1 -1
  869. package/PostProcesses/subSurfaceScatteringPostProcess.pure.d.ts +1 -0
  870. package/PostProcesses/subSurfaceScatteringPostProcess.pure.js +10 -0
  871. package/PostProcesses/subSurfaceScatteringPostProcess.pure.js.map +1 -1
  872. package/PostProcesses/thinAnaglyphPostProcess.d.ts +1 -1
  873. package/PostProcesses/thinAnaglyphPostProcess.js +1 -1
  874. package/PostProcesses/thinAnaglyphPostProcess.js.map +1 -1
  875. package/PostProcesses/thinBlackAndWhitePostProcess.d.ts +1 -1
  876. package/PostProcesses/thinBlackAndWhitePostProcess.js +1 -1
  877. package/PostProcesses/thinBlackAndWhitePostProcess.js.map +1 -1
  878. package/PostProcesses/thinBloomEffect.js +1 -1
  879. package/PostProcesses/thinBloomEffect.js.map +1 -1
  880. package/PostProcesses/thinBloomMergePostProcess.d.ts +1 -1
  881. package/PostProcesses/thinBloomMergePostProcess.js +1 -1
  882. package/PostProcesses/thinBloomMergePostProcess.js.map +1 -1
  883. package/PostProcesses/thinBlurPostProcess.d.ts +1 -1
  884. package/PostProcesses/thinBlurPostProcess.js +1 -1
  885. package/PostProcesses/thinBlurPostProcess.js.map +1 -1
  886. package/PostProcesses/thinChromaticAberrationPostProcess.d.ts +2 -2
  887. package/PostProcesses/thinChromaticAberrationPostProcess.js +2 -2
  888. package/PostProcesses/thinChromaticAberrationPostProcess.js.map +1 -1
  889. package/PostProcesses/thinCircleOfConfusionPostProcess.d.ts +1 -1
  890. package/PostProcesses/thinCircleOfConfusionPostProcess.js +1 -1
  891. package/PostProcesses/thinCircleOfConfusionPostProcess.js.map +1 -1
  892. package/PostProcesses/thinColorCorrectionPostProcess.d.ts +1 -1
  893. package/PostProcesses/thinColorCorrectionPostProcess.js +2 -2
  894. package/PostProcesses/thinColorCorrectionPostProcess.js.map +1 -1
  895. package/PostProcesses/thinConvolutionPostProcess.d.ts +1 -1
  896. package/PostProcesses/thinConvolutionPostProcess.js +1 -1
  897. package/PostProcesses/thinConvolutionPostProcess.js.map +1 -1
  898. package/PostProcesses/thinCustomPostProcess.d.ts +1 -1
  899. package/PostProcesses/thinCustomPostProcess.js +1 -1
  900. package/PostProcesses/thinCustomPostProcess.js.map +1 -1
  901. package/PostProcesses/thinDepthOfFieldEffect.d.ts +3 -0
  902. package/PostProcesses/thinDepthOfFieldEffect.js +4 -1
  903. package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -1
  904. package/PostProcesses/thinDepthOfFieldMergePostProcess.d.ts +1 -1
  905. package/PostProcesses/thinDepthOfFieldMergePostProcess.js +1 -1
  906. package/PostProcesses/thinDepthOfFieldMergePostProcess.js.map +1 -1
  907. package/PostProcesses/thinExtractHighlightsPostProcess.d.ts +1 -1
  908. package/PostProcesses/thinExtractHighlightsPostProcess.js +1 -1
  909. package/PostProcesses/thinExtractHighlightsPostProcess.js.map +1 -1
  910. package/PostProcesses/thinFXAAPostProcess.d.ts +2 -2
  911. package/PostProcesses/thinFXAAPostProcess.js +2 -2
  912. package/PostProcesses/thinFXAAPostProcess.js.map +1 -1
  913. package/PostProcesses/thinFilterPostProcess.d.ts +2 -2
  914. package/PostProcesses/thinFilterPostProcess.js +2 -2
  915. package/PostProcesses/thinFilterPostProcess.js.map +1 -1
  916. package/PostProcesses/thinGrainPostProcess.d.ts +1 -1
  917. package/PostProcesses/thinGrainPostProcess.js +1 -1
  918. package/PostProcesses/thinGrainPostProcess.js.map +1 -1
  919. package/PostProcesses/thinImageProcessingPostProcess.d.ts +2 -2
  920. package/PostProcesses/thinImageProcessingPostProcess.js +2 -2
  921. package/PostProcesses/thinImageProcessingPostProcess.js.map +1 -1
  922. package/PostProcesses/thinMotionBlurPostProcess.d.ts +1 -1
  923. package/PostProcesses/thinMotionBlurPostProcess.js +2 -2
  924. package/PostProcesses/thinMotionBlurPostProcess.js.map +1 -1
  925. package/PostProcesses/thinPassPostProcess.d.ts +1 -1
  926. package/PostProcesses/thinPassPostProcess.js +1 -1
  927. package/PostProcesses/thinPassPostProcess.js.map +1 -1
  928. package/PostProcesses/thinSSAO2BlurPostProcess.d.ts +1 -1
  929. package/PostProcesses/thinSSAO2BlurPostProcess.js +1 -1
  930. package/PostProcesses/thinSSAO2BlurPostProcess.js.map +1 -1
  931. package/PostProcesses/thinSSAO2CombinePostProcess.d.ts +1 -1
  932. package/PostProcesses/thinSSAO2CombinePostProcess.js +2 -2
  933. package/PostProcesses/thinSSAO2CombinePostProcess.js.map +1 -1
  934. package/PostProcesses/thinSSAO2PostProcess.d.ts +7 -2
  935. package/PostProcesses/thinSSAO2PostProcess.js +36 -4
  936. package/PostProcesses/thinSSAO2PostProcess.js.map +1 -1
  937. package/PostProcesses/thinSSRBlurCombinerPostProcess.d.ts +1 -1
  938. package/PostProcesses/thinSSRBlurCombinerPostProcess.js +2 -2
  939. package/PostProcesses/thinSSRBlurCombinerPostProcess.js.map +1 -1
  940. package/PostProcesses/thinSSRBlurPostProcess.d.ts +2 -2
  941. package/PostProcesses/thinSSRBlurPostProcess.js +2 -2
  942. package/PostProcesses/thinSSRBlurPostProcess.js.map +1 -1
  943. package/PostProcesses/thinSSRPostProcess.d.ts +1 -1
  944. package/PostProcesses/thinSSRPostProcess.js +2 -2
  945. package/PostProcesses/thinSSRPostProcess.js.map +1 -1
  946. package/PostProcesses/thinScreenSpaceCurvaturePostProcess.d.ts +1 -1
  947. package/PostProcesses/thinScreenSpaceCurvaturePostProcess.js +1 -1
  948. package/PostProcesses/thinScreenSpaceCurvaturePostProcess.js.map +1 -1
  949. package/PostProcesses/thinSharpenPostProcess.d.ts +1 -1
  950. package/PostProcesses/thinSharpenPostProcess.js +1 -1
  951. package/PostProcesses/thinSharpenPostProcess.js.map +1 -1
  952. package/PostProcesses/thinTAAPostProcess.d.ts +3 -3
  953. package/PostProcesses/thinTAAPostProcess.js +4 -4
  954. package/PostProcesses/thinTAAPostProcess.js.map +1 -1
  955. package/PostProcesses/thinTonemapPostProcess.d.ts +1 -1
  956. package/PostProcesses/thinTonemapPostProcess.js +1 -1
  957. package/PostProcesses/thinTonemapPostProcess.js.map +1 -1
  958. package/PostProcesses/vrDistortionCorrectionPostProcess.d.ts +1 -1
  959. package/PostProcesses/vrDistortionCorrectionPostProcess.js +3 -3
  960. package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
  961. package/Rendering/IBLShadows/iblShadowsAccumulationPass.d.ts +2 -2
  962. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +4 -4
  963. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
  964. package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.d.ts +2 -2
  965. package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js +4 -4
  966. package/Rendering/IBLShadows/iblShadowsSpatialBlurPass.js.map +1 -1
  967. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +3 -3
  968. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +4 -4
  969. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  970. package/Rendering/depthPeelingRenderer.d.ts +1 -1
  971. package/Rendering/depthPeelingRenderer.js +2 -2
  972. package/Rendering/depthPeelingRenderer.js.map +1 -1
  973. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +1 -1
  974. package/Rendering/fluidRenderer/fluidRenderingObject.js +1 -1
  975. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  976. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +1 -1
  977. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +2 -2
  978. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  979. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +3 -3
  980. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +3 -3
  981. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  982. package/Rendering/fluidRenderer/fluidRenderingTextures.d.ts +2 -2
  983. package/Rendering/fluidRenderer/fluidRenderingTextures.js +3 -3
  984. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
  985. package/Rendering/iblCdfGenerator.d.ts +3 -3
  986. package/Rendering/iblCdfGenerator.js +5 -5
  987. package/Rendering/iblCdfGenerator.js.map +1 -1
  988. package/Rendering/renderingGroup.js +1 -1
  989. package/Rendering/renderingGroup.js.map +1 -1
  990. package/Rendering/subSurfaceConfiguration.d.ts +2 -2
  991. package/Rendering/subSurfaceConfiguration.js +2 -2
  992. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  993. package/Rendering/utilityLayerRenderer.d.ts +2 -2
  994. package/Rendering/utilityLayerRenderer.js +4 -4
  995. package/Rendering/utilityLayerRenderer.js.map +1 -1
  996. package/Shaders/ssao2.fragment.js +10 -2
  997. package/Shaders/ssao2.fragment.js.map +1 -1
  998. package/ShadersWGSL/gpuRenderParticles.fragment.d.ts +5 -0
  999. package/ShadersWGSL/gpuRenderParticles.fragment.js +50 -0
  1000. package/ShadersWGSL/gpuRenderParticles.fragment.js.map +1 -0
  1001. package/ShadersWGSL/gpuRenderParticles.vertex.d.ts +5 -0
  1002. package/ShadersWGSL/gpuRenderParticles.vertex.js +120 -0
  1003. package/ShadersWGSL/gpuRenderParticles.vertex.js.map +1 -0
  1004. package/ShadersWGSL/noise.fragment.d.ts +5 -0
  1005. package/ShadersWGSL/noise.fragment.js +18 -0
  1006. package/ShadersWGSL/noise.fragment.js.map +1 -0
  1007. package/ShadersWGSL/ssao2.fragment.js +10 -2
  1008. package/ShadersWGSL/ssao2.fragment.js.map +1 -1
  1009. package/SmartAssets/smartAssetSerializer.js +1 -1
  1010. package/SmartAssets/smartAssetSerializer.js.map +1 -1
  1011. package/Sprites/sprite.d.ts +2 -2
  1012. package/Sprites/sprite.js +2 -2
  1013. package/Sprites/sprite.js.map +1 -1
  1014. package/Sprites/spriteManager.d.ts +2 -2
  1015. package/Sprites/spriteManager.js +4 -5
  1016. package/Sprites/spriteManager.js.map +1 -1
  1017. package/Sprites/spritePackedManager.js +1 -1
  1018. package/Sprites/spritePackedManager.js.map +1 -1
  1019. package/Sprites/spriteRenderer.js +2 -2
  1020. package/Sprites/spriteRenderer.js.map +1 -1
  1021. package/XR/features/WebXRHitTestLegacy.d.ts +1 -1
  1022. package/XR/features/WebXRHitTestLegacy.js +2 -2
  1023. package/XR/features/WebXRHitTestLegacy.js.map +1 -1
  1024. package/XR/motionController/webXRAbstractMotionController.js +2 -2
  1025. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  1026. package/XR/motionController/webXRGenericMotionController.js +2 -2
  1027. package/XR/motionController/webXRGenericMotionController.js.map +1 -1
  1028. package/XR/motionController/webXRProfiledMotionController.js +4 -4
  1029. package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
  1030. package/XR/webXRCamera.d.ts +3 -3
  1031. package/XR/webXRCamera.js +4 -4
  1032. package/XR/webXRCamera.js.map +1 -1
  1033. package/XR/webXRDefaultExperience.d.ts +4 -4
  1034. package/XR/webXRDefaultExperience.js +4 -4
  1035. package/XR/webXRDefaultExperience.js.map +1 -1
  1036. package/XR/webXREnterExitUI.js +1 -1
  1037. package/XR/webXREnterExitUI.js.map +1 -1
  1038. package/XR/webXRExperienceHelper.js +2 -2
  1039. package/XR/webXRExperienceHelper.js.map +1 -1
  1040. package/XR/webXRFeaturesManager.d.ts +47 -0
  1041. package/XR/webXRFeaturesManager.js +1 -1
  1042. package/XR/webXRFeaturesManager.js.map +1 -1
  1043. package/XR/webXRInput.js +1 -1
  1044. package/XR/webXRInput.js.map +1 -1
  1045. package/XR/webXRInputSource.js +4 -4
  1046. package/XR/webXRInputSource.js.map +1 -1
  1047. package/XR/webXRManagedOutputCanvas.js +1 -1
  1048. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  1049. package/XR/webXRRenderTargetTextureProvider.d.ts +1 -1
  1050. package/XR/webXRRenderTargetTextureProvider.js +1 -1
  1051. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  1052. package/assetContainer.d.ts +4 -4
  1053. package/assetContainer.js +6 -6
  1054. package/assetContainer.js.map +1 -1
  1055. package/node.d.ts +1 -1
  1056. package/node.js +6 -2
  1057. package/node.js.map +1 -1
  1058. package/package.json +684 -3
@@ -3,7 +3,7 @@ import { type PhysicsMaterial } from "./physicsMaterial.js";
3
3
  import { PhysicsShape } from "./physicsShape.js";
4
4
  import { type Scene } from "../../scene.js";
5
5
  import { type TransformNode } from "../../Meshes/transformNode.js";
6
- import { Quaternion, Vector3 } from "../../Maths/math.vector.js";
6
+ import { Quaternion, Vector3 } from "../../Maths/math.vector.pure.js";
7
7
  import { PhysicsMotionType, PhysicsShapeType } from "./IPhysicsEnginePlugin.js";
8
8
  import { type Mesh } from "../../Meshes/mesh.js";
9
9
  /**
@@ -1,7 +1,7 @@
1
1
  import { PhysicsBody } from "./physicsBody.js";
2
2
  import { PhysicsShape } from "./physicsShape.js";
3
3
  import { Logger } from "../../Misc/logger.js";
4
- import { Quaternion, TmpVectors, Vector3 } from "../../Maths/math.vector.js";
4
+ import { Quaternion, TmpVectors, Vector3 } from "../../Maths/math.vector.pure.js";
5
5
  import { WithinEpsilon } from "../../Maths/math.scalar.functions.js";
6
6
  import { BoundingBox } from "../../Culling/boundingBox.js";
7
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"physicsAggregate.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsAggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,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L,CAAC;CACJ","sourcesContent":["import { PhysicsBody } from \"./physicsBody\";\r\nimport { type PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { PhysicsShape } from \"./physicsShape\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { type Scene } from \"../../scene\";\r\nimport { type TransformNode } from \"../../Meshes/transformNode\";\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { WithinEpsilon } from \"../../Maths/math.scalar.functions\";\r\nimport { type IPhysicsEnginePluginV2, PhysicsMotionType, PhysicsShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport { type Mesh } from \"../../Meshes/mesh\";\r\nimport { type Observer } from \"../../Misc/observable\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Node } from \"../../node\";\r\nimport { type AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { BoundingBox } from \"../../Culling/boundingBox\";\r\n\r\n/**\r\n * The interface for the physics aggregate parameters\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsAggregateParameters {\r\n /**\r\n * The mass of the physics aggregate\r\n */\r\n mass: number;\r\n\r\n /**\r\n * The friction of the physics aggregate\r\n */\r\n friction?: number;\r\n\r\n /**\r\n * The coefficient of restitution of the physics aggregate\r\n */\r\n restitution?: number;\r\n\r\n /**\r\n * Radius for sphere, cylinder and capsule\r\n */\r\n radius?: number;\r\n\r\n /**\r\n * Starting point for cylinder/capsule\r\n */\r\n pointA?: Vector3;\r\n\r\n /**\r\n * Ending point for cylinder/capsule\r\n */\r\n pointB?: Vector3;\r\n\r\n /**\r\n * Extents for box\r\n */\r\n extents?: Vector3;\r\n\r\n /**\r\n * Orientation for box\r\n */\r\n rotation?: Quaternion;\r\n\r\n /**\r\n * mesh local center\r\n */\r\n center?: Vector3;\r\n\r\n /**\r\n * mesh object. Used for mesh and convex hull aggregates.\r\n */\r\n mesh?: Mesh;\r\n\r\n /**\r\n * Physics engine will try to make this body sleeping and not active\r\n */\r\n startAsleep?: boolean;\r\n\r\n /**\r\n * If true, mark the created shape as a trigger shape\r\n */\r\n isTriggerShape?: boolean;\r\n /**\r\n * Specify the body motion type\r\n */\r\n motionType?: PhysicsMotionType;\r\n}\r\n\r\n/**\r\n * Helper class to create and interact with a PhysicsAggregate.\r\n * This is a transition object that works like Physics Plugin V1 Impostors.\r\n * This helper instantiates all mandatory physics objects to get a body/shape and material.\r\n * It's less efficient than handling body and shapes independently but for prototyping or\r\n * a small numbers of physics objects, it's good enough.\r\n */\r\nexport class PhysicsAggregate {\r\n /**\r\n * The body that is associated with this aggregate\r\n */\r\n public body: PhysicsBody;\r\n\r\n /**\r\n * The shape that is associated with this aggregate\r\n */\r\n public shape: PhysicsShape;\r\n\r\n /**\r\n * The material that is associated with this aggregate\r\n */\r\n public material: PhysicsMaterial;\r\n\r\n private _disposeShapeWhenDisposed = true;\r\n private _options: PhysicsAggregateParameters = { mass: 0 };\r\n\r\n private _nodeDisposeObserver: Nullable<Observer<Node>>;\r\n\r\n /**\r\n * Get current computed options\r\n */\r\n public get options() {\r\n return this._options;\r\n }\r\n\r\n constructor(\r\n /**\r\n * The physics-enabled object used as the physics aggregate\r\n */\r\n public transformNode: TransformNode,\r\n /**\r\n * The type of the physics aggregate\r\n */\r\n public type: PhysicsShapeType | PhysicsShape,\r\n _options: PhysicsAggregateParameters = { mass: 0 },\r\n private _scene?: Scene\r\n ) {\r\n //sanity check!\r\n if (!this.transformNode) {\r\n Logger.Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n const m = transformNode as Mesh;\r\n if (this.transformNode.parent && this._options.mass !== 0 && m.hasThinInstances) {\r\n Logger.Warn(\r\n \"A physics body has been created for an object which has a parent and thin instances. Babylon physics currently works in local space so unexpected issues may occur.\"\r\n );\r\n }\r\n\r\n // Legacy support for old syntax.\r\n if (!this._scene && transformNode.getScene) {\r\n this._scene = transformNode.getScene();\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n //default options params\r\n this._prepareOptions(_options);\r\n const startAsleep = this._options.startAsleep ?? false;\r\n this.body = new PhysicsBody(transformNode, this._options.motionType!, startAsleep, this._scene);\r\n if ((type as any).getClassName && (type as any).getClassName() === \"PhysicsShape\") {\r\n this.shape = type as PhysicsShape;\r\n this._disposeShapeWhenDisposed = false;\r\n } else {\r\n this.shape = new PhysicsShape(\r\n {\r\n type: type as PhysicsShapeType,\r\n parameters: this._options as any,\r\n },\r\n this._scene\r\n );\r\n }\r\n\r\n if (this._options.isTriggerShape) {\r\n this.shape.isTrigger = true;\r\n }\r\n\r\n this.material = { friction: this._options.friction, restitution: this._options.restitution };\r\n this.body.shape = this.shape;\r\n this.shape.material = this.material;\r\n\r\n this.body.setMassProperties({ mass: this._options.mass });\r\n\r\n this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n protected _prepareOptions(_options: PhysicsAggregateParameters) {\r\n const m = this.transformNode as Mesh;\r\n this._options = { mass: 0 };\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n this._options.isTriggerShape = _options.isTriggerShape ?? false;\r\n this._options.mesh = _options.mesh ?? (m._isMesh ? m : undefined);\r\n this._options.motionType = _options.motionType ?? (this._options.mass === 0 ? PhysicsMotionType.STATIC : PhysicsMotionType.DYNAMIC);\r\n Object.assign(this._options, {\r\n pointA: _options.pointA,\r\n pointB: _options.pointB,\r\n radius: _options.radius,\r\n extents: _options.extents,\r\n rotation: _options.rotation,\r\n center: _options.center,\r\n startAsleep: _options.startAsleep,\r\n isTriggerShape: _options.isTriggerShape,\r\n } as Partial<PhysicsAggregateParameters>);\r\n this._addSizeOptions();\r\n }\r\n\r\n private _getObjectBoundingBox() {\r\n if ((this.transformNode as AbstractMesh).getRawBoundingInfo) {\r\n return (this.transformNode as AbstractMesh).getRawBoundingInfo().boundingBox;\r\n } else {\r\n return new BoundingBox(new Vector3(-0.5, -0.5, -0.5), new Vector3(0.5, 0.5, 0.5));\r\n }\r\n }\r\n\r\n private _hasVertices(node: TransformNode): boolean {\r\n return (node as any)?.getTotalVertices() > 0;\r\n }\r\n\r\n private _addSizeOptions(): void {\r\n this.transformNode.computeWorldMatrix(true);\r\n const bb = this._getObjectBoundingBox();\r\n const extents = TmpVectors.Vector3[0];\r\n extents.copyFrom(bb.extendSize);\r\n extents.scaleInPlace(2);\r\n extents.multiplyInPlace(this.transformNode.absoluteScaling);\r\n // In case we had any negative scaling, we need to take the absolute value of the extents.\r\n extents.x = Math.abs(extents.x);\r\n extents.y = Math.abs(extents.y);\r\n extents.z = Math.abs(extents.z);\r\n\r\n const min = TmpVectors.Vector3[1];\r\n min.copyFrom(bb.minimum);\r\n min.multiplyInPlace(this.transformNode.absoluteScaling);\r\n\r\n if (!this._options.center) {\r\n const center = new Vector3();\r\n center.copyFrom(bb.center);\r\n center.multiplyInPlace(this.transformNode.absoluteScaling);\r\n this._options.center = center;\r\n }\r\n\r\n switch (this.type) {\r\n case PhysicsShapeType.SPHERE:\r\n if (!this._options.radius && WithinEpsilon(extents.x, extents.y, 0.0001) && WithinEpsilon(extents.x, extents.z, 0.0001)) {\r\n this._options.radius = extents.x / 2;\r\n } else if (!this._options.radius) {\r\n Logger.Warn(\"Non uniform scaling is unsupported for sphere shapes. Setting the radius to the biggest bounding box extent.\");\r\n this._options.radius = Math.max(extents.x, extents.y, extents.z) / 2;\r\n }\r\n break;\r\n case PhysicsShapeType.CAPSULE:\r\n {\r\n const capRadius = extents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, min.y + capRadius, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, min.y + extents.y - capRadius, 0);\r\n }\r\n break;\r\n case PhysicsShapeType.CYLINDER:\r\n {\r\n const capRadius = extents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, min.y, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, min.y + extents.y, 0);\r\n }\r\n break;\r\n case PhysicsShapeType.MESH:\r\n case PhysicsShapeType.CONVEX_HULL:\r\n case PhysicsShapeType.HEIGHTFIELD:\r\n if (!this._options.mesh && this._hasVertices(this.transformNode)) {\r\n this._options.mesh = this.transformNode as Mesh;\r\n } else if (!this._options.mesh || !this._hasVertices(this._options.mesh)) {\r\n throw new Error(\r\n \"No valid mesh was provided for mesh or convex hull shape parameter. Please provide a mesh with valid geometry (number of vertices greater than 0).\"\r\n );\r\n }\r\n break;\r\n case PhysicsShapeType.BOX:\r\n this._options.extents = this._options.extents ?? new Vector3(extents.x, extents.y, extents.z);\r\n this._options.rotation = this._options.rotation ?? Quaternion.Identity();\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the options for the physics aggregate with the provided parameters.\r\n * @param _options - The new set of options to update the physics aggregate with.\r\n */\r\n public updateOptions(_options: PhysicsAggregateParameters) {\r\n this._prepareOptions(_options);\r\n const startAsleep = this._options.startAsleep ?? false;\r\n if (this._options.motionType !== this.body.motionType) {\r\n this.body.setMotionType(this._options.motionType!);\r\n }\r\n if (startAsleep !== this.body.startAsleep) {\r\n this.body.startAsleep = startAsleep;\r\n }\r\n this._addSizeOptions();\r\n this.shape.isTrigger = this._options.isTriggerShape ?? false;\r\n if (this.material) {\r\n this.material.friction = this._options.friction;\r\n this.material.restitution = this._options.restitution;\r\n }\r\n this.body.setMassProperties({ mass: this._options.mass });\r\n const plugin = this._scene?.getPhysicsEngine()?.getPhysicsPlugin?.() as IPhysicsEnginePluginV2;\r\n if (plugin) {\r\n plugin.initShape(this.shape, this.shape.type, this._options);\r\n this.body.shape = this.shape;\r\n }\r\n }\r\n\r\n /**\r\n * Releases the body, shape and material\r\n */\r\n public dispose(): void {\r\n if (this._nodeDisposeObserver) {\r\n this.body.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\r\n this._nodeDisposeObserver = null;\r\n }\r\n this.body.dispose();\r\n if (this._disposeShapeWhenDisposed) {\r\n this.shape.dispose();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsAggregate.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsAggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAOlE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAwExD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAqBzB;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;IACI;;OAEG;IACI,aAA4B;IACnC;;OAEG;IACI,IAAqC,EAC5C,WAAuC,EAAE,IAAI,EAAE,CAAC,EAAE,EAC1C,MAAc;QANf,kBAAa,GAAb,aAAa,CAAe;QAI5B,SAAI,GAAJ,IAAI,CAAiC;QAEpC,WAAM,GAAN,MAAM,CAAQ;QAtBlB,8BAAyB,GAAG,IAAI,CAAC;QACjC,aAAQ,GAA+B,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAuBvD,eAAe;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YACvE,OAAO;QACX,CAAC;QACD,MAAM,CAAC,GAAG,aAAqB,CAAC;QAChC,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,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CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAC9E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { PhysicsBody } from \"./physicsBody\";\r\nimport { type PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { PhysicsShape } from \"./physicsShape\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { type Scene } from \"../../scene\";\r\nimport { type TransformNode } from \"../../Meshes/transformNode\";\r\nimport { Quaternion, TmpVectors, Vector3 } from \"../../Maths/math.vector.pure\";\r\nimport { WithinEpsilon } from \"../../Maths/math.scalar.functions\";\r\nimport { type IPhysicsEnginePluginV2, PhysicsMotionType, PhysicsShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport { type Mesh } from \"../../Meshes/mesh\";\r\nimport { type Observer } from \"../../Misc/observable\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Node } from \"../../node\";\r\nimport { type AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { BoundingBox } from \"../../Culling/boundingBox\";\r\n\r\n/**\r\n * The interface for the physics aggregate parameters\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsAggregateParameters {\r\n /**\r\n * The mass of the physics aggregate\r\n */\r\n mass: number;\r\n\r\n /**\r\n * The friction of the physics aggregate\r\n */\r\n friction?: number;\r\n\r\n /**\r\n * The coefficient of restitution of the physics aggregate\r\n */\r\n restitution?: number;\r\n\r\n /**\r\n * Radius for sphere, cylinder and capsule\r\n */\r\n radius?: number;\r\n\r\n /**\r\n * Starting point for cylinder/capsule\r\n */\r\n pointA?: Vector3;\r\n\r\n /**\r\n * Ending point for cylinder/capsule\r\n */\r\n pointB?: Vector3;\r\n\r\n /**\r\n * Extents for box\r\n */\r\n extents?: Vector3;\r\n\r\n /**\r\n * Orientation for box\r\n */\r\n rotation?: Quaternion;\r\n\r\n /**\r\n * mesh local center\r\n */\r\n center?: Vector3;\r\n\r\n /**\r\n * mesh object. Used for mesh and convex hull aggregates.\r\n */\r\n mesh?: Mesh;\r\n\r\n /**\r\n * Physics engine will try to make this body sleeping and not active\r\n */\r\n startAsleep?: boolean;\r\n\r\n /**\r\n * If true, mark the created shape as a trigger shape\r\n */\r\n isTriggerShape?: boolean;\r\n /**\r\n * Specify the body motion type\r\n */\r\n motionType?: PhysicsMotionType;\r\n}\r\n\r\n/**\r\n * Helper class to create and interact with a PhysicsAggregate.\r\n * This is a transition object that works like Physics Plugin V1 Impostors.\r\n * This helper instantiates all mandatory physics objects to get a body/shape and material.\r\n * It's less efficient than handling body and shapes independently but for prototyping or\r\n * a small numbers of physics objects, it's good enough.\r\n */\r\nexport class PhysicsAggregate {\r\n /**\r\n * The body that is associated with this aggregate\r\n */\r\n public body: PhysicsBody;\r\n\r\n /**\r\n * The shape that is associated with this aggregate\r\n */\r\n public shape: PhysicsShape;\r\n\r\n /**\r\n * The material that is associated with this aggregate\r\n */\r\n public material: PhysicsMaterial;\r\n\r\n private _disposeShapeWhenDisposed = true;\r\n private _options: PhysicsAggregateParameters = { mass: 0 };\r\n\r\n private _nodeDisposeObserver: Nullable<Observer<Node>>;\r\n\r\n /**\r\n * Get current computed options\r\n */\r\n public get options() {\r\n return this._options;\r\n }\r\n\r\n constructor(\r\n /**\r\n * The physics-enabled object used as the physics aggregate\r\n */\r\n public transformNode: TransformNode,\r\n /**\r\n * The type of the physics aggregate\r\n */\r\n public type: PhysicsShapeType | PhysicsShape,\r\n _options: PhysicsAggregateParameters = { mass: 0 },\r\n private _scene?: Scene\r\n ) {\r\n //sanity check!\r\n if (!this.transformNode) {\r\n Logger.Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n const m = transformNode as Mesh;\r\n if (this.transformNode.parent && this._options.mass !== 0 && m.hasThinInstances) {\r\n Logger.Warn(\r\n \"A physics body has been created for an object which has a parent and thin instances. Babylon physics currently works in local space so unexpected issues may occur.\"\r\n );\r\n }\r\n\r\n // Legacy support for old syntax.\r\n if (!this._scene && transformNode.getScene) {\r\n this._scene = transformNode.getScene();\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n //default options params\r\n this._prepareOptions(_options);\r\n const startAsleep = this._options.startAsleep ?? false;\r\n this.body = new PhysicsBody(transformNode, this._options.motionType!, startAsleep, this._scene);\r\n if ((type as any).getClassName && (type as any).getClassName() === \"PhysicsShape\") {\r\n this.shape = type as PhysicsShape;\r\n this._disposeShapeWhenDisposed = false;\r\n } else {\r\n this.shape = new PhysicsShape(\r\n {\r\n type: type as PhysicsShapeType,\r\n parameters: this._options as any,\r\n },\r\n this._scene\r\n );\r\n }\r\n\r\n if (this._options.isTriggerShape) {\r\n this.shape.isTrigger = true;\r\n }\r\n\r\n this.material = { friction: this._options.friction, restitution: this._options.restitution };\r\n this.body.shape = this.shape;\r\n this.shape.material = this.material;\r\n\r\n this.body.setMassProperties({ mass: this._options.mass });\r\n\r\n this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n protected _prepareOptions(_options: PhysicsAggregateParameters) {\r\n const m = this.transformNode as Mesh;\r\n this._options = { mass: 0 };\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n this._options.isTriggerShape = _options.isTriggerShape ?? false;\r\n this._options.mesh = _options.mesh ?? (m._isMesh ? m : undefined);\r\n this._options.motionType = _options.motionType ?? (this._options.mass === 0 ? PhysicsMotionType.STATIC : PhysicsMotionType.DYNAMIC);\r\n Object.assign(this._options, {\r\n pointA: _options.pointA,\r\n pointB: _options.pointB,\r\n radius: _options.radius,\r\n extents: _options.extents,\r\n rotation: _options.rotation,\r\n center: _options.center,\r\n startAsleep: _options.startAsleep,\r\n isTriggerShape: _options.isTriggerShape,\r\n } as Partial<PhysicsAggregateParameters>);\r\n this._addSizeOptions();\r\n }\r\n\r\n private _getObjectBoundingBox() {\r\n if ((this.transformNode as AbstractMesh).getRawBoundingInfo) {\r\n return (this.transformNode as AbstractMesh).getRawBoundingInfo().boundingBox;\r\n } else {\r\n return new BoundingBox(new Vector3(-0.5, -0.5, -0.5), new Vector3(0.5, 0.5, 0.5));\r\n }\r\n }\r\n\r\n private _hasVertices(node: TransformNode): boolean {\r\n return (node as any)?.getTotalVertices() > 0;\r\n }\r\n\r\n private _addSizeOptions(): void {\r\n this.transformNode.computeWorldMatrix(true);\r\n const bb = this._getObjectBoundingBox();\r\n const extents = TmpVectors.Vector3[0];\r\n extents.copyFrom(bb.extendSize);\r\n extents.scaleInPlace(2);\r\n extents.multiplyInPlace(this.transformNode.absoluteScaling);\r\n // In case we had any negative scaling, we need to take the absolute value of the extents.\r\n extents.x = Math.abs(extents.x);\r\n extents.y = Math.abs(extents.y);\r\n extents.z = Math.abs(extents.z);\r\n\r\n const min = TmpVectors.Vector3[1];\r\n min.copyFrom(bb.minimum);\r\n min.multiplyInPlace(this.transformNode.absoluteScaling);\r\n\r\n if (!this._options.center) {\r\n const center = new Vector3();\r\n center.copyFrom(bb.center);\r\n center.multiplyInPlace(this.transformNode.absoluteScaling);\r\n this._options.center = center;\r\n }\r\n\r\n switch (this.type) {\r\n case PhysicsShapeType.SPHERE:\r\n if (!this._options.radius && WithinEpsilon(extents.x, extents.y, 0.0001) && WithinEpsilon(extents.x, extents.z, 0.0001)) {\r\n this._options.radius = extents.x / 2;\r\n } else if (!this._options.radius) {\r\n Logger.Warn(\"Non uniform scaling is unsupported for sphere shapes. Setting the radius to the biggest bounding box extent.\");\r\n this._options.radius = Math.max(extents.x, extents.y, extents.z) / 2;\r\n }\r\n break;\r\n case PhysicsShapeType.CAPSULE:\r\n {\r\n const capRadius = extents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, min.y + capRadius, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, min.y + extents.y - capRadius, 0);\r\n }\r\n break;\r\n case PhysicsShapeType.CYLINDER:\r\n {\r\n const capRadius = extents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, min.y, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, min.y + extents.y, 0);\r\n }\r\n break;\r\n case PhysicsShapeType.MESH:\r\n case PhysicsShapeType.CONVEX_HULL:\r\n case PhysicsShapeType.HEIGHTFIELD:\r\n if (!this._options.mesh && this._hasVertices(this.transformNode)) {\r\n this._options.mesh = this.transformNode as Mesh;\r\n } else if (!this._options.mesh || !this._hasVertices(this._options.mesh)) {\r\n throw new Error(\r\n \"No valid mesh was provided for mesh or convex hull shape parameter. Please provide a mesh with valid geometry (number of vertices greater than 0).\"\r\n );\r\n }\r\n break;\r\n case PhysicsShapeType.BOX:\r\n this._options.extents = this._options.extents ?? new Vector3(extents.x, extents.y, extents.z);\r\n this._options.rotation = this._options.rotation ?? Quaternion.Identity();\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Updates the options for the physics aggregate with the provided parameters.\r\n * @param _options - The new set of options to update the physics aggregate with.\r\n */\r\n public updateOptions(_options: PhysicsAggregateParameters) {\r\n this._prepareOptions(_options);\r\n const startAsleep = this._options.startAsleep ?? false;\r\n if (this._options.motionType !== this.body.motionType) {\r\n this.body.setMotionType(this._options.motionType!);\r\n }\r\n if (startAsleep !== this.body.startAsleep) {\r\n this.body.startAsleep = startAsleep;\r\n }\r\n this._addSizeOptions();\r\n this.shape.isTrigger = this._options.isTriggerShape ?? false;\r\n if (this.material) {\r\n this.material.friction = this._options.friction;\r\n this.material.restitution = this._options.restitution;\r\n }\r\n this.body.setMassProperties({ mass: this._options.mass });\r\n const plugin = this._scene?.getPhysicsEngine()?.getPhysicsPlugin?.() as IPhysicsEnginePluginV2;\r\n if (plugin) {\r\n plugin.initShape(this.shape, this.shape.type, this._options);\r\n this.body.shape = this.shape;\r\n }\r\n }\r\n\r\n /**\r\n * Releases the body, shape and material\r\n */\r\n public dispose(): void {\r\n if (this._nodeDisposeObserver) {\r\n this.body.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\r\n this._nodeDisposeObserver = null;\r\n }\r\n this.body.dispose();\r\n if (this._disposeShapeWhenDisposed) {\r\n this.shape.dispose();\r\n }\r\n }\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import { type IBasePhysicsCollisionEvent, type IPhysicsCollisionEvent, type PhysicsMassProperties, PhysicsMotionType, PhysicsPrestepType } from "./IPhysicsEnginePlugin.js";
2
2
  import { type PhysicsShape } from "./physicsShape.js";
3
- import { Vector3, Quaternion } from "../../Maths/math.vector.js";
3
+ import { Vector3, Quaternion } from "../../Maths/math.vector.pure.js";
4
4
  import { type Scene } from "../../scene.js";
5
5
  import { type Nullable } from "../../types.js";
6
6
  import { type PhysicsConstraint } from "./physicsConstraint.js";
@@ -1,5 +1,5 @@
1
1
  import { PhysicsPrestepType, } from "./IPhysicsEnginePlugin.js";
2
- import { Vector3, Quaternion, TmpVectors } from "../../Maths/math.vector.js";
2
+ import { Vector3, Quaternion, TmpVectors } from "../../Maths/math.vector.pure.js";
3
3
  /**
4
4
  * PhysicsBody is useful for creating a physics body that can be used in a physics engine. It allows
5
5
  * the user to set the mass and velocity of the body, which can then be used to calculate the
@@ -1 +1 @@
1
- {"version":3,"file":"physicsBody.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsBody.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,kBAAkB,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;A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AAC;QACD,qEAAqE;QACrE,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3B,IAAI,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAChC,IAAI,CAAC,gCAAgC,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACzE,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import {\r\n type IBasePhysicsCollisionEvent,\r\n type IPhysicsCollisionEvent,\r\n type IPhysicsEnginePluginV2,\r\n type PhysicsMassProperties,\r\n PhysicsMotionType,\r\n PhysicsPrestepType,\r\n} from \"./IPhysicsEnginePlugin\";\r\nimport { type PhysicsShape } from \"./physicsShape\";\r\nimport { Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector\";\r\nimport { type Scene } from \"../../scene\";\r\nimport { type PhysicsEngine } from \"./physicsEngine\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type PhysicsConstraint } from \"./physicsConstraint\";\r\nimport { type Bone } from \"../../Bones/bone\";\r\nimport { Space } from \"../../Maths/math.axis\";\r\nimport { type Observable, type Observer } from \"../../Misc/observable\";\r\nimport { type Node } from \"../../node\";\r\nimport { type Mesh } from \"../../Meshes/mesh\";\r\nimport { type AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { type TransformNode } from \"../../Meshes/transformNode\";\r\nimport { type BoundingBox } from \"../../Culling/boundingBox\";\r\n\r\n/**\r\n * PhysicsBody is useful for creating a physics body that can be used in a physics engine. It allows\r\n * the user to set the mass and velocity of the body, which can then be used to calculate the\r\n * motion of the body in the physics engine.\r\n */\r\nexport class PhysicsBody {\r\n /**\r\n * V2 Physics plugin private data for single Transform\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * V2 Physics plugin private data for instances\r\n */\r\n public _pluginDataInstances: Array<any> = [];\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n /**\r\n * The engine used to create and manage this Physics Body\r\n */\r\n private _physicsEngine: PhysicsEngine;\r\n /**\r\n * If the collision callback is enabled\r\n */\r\n private _collisionCBEnabled: boolean = false;\r\n /**\r\n * If the collision ended callback is enabled\r\n */\r\n private _collisionEndedCBEnabled: boolean = false;\r\n /**\r\n * The transform node associated with this Physics Body\r\n */\r\n transformNode: TransformNode;\r\n\r\n /**\r\n * Disable pre-step that consists in updating Physics Body from Transform Node Translation/Orientation.\r\n * True by default for maximum performance.\r\n */\r\n public get disablePreStep(): boolean {\r\n return this._prestepType == PhysicsPrestepType.DISABLED;\r\n }\r\n\r\n public set disablePreStep(value: boolean) {\r\n this._prestepType = value ? PhysicsPrestepType.DISABLED : PhysicsPrestepType.TELEPORT;\r\n }\r\n\r\n /**\r\n * Disable sync from physics to transformNode. This value is set to true at body creation or at motionType setting when the body is not dynamic.\r\n */\r\n disableSync: boolean = false;\r\n\r\n /**\r\n * Physics engine will try to make this body sleeping and not active\r\n */\r\n public startAsleep: boolean;\r\n\r\n private _nodeDisposeObserver: Nullable<Observer<Node>>;\r\n\r\n private _isDisposed = false;\r\n\r\n private _shape: Nullable<PhysicsShape> = null;\r\n\r\n private _prestepType: PhysicsPrestepType = PhysicsPrestepType.DISABLED;\r\n private _isAttached = false;\r\n /**\r\n * Constructs a new physics body for the given node.\r\n * @param transformNode - The Transform Node to construct the physics body for. For better performance, it is advised that this node does not have a parent.\r\n * @param _motionType - The motion type of the physics body. The options are:\r\n * - PhysicsMotionType.STATIC - Static bodies are not moving and unaffected by forces or collisions. They are good for level boundaries or terrain.\r\n * - PhysicsMotionType.DYNAMIC - Dynamic bodies are fully simulated. They can move and collide with other objects.\r\n * - PhysicsMotionType.ANIMATED - They behave like dynamic bodies, but they won't be affected by other bodies, but still push other bodies out of the way.\r\n * @param startsAsleep - Whether the physics body should start in a sleeping state (not a guarantee). Defaults to false.\r\n * @param scene - The scene containing the physics engine.\r\n *\r\n * This code is useful for creating a physics body for a given Transform Node in a scene.\r\n * It checks the version of the physics engine and the physics plugin, and initializes the body accordingly.\r\n * It also sets the node's rotation quaternion if it is not already set. Finally, it adds the body to the physics engine.\r\n */\r\n constructor(\r\n transformNode: TransformNode,\r\n private _motionType: PhysicsMotionType,\r\n startsAsleep: boolean,\r\n scene: Scene\r\n ) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine() as PhysicsEngine;\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n this._physicsEngine = physicsEngine;\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin;\r\n if (!transformNode.rotationQuaternion) {\r\n transformNode.rotationQuaternion = Quaternion.FromEulerAngles(transformNode.rotation.x, transformNode.rotation.y, transformNode.rotation.z);\r\n }\r\n\r\n this.startAsleep = startsAsleep;\r\n\r\n // only dynamic and animated body needs sync from physics to transformNode\r\n this.disableSync = this._motionType == PhysicsMotionType.STATIC;\r\n\r\n this.transformNode = transformNode;\r\n\r\n this.attach();\r\n\r\n this._nodeDisposeObserver = transformNode.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Returns the string \"PhysicsBody\".\r\n * @returns \"PhysicsBody\"\r\n */\r\n public getClassName() {\r\n return \"PhysicsBody\";\r\n }\r\n //Attach the body to the physics engine\r\n public attach() {\r\n if (!this._isAttached) {\r\n // instances?\r\n const m = this.transformNode as Mesh;\r\n if (m.hasThinInstances) {\r\n this._physicsPlugin.initBodyInstances(this, this._motionType, m);\r\n } else {\r\n // single instance\r\n if (this.transformNode.parent) {\r\n // Force computation of world matrix so that the parent transforms are correctly reflected in absolutePosition/absoluteRotationQuaternion.\r\n this.transformNode.computeWorldMatrix(true);\r\n }\r\n this._physicsPlugin.initBody(this, this._motionType, this.transformNode.absolutePosition, this.transformNode.absoluteRotationQuaternion);\r\n }\r\n this.transformNode.physicsBody = this;\r\n this._physicsEngine.addBody(this);\r\n this._isAttached = true;\r\n }\r\n }\r\n\r\n //Detach the body from the physics engine\r\n public detach() {\r\n if (this._isAttached) {\r\n this._physicsEngine.removeBody(this);\r\n this._physicsPlugin.removeBody(this);\r\n this.transformNode.physicsBody = null;\r\n this._isAttached = false;\r\n }\r\n }\r\n\r\n /**\r\n * Clone the PhysicsBody to a new body and assign it to the transformNode parameter\r\n * @param transformNode transformNode that will be used for the cloned PhysicsBody\r\n * @returns the newly cloned PhysicsBody\r\n */\r\n public clone(transformNode: TransformNode): PhysicsBody {\r\n const clonedBody = new PhysicsBody(transformNode, this.getMotionType(), this.startAsleep, this.transformNode.getScene());\r\n clonedBody.shape = this.shape;\r\n clonedBody.setMassProperties(this.getMassProperties());\r\n clonedBody.setLinearDamping(this.getLinearDamping());\r\n clonedBody.setAngularDamping(this.getAngularDamping());\r\n return clonedBody;\r\n }\r\n\r\n /**\r\n * If a physics body is connected to an instanced node, update the number physic instances to match the number of node instances.\r\n */\r\n public updateBodyInstances() {\r\n const m = this.transformNode as Mesh;\r\n if (m.hasThinInstances) {\r\n this._physicsPlugin.updateBodyInstances(this, m);\r\n }\r\n }\r\n\r\n /**\r\n * This returns the number of internal instances of the physics body\r\n */\r\n public get numInstances(): number {\r\n return this._pluginDataInstances.length;\r\n }\r\n\r\n /**\r\n * Get the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\r\n */\r\n public get motionType(): PhysicsMotionType {\r\n return this._physicsPlugin.getMotionType(this);\r\n }\r\n\r\n /**\r\n * Sets the shape of the physics body.\r\n * @param shape - The shape of the physics body.\r\n *\r\n * This method is useful for setting the shape of the physics body, which is necessary for the physics engine to accurately simulate the body's behavior.\r\n * The shape is used to calculate the body's mass, inertia, and other properties.\r\n */\r\n public set shape(shape: Nullable<PhysicsShape>) {\r\n this._shape = shape;\r\n if (shape) {\r\n this._physicsPlugin.setShape(this, shape);\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves the physics shape associated with this object.\r\n *\r\n * @returns The physics shape associated with this object, or `undefined` if no\r\n * shape is associated.\r\n *\r\n * This method is useful for retrieving the physics shape associated with this object,\r\n * which can be used to apply physical forces to the object or to detect collisions.\r\n */\r\n public get shape(): Nullable<PhysicsShape> {\r\n return this._shape;\r\n }\r\n\r\n /**\r\n * Returns the bounding box of the physics body.\r\n * @returns The bounding box of the physics body.\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBodyBoundingBox(this);\r\n }\r\n\r\n /**\r\n * Sets the event mask for the physics engine.\r\n *\r\n * @param eventMask - A bitmask that determines which events will be sent to the physics engine.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the event mask for.\r\n *\r\n * This method is useful for setting the event mask for the physics engine, which determines which events\r\n * will be sent to the physics engine. This allows the user to control which events the physics engine will respond to.\r\n */\r\n public setEventMask(eventMask: number, instanceIndex?: number) {\r\n this._physicsPlugin.setEventMask(this, eventMask, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the event mask of the physics engine.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the event mask for.\r\n * @returns The event mask of the physics engine.\r\n *\r\n * This method is useful for getting the event mask of the physics engine,\r\n * which is used to determine which events the engine will respond to.\r\n * This is important for ensuring that the engine is responding to the correct events and not\r\n * wasting resources on unnecessary events.\r\n */\r\n public getEventMask(instanceIndex?: number): number {\r\n return this._physicsPlugin.getEventMask(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\r\n * @param motionType - The motion type to set.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the motion type for. If body is instanced but instanceIndex is undefined, the motion type will be set for all instances.\r\n */\r\n public setMotionType(motionType: PhysicsMotionType, instanceIndex?: number) {\r\n this.disableSync = instanceIndex === undefined && motionType == PhysicsMotionType.STATIC;\r\n this._physicsPlugin.setMotionType(this, motionType, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the motion type for.\r\n * @returns The motion type of the physics body.\r\n */\r\n public getMotionType(instanceIndex?: number): PhysicsMotionType {\r\n return this._physicsPlugin.getMotionType(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Set the prestep type of the body\r\n * @param prestepType prestep type provided by PhysicsPrestepType\r\n */\r\n public setPrestepType(prestepType: PhysicsPrestepType): void {\r\n this._prestepType = prestepType;\r\n }\r\n\r\n /**\r\n * Get the current prestep type of the body\r\n * @returns the type of prestep associated with the body and its instance index\r\n */\r\n public getPrestepType(): PhysicsPrestepType {\r\n return this._prestepType;\r\n }\r\n\r\n /**\r\n * Computes the mass properties of the physics object, based on the set of physics shapes this body uses.\r\n * This method is useful for computing the initial mass properties of a physics object, such as its mass,\r\n * inertia, and center of mass; these values are important for accurately simulating the physics of the\r\n * object in the physics engine, and computing values based on the shape will provide you with reasonable\r\n * initial values, which you can then customize.\r\n * @param instanceIndex - The index of the instance to compute the mass properties for.\r\n * @returns The mass properties of the object.\r\n */\r\n public computeMassProperties(instanceIndex?: number): PhysicsMassProperties {\r\n return this._physicsPlugin.computeMassProperties(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the mass properties of the physics object.\r\n *\r\n * @param massProps - The mass properties to set.\r\n * @param instanceIndex - The index of the instance to set the mass properties for. If not defined, the mass properties will be set for all instances.\r\n *\r\n * This method is useful for setting the mass properties of a physics object, such as its mass,\r\n * inertia, and center of mass. This is important for accurately simulating the physics of the object in the physics engine.\r\n */\r\n public setMassProperties(massProps: PhysicsMassProperties, instanceIndex?: number): void {\r\n this._physicsPlugin.setMassProperties(this, massProps, instanceIndex);\r\n }\r\n\r\n /**\r\n * Retrieves the mass properties of the object.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the mass properties for.\r\n * @returns The mass properties of the object.\r\n *\r\n * This method is useful for physics simulations, as it allows the user to\r\n * retrieve the mass properties of the object, such as its mass, center of mass,\r\n * and moment of inertia. This information is necessary for accurate physics\r\n * simulations.\r\n */\r\n public getMassProperties(instanceIndex?: number): PhysicsMassProperties {\r\n return this._physicsPlugin.getMassProperties(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the linear damping of the physics body.\r\n *\r\n * @param damping - The linear damping value.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the linear damping for.\r\n *\r\n * This method is useful for controlling the linear damping of the physics body,\r\n * which is the rate at which the body's velocity decreases over time. This is useful for simulating\r\n * the effects of air resistance or other forms of friction.\r\n */\r\n public setLinearDamping(damping: number, instanceIndex?: number) {\r\n this._physicsPlugin.setLinearDamping(this, damping, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the linear damping of the physics body.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear damping for.\r\n * @returns The linear damping of the physics body.\r\n *\r\n * This method is useful for retrieving the linear damping of the physics body, which is the amount of\r\n * resistance the body has to linear motion. This is useful for simulating realistic physics behavior\r\n * in a game.\r\n */\r\n public getLinearDamping(instanceIndex?: number): number {\r\n return this._physicsPlugin.getLinearDamping(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the angular damping of the physics body.\r\n * @param damping The angular damping of the body.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the angular damping for.\r\n *\r\n * This method is useful for controlling the angular velocity of a physics body.\r\n * By setting the damping, the body's angular velocity will be reduced over time, simulating the effect of friction.\r\n * This can be used to create realistic physical behavior in a physics engine.\r\n */\r\n public setAngularDamping(damping: number, instanceIndex?: number) {\r\n this._physicsPlugin.setAngularDamping(this, damping, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the angular damping of the physics body.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular damping for.\r\n *\r\n * @returns The angular damping of the physics body.\r\n *\r\n * This method is useful for getting the angular damping of the physics body,\r\n * which is the rate of reduction of the angular velocity over time.\r\n * This is important for simulating realistic physics behavior in a game.\r\n */\r\n public getAngularDamping(instanceIndex?: number): number {\r\n return this._physicsPlugin.getAngularDamping(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the linear velocity of the physics object.\r\n * @param linVel - The linear velocity to set.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the linear velocity for.\r\n *\r\n * This method is useful for setting the linear velocity of a physics object,\r\n * which is necessary for simulating realistic physics in a game engine.\r\n * By setting the linear velocity, the physics object will move in the direction and speed specified by the vector.\r\n * This allows for realistic physics simulations, such as simulating the motion of a ball rolling down a hill.\r\n */\r\n public setLinearVelocity(linVel: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.setLinearVelocity(this, linVel, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the linear velocity of the physics body and stores it in the given vector3.\r\n * @param linVel - The vector3 to store the linear velocity in.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear velocity for.\r\n *\r\n * This method is useful for getting the linear velocity of a physics body in a physics engine.\r\n * This can be used to determine the speed and direction of the body, which can be used to calculate the motion of the body.\r\n */\r\n public getLinearVelocityToRef(linVel: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.getLinearVelocityToRef(this, linVel, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the linear velocity of the physics body as a new vector3.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear velocity for.\r\n * @returns The linear velocity of the physics body.\r\n *\r\n * This method is useful for getting the linear velocity of a physics body in a physics engine.\r\n * This can be used to determine the speed and direction of the body, which can be used to calculate the motion of the body.\r\n */\r\n public getLinearVelocity(instanceIndex?: number): Vector3 {\r\n const ref = new Vector3();\r\n this.getLinearVelocityToRef(ref, instanceIndex);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Sets the angular velocity of the physics object.\r\n * @param angVel - The angular velocity to set.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the angular velocity for.\r\n *\r\n * This method is useful for setting the angular velocity of a physics object, which is necessary for\r\n * simulating realistic physics behavior. The angular velocity is used to determine the rate of rotation of the object,\r\n * which is important for simulating realistic motion.\r\n */\r\n public setAngularVelocity(angVel: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.setAngularVelocity(this, angVel, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the angular velocity of the physics body and stores it in the given vector3.\r\n * @param angVel - The vector3 to store the angular velocity in.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular velocity for.\r\n *\r\n * This method is useful for getting the angular velocity of a physics body, which can be used to determine the body's\r\n * rotational speed. This information can be used to create realistic physics simulations.\r\n */\r\n public getAngularVelocityToRef(angVel: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.getAngularVelocityToRef(this, angVel, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the angular velocity of the physics body as a new vector3.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular velocity for.\r\n * @returns The angular velocity of the physics body.\r\n *\r\n * This method is useful for getting the angular velocity of a physics body, which can be used to determine the body's\r\n * rotational speed. This information can be used to create realistic physics simulations.\r\n */\r\n public getAngularVelocity(instanceIndex?: number): Vector3 {\r\n const ref = new Vector3();\r\n this.getAngularVelocityToRef(ref, instanceIndex);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Applies an impulse to the physics object.\r\n *\r\n * @param impulse The impulse vector.\r\n * @param location The location of the impulse.\r\n * @param instanceIndex For a instanced body, the instance to where the impulse should be applied. If not specified, the impulse is applied to all instances.\r\n *\r\n * This method is useful for applying an impulse to a physics object, which can be used to simulate physical forces such as gravity,\r\n * collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.\r\n */\r\n public applyImpulse(impulse: Vector3, location: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.applyImpulse(this, impulse, location, instanceIndex);\r\n }\r\n\r\n /**\r\n * Add torque to a physics body\r\n * @param angularImpulse The angular impulse vector.\r\n * @param instanceIndex For a instanced body, the instance to where the impulse should be applied. If not specified, the impulse is applied to all instances.\r\n */\r\n public applyAngularImpulse(angularImpulse: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.applyAngularImpulse(this, angularImpulse, instanceIndex);\r\n }\r\n\r\n /**\r\n * Applies a torque to the physics body.\r\n *\r\n * @param torque The torque vector.\r\n * @param instanceIndex For a instanced body, the instance to where the torque should be applied. If not specified, the torque is applied to all instances.\r\n *\r\n * This method is useful for applying a torque to a physics body, which can be used to simulate rotational forces such as motors,\r\n * angular momentum, and rotational dynamics. This can be used to create realistic physics simulations in a game or other application.\r\n */\r\n public applyTorque(torque: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.applyTorque(this, torque, instanceIndex);\r\n }\r\n\r\n /**\r\n * Applies a force to the physics object.\r\n *\r\n * @param force The force vector.\r\n * @param location The location of the force.\r\n * @param instanceIndex For a instanced body, the instance to where the force should be applied. If not specified, the force is applied to all instances.\r\n *\r\n * This method is useful for applying a force to a physics object, which can be used to simulate physical forces such as gravity,\r\n * collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.\r\n */\r\n public applyForce(force: Vector3, location: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.applyForce(this, force, location, instanceIndex);\r\n }\r\n\r\n /**\r\n * Retrieves the geometry of the body from the physics plugin.\r\n *\r\n * @returns The geometry of the body.\r\n *\r\n * This method is useful for retrieving the geometry of the body from the physics plugin, which can be used for various physics calculations.\r\n */\r\n public getGeometry(): object {\r\n return this._physicsPlugin.getBodyGeometry(this);\r\n }\r\n\r\n /**\r\n * Returns an observable that will be notified for when a collision starts or continues for this PhysicsBody\r\n * @param instanceIndex - optionally, the index of the instance in the body\r\n * @returns Observable\r\n */\r\n public getCollisionObservable(instanceIndex?: number): Observable<IPhysicsCollisionEvent> {\r\n return this._physicsPlugin.getCollisionObservable(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Returns an observable that will be notified when the body has finished colliding with another body\r\n * @param instanceIndex - optionally, the index of the instance in the body\r\n * @returns Observable\r\n */\r\n public getCollisionEndedObservable(instanceIndex?: number): Observable<IBasePhysicsCollisionEvent> {\r\n return this._physicsPlugin.getCollisionEndedObservable(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Enable or disable collision callback for this PhysicsBody.\r\n * @param enabled true if PhysicsBody's collision will rise a collision event and notifies the observable\r\n */\r\n public setCollisionCallbackEnabled(enabled: boolean): void {\r\n this._collisionCBEnabled = enabled;\r\n this._physicsPlugin.setCollisionCallbackEnabled(this, enabled);\r\n }\r\n\r\n /**\r\n * Enable or disable collision ended callback for this PhysicsBody.\r\n * @param enabled true if PhysicsBody's collision ended will rise a collision event and notifies the observable\r\n */\r\n public setCollisionEndedCallbackEnabled(enabled: boolean): void {\r\n this._collisionEndedCBEnabled = enabled;\r\n this._physicsPlugin.setCollisionEndedCallbackEnabled(this, enabled);\r\n }\r\n\r\n /**\r\n * Get the center of the object in world space.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the center for.\r\n * @returns geometric center of the associated mesh\r\n */\r\n public getObjectCenterWorld(instanceIndex?: number): Vector3 {\r\n const ref = new Vector3();\r\n return this.getObjectCenterWorldToRef(ref, instanceIndex);\r\n }\r\n\r\n /**\r\n * Get the center of the object in world space.\r\n * @param ref - The vector3 to store the result in.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the center for.\r\n * @returns geometric center of the associated mesh\r\n */\r\n public getObjectCenterWorldToRef(ref: Vector3, instanceIndex?: number): Vector3 {\r\n if (this._pluginDataInstances?.length > 0) {\r\n const index = instanceIndex || 0;\r\n const matrixData = (this.transformNode as Mesh)._thinInstanceDataStorage.matrixData;\r\n if (matrixData) {\r\n ref.set(matrixData[index * 16 + 12], matrixData[index * 16 + 13], matrixData[index * 16 + 14]);\r\n }\r\n } else {\r\n ref.copyFrom(this.transformNode.position);\r\n }\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds a constraint to the physics engine.\r\n *\r\n * @param childBody - The body to which the constraint will be applied.\r\n * @param constraint - The constraint to be applied.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.\r\n * @param childInstanceIndex - If the child body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.\r\n *\r\n */\r\n public addConstraint(childBody: PhysicsBody, constraint: PhysicsConstraint, instanceIndex?: number, childInstanceIndex?: number): void {\r\n this._physicsPlugin.addConstraint(this, childBody, constraint, instanceIndex, childInstanceIndex);\r\n }\r\n\r\n /**\r\n * Sync with a bone\r\n * @param bone The bone that the impostor will be synced to.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n * @param boneAxis Optional vector3 axis the bone is aligned with\r\n */\r\n public syncWithBone(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion, boneAxis?: Vector3) {\r\n const mesh = this.transformNode;\r\n\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n const tempQuat = TmpVectors.Quaternion[0];\r\n bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, tempQuat);\r\n tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);\r\n } else {\r\n bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, mesh.rotationQuaternion);\r\n }\r\n }\r\n\r\n const pos = TmpVectors.Vector3[0];\r\n const boneDir = TmpVectors.Vector3[1];\r\n\r\n if (!boneAxis) {\r\n boneAxis = TmpVectors.Vector3[2];\r\n boneAxis.x = 0;\r\n boneAxis.y = 1;\r\n boneAxis.z = 0;\r\n }\r\n\r\n bone.getDirectionToRef(boneAxis, boneMesh, boneDir);\r\n bone.getAbsolutePositionToRef(boneMesh, pos);\r\n\r\n if ((distToJoint === undefined || distToJoint === null) && jointPivot) {\r\n distToJoint = jointPivot.length();\r\n }\r\n\r\n if (distToJoint !== undefined && distToJoint !== null) {\r\n pos.x += boneDir.x * distToJoint;\r\n pos.y += boneDir.y * distToJoint;\r\n pos.z += boneDir.z * distToJoint;\r\n }\r\n\r\n mesh.setAbsolutePosition(pos);\r\n }\r\n\r\n /**\r\n * Executes a callback on the body or all of the instances of a body\r\n * @param callback the callback to execute\r\n */\r\n public iterateOverAllInstances(callback: (body: PhysicsBody, instanceIndex?: number) => void) {\r\n if (this._pluginDataInstances?.length > 0) {\r\n for (let i = 0; i < this._pluginDataInstances.length; i++) {\r\n callback(this, i);\r\n }\r\n } else {\r\n callback(this, undefined);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the gravity factor of the physics body\r\n * @param factor the gravity factor to set\r\n * @param instanceIndex the instance of the body to set, if undefined all instances will be set\r\n */\r\n public setGravityFactor(factor: number, instanceIndex?: number) {\r\n this._physicsPlugin.setGravityFactor(this, factor, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the gravity factor of the physics body\r\n * @param instanceIndex the instance of the body to get, if undefined the value of first instance will be returned\r\n * @returns the gravity factor\r\n */\r\n public getGravityFactor(instanceIndex?: number): number {\r\n return this._physicsPlugin.getGravityFactor(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Set the target transformation (position and rotation) of the body, such that the body will set its velocity to reach that target\r\n * @param position The target position\r\n * @param rotation The target rotation\r\n * @param instanceIndex The index of the instance in an instanced body\r\n */\r\n public setTargetTransform(position: Vector3, rotation: Quaternion, instanceIndex?: number) {\r\n this._physicsPlugin.setTargetTransform(this, position, rotation, instanceIndex);\r\n }\r\n\r\n /**\r\n * Returns if the body has been disposed.\r\n * @returns true if disposed, false otherwise.\r\n */\r\n public get isDisposed() {\r\n return this._isDisposed;\r\n }\r\n\r\n /**\r\n * Disposes the body from the physics engine.\r\n *\r\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\r\n */\r\n public dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n // Disable collisions CB so it doesn't fire when the body is disposed\r\n if (this._collisionCBEnabled) {\r\n this.setCollisionCallbackEnabled(false);\r\n }\r\n if (this._collisionEndedCBEnabled) {\r\n this.setCollisionEndedCallbackEnabled(false);\r\n }\r\n if (this._nodeDisposeObserver) {\r\n this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\r\n this._nodeDisposeObserver = null;\r\n }\r\n this.detach();\r\n this._physicsPlugin.disposeBody(this);\r\n this._pluginData = null;\r\n this._pluginDataInstances.length = 0;\r\n this._isDisposed = true;\r\n this.shape = null;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsBody.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsBody.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,kBAAkB,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAc/E;;;;GAIG;AACH,MAAM,OAAO,WAAW;IA8BpB;;;OAGG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,YAAY,IAAI,kBAAkB,CAAC,QAAQ,CAAC;IAC5D,CAAC;IAED,IAAW,cA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E,CAAC;YAChC,IAAI,CAAC,gCAAgC,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACzE,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import {\r\n type IBasePhysicsCollisionEvent,\r\n type IPhysicsCollisionEvent,\r\n type IPhysicsEnginePluginV2,\r\n type PhysicsMassProperties,\r\n PhysicsMotionType,\r\n PhysicsPrestepType,\r\n} from \"./IPhysicsEnginePlugin\";\r\nimport { type PhysicsShape } from \"./physicsShape\";\r\nimport { Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector.pure\";\r\nimport { type Scene } from \"../../scene\";\r\nimport { type PhysicsEngine } from \"./physicsEngine\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type PhysicsConstraint } from \"./physicsConstraint\";\r\nimport { type Bone } from \"../../Bones/bone\";\r\nimport { Space } from \"../../Maths/math.axis\";\r\nimport { type Observable, type Observer } from \"../../Misc/observable\";\r\nimport { type Node } from \"../../node\";\r\nimport { type Mesh } from \"../../Meshes/mesh\";\r\nimport { type AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { type TransformNode } from \"../../Meshes/transformNode\";\r\nimport { type BoundingBox } from \"../../Culling/boundingBox\";\r\n\r\n/**\r\n * PhysicsBody is useful for creating a physics body that can be used in a physics engine. It allows\r\n * the user to set the mass and velocity of the body, which can then be used to calculate the\r\n * motion of the body in the physics engine.\r\n */\r\nexport class PhysicsBody {\r\n /**\r\n * V2 Physics plugin private data for single Transform\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * V2 Physics plugin private data for instances\r\n */\r\n public _pluginDataInstances: Array<any> = [];\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n /**\r\n * The engine used to create and manage this Physics Body\r\n */\r\n private _physicsEngine: PhysicsEngine;\r\n /**\r\n * If the collision callback is enabled\r\n */\r\n private _collisionCBEnabled: boolean = false;\r\n /**\r\n * If the collision ended callback is enabled\r\n */\r\n private _collisionEndedCBEnabled: boolean = false;\r\n /**\r\n * The transform node associated with this Physics Body\r\n */\r\n transformNode: TransformNode;\r\n\r\n /**\r\n * Disable pre-step that consists in updating Physics Body from Transform Node Translation/Orientation.\r\n * True by default for maximum performance.\r\n */\r\n public get disablePreStep(): boolean {\r\n return this._prestepType == PhysicsPrestepType.DISABLED;\r\n }\r\n\r\n public set disablePreStep(value: boolean) {\r\n this._prestepType = value ? PhysicsPrestepType.DISABLED : PhysicsPrestepType.TELEPORT;\r\n }\r\n\r\n /**\r\n * Disable sync from physics to transformNode. This value is set to true at body creation or at motionType setting when the body is not dynamic.\r\n */\r\n disableSync: boolean = false;\r\n\r\n /**\r\n * Physics engine will try to make this body sleeping and not active\r\n */\r\n public startAsleep: boolean;\r\n\r\n private _nodeDisposeObserver: Nullable<Observer<Node>>;\r\n\r\n private _isDisposed = false;\r\n\r\n private _shape: Nullable<PhysicsShape> = null;\r\n\r\n private _prestepType: PhysicsPrestepType = PhysicsPrestepType.DISABLED;\r\n private _isAttached = false;\r\n /**\r\n * Constructs a new physics body for the given node.\r\n * @param transformNode - The Transform Node to construct the physics body for. For better performance, it is advised that this node does not have a parent.\r\n * @param _motionType - The motion type of the physics body. The options are:\r\n * - PhysicsMotionType.STATIC - Static bodies are not moving and unaffected by forces or collisions. They are good for level boundaries or terrain.\r\n * - PhysicsMotionType.DYNAMIC - Dynamic bodies are fully simulated. They can move and collide with other objects.\r\n * - PhysicsMotionType.ANIMATED - They behave like dynamic bodies, but they won't be affected by other bodies, but still push other bodies out of the way.\r\n * @param startsAsleep - Whether the physics body should start in a sleeping state (not a guarantee). Defaults to false.\r\n * @param scene - The scene containing the physics engine.\r\n *\r\n * This code is useful for creating a physics body for a given Transform Node in a scene.\r\n * It checks the version of the physics engine and the physics plugin, and initializes the body accordingly.\r\n * It also sets the node's rotation quaternion if it is not already set. Finally, it adds the body to the physics engine.\r\n */\r\n constructor(\r\n transformNode: TransformNode,\r\n private _motionType: PhysicsMotionType,\r\n startsAsleep: boolean,\r\n scene: Scene\r\n ) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine() as PhysicsEngine;\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n this._physicsEngine = physicsEngine;\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin;\r\n if (!transformNode.rotationQuaternion) {\r\n transformNode.rotationQuaternion = Quaternion.FromEulerAngles(transformNode.rotation.x, transformNode.rotation.y, transformNode.rotation.z);\r\n }\r\n\r\n this.startAsleep = startsAsleep;\r\n\r\n // only dynamic and animated body needs sync from physics to transformNode\r\n this.disableSync = this._motionType == PhysicsMotionType.STATIC;\r\n\r\n this.transformNode = transformNode;\r\n\r\n this.attach();\r\n\r\n this._nodeDisposeObserver = transformNode.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Returns the string \"PhysicsBody\".\r\n * @returns \"PhysicsBody\"\r\n */\r\n public getClassName() {\r\n return \"PhysicsBody\";\r\n }\r\n //Attach the body to the physics engine\r\n public attach() {\r\n if (!this._isAttached) {\r\n // instances?\r\n const m = this.transformNode as Mesh;\r\n if (m.hasThinInstances) {\r\n this._physicsPlugin.initBodyInstances(this, this._motionType, m);\r\n } else {\r\n // single instance\r\n if (this.transformNode.parent) {\r\n // Force computation of world matrix so that the parent transforms are correctly reflected in absolutePosition/absoluteRotationQuaternion.\r\n this.transformNode.computeWorldMatrix(true);\r\n }\r\n this._physicsPlugin.initBody(this, this._motionType, this.transformNode.absolutePosition, this.transformNode.absoluteRotationQuaternion);\r\n }\r\n this.transformNode.physicsBody = this;\r\n this._physicsEngine.addBody(this);\r\n this._isAttached = true;\r\n }\r\n }\r\n\r\n //Detach the body from the physics engine\r\n public detach() {\r\n if (this._isAttached) {\r\n this._physicsEngine.removeBody(this);\r\n this._physicsPlugin.removeBody(this);\r\n this.transformNode.physicsBody = null;\r\n this._isAttached = false;\r\n }\r\n }\r\n\r\n /**\r\n * Clone the PhysicsBody to a new body and assign it to the transformNode parameter\r\n * @param transformNode transformNode that will be used for the cloned PhysicsBody\r\n * @returns the newly cloned PhysicsBody\r\n */\r\n public clone(transformNode: TransformNode): PhysicsBody {\r\n const clonedBody = new PhysicsBody(transformNode, this.getMotionType(), this.startAsleep, this.transformNode.getScene());\r\n clonedBody.shape = this.shape;\r\n clonedBody.setMassProperties(this.getMassProperties());\r\n clonedBody.setLinearDamping(this.getLinearDamping());\r\n clonedBody.setAngularDamping(this.getAngularDamping());\r\n return clonedBody;\r\n }\r\n\r\n /**\r\n * If a physics body is connected to an instanced node, update the number physic instances to match the number of node instances.\r\n */\r\n public updateBodyInstances() {\r\n const m = this.transformNode as Mesh;\r\n if (m.hasThinInstances) {\r\n this._physicsPlugin.updateBodyInstances(this, m);\r\n }\r\n }\r\n\r\n /**\r\n * This returns the number of internal instances of the physics body\r\n */\r\n public get numInstances(): number {\r\n return this._pluginDataInstances.length;\r\n }\r\n\r\n /**\r\n * Get the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\r\n */\r\n public get motionType(): PhysicsMotionType {\r\n return this._physicsPlugin.getMotionType(this);\r\n }\r\n\r\n /**\r\n * Sets the shape of the physics body.\r\n * @param shape - The shape of the physics body.\r\n *\r\n * This method is useful for setting the shape of the physics body, which is necessary for the physics engine to accurately simulate the body's behavior.\r\n * The shape is used to calculate the body's mass, inertia, and other properties.\r\n */\r\n public set shape(shape: Nullable<PhysicsShape>) {\r\n this._shape = shape;\r\n if (shape) {\r\n this._physicsPlugin.setShape(this, shape);\r\n }\r\n }\r\n\r\n /**\r\n * Retrieves the physics shape associated with this object.\r\n *\r\n * @returns The physics shape associated with this object, or `undefined` if no\r\n * shape is associated.\r\n *\r\n * This method is useful for retrieving the physics shape associated with this object,\r\n * which can be used to apply physical forces to the object or to detect collisions.\r\n */\r\n public get shape(): Nullable<PhysicsShape> {\r\n return this._shape;\r\n }\r\n\r\n /**\r\n * Returns the bounding box of the physics body.\r\n * @returns The bounding box of the physics body.\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBodyBoundingBox(this);\r\n }\r\n\r\n /**\r\n * Sets the event mask for the physics engine.\r\n *\r\n * @param eventMask - A bitmask that determines which events will be sent to the physics engine.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the event mask for.\r\n *\r\n * This method is useful for setting the event mask for the physics engine, which determines which events\r\n * will be sent to the physics engine. This allows the user to control which events the physics engine will respond to.\r\n */\r\n public setEventMask(eventMask: number, instanceIndex?: number) {\r\n this._physicsPlugin.setEventMask(this, eventMask, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the event mask of the physics engine.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the event mask for.\r\n * @returns The event mask of the physics engine.\r\n *\r\n * This method is useful for getting the event mask of the physics engine,\r\n * which is used to determine which events the engine will respond to.\r\n * This is important for ensuring that the engine is responding to the correct events and not\r\n * wasting resources on unnecessary events.\r\n */\r\n public getEventMask(instanceIndex?: number): number {\r\n return this._physicsPlugin.getEventMask(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\r\n * @param motionType - The motion type to set.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the motion type for. If body is instanced but instanceIndex is undefined, the motion type will be set for all instances.\r\n */\r\n public setMotionType(motionType: PhysicsMotionType, instanceIndex?: number) {\r\n this.disableSync = instanceIndex === undefined && motionType == PhysicsMotionType.STATIC;\r\n this._physicsPlugin.setMotionType(this, motionType, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the motion type for.\r\n * @returns The motion type of the physics body.\r\n */\r\n public getMotionType(instanceIndex?: number): PhysicsMotionType {\r\n return this._physicsPlugin.getMotionType(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Set the prestep type of the body\r\n * @param prestepType prestep type provided by PhysicsPrestepType\r\n */\r\n public setPrestepType(prestepType: PhysicsPrestepType): void {\r\n this._prestepType = prestepType;\r\n }\r\n\r\n /**\r\n * Get the current prestep type of the body\r\n * @returns the type of prestep associated with the body and its instance index\r\n */\r\n public getPrestepType(): PhysicsPrestepType {\r\n return this._prestepType;\r\n }\r\n\r\n /**\r\n * Computes the mass properties of the physics object, based on the set of physics shapes this body uses.\r\n * This method is useful for computing the initial mass properties of a physics object, such as its mass,\r\n * inertia, and center of mass; these values are important for accurately simulating the physics of the\r\n * object in the physics engine, and computing values based on the shape will provide you with reasonable\r\n * initial values, which you can then customize.\r\n * @param instanceIndex - The index of the instance to compute the mass properties for.\r\n * @returns The mass properties of the object.\r\n */\r\n public computeMassProperties(instanceIndex?: number): PhysicsMassProperties {\r\n return this._physicsPlugin.computeMassProperties(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the mass properties of the physics object.\r\n *\r\n * @param massProps - The mass properties to set.\r\n * @param instanceIndex - The index of the instance to set the mass properties for. If not defined, the mass properties will be set for all instances.\r\n *\r\n * This method is useful for setting the mass properties of a physics object, such as its mass,\r\n * inertia, and center of mass. This is important for accurately simulating the physics of the object in the physics engine.\r\n */\r\n public setMassProperties(massProps: PhysicsMassProperties, instanceIndex?: number): void {\r\n this._physicsPlugin.setMassProperties(this, massProps, instanceIndex);\r\n }\r\n\r\n /**\r\n * Retrieves the mass properties of the object.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the mass properties for.\r\n * @returns The mass properties of the object.\r\n *\r\n * This method is useful for physics simulations, as it allows the user to\r\n * retrieve the mass properties of the object, such as its mass, center of mass,\r\n * and moment of inertia. This information is necessary for accurate physics\r\n * simulations.\r\n */\r\n public getMassProperties(instanceIndex?: number): PhysicsMassProperties {\r\n return this._physicsPlugin.getMassProperties(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the linear damping of the physics body.\r\n *\r\n * @param damping - The linear damping value.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the linear damping for.\r\n *\r\n * This method is useful for controlling the linear damping of the physics body,\r\n * which is the rate at which the body's velocity decreases over time. This is useful for simulating\r\n * the effects of air resistance or other forms of friction.\r\n */\r\n public setLinearDamping(damping: number, instanceIndex?: number) {\r\n this._physicsPlugin.setLinearDamping(this, damping, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the linear damping of the physics body.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear damping for.\r\n * @returns The linear damping of the physics body.\r\n *\r\n * This method is useful for retrieving the linear damping of the physics body, which is the amount of\r\n * resistance the body has to linear motion. This is useful for simulating realistic physics behavior\r\n * in a game.\r\n */\r\n public getLinearDamping(instanceIndex?: number): number {\r\n return this._physicsPlugin.getLinearDamping(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the angular damping of the physics body.\r\n * @param damping The angular damping of the body.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the angular damping for.\r\n *\r\n * This method is useful for controlling the angular velocity of a physics body.\r\n * By setting the damping, the body's angular velocity will be reduced over time, simulating the effect of friction.\r\n * This can be used to create realistic physical behavior in a physics engine.\r\n */\r\n public setAngularDamping(damping: number, instanceIndex?: number) {\r\n this._physicsPlugin.setAngularDamping(this, damping, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the angular damping of the physics body.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular damping for.\r\n *\r\n * @returns The angular damping of the physics body.\r\n *\r\n * This method is useful for getting the angular damping of the physics body,\r\n * which is the rate of reduction of the angular velocity over time.\r\n * This is important for simulating realistic physics behavior in a game.\r\n */\r\n public getAngularDamping(instanceIndex?: number): number {\r\n return this._physicsPlugin.getAngularDamping(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Sets the linear velocity of the physics object.\r\n * @param linVel - The linear velocity to set.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the linear velocity for.\r\n *\r\n * This method is useful for setting the linear velocity of a physics object,\r\n * which is necessary for simulating realistic physics in a game engine.\r\n * By setting the linear velocity, the physics object will move in the direction and speed specified by the vector.\r\n * This allows for realistic physics simulations, such as simulating the motion of a ball rolling down a hill.\r\n */\r\n public setLinearVelocity(linVel: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.setLinearVelocity(this, linVel, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the linear velocity of the physics body and stores it in the given vector3.\r\n * @param linVel - The vector3 to store the linear velocity in.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear velocity for.\r\n *\r\n * This method is useful for getting the linear velocity of a physics body in a physics engine.\r\n * This can be used to determine the speed and direction of the body, which can be used to calculate the motion of the body.\r\n */\r\n public getLinearVelocityToRef(linVel: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.getLinearVelocityToRef(this, linVel, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the linear velocity of the physics body as a new vector3.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the linear velocity for.\r\n * @returns The linear velocity of the physics body.\r\n *\r\n * This method is useful for getting the linear velocity of a physics body in a physics engine.\r\n * This can be used to determine the speed and direction of the body, which can be used to calculate the motion of the body.\r\n */\r\n public getLinearVelocity(instanceIndex?: number): Vector3 {\r\n const ref = new Vector3();\r\n this.getLinearVelocityToRef(ref, instanceIndex);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Sets the angular velocity of the physics object.\r\n * @param angVel - The angular velocity to set.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to set the angular velocity for.\r\n *\r\n * This method is useful for setting the angular velocity of a physics object, which is necessary for\r\n * simulating realistic physics behavior. The angular velocity is used to determine the rate of rotation of the object,\r\n * which is important for simulating realistic motion.\r\n */\r\n public setAngularVelocity(angVel: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.setAngularVelocity(this, angVel, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the angular velocity of the physics body and stores it in the given vector3.\r\n * @param angVel - The vector3 to store the angular velocity in.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular velocity for.\r\n *\r\n * This method is useful for getting the angular velocity of a physics body, which can be used to determine the body's\r\n * rotational speed. This information can be used to create realistic physics simulations.\r\n */\r\n public getAngularVelocityToRef(angVel: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.getAngularVelocityToRef(this, angVel, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the angular velocity of the physics body as a new vector3.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the angular velocity for.\r\n * @returns The angular velocity of the physics body.\r\n *\r\n * This method is useful for getting the angular velocity of a physics body, which can be used to determine the body's\r\n * rotational speed. This information can be used to create realistic physics simulations.\r\n */\r\n public getAngularVelocity(instanceIndex?: number): Vector3 {\r\n const ref = new Vector3();\r\n this.getAngularVelocityToRef(ref, instanceIndex);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Applies an impulse to the physics object.\r\n *\r\n * @param impulse The impulse vector.\r\n * @param location The location of the impulse.\r\n * @param instanceIndex For a instanced body, the instance to where the impulse should be applied. If not specified, the impulse is applied to all instances.\r\n *\r\n * This method is useful for applying an impulse to a physics object, which can be used to simulate physical forces such as gravity,\r\n * collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.\r\n */\r\n public applyImpulse(impulse: Vector3, location: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.applyImpulse(this, impulse, location, instanceIndex);\r\n }\r\n\r\n /**\r\n * Add torque to a physics body\r\n * @param angularImpulse The angular impulse vector.\r\n * @param instanceIndex For a instanced body, the instance to where the impulse should be applied. If not specified, the impulse is applied to all instances.\r\n */\r\n public applyAngularImpulse(angularImpulse: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.applyAngularImpulse(this, angularImpulse, instanceIndex);\r\n }\r\n\r\n /**\r\n * Applies a torque to the physics body.\r\n *\r\n * @param torque The torque vector.\r\n * @param instanceIndex For a instanced body, the instance to where the torque should be applied. If not specified, the torque is applied to all instances.\r\n *\r\n * This method is useful for applying a torque to a physics body, which can be used to simulate rotational forces such as motors,\r\n * angular momentum, and rotational dynamics. This can be used to create realistic physics simulations in a game or other application.\r\n */\r\n public applyTorque(torque: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.applyTorque(this, torque, instanceIndex);\r\n }\r\n\r\n /**\r\n * Applies a force to the physics object.\r\n *\r\n * @param force The force vector.\r\n * @param location The location of the force.\r\n * @param instanceIndex For a instanced body, the instance to where the force should be applied. If not specified, the force is applied to all instances.\r\n *\r\n * This method is useful for applying a force to a physics object, which can be used to simulate physical forces such as gravity,\r\n * collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.\r\n */\r\n public applyForce(force: Vector3, location: Vector3, instanceIndex?: number): void {\r\n this._physicsPlugin.applyForce(this, force, location, instanceIndex);\r\n }\r\n\r\n /**\r\n * Retrieves the geometry of the body from the physics plugin.\r\n *\r\n * @returns The geometry of the body.\r\n *\r\n * This method is useful for retrieving the geometry of the body from the physics plugin, which can be used for various physics calculations.\r\n */\r\n public getGeometry(): object {\r\n return this._physicsPlugin.getBodyGeometry(this);\r\n }\r\n\r\n /**\r\n * Returns an observable that will be notified for when a collision starts or continues for this PhysicsBody\r\n * @param instanceIndex - optionally, the index of the instance in the body\r\n * @returns Observable\r\n */\r\n public getCollisionObservable(instanceIndex?: number): Observable<IPhysicsCollisionEvent> {\r\n return this._physicsPlugin.getCollisionObservable(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Returns an observable that will be notified when the body has finished colliding with another body\r\n * @param instanceIndex - optionally, the index of the instance in the body\r\n * @returns Observable\r\n */\r\n public getCollisionEndedObservable(instanceIndex?: number): Observable<IBasePhysicsCollisionEvent> {\r\n return this._physicsPlugin.getCollisionEndedObservable(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Enable or disable collision callback for this PhysicsBody.\r\n * @param enabled true if PhysicsBody's collision will rise a collision event and notifies the observable\r\n */\r\n public setCollisionCallbackEnabled(enabled: boolean): void {\r\n this._collisionCBEnabled = enabled;\r\n this._physicsPlugin.setCollisionCallbackEnabled(this, enabled);\r\n }\r\n\r\n /**\r\n * Enable or disable collision ended callback for this PhysicsBody.\r\n * @param enabled true if PhysicsBody's collision ended will rise a collision event and notifies the observable\r\n */\r\n public setCollisionEndedCallbackEnabled(enabled: boolean): void {\r\n this._collisionEndedCBEnabled = enabled;\r\n this._physicsPlugin.setCollisionEndedCallbackEnabled(this, enabled);\r\n }\r\n\r\n /**\r\n * Get the center of the object in world space.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the center for.\r\n * @returns geometric center of the associated mesh\r\n */\r\n public getObjectCenterWorld(instanceIndex?: number): Vector3 {\r\n const ref = new Vector3();\r\n return this.getObjectCenterWorldToRef(ref, instanceIndex);\r\n }\r\n\r\n /**\r\n * Get the center of the object in world space.\r\n * @param ref - The vector3 to store the result in.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to get the center for.\r\n * @returns geometric center of the associated mesh\r\n */\r\n public getObjectCenterWorldToRef(ref: Vector3, instanceIndex?: number): Vector3 {\r\n if (this._pluginDataInstances?.length > 0) {\r\n const index = instanceIndex || 0;\r\n const matrixData = (this.transformNode as Mesh)._thinInstanceDataStorage.matrixData;\r\n if (matrixData) {\r\n ref.set(matrixData[index * 16 + 12], matrixData[index * 16 + 13], matrixData[index * 16 + 14]);\r\n }\r\n } else {\r\n ref.copyFrom(this.transformNode.position);\r\n }\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds a constraint to the physics engine.\r\n *\r\n * @param childBody - The body to which the constraint will be applied.\r\n * @param constraint - The constraint to be applied.\r\n * @param instanceIndex - If this body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.\r\n * @param childInstanceIndex - If the child body is instanced, the index of the instance to which the constraint will be applied. If not specified, no constraint will be applied.\r\n *\r\n */\r\n public addConstraint(childBody: PhysicsBody, constraint: PhysicsConstraint, instanceIndex?: number, childInstanceIndex?: number): void {\r\n this._physicsPlugin.addConstraint(this, childBody, constraint, instanceIndex, childInstanceIndex);\r\n }\r\n\r\n /**\r\n * Sync with a bone\r\n * @param bone The bone that the impostor will be synced to.\r\n * @param boneMesh The mesh that the bone is influencing.\r\n * @param jointPivot The pivot of the joint / bone in local space.\r\n * @param distToJoint Optional distance from the impostor to the joint.\r\n * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.\r\n * @param boneAxis Optional vector3 axis the bone is aligned with\r\n */\r\n public syncWithBone(bone: Bone, boneMesh: AbstractMesh, jointPivot: Vector3, distToJoint?: number, adjustRotation?: Quaternion, boneAxis?: Vector3) {\r\n const mesh = this.transformNode;\r\n\r\n if (mesh.rotationQuaternion) {\r\n if (adjustRotation) {\r\n const tempQuat = TmpVectors.Quaternion[0];\r\n bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, tempQuat);\r\n tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);\r\n } else {\r\n bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, mesh.rotationQuaternion);\r\n }\r\n }\r\n\r\n const pos = TmpVectors.Vector3[0];\r\n const boneDir = TmpVectors.Vector3[1];\r\n\r\n if (!boneAxis) {\r\n boneAxis = TmpVectors.Vector3[2];\r\n boneAxis.x = 0;\r\n boneAxis.y = 1;\r\n boneAxis.z = 0;\r\n }\r\n\r\n bone.getDirectionToRef(boneAxis, boneMesh, boneDir);\r\n bone.getAbsolutePositionToRef(boneMesh, pos);\r\n\r\n if ((distToJoint === undefined || distToJoint === null) && jointPivot) {\r\n distToJoint = jointPivot.length();\r\n }\r\n\r\n if (distToJoint !== undefined && distToJoint !== null) {\r\n pos.x += boneDir.x * distToJoint;\r\n pos.y += boneDir.y * distToJoint;\r\n pos.z += boneDir.z * distToJoint;\r\n }\r\n\r\n mesh.setAbsolutePosition(pos);\r\n }\r\n\r\n /**\r\n * Executes a callback on the body or all of the instances of a body\r\n * @param callback the callback to execute\r\n */\r\n public iterateOverAllInstances(callback: (body: PhysicsBody, instanceIndex?: number) => void) {\r\n if (this._pluginDataInstances?.length > 0) {\r\n for (let i = 0; i < this._pluginDataInstances.length; i++) {\r\n callback(this, i);\r\n }\r\n } else {\r\n callback(this, undefined);\r\n }\r\n }\r\n\r\n /**\r\n * Sets the gravity factor of the physics body\r\n * @param factor the gravity factor to set\r\n * @param instanceIndex the instance of the body to set, if undefined all instances will be set\r\n */\r\n public setGravityFactor(factor: number, instanceIndex?: number) {\r\n this._physicsPlugin.setGravityFactor(this, factor, instanceIndex);\r\n }\r\n\r\n /**\r\n * Gets the gravity factor of the physics body\r\n * @param instanceIndex the instance of the body to get, if undefined the value of first instance will be returned\r\n * @returns the gravity factor\r\n */\r\n public getGravityFactor(instanceIndex?: number): number {\r\n return this._physicsPlugin.getGravityFactor(this, instanceIndex);\r\n }\r\n\r\n /**\r\n * Set the target transformation (position and rotation) of the body, such that the body will set its velocity to reach that target\r\n * @param position The target position\r\n * @param rotation The target rotation\r\n * @param instanceIndex The index of the instance in an instanced body\r\n */\r\n public setTargetTransform(position: Vector3, rotation: Quaternion, instanceIndex?: number) {\r\n this._physicsPlugin.setTargetTransform(this, position, rotation, instanceIndex);\r\n }\r\n\r\n /**\r\n * Returns if the body has been disposed.\r\n * @returns true if disposed, false otherwise.\r\n */\r\n public get isDisposed() {\r\n return this._isDisposed;\r\n }\r\n\r\n /**\r\n * Disposes the body from the physics engine.\r\n *\r\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\r\n */\r\n public dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n // Disable collisions CB so it doesn't fire when the body is disposed\r\n if (this._collisionCBEnabled) {\r\n this.setCollisionCallbackEnabled(false);\r\n }\r\n if (this._collisionEndedCBEnabled) {\r\n this.setCollisionEndedCallbackEnabled(false);\r\n }\r\n if (this._nodeDisposeObserver) {\r\n this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\r\n this._nodeDisposeObserver = null;\r\n }\r\n this.detach();\r\n this._physicsPlugin.disposeBody(this);\r\n this._pluginData = null;\r\n this._pluginDataInstances.length = 0;\r\n this._isDisposed = true;\r\n this.shape = null;\r\n }\r\n}\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type Nullable } from "../../types.js";
2
- import { Vector3 } from "../../Maths/math.vector.js";
2
+ import { Vector3 } from "../../Maths/math.vector.pure.js";
3
3
  import { type IPhysicsEngine } from "../IPhysicsEngine.js";
4
4
  import { type IPhysicsEnginePluginV2 } from "./IPhysicsEnginePlugin.js";
5
5
  import { type IRaycastQuery, PhysicsRaycastResult } from "../physicsRaycastResult.js";
@@ -1,4 +1,4 @@
1
- import { Vector3 } from "../../Maths/math.vector.js";
1
+ import { Vector3 } from "../../Maths/math.vector.pure.js";
2
2
  import { PhysicsRaycastResult } from "../physicsRaycastResult.js";
3
3
  import { _WarnImport } from "../../Misc/devTools.js";
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"physicsEngine.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsEngine.ts"],"names":[],"mapp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AC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC;IACL,CAAC;IACD;;OAEG;IACI,SAAS;QACZ,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;;;;OAQG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,MAA0D,EAAE,KAAqB;QAC7H,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,IAAa,EAAE,EAAW,EAAE,KAAqB;QAC5D,MAAM,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,KAAqB;QACjE,MAAM,MAAM,GAAgC,EAAE,CAAC;QAC/C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { type IPhysicsEngine } from \"../IPhysicsEngine\";\r\nimport { type IPhysicsEnginePluginV2 } from \"./IPhysicsEnginePlugin\";\r\nimport { type IRaycastQuery, PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\nimport { type PhysicsBody } from \"./physicsBody\";\r\n\r\n/**\r\n * Class used to control physics engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsEngine implements IPhysicsEngine {\r\n /** @internal */\r\n private _physicsBodies: Array<PhysicsBody> = [];\r\n private _subTimeStep: number = 0;\r\n\r\n /**\r\n * Gets the gravity vector used by the simulation\r\n */\r\n public gravity: Vector3;\r\n\r\n /**\r\n *\r\n * @returns physics plugin version\r\n */\r\n public getPluginVersion(): number {\r\n return this._physicsPlugin.getPluginVersion();\r\n }\r\n // eslint-disable-next-line jsdoc/require-returns-check\r\n /**\r\n * Factory used to create the default physics plugin.\r\n * @returns The default physics plugin\r\n */\r\n public static DefaultPluginFactory(): IPhysicsEnginePluginV2 {\r\n throw _WarnImport(\"\");\r\n }\r\n\r\n /**\r\n * Creates a new Physics Engine\r\n * @param gravity defines the gravity vector used by the simulation\r\n * @param _physicsPlugin defines the plugin to use (CannonJS by default)\r\n */\r\n constructor(\r\n gravity: Nullable<Vector3>,\r\n private _physicsPlugin: IPhysicsEnginePluginV2 = PhysicsEngine.DefaultPluginFactory()\r\n ) {\r\n gravity = gravity || new Vector3(0, -9.807, 0);\r\n this.setGravity(gravity);\r\n this.setTimeStep();\r\n }\r\n\r\n /**\r\n * Sets the gravity vector used by the simulation\r\n * @param gravity defines the gravity vector to use\r\n */\r\n public setGravity(gravity: Vector3): void {\r\n this.gravity = gravity;\r\n this._physicsPlugin.setGravity(this.gravity);\r\n }\r\n\r\n /**\r\n * Set the time step of the physics engine.\r\n * Default is 1/60.\r\n * To slow it down, enter 1/600 for example.\r\n * To speed it up, 1/30\r\n * Unit is seconds.\r\n * @param newTimeStep defines the new timestep to apply to this world.\r\n */\r\n public setTimeStep(newTimeStep: number = 1 / 60) {\r\n this._physicsPlugin.setTimeStep(newTimeStep);\r\n }\r\n\r\n /**\r\n * Get the time step of the physics engine.\r\n * @returns the current time step\r\n */\r\n public getTimeStep(): number {\r\n return this._physicsPlugin.getTimeStep();\r\n }\r\n\r\n /**\r\n * Set the sub time step of the physics engine.\r\n * Default is 0 meaning there is no sub steps\r\n * To increase physics resolution precision, set a small value (like 1 ms)\r\n * @param subTimeStep defines the new sub timestep used for physics resolution.\r\n */\r\n public setSubTimeStep(subTimeStep: number = 0) {\r\n this._subTimeStep = subTimeStep;\r\n }\r\n\r\n /**\r\n * Get the sub time step of the physics engine.\r\n * @returns the current sub time step\r\n */\r\n public getSubTimeStep() {\r\n return this._subTimeStep;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.dispose();\r\n }\r\n\r\n /**\r\n * Gets the name of the current physics plugin\r\n * @returns the name of the plugin\r\n */\r\n public getPhysicsPluginName(): string {\r\n return this._physicsPlugin.name;\r\n }\r\n\r\n /**\r\n * Set the maximum allowed linear and angular velocities\r\n * @param maxLinearVelocity maximum allowed linear velocity\r\n * @param maxAngularVelocity maximum allowed angular velocity\r\n */\r\n setVelocityLimits(maxLinearVelocity: number, maxAngularVelocity: number): void {\r\n this._physicsPlugin.setVelocityLimits(maxLinearVelocity, maxAngularVelocity);\r\n }\r\n\r\n /**\r\n * @returns maximum allowed linear velocity\r\n */\r\n getMaxLinearVelocity(): number {\r\n return this._physicsPlugin.getMaxLinearVelocity();\r\n }\r\n\r\n /**\r\n * @returns maximum allowed angular velocity\r\n */\r\n getMaxAngularVelocity(): number {\r\n return this._physicsPlugin.getMaxAngularVelocity();\r\n }\r\n\r\n /**\r\n * Called by the scene. No need to call it.\r\n * @param delta defines the timespan between frames\r\n */\r\n public _step(delta: number) {\r\n if (delta > 0.1) {\r\n delta = 0.1;\r\n } else if (delta <= 0) {\r\n delta = 1.0 / 60.0;\r\n }\r\n\r\n this._physicsPlugin.executeStep(delta, this._physicsBodies);\r\n }\r\n\r\n /**\r\n * Add a body as an active component of this engine\r\n * @param physicsBody The body to add\r\n */\r\n public addBody(physicsBody: PhysicsBody): void {\r\n this._physicsBodies.push(physicsBody);\r\n }\r\n /**\r\n * Removes a particular body from this engine\r\n * @param physicsBody The body to remove from the simulation\r\n */\r\n public removeBody(physicsBody: PhysicsBody): void {\r\n const index = this._physicsBodies.indexOf(physicsBody);\r\n if (index > -1) {\r\n /*const removed =*/ this._physicsBodies.splice(index, 1);\r\n }\r\n }\r\n /**\r\n * @returns an array of bodies added to this engine\r\n */\r\n public getBodies(): Array<PhysicsBody> {\r\n return this._physicsBodies;\r\n }\r\n\r\n /**\r\n * Gets the current plugin used to run the simulation\r\n * @returns current plugin\r\n */\r\n public getPhysicsPlugin(): IPhysicsEnginePluginV2 {\r\n return this._physicsPlugin;\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param result resulting PhysicsRaycastResult or array of PhysicsRaycastResults\r\n * @param query raycast query object\r\n * If result is an empty array, it will be populated with every detected raycast hit.\r\n * If result is a populated array, it will only fill the PhysicsRaycastResults present in the array.\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult | Array<PhysicsRaycastResult>, query?: IRaycastQuery): void {\r\n this._physicsPlugin.raycast(from, to, result, query);\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param query raycast query object\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3, query?: IRaycastQuery): PhysicsRaycastResult {\r\n const result = new PhysicsRaycastResult();\r\n this._physicsPlugin.raycast(from, to, result, query);\r\n return result;\r\n }\r\n\r\n /**\r\n * Does a raycast through multiple objects in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param query raycast query object\r\n * @returns array of PhysicsRaycastResult\r\n */\r\n public raycastMulti(from: Vector3, to: Vector3, query?: IRaycastQuery): Array<PhysicsRaycastResult> {\r\n const result: Array<PhysicsRaycastResult> = [];\r\n this._physicsPlugin.raycast(from, to, result, query);\r\n return result;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsEngine.js","sourceRoot":"","sources":["../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AAC,EAAE,CAAC;YACb,mBAAmB,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC;IACL,CAAC;IACD;;OAEG;IACI,SAAS;QACZ,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;;;;OAQG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,MAA0D,EAAE,KAAqB;QAC7H,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,IAAa,EAAE,EAAW,EAAE,KAAqB;QAC5D,MAAM,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,KAAqB;QACjE,MAAM,MAAM,GAAgC,EAAE,CAAC;QAC/C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector.pure\";\r\nimport { type IPhysicsEngine } from \"../IPhysicsEngine\";\r\nimport { type IPhysicsEnginePluginV2 } from \"./IPhysicsEnginePlugin\";\r\nimport { type IRaycastQuery, PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\nimport { type PhysicsBody } from \"./physicsBody\";\r\n\r\n/**\r\n * Class used to control physics engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsEngine implements IPhysicsEngine {\r\n /** @internal */\r\n private _physicsBodies: Array<PhysicsBody> = [];\r\n private _subTimeStep: number = 0;\r\n\r\n /**\r\n * Gets the gravity vector used by the simulation\r\n */\r\n public gravity: Vector3;\r\n\r\n /**\r\n *\r\n * @returns physics plugin version\r\n */\r\n public getPluginVersion(): number {\r\n return this._physicsPlugin.getPluginVersion();\r\n }\r\n // eslint-disable-next-line jsdoc/require-returns-check\r\n /**\r\n * Factory used to create the default physics plugin.\r\n * @returns The default physics plugin\r\n */\r\n public static DefaultPluginFactory(): IPhysicsEnginePluginV2 {\r\n throw _WarnImport(\"\");\r\n }\r\n\r\n /**\r\n * Creates a new Physics Engine\r\n * @param gravity defines the gravity vector used by the simulation\r\n * @param _physicsPlugin defines the plugin to use (CannonJS by default)\r\n */\r\n constructor(\r\n gravity: Nullable<Vector3>,\r\n private _physicsPlugin: IPhysicsEnginePluginV2 = PhysicsEngine.DefaultPluginFactory()\r\n ) {\r\n gravity = gravity || new Vector3(0, -9.807, 0);\r\n this.setGravity(gravity);\r\n this.setTimeStep();\r\n }\r\n\r\n /**\r\n * Sets the gravity vector used by the simulation\r\n * @param gravity defines the gravity vector to use\r\n */\r\n public setGravity(gravity: Vector3): void {\r\n this.gravity = gravity;\r\n this._physicsPlugin.setGravity(this.gravity);\r\n }\r\n\r\n /**\r\n * Set the time step of the physics engine.\r\n * Default is 1/60.\r\n * To slow it down, enter 1/600 for example.\r\n * To speed it up, 1/30\r\n * Unit is seconds.\r\n * @param newTimeStep defines the new timestep to apply to this world.\r\n */\r\n public setTimeStep(newTimeStep: number = 1 / 60) {\r\n this._physicsPlugin.setTimeStep(newTimeStep);\r\n }\r\n\r\n /**\r\n * Get the time step of the physics engine.\r\n * @returns the current time step\r\n */\r\n public getTimeStep(): number {\r\n return this._physicsPlugin.getTimeStep();\r\n }\r\n\r\n /**\r\n * Set the sub time step of the physics engine.\r\n * Default is 0 meaning there is no sub steps\r\n * To increase physics resolution precision, set a small value (like 1 ms)\r\n * @param subTimeStep defines the new sub timestep used for physics resolution.\r\n */\r\n public setSubTimeStep(subTimeStep: number = 0) {\r\n this._subTimeStep = subTimeStep;\r\n }\r\n\r\n /**\r\n * Get the sub time step of the physics engine.\r\n * @returns the current sub time step\r\n */\r\n public getSubTimeStep() {\r\n return this._subTimeStep;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.dispose();\r\n }\r\n\r\n /**\r\n * Gets the name of the current physics plugin\r\n * @returns the name of the plugin\r\n */\r\n public getPhysicsPluginName(): string {\r\n return this._physicsPlugin.name;\r\n }\r\n\r\n /**\r\n * Set the maximum allowed linear and angular velocities\r\n * @param maxLinearVelocity maximum allowed linear velocity\r\n * @param maxAngularVelocity maximum allowed angular velocity\r\n */\r\n setVelocityLimits(maxLinearVelocity: number, maxAngularVelocity: number): void {\r\n this._physicsPlugin.setVelocityLimits(maxLinearVelocity, maxAngularVelocity);\r\n }\r\n\r\n /**\r\n * @returns maximum allowed linear velocity\r\n */\r\n getMaxLinearVelocity(): number {\r\n return this._physicsPlugin.getMaxLinearVelocity();\r\n }\r\n\r\n /**\r\n * @returns maximum allowed angular velocity\r\n */\r\n getMaxAngularVelocity(): number {\r\n return this._physicsPlugin.getMaxAngularVelocity();\r\n }\r\n\r\n /**\r\n * Called by the scene. No need to call it.\r\n * @param delta defines the timespan between frames\r\n */\r\n public _step(delta: number) {\r\n if (delta > 0.1) {\r\n delta = 0.1;\r\n } else if (delta <= 0) {\r\n delta = 1.0 / 60.0;\r\n }\r\n\r\n this._physicsPlugin.executeStep(delta, this._physicsBodies);\r\n }\r\n\r\n /**\r\n * Add a body as an active component of this engine\r\n * @param physicsBody The body to add\r\n */\r\n public addBody(physicsBody: PhysicsBody): void {\r\n this._physicsBodies.push(physicsBody);\r\n }\r\n /**\r\n * Removes a particular body from this engine\r\n * @param physicsBody The body to remove from the simulation\r\n */\r\n public removeBody(physicsBody: PhysicsBody): void {\r\n const index = this._physicsBodies.indexOf(physicsBody);\r\n if (index > -1) {\r\n /*const removed =*/ this._physicsBodies.splice(index, 1);\r\n }\r\n }\r\n /**\r\n * @returns an array of bodies added to this engine\r\n */\r\n public getBodies(): Array<PhysicsBody> {\r\n return this._physicsBodies;\r\n }\r\n\r\n /**\r\n * Gets the current plugin used to run the simulation\r\n * @returns current plugin\r\n */\r\n public getPhysicsPlugin(): IPhysicsEnginePluginV2 {\r\n return this._physicsPlugin;\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param result resulting PhysicsRaycastResult or array of PhysicsRaycastResults\r\n * @param query raycast query object\r\n * If result is an empty array, it will be populated with every detected raycast hit.\r\n * If result is a populated array, it will only fill the PhysicsRaycastResults present in the array.\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult | Array<PhysicsRaycastResult>, query?: IRaycastQuery): void {\r\n this._physicsPlugin.raycast(from, to, result, query);\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param query raycast query object\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3, query?: IRaycastQuery): PhysicsRaycastResult {\r\n const result = new PhysicsRaycastResult();\r\n this._physicsPlugin.raycast(from, to, result, query);\r\n return result;\r\n }\r\n\r\n /**\r\n * Does a raycast through multiple objects in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param query raycast query object\r\n * @returns array of PhysicsRaycastResult\r\n */\r\n public raycastMulti(from: Vector3, to: Vector3, query?: IRaycastQuery): Array<PhysicsRaycastResult> {\r\n const result: Array<PhysicsRaycastResult> = [];\r\n this._physicsPlugin.raycast(from, to, result, query);\r\n return result;\r\n }\r\n}\r\n"]}
@@ -3,7 +3,7 @@ import { type AbstractMesh } from "../../Meshes/abstractMesh.js";
3
3
  import { type BoundingBox } from "../../Culling/boundingBox.js";
4
4
  import { PhysicsShapeType, type PhysicsShapeParameters } from "./IPhysicsEnginePlugin.js";
5
5
  import { type PhysicsMaterial } from "./physicsMaterial.js";
6
- import { Vector3, Quaternion } from "../../Maths/math.vector.js";
6
+ import { Vector3, Quaternion } from "../../Maths/math.vector.pure.js";
7
7
  import { type GroundMesh } from "../../Meshes/groundMesh.js";
8
8
  import { type Mesh } from "../../Meshes/mesh.js";
9
9
  import { type Scene } from "../../scene.js";
@@ -1,4 +1,4 @@
1
- import { Matrix, Vector3, Quaternion, TmpVectors } from "../../Maths/math.vector.js";
1
+ import { Matrix, Vector3, Quaternion, TmpVectors } from "../../Maths/math.vector.pure.js";
2
2
  /**
3
3
  * PhysicsShape class.
4
4
  * This class is useful for creating a physics shape that can be used in a physics engine.
@@ -1 +1 @@
1
- {"version":3,"file":"physicsShape.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsShape.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAwBlF;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAkBrB;;;;;;;;;;;;OAYG;IACH,YAAY,OAA2B,EAAE,KAAY;QA9BrD;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAU5B,eAAU,GAAY,KAAK,CAAC;QAE5B,gBAAW,GAAG,KAAK,CAAC;QAgBxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO;QACX,CAAC;QACD,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,aAAa,CAAC,gBAAgB,EAAE,IAAI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AE,EAAE,EAAE,KAAK,CAAC,CAAC;IACrF,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAC9C;;;;OAIG;IACH,YAAY,IAAU,EAAE,KAAY;QAChC,KAAK,CAAC,EAAE,IAAI,+BAAuB,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,YAAY;IACnD;;;OAGG;IACH,YAAY,KAAY;QACpB,KAAK,CAAC,EAAE,IAAI,oCAA4B,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IACrD;;;;;;;;OAQG;IACH,YAAY,gBAAwB,EAAE,gBAAwB,EAAE,sBAA8B,EAAE,sBAA8B,EAAE,eAA6B,EAAE,KAAY;QACvK,KAAK,CACD;YACI,IAAI,sCAA8B;YAClC,UAAU,EAAE;gBACR,gBAAgB,EAAE,gBAAgB;gBAClC,gBAAgB,EAAE,gBAAgB;gBAClC,sBAAsB,EAAE,sBAAsB;gBAC9C,sBAAsB,EAAE,sBAAsB;gBAC9C,eAAe,EAAE,eAAe;aACnC;SACJ,EACD,KAAK,CACR,CAAC;IACN,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACpD;;;;OAIG;IACH,YAAY,UAAsB,EAAE,KAAY;QAC5C,KAAK,CAAC,EAAE,IAAI,sCAA8B,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACjG,CAAC;CACJ","sourcesContent":["import { type TransformNode } from \"../../Meshes/transformNode\";\r\nimport { type AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { type BoundingBox } from \"../../Culling/boundingBox\";\r\nimport { PhysicsShapeType, type IPhysicsEnginePluginV2, type PhysicsShapeParameters } from \"./IPhysicsEnginePlugin\";\r\nimport { type PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { Matrix, Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector\";\r\nimport { type GroundMesh } from \"../../Meshes/groundMesh\";\r\nimport { type Mesh } from \"../../Meshes/mesh\";\r\nimport { type Scene } from \"../../scene\";\r\n\r\n/**\r\n * Options for creating a physics shape\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicShapeOptions {\r\n /**\r\n * The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n */\r\n type?: PhysicsShapeType;\r\n /**\r\n * The parameters of the shape. Varies depending of the shape type.\r\n */\r\n parameters?: PhysicsShapeParameters;\r\n /**\r\n * Reference to an already existing physics shape in the plugin.\r\n */\r\n pluginData?: any;\r\n}\r\n\r\n/**\r\n * PhysicsShape class.\r\n * This class is useful for creating a physics shape that can be used in a physics engine.\r\n * A Physic Shape determine how collision are computed. It must be attached to a body.\r\n */\r\nexport class PhysicsShape {\r\n /**\r\n * V2 Physics plugin private data for single shape\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n private _type: PhysicsShapeType;\r\n\r\n private _material: PhysicsMaterial;\r\n\r\n private _isTrigger: boolean = false;\r\n\r\n private _isDisposed = false;\r\n\r\n /**\r\n * Constructs a new physics shape.\r\n * @param options The options for the physics shape. These are:\r\n * * type: The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n * * parameters: The parameters of the shape.\r\n * * pluginData: The plugin data of the shape. This is used if you already have a reference to the object on the plugin side.\r\n * You need to specify either type or pluginData.\r\n * @param scene The scene the shape belongs to.\r\n *\r\n * This code is useful for creating a new physics shape with the given type, options, and scene.\r\n * It also checks that the physics engine and plugin version are correct.\r\n * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.\r\n */\r\n constructor(options: PhysicShapeOptions, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n\r\n if (options.pluginData !== undefined && options.pluginData !== null) {\r\n this._pluginData = options.pluginData;\r\n this._type = this._physicsPlugin.getShapeType(this);\r\n } else if (options.type !== undefined && options.type !== null) {\r\n this._type = options.type;\r\n const parameters = options.parameters ?? {};\r\n this._physicsPlugin.initShape(this, options.type, parameters);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the string \"PhysicsShape\".\r\n * @returns \"PhysicsShape\"\r\n */\r\n public getClassName() {\r\n return \"PhysicsShape\";\r\n }\r\n\r\n /**\r\n * Returns the type of the physics shape.\r\n * @returns The type of the physics shape.\r\n */\r\n public get type(): PhysicsShapeType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Set the membership mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which the shape is a member. This is used in combination\r\n * with the collide mask to determine if this shape should collide with\r\n * another.\r\n *\r\n * @param membershipMask Bitfield of categories of this shape.\r\n */\r\n public set filterMembershipMask(membershipMask: number) {\r\n this._physicsPlugin.setShapeFilterMembershipMask(this, membershipMask);\r\n }\r\n\r\n /**\r\n * Get the membership mask of a shape.\r\n * @returns Bitmask of categories which this shape is a member of.\r\n */\r\n public get filterMembershipMask(): number {\r\n return this._physicsPlugin.getShapeFilterMembershipMask(this);\r\n }\r\n\r\n /**\r\n * Sets the collide mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which this shape collides with. Given two shapes,\r\n * the engine will check if the collide mask and membership overlap:\r\n * shapeA.filterMembershipMask & shapeB.filterCollideMask\r\n *\r\n * If this value is zero (i.e. shapeB only collides with categories\r\n * which shapeA is _not_ a member of) then the shapes will not collide.\r\n *\r\n * Note, the engine will also perform the same test with shapeA and\r\n * shapeB swapped; the shapes will not collide if either shape has\r\n * a collideMask which prevents collision with the other shape.\r\n *\r\n * @param collideMask Bitmask of categories this shape should collide with\r\n */\r\n public set filterCollideMask(collideMask: number) {\r\n this._physicsPlugin.setShapeFilterCollideMask(this, collideMask);\r\n }\r\n\r\n /**\r\n *\r\n * @returns Bitmask of categories that this shape should collide with\r\n */\r\n public get filterCollideMask(): number {\r\n return this._physicsPlugin.getShapeFilterCollideMask(this);\r\n }\r\n /**\r\n *\r\n * @param material\r\n */\r\n public set material(material: PhysicsMaterial) {\r\n this._physicsPlugin.setMaterial(this, material);\r\n this._material = material;\r\n }\r\n\r\n /**\r\n * Returns the material of the physics shape.\r\n * @returns The material of the physics shape.\r\n */\r\n public get material(): PhysicsMaterial {\r\n if (!this._material) {\r\n this._material = this._physicsPlugin.getMaterial(this);\r\n }\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Sets the density of the physics shape.\r\n * @param density The density of the physics shape.\r\n */\r\n public set density(density: number) {\r\n this._physicsPlugin.setDensity(this, density);\r\n }\r\n\r\n /**\r\n * Returns the density of the physics shape.\r\n * @returns The density of the physics shape.\r\n */\r\n public get density(): number {\r\n return this._physicsPlugin.getDensity(this);\r\n }\r\n\r\n /**\r\n * Utility to add a child shape to this container,\r\n * automatically computing the relative transform between\r\n * the container shape and the child instance.\r\n *\r\n * @param parentTransform The transform node associated with this shape\r\n * @param newChild The new PhysicsShape to add\r\n * @param childTransform The transform node associated with the child shape\r\n */\r\n public addChildFromParent(parentTransform: TransformNode, newChild: PhysicsShape, childTransform: TransformNode): void {\r\n const childToWorld = childTransform.computeWorldMatrix(true);\r\n const parentToWorld = parentTransform.computeWorldMatrix(true);\r\n const childToParent = TmpVectors.Matrix[0];\r\n childToWorld.multiplyToRef(Matrix.Invert(parentToWorld), childToParent);\r\n const translation = TmpVectors.Vector3[0];\r\n const rotation = TmpVectors.Quaternion[0];\r\n const scale = TmpVectors.Vector3[1];\r\n childToParent.decompose(scale, rotation, translation);\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Adds a child shape to a container with an optional transform\r\n * @param newChild The new PhysicsShape to add\r\n * @param translation Optional position of the child shape relative to this shape\r\n * @param rotation Optional rotation of the child shape relative to this shape\r\n * @param scale Optional scale of the child shape relative to this shape\r\n */\r\n public addChild(newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void {\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Removes a child shape from this shape.\r\n * @param childIndex The index of the child shape to remove\r\n */\r\n public removeChild(childIndex: number): void {\r\n this._physicsPlugin.removeChild(this, childIndex);\r\n }\r\n\r\n /**\r\n * Returns the number of children of a physics shape.\r\n * @returns The number of children of a physics shape.\r\n */\r\n public getNumChildren(): number {\r\n return this._physicsPlugin.getNumChildren(this);\r\n }\r\n\r\n /**\r\n * Returns the bounding box of the physics shape.\r\n * @returns The bounding box of the physics shape.\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBoundingBox(this);\r\n }\r\n\r\n public set isTrigger(isTrigger: boolean) {\r\n if (this._isTrigger === isTrigger) {\r\n return;\r\n }\r\n this._isTrigger = isTrigger;\r\n this._physicsPlugin.setTrigger(this, isTrigger);\r\n }\r\n\r\n public get isTrigger(): boolean {\r\n return this._isTrigger;\r\n }\r\n\r\n /**\r\n * Dispose the shape and release its associated resources.\r\n */\r\n public dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n this._physicsPlugin.disposeShape(this);\r\n this._isDisposed = true;\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a sphere shape\r\n */\r\nexport class PhysicsShapeSphere extends PhysicsShape {\r\n /**\r\n * Constructor for the Sphere Shape\r\n * @param center local center of the sphere\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.SPHERE, parameters: { center: center, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate sphere from the mesh.\r\n * @param mesh node from which to derive the sphere shape\r\n * @returns PhysicsShapeSphere\r\n */\r\n static FromMesh(mesh: AbstractMesh) {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingSphere.center;\r\n const he = bounds.boundingBox.extendSize;\r\n const radius = Math.max(he.x, he.y, he.z);\r\n return new PhysicsShapeSphere(centerLocal, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a capsule shape\r\n */\r\nexport class PhysicsShapeCapsule extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the capsule segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CAPSULE, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate capsule from the mesh. Note, this is\r\n * not the optimal bounding capsule.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Capsule\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCapsule {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y - radius, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCapsule(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a cylinder shape\r\n */\r\nexport class PhysicsShapeCylinder extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the cylinder segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CYLINDER, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate cylinder from the mesh. Note, this is\r\n * not the optimal bounding cylinder.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Cylinder\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCylinder {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCylinder(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a box shape\r\n */\r\nexport class PhysicsShapeBox extends PhysicsShape {\r\n /**\r\n *\r\n * @param center local center of the box\r\n * @param rotation local orientation\r\n * @param extents size of the box in each direction\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene) {\r\n super({ type: PhysicsShapeType.BOX, parameters: { center: center, rotation: rotation, extents: extents } }, scene);\r\n }\r\n\r\n /**\r\n *\r\n * @param mesh\r\n * @returns PhysicsShapeBox\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeBox {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingBox.center;\r\n const extents = bounds.boundingBox.extendSize.scale(2.0); //<todo.eoin extendSize seems to really be half-extents?\r\n return new PhysicsShapeBox(centerLocal, Quaternion.Identity(), extents, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a convex hull shape\r\n */\r\nexport class PhysicsShapeConvexHull extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh to be used as topology infos for the convex hull\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.CONVEX_HULL, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a mesh shape\r\n */\r\nexport class PhysicsShapeMesh extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh topology that will be used to create the shape\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.MESH, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.\r\n */\r\nexport class PhysicsShapeContainer extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape container\r\n * @param scene scene to attach to\r\n */\r\n constructor(scene: Scene) {\r\n super({ type: PhysicsShapeType.CONTAINER, parameters: {} }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a heightfield Shape\r\n */\r\nexport class PhysicsShapeHeightField extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param heightFieldSizeX The size of the heightfield in the X axis\r\n * @param heightFieldSizeZ The size of the heightfield in the Z axis\r\n * @param numHeightFieldSamplesX The number of samples along the X axis\r\n * @param numHeightFieldSamplesZ The number of samples along the Z axis\r\n * @param heightFieldData The data for the heightfield\r\n * @param scene scene to attach to\r\n */\r\n constructor(heightFieldSizeX: number, heightFieldSizeZ: number, numHeightFieldSamplesX: number, numHeightFieldSamplesZ: number, heightFieldData: Float32Array, scene: Scene) {\r\n super(\r\n {\r\n type: PhysicsShapeType.HEIGHTFIELD,\r\n parameters: {\r\n heightFieldSizeX: heightFieldSizeX,\r\n heightFieldSizeZ: heightFieldSizeZ,\r\n numHeightFieldSamplesX: numHeightFieldSamplesX,\r\n numHeightFieldSamplesZ: numHeightFieldSamplesZ,\r\n heightFieldData: heightFieldData,\r\n },\r\n },\r\n scene\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a ground mesh Shape\r\n */\r\nexport class PhysicsShapeGroundMesh extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param groundMesh ground mesh used for display\r\n * @param scene scene to attach to\r\n */\r\n constructor(groundMesh: GroundMesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.HEIGHTFIELD, parameters: { groundMesh: groundMesh } }, scene);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsShape.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsShape.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAwBvF;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAkBrB;;;;;;;;;;;;OAYG;IACH,YAAY,OAA2B,EAAE,KAAY;QA9BrD;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAU5B,eAAU,GAAY,KAAK,CAAC;QAE5B,gBAAW,GAAG,KAAK,CAAC;QAgBxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO;QACX,CAAC;QACD,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,kD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AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,YAAY;IAC9C;;;;OAIG;IACH,YAAY,IAAU,EAAE,KAAY;QAChC,KAAK,CAAC,EAAE,IAAI,+BAAuB,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,YAAY;IACnD;;;OAGG;IACH,YAAY,KAAY;QACpB,KAAK,CAAC,EAAE,IAAI,oCAA4B,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IACrD;;;;;;;;OAQG;IACH,YAAY,gBAAwB,EAAE,gBAAwB,EAAE,sBAA8B,EAAE,sBAA8B,EAAE,eAA6B,EAAE,KAAY;QACvK,KAAK,CACD;YACI,IAAI,sCAA8B;YAClC,UAAU,EAAE;gBACR,gBAAgB,EAAE,gBAAgB;gBAClC,gBAAgB,EAAE,gBAAgB;gBAClC,sBAAsB,EAAE,sBAAsB;gBAC9C,sBAAsB,EAAE,sBAAsB;gBAC9C,eAAe,EAAE,eAAe;aACnC;SACJ,EACD,KAAK,CACR,CAAC;IACN,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACpD;;;;OAIG;IACH,YAAY,UAAsB,EAAE,KAAY;QAC5C,KAAK,CAAC,EAAE,IAAI,sCAA8B,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACjG,CAAC;CACJ","sourcesContent":["import { type TransformNode } from \"../../Meshes/transformNode\";\r\nimport { type AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { type BoundingBox } from \"../../Culling/boundingBox\";\r\nimport { PhysicsShapeType, type IPhysicsEnginePluginV2, type PhysicsShapeParameters } from \"./IPhysicsEnginePlugin\";\r\nimport { type PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { Matrix, Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector.pure\";\r\nimport { type GroundMesh } from \"../../Meshes/groundMesh\";\r\nimport { type Mesh } from \"../../Meshes/mesh\";\r\nimport { type Scene } from \"../../scene\";\r\n\r\n/**\r\n * Options for creating a physics shape\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicShapeOptions {\r\n /**\r\n * The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n */\r\n type?: PhysicsShapeType;\r\n /**\r\n * The parameters of the shape. Varies depending of the shape type.\r\n */\r\n parameters?: PhysicsShapeParameters;\r\n /**\r\n * Reference to an already existing physics shape in the plugin.\r\n */\r\n pluginData?: any;\r\n}\r\n\r\n/**\r\n * PhysicsShape class.\r\n * This class is useful for creating a physics shape that can be used in a physics engine.\r\n * A Physic Shape determine how collision are computed. It must be attached to a body.\r\n */\r\nexport class PhysicsShape {\r\n /**\r\n * V2 Physics plugin private data for single shape\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n private _type: PhysicsShapeType;\r\n\r\n private _material: PhysicsMaterial;\r\n\r\n private _isTrigger: boolean = false;\r\n\r\n private _isDisposed = false;\r\n\r\n /**\r\n * Constructs a new physics shape.\r\n * @param options The options for the physics shape. These are:\r\n * * type: The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n * * parameters: The parameters of the shape.\r\n * * pluginData: The plugin data of the shape. This is used if you already have a reference to the object on the plugin side.\r\n * You need to specify either type or pluginData.\r\n * @param scene The scene the shape belongs to.\r\n *\r\n * This code is useful for creating a new physics shape with the given type, options, and scene.\r\n * It also checks that the physics engine and plugin version are correct.\r\n * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.\r\n */\r\n constructor(options: PhysicShapeOptions, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n\r\n if (options.pluginData !== undefined && options.pluginData !== null) {\r\n this._pluginData = options.pluginData;\r\n this._type = this._physicsPlugin.getShapeType(this);\r\n } else if (options.type !== undefined && options.type !== null) {\r\n this._type = options.type;\r\n const parameters = options.parameters ?? {};\r\n this._physicsPlugin.initShape(this, options.type, parameters);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the string \"PhysicsShape\".\r\n * @returns \"PhysicsShape\"\r\n */\r\n public getClassName() {\r\n return \"PhysicsShape\";\r\n }\r\n\r\n /**\r\n * Returns the type of the physics shape.\r\n * @returns The type of the physics shape.\r\n */\r\n public get type(): PhysicsShapeType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Set the membership mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which the shape is a member. This is used in combination\r\n * with the collide mask to determine if this shape should collide with\r\n * another.\r\n *\r\n * @param membershipMask Bitfield of categories of this shape.\r\n */\r\n public set filterMembershipMask(membershipMask: number) {\r\n this._physicsPlugin.setShapeFilterMembershipMask(this, membershipMask);\r\n }\r\n\r\n /**\r\n * Get the membership mask of a shape.\r\n * @returns Bitmask of categories which this shape is a member of.\r\n */\r\n public get filterMembershipMask(): number {\r\n return this._physicsPlugin.getShapeFilterMembershipMask(this);\r\n }\r\n\r\n /**\r\n * Sets the collide mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which this shape collides with. Given two shapes,\r\n * the engine will check if the collide mask and membership overlap:\r\n * shapeA.filterMembershipMask & shapeB.filterCollideMask\r\n *\r\n * If this value is zero (i.e. shapeB only collides with categories\r\n * which shapeA is _not_ a member of) then the shapes will not collide.\r\n *\r\n * Note, the engine will also perform the same test with shapeA and\r\n * shapeB swapped; the shapes will not collide if either shape has\r\n * a collideMask which prevents collision with the other shape.\r\n *\r\n * @param collideMask Bitmask of categories this shape should collide with\r\n */\r\n public set filterCollideMask(collideMask: number) {\r\n this._physicsPlugin.setShapeFilterCollideMask(this, collideMask);\r\n }\r\n\r\n /**\r\n *\r\n * @returns Bitmask of categories that this shape should collide with\r\n */\r\n public get filterCollideMask(): number {\r\n return this._physicsPlugin.getShapeFilterCollideMask(this);\r\n }\r\n /**\r\n *\r\n * @param material\r\n */\r\n public set material(material: PhysicsMaterial) {\r\n this._physicsPlugin.setMaterial(this, material);\r\n this._material = material;\r\n }\r\n\r\n /**\r\n * Returns the material of the physics shape.\r\n * @returns The material of the physics shape.\r\n */\r\n public get material(): PhysicsMaterial {\r\n if (!this._material) {\r\n this._material = this._physicsPlugin.getMaterial(this);\r\n }\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Sets the density of the physics shape.\r\n * @param density The density of the physics shape.\r\n */\r\n public set density(density: number) {\r\n this._physicsPlugin.setDensity(this, density);\r\n }\r\n\r\n /**\r\n * Returns the density of the physics shape.\r\n * @returns The density of the physics shape.\r\n */\r\n public get density(): number {\r\n return this._physicsPlugin.getDensity(this);\r\n }\r\n\r\n /**\r\n * Utility to add a child shape to this container,\r\n * automatically computing the relative transform between\r\n * the container shape and the child instance.\r\n *\r\n * @param parentTransform The transform node associated with this shape\r\n * @param newChild The new PhysicsShape to add\r\n * @param childTransform The transform node associated with the child shape\r\n */\r\n public addChildFromParent(parentTransform: TransformNode, newChild: PhysicsShape, childTransform: TransformNode): void {\r\n const childToWorld = childTransform.computeWorldMatrix(true);\r\n const parentToWorld = parentTransform.computeWorldMatrix(true);\r\n const childToParent = TmpVectors.Matrix[0];\r\n childToWorld.multiplyToRef(Matrix.Invert(parentToWorld), childToParent);\r\n const translation = TmpVectors.Vector3[0];\r\n const rotation = TmpVectors.Quaternion[0];\r\n const scale = TmpVectors.Vector3[1];\r\n childToParent.decompose(scale, rotation, translation);\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Adds a child shape to a container with an optional transform\r\n * @param newChild The new PhysicsShape to add\r\n * @param translation Optional position of the child shape relative to this shape\r\n * @param rotation Optional rotation of the child shape relative to this shape\r\n * @param scale Optional scale of the child shape relative to this shape\r\n */\r\n public addChild(newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void {\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Removes a child shape from this shape.\r\n * @param childIndex The index of the child shape to remove\r\n */\r\n public removeChild(childIndex: number): void {\r\n this._physicsPlugin.removeChild(this, childIndex);\r\n }\r\n\r\n /**\r\n * Returns the number of children of a physics shape.\r\n * @returns The number of children of a physics shape.\r\n */\r\n public getNumChildren(): number {\r\n return this._physicsPlugin.getNumChildren(this);\r\n }\r\n\r\n /**\r\n * Returns the bounding box of the physics shape.\r\n * @returns The bounding box of the physics shape.\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBoundingBox(this);\r\n }\r\n\r\n public set isTrigger(isTrigger: boolean) {\r\n if (this._isTrigger === isTrigger) {\r\n return;\r\n }\r\n this._isTrigger = isTrigger;\r\n this._physicsPlugin.setTrigger(this, isTrigger);\r\n }\r\n\r\n public get isTrigger(): boolean {\r\n return this._isTrigger;\r\n }\r\n\r\n /**\r\n * Dispose the shape and release its associated resources.\r\n */\r\n public dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n this._physicsPlugin.disposeShape(this);\r\n this._isDisposed = true;\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a sphere shape\r\n */\r\nexport class PhysicsShapeSphere extends PhysicsShape {\r\n /**\r\n * Constructor for the Sphere Shape\r\n * @param center local center of the sphere\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.SPHERE, parameters: { center: center, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate sphere from the mesh.\r\n * @param mesh node from which to derive the sphere shape\r\n * @returns PhysicsShapeSphere\r\n */\r\n static FromMesh(mesh: AbstractMesh) {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingSphere.center;\r\n const he = bounds.boundingBox.extendSize;\r\n const radius = Math.max(he.x, he.y, he.z);\r\n return new PhysicsShapeSphere(centerLocal, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a capsule shape\r\n */\r\nexport class PhysicsShapeCapsule extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the capsule segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CAPSULE, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate capsule from the mesh. Note, this is\r\n * not the optimal bounding capsule.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Capsule\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCapsule {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y - radius, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCapsule(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a cylinder shape\r\n */\r\nexport class PhysicsShapeCylinder extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the cylinder segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CYLINDER, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate cylinder from the mesh. Note, this is\r\n * not the optimal bounding cylinder.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Cylinder\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCylinder {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCylinder(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a box shape\r\n */\r\nexport class PhysicsShapeBox extends PhysicsShape {\r\n /**\r\n *\r\n * @param center local center of the box\r\n * @param rotation local orientation\r\n * @param extents size of the box in each direction\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene) {\r\n super({ type: PhysicsShapeType.BOX, parameters: { center: center, rotation: rotation, extents: extents } }, scene);\r\n }\r\n\r\n /**\r\n *\r\n * @param mesh\r\n * @returns PhysicsShapeBox\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeBox {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingBox.center;\r\n const extents = bounds.boundingBox.extendSize.scale(2.0); //<todo.eoin extendSize seems to really be half-extents?\r\n return new PhysicsShapeBox(centerLocal, Quaternion.Identity(), extents, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a convex hull shape\r\n */\r\nexport class PhysicsShapeConvexHull extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh to be used as topology infos for the convex hull\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.CONVEX_HULL, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a mesh shape\r\n */\r\nexport class PhysicsShapeMesh extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh topology that will be used to create the shape\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.MESH, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.\r\n */\r\nexport class PhysicsShapeContainer extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape container\r\n * @param scene scene to attach to\r\n */\r\n constructor(scene: Scene) {\r\n super({ type: PhysicsShapeType.CONTAINER, parameters: {} }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a heightfield Shape\r\n */\r\nexport class PhysicsShapeHeightField extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param heightFieldSizeX The size of the heightfield in the X axis\r\n * @param heightFieldSizeZ The size of the heightfield in the Z axis\r\n * @param numHeightFieldSamplesX The number of samples along the X axis\r\n * @param numHeightFieldSamplesZ The number of samples along the Z axis\r\n * @param heightFieldData The data for the heightfield\r\n * @param scene scene to attach to\r\n */\r\n constructor(heightFieldSizeX: number, heightFieldSizeZ: number, numHeightFieldSamplesX: number, numHeightFieldSamplesZ: number, heightFieldData: Float32Array, scene: Scene) {\r\n super(\r\n {\r\n type: PhysicsShapeType.HEIGHTFIELD,\r\n parameters: {\r\n heightFieldSizeX: heightFieldSizeX,\r\n heightFieldSizeZ: heightFieldSizeZ,\r\n numHeightFieldSamplesX: numHeightFieldSamplesX,\r\n numHeightFieldSamplesZ: numHeightFieldSamplesZ,\r\n heightFieldData: heightFieldData,\r\n },\r\n },\r\n scene\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a ground mesh Shape\r\n */\r\nexport class PhysicsShapeGroundMesh extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param groundMesh ground mesh used for display\r\n * @param scene scene to attach to\r\n */\r\n constructor(groundMesh: GroundMesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.HEIGHTFIELD, parameters: { groundMesh: groundMesh } }, scene);\r\n }\r\n}\r\n"]}