@babylonjs/core 5.45.2 → 5.46.0

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 (525) hide show
  1. package/Actions/condition.js +23 -23
  2. package/Actions/condition.js.map +1 -1
  3. package/Animations/animatable.js +48 -48
  4. package/Animations/animatable.js.map +1 -1
  5. package/Animations/animation.js +53 -53
  6. package/Animations/animation.js.map +1 -1
  7. package/Animations/animationGroup.js +53 -53
  8. package/Animations/animationGroup.js.map +1 -1
  9. package/Animations/runtimeAnimation.js +36 -36
  10. package/Animations/runtimeAnimation.js.map +1 -1
  11. package/Audio/audioEngine.js +14 -14
  12. package/Audio/audioEngine.js.map +1 -1
  13. package/Audio/audioSceneComponent.js +14 -14
  14. package/Audio/audioSceneComponent.js.map +1 -1
  15. package/Audio/sound.js +47 -47
  16. package/Audio/sound.js.map +1 -1
  17. package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +1 -1
  18. package/Behaviors/Meshes/fadeInOutBehavior.js +11 -11
  19. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  20. package/Behaviors/Meshes/pointerDragBehavior.js +34 -34
  21. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  22. package/Bones/bone.js +15 -15
  23. package/Bones/bone.js.map +1 -1
  24. package/Bones/boneIKController.js +9 -9
  25. package/Bones/boneIKController.js.map +1 -1
  26. package/Bones/boneLookController.js +50 -50
  27. package/Bones/boneLookController.js.map +1 -1
  28. package/Bones/skeleton.js +35 -35
  29. package/Bones/skeleton.js.map +1 -1
  30. package/Buffers/buffer.js +14 -14
  31. package/Buffers/buffer.js.map +1 -1
  32. package/Buffers/dataBuffer.js +6 -6
  33. package/Buffers/dataBuffer.js.map +1 -1
  34. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +42 -42
  35. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
  36. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +18 -18
  37. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  38. package/Cameras/VR/vrExperienceHelper.js +178 -178
  39. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  40. package/Cameras/arcRotateCamera.js +176 -176
  41. package/Cameras/arcRotateCamera.js.map +1 -1
  42. package/Cameras/camera.js +90 -90
  43. package/Cameras/camera.js.map +1 -1
  44. package/Cameras/flyCamera.js +82 -82
  45. package/Cameras/flyCamera.js.map +1 -1
  46. package/Cameras/freeCamera.js +54 -54
  47. package/Cameras/freeCamera.js.map +1 -1
  48. package/Compute/computeShader.js +12 -12
  49. package/Compute/computeShader.js.map +1 -1
  50. package/Culling/ray.d.ts +1 -1
  51. package/Debug/axesViewer.js +12 -12
  52. package/Debug/axesViewer.js.map +1 -1
  53. package/Debug/debugLayer.js +21 -21
  54. package/Debug/debugLayer.js.map +1 -1
  55. package/Debug/directionalLightFrustumViewer.js +20 -20
  56. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  57. package/Debug/rayHelper.js +10 -10
  58. package/Debug/rayHelper.js.map +1 -1
  59. package/Debug/skeletonViewer.js +81 -81
  60. package/Debug/skeletonViewer.js.map +1 -1
  61. package/DeviceInput/InputDevices/deviceSource.d.ts +1 -1
  62. package/DeviceInput/InputDevices/deviceSourceManager.js +31 -31
  63. package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
  64. package/DeviceInput/InputDevices/deviceTypes.d.ts +1 -1
  65. package/DeviceInput/internalDeviceSourceManager.d.ts +2 -2
  66. package/Engines/Extensions/engine.computeShader.d.ts +3 -3
  67. package/Engines/Extensions/engine.multiRender.js +1 -1
  68. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  69. package/Engines/Extensions/engine.query.d.ts +1 -1
  70. package/Engines/Extensions/engine.renderTarget.d.ts +1 -1
  71. package/Engines/Extensions/engine.renderTarget.js +1 -1
  72. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  73. package/Engines/Native/nativeDataStream.d.ts +1 -1
  74. package/Engines/Native/nativeHardwareTexture.js +3 -3
  75. package/Engines/Native/nativeHardwareTexture.js.map +1 -1
  76. package/Engines/Native/nativeInterfaces.d.ts +5 -5
  77. package/Engines/Native/nativePipelineContext.js +7 -7
  78. package/Engines/Native/nativePipelineContext.js.map +1 -1
  79. package/Engines/Native/nativeRenderTargetWrapper.js +6 -6
  80. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  81. package/Engines/Processors/shaderCodeInliner.js +4 -4
  82. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  83. package/Engines/Processors/shaderProcessingOptions.d.ts +1 -1
  84. package/Engines/WebGL/webGLHardwareTexture.js +3 -3
  85. package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
  86. package/Engines/WebGPU/webgpuBufferManager.js +3 -3
  87. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  88. package/Engines/WebGPU/webgpuCacheBindGroups.js +6 -6
  89. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  90. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +5 -5
  91. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  92. package/Engines/WebGPU/webgpuClearQuad.js +11 -11
  93. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  94. package/Engines/WebGPU/webgpuComputeContext.js +7 -7
  95. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  96. package/Engines/WebGPU/webgpuComputePipelineContext.js +4 -4
  97. package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
  98. package/Engines/WebGPU/webgpuDrawContext.js +7 -7
  99. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  100. package/Engines/WebGPU/webgpuHardwareTexture.js +9 -9
  101. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  102. package/Engines/WebGPU/webgpuMaterialContext.js +5 -5
  103. package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
  104. package/Engines/WebGPU/webgpuOcclusionQuery.js +10 -10
  105. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  106. package/Engines/WebGPU/webgpuPipelineContext.js +6 -6
  107. package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
  108. package/Engines/WebGPU/webgpuQuerySet.js +3 -3
  109. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  110. package/Engines/WebGPU/webgpuShaderProcessingContext.js +3 -3
  111. package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
  112. package/Engines/WebGPU/webgpuTextureHelper.js +3 -3
  113. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  114. package/Engines/WebGPU/webgpuTimestampQuery.js +3 -3
  115. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  116. package/Engines/engine.js +134 -134
  117. package/Engines/engine.js.map +1 -1
  118. package/Engines/nativeEngine.js +6 -6
  119. package/Engines/nativeEngine.js.map +1 -1
  120. package/Engines/nullEngine.js +25 -25
  121. package/Engines/nullEngine.js.map +1 -1
  122. package/Engines/renderTargetWrapper.js +25 -25
  123. package/Engines/renderTargetWrapper.js.map +1 -1
  124. package/Engines/thinEngine.js +243 -243
  125. package/Engines/thinEngine.js.map +1 -1
  126. package/Engines/webgpuEngine.js +132 -132
  127. package/Engines/webgpuEngine.js.map +1 -1
  128. package/Events/keyboardEvents.js +10 -10
  129. package/Events/keyboardEvents.js.map +1 -1
  130. package/Events/pointerEvents.js +9 -9
  131. package/Events/pointerEvents.js.map +1 -1
  132. package/Gamepads/Controllers/poseEnabledController.js +9 -9
  133. package/Gamepads/Controllers/poseEnabledController.js.map +1 -1
  134. package/Gamepads/Controllers/webVRController.js +13 -13
  135. package/Gamepads/Controllers/webVRController.js.map +1 -1
  136. package/Gamepads/gamepad.js +20 -20
  137. package/Gamepads/gamepad.js.map +1 -1
  138. package/Gizmos/axisDragGizmo.js +45 -45
  139. package/Gizmos/axisDragGizmo.js.map +1 -1
  140. package/Gizmos/axisScaleGizmo.js +12 -12
  141. package/Gizmos/axisScaleGizmo.js.map +1 -1
  142. package/Gizmos/boundingBoxGizmo.js +74 -74
  143. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  144. package/Gizmos/gizmo.js +34 -34
  145. package/Gizmos/gizmo.js.map +1 -1
  146. package/Gizmos/gizmoManager.js +40 -40
  147. package/Gizmos/gizmoManager.js.map +1 -1
  148. package/Gizmos/planeDragGizmo.js +23 -23
  149. package/Gizmos/planeDragGizmo.js.map +1 -1
  150. package/Gizmos/planeRotationGizmo.js +12 -12
  151. package/Gizmos/planeRotationGizmo.js.map +1 -1
  152. package/Gizmos/positionGizmo.js +40 -40
  153. package/Gizmos/positionGizmo.js.map +1 -1
  154. package/Gizmos/rotationGizmo.js +47 -47
  155. package/Gizmos/rotationGizmo.js.map +1 -1
  156. package/Gizmos/scaleGizmo.js +41 -41
  157. package/Gizmos/scaleGizmo.js.map +1 -1
  158. package/Helpers/environmentHelper.js +18 -18
  159. package/Helpers/environmentHelper.js.map +1 -1
  160. package/Helpers/textureDome.js +96 -96
  161. package/Helpers/textureDome.js.map +1 -1
  162. package/IAccessibilityTag.d.ts +2 -2
  163. package/Instrumentation/engineInstrumentation.js +21 -21
  164. package/Instrumentation/engineInstrumentation.js.map +1 -1
  165. package/Instrumentation/sceneInstrumentation.js +90 -90
  166. package/Instrumentation/sceneInstrumentation.js.map +1 -1
  167. package/Layers/effectLayer.js +48 -48
  168. package/Layers/effectLayer.js.map +1 -1
  169. package/Layers/glowLayer.js +32 -32
  170. package/Layers/glowLayer.js.map +1 -1
  171. package/Layers/highlightLayer.js +26 -26
  172. package/Layers/highlightLayer.js.map +1 -1
  173. package/Layers/layer.js +40 -40
  174. package/Layers/layer.js.map +1 -1
  175. package/LensFlares/lensFlare.js +15 -15
  176. package/LensFlares/lensFlare.js.map +1 -1
  177. package/LensFlares/lensFlareSystem.js +4 -4
  178. package/LensFlares/lensFlareSystem.js.map +1 -1
  179. package/Lights/Shadows/cascadedShadowGenerator.js +18 -18
  180. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  181. package/Lights/Shadows/shadowGenerator.js +115 -115
  182. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  183. package/Lights/directionalLight.js +31 -31
  184. package/Lights/directionalLight.js.map +1 -1
  185. package/Lights/light.js +72 -72
  186. package/Lights/light.js.map +1 -1
  187. package/Lights/pointLight.js +18 -18
  188. package/Lights/pointLight.js.map +1 -1
  189. package/Lights/spotLight.js +30 -30
  190. package/Lights/spotLight.js.map +1 -1
  191. package/Loading/sceneLoader.d.ts +1 -1
  192. package/Materials/Background/backgroundMaterial.js +124 -124
  193. package/Materials/Background/backgroundMaterial.js.map +1 -1
  194. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +8 -8
  195. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  196. package/Materials/Node/Blocks/Dual/lightBlock.js +14 -14
  197. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  198. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +9 -9
  199. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  200. package/Materials/Node/Blocks/Dual/textureBlock.js +26 -26
  201. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  202. package/Materials/Node/Blocks/Input/inputBlock.js +34 -34
  203. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  204. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +14 -14
  205. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  206. package/Materials/Node/Blocks/PBR/reflectionBlock.js +16 -16
  207. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  208. package/Materials/Node/Blocks/customBlock.js +7 -7
  209. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  210. package/Materials/Node/Blocks/gradientBlock.js +13 -13
  211. package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
  212. package/Materials/Node/Blocks/triPlanarBlock.js +30 -30
  213. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  214. package/Materials/Node/nodeMaterial.d.ts +1 -1
  215. package/Materials/Node/nodeMaterial.js +60 -60
  216. package/Materials/Node/nodeMaterial.js.map +1 -1
  217. package/Materials/Node/nodeMaterialBlock.js +35 -35
  218. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  219. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +50 -50
  220. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  221. package/Materials/PBR/pbrAnisotropicConfiguration.js +5 -5
  222. package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
  223. package/Materials/PBR/pbrBRDFConfiguration.js +4 -4
  224. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  225. package/Materials/PBR/pbrBaseMaterial.js +52 -52
  226. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  227. package/Materials/PBR/pbrBaseSimpleMaterial.js +17 -17
  228. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  229. package/Materials/PBR/pbrClearCoatConfiguration.js +5 -5
  230. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  231. package/Materials/PBR/pbrIridescenceConfiguration.js +5 -5
  232. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  233. package/Materials/PBR/pbrMaterial.js +209 -209
  234. package/Materials/PBR/pbrMaterial.js.map +1 -1
  235. package/Materials/PBR/pbrSheenConfiguration.js +5 -5
  236. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  237. package/Materials/PBR/pbrSpecularGlossinessMaterial.js +6 -6
  238. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  239. package/Materials/PBR/pbrSubSurfaceConfiguration.js +51 -51
  240. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  241. package/Materials/Textures/baseTexture.js +99 -99
  242. package/Materials/Textures/baseTexture.js.map +1 -1
  243. package/Materials/Textures/cubeTexture.js +61 -61
  244. package/Materials/Textures/cubeTexture.js.map +1 -1
  245. package/Materials/Textures/externalTexture.js +16 -16
  246. package/Materials/Textures/externalTexture.js.map +1 -1
  247. package/Materials/Textures/hdrCubeTexture.js +44 -44
  248. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  249. package/Materials/Textures/internalTexture.js +31 -31
  250. package/Materials/Textures/internalTexture.js.map +1 -1
  251. package/Materials/Textures/mirrorTexture.js +73 -73
  252. package/Materials/Textures/mirrorTexture.js.map +1 -1
  253. package/Materials/Textures/multiRenderTarget.js +47 -47
  254. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  255. package/Materials/Textures/rawTexture2DArray.js +6 -6
  256. package/Materials/Textures/rawTexture2DArray.js.map +1 -1
  257. package/Materials/Textures/renderTargetTexture.js +142 -142
  258. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  259. package/Materials/Textures/texture.d.ts +1 -1
  260. package/Materials/Textures/texture.js +26 -26
  261. package/Materials/Textures/texture.js.map +1 -1
  262. package/Materials/Textures/textureCreationOptions.d.ts +1 -1
  263. package/Materials/Textures/textureSampler.js +20 -20
  264. package/Materials/Textures/textureSampler.js.map +1 -1
  265. package/Materials/Textures/thinRenderTargetTexture.js +6 -6
  266. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  267. package/Materials/Textures/thinTexture.js +39 -39
  268. package/Materials/Textures/thinTexture.js.map +1 -1
  269. package/Materials/Textures/videoTexture.js +40 -40
  270. package/Materials/Textures/videoTexture.js.map +1 -1
  271. package/Materials/drawWrapper.js +6 -6
  272. package/Materials/drawWrapper.js.map +1 -1
  273. package/Materials/effect.js +18 -18
  274. package/Materials/effect.js.map +1 -1
  275. package/Materials/effectRenderer.js +9 -9
  276. package/Materials/effectRenderer.js.map +1 -1
  277. package/Materials/fresnelParameters.d.ts +2 -2
  278. package/Materials/fresnelParameters.js +13 -13
  279. package/Materials/fresnelParameters.js.map +1 -1
  280. package/Materials/material.detailMapConfiguration.js +5 -5
  281. package/Materials/material.detailMapConfiguration.js.map +1 -1
  282. package/Materials/material.js +223 -223
  283. package/Materials/material.js.map +1 -1
  284. package/Materials/materialPluginBase.js +5 -5
  285. package/Materials/materialPluginBase.js.map +1 -1
  286. package/Materials/materialPluginEvent.d.ts +14 -14
  287. package/Materials/materialPluginManager.d.ts +1 -1
  288. package/Materials/multiMaterial.js +16 -16
  289. package/Materials/multiMaterial.js.map +1 -1
  290. package/Materials/shadowDepthWrapper.js +14 -14
  291. package/Materials/shadowDepthWrapper.js.map +1 -1
  292. package/Materials/standardMaterial.js +100 -100
  293. package/Materials/standardMaterial.js.map +1 -1
  294. package/Materials/uniformBufferEffectCommonAccessor.js +3 -3
  295. package/Materials/uniformBufferEffectCommonAccessor.js.map +1 -1
  296. package/Maths/math.functions.js +2 -0
  297. package/Maths/math.functions.js.map +1 -1
  298. package/Maths/math.path.js +11 -11
  299. package/Maths/math.path.js.map +1 -1
  300. package/Maths/math.vector.d.ts +6 -7
  301. package/Maths/math.vector.js +48 -48
  302. package/Maths/math.vector.js.map +1 -1
  303. package/Meshes/Builders/goldbergBuilder.d.ts +2 -2
  304. package/Meshes/Compression/dracoCompression.js +23 -23
  305. package/Meshes/Compression/dracoCompression.js.map +1 -1
  306. package/Meshes/Compression/meshoptCompression.js +9 -9
  307. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  308. package/Meshes/abstractMesh.js +179 -179
  309. package/Meshes/abstractMesh.js.map +1 -1
  310. package/Meshes/geometry.js +32 -32
  311. package/Meshes/geometry.js.map +1 -1
  312. package/Meshes/goldbergMesh.d.ts +1 -1
  313. package/Meshes/linesMesh.js +3 -3
  314. package/Meshes/linesMesh.js.map +1 -1
  315. package/Meshes/mesh.js +165 -165
  316. package/Meshes/mesh.js.map +1 -1
  317. package/Meshes/mesh.vertexData.js.map +1 -1
  318. package/Meshes/polygonMesh.js +5 -5
  319. package/Meshes/polygonMesh.js.map +1 -1
  320. package/Meshes/subMesh.js +59 -59
  321. package/Meshes/subMesh.js.map +1 -1
  322. package/Meshes/transformNode.js +52 -52
  323. package/Meshes/transformNode.js.map +1 -1
  324. package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.d.ts +1 -1
  325. package/Misc/PerformanceViewer/performanceViewerCollector.js +12 -12
  326. package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
  327. package/Misc/arrayTools.d.ts +1 -1
  328. package/Misc/copyTextureToTexture.js +3 -3
  329. package/Misc/copyTextureToTexture.js.map +1 -1
  330. package/Misc/coroutine.d.ts +5 -5
  331. package/Misc/deferred.js +9 -9
  332. package/Misc/deferred.js.map +1 -1
  333. package/Misc/depthReducer.js +7 -7
  334. package/Misc/depthReducer.js.map +1 -1
  335. package/Misc/environmentTextureTools.d.ts +1 -1
  336. package/Misc/error.d.ts +1 -1
  337. package/Misc/fileTools.d.ts +5 -5
  338. package/Misc/filesInput.js +6 -6
  339. package/Misc/filesInput.js.map +1 -1
  340. package/Misc/khronosTextureContainer2.js +9 -9
  341. package/Misc/khronosTextureContainer2.js.map +1 -1
  342. package/Misc/observable.js +12 -12
  343. package/Misc/observable.js.map +1 -1
  344. package/Misc/perfCounter.js +16 -16
  345. package/Misc/perfCounter.js.map +1 -1
  346. package/Misc/sceneOptimizer.js +76 -76
  347. package/Misc/sceneOptimizer.js.map +1 -1
  348. package/Misc/stringDictionary.d.ts +1 -1
  349. package/Misc/trajectoryClassifier.js +67 -67
  350. package/Misc/trajectoryClassifier.js.map +1 -1
  351. package/Misc/videoRecorder.js +15 -15
  352. package/Misc/videoRecorder.js.map +1 -1
  353. package/Misc/virtualJoystick.js +12 -12
  354. package/Misc/virtualJoystick.js.map +1 -1
  355. package/Morph/morphTarget.js +28 -28
  356. package/Morph/morphTarget.js.map +1 -1
  357. package/Morph/morphTargetManager.js +18 -18
  358. package/Morph/morphTargetManager.js.map +1 -1
  359. package/Offline/database.js +12 -12
  360. package/Offline/database.js.map +1 -1
  361. package/Particles/EmitterTypes/coneParticleEmitter.js +25 -25
  362. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  363. package/Particles/EmitterTypes/meshParticleEmitter.js +20 -20
  364. package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
  365. package/Particles/baseParticleSystem.js +232 -232
  366. package/Particles/baseParticleSystem.js.map +1 -1
  367. package/Particles/cloudPoint.js +9 -9
  368. package/Particles/cloudPoint.js.map +1 -1
  369. package/Particles/gpuParticleSystem.js +123 -123
  370. package/Particles/gpuParticleSystem.js.map +1 -1
  371. package/Particles/particleSystem.js +102 -102
  372. package/Particles/particleSystem.js.map +1 -1
  373. package/Particles/pointsCloudSystem.js +18 -18
  374. package/Particles/pointsCloudSystem.js.map +1 -1
  375. package/Particles/solidParticle.js +23 -23
  376. package/Particles/solidParticle.js.map +1 -1
  377. package/Physics/v1/physicsEngine.js +14 -14
  378. package/Physics/v1/physicsEngine.js.map +1 -1
  379. package/Physics/v1/physicsImpostor.js +149 -149
  380. package/Physics/v1/physicsImpostor.js.map +1 -1
  381. package/Physics/v2/physicsEngine.js +14 -14
  382. package/Physics/v2/physicsEngine.js.map +1 -1
  383. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +129 -129
  384. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  385. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +68 -68
  386. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  387. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +6 -6
  388. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  389. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +226 -225
  390. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  391. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +10 -10
  392. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  393. package/PostProcesses/anaglyphPostProcess.js +7 -7
  394. package/PostProcesses/anaglyphPostProcess.js.map +1 -1
  395. package/PostProcesses/blackAndWhitePostProcess.js +7 -7
  396. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  397. package/PostProcesses/bloomEffect.js +28 -28
  398. package/PostProcesses/bloomEffect.js.map +1 -1
  399. package/PostProcesses/bloomMergePostProcess.js +7 -7
  400. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  401. package/PostProcesses/blurPostProcess.js +32 -32
  402. package/PostProcesses/blurPostProcess.js.map +1 -1
  403. package/PostProcesses/chromaticAberrationPostProcess.js +7 -7
  404. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  405. package/PostProcesses/circleOfConfusionPostProcess.js +7 -7
  406. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  407. package/PostProcesses/colorCorrectionPostProcess.js +7 -7
  408. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  409. package/PostProcesses/convolutionPostProcess.js +7 -7
  410. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  411. package/PostProcesses/depthOfFieldBlurPostProcess.js +7 -7
  412. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  413. package/PostProcesses/depthOfFieldEffect.js +36 -36
  414. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  415. package/PostProcesses/depthOfFieldMergePostProcess.js +7 -7
  416. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  417. package/PostProcesses/extractHighlightsPostProcess.js +7 -7
  418. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  419. package/PostProcesses/filterPostProcess.js +7 -7
  420. package/PostProcesses/filterPostProcess.js.map +1 -1
  421. package/PostProcesses/grainPostProcess.js +7 -7
  422. package/PostProcesses/grainPostProcess.js.map +1 -1
  423. package/PostProcesses/imageProcessingPostProcess.js +42 -42
  424. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  425. package/PostProcesses/motionBlurPostProcess.js +41 -41
  426. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  427. package/PostProcesses/passPostProcess.js +15 -15
  428. package/PostProcesses/passPostProcess.js.map +1 -1
  429. package/PostProcesses/postProcess.d.ts +2 -2
  430. package/PostProcesses/postProcess.js +123 -123
  431. package/PostProcesses/postProcess.js.map +1 -1
  432. package/PostProcesses/refractionPostProcess.js +21 -21
  433. package/PostProcesses/refractionPostProcess.js.map +1 -1
  434. package/PostProcesses/screenSpaceCurvaturePostProcess.js +7 -7
  435. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  436. package/PostProcesses/screenSpaceReflectionPostProcess.js +19 -19
  437. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  438. package/PostProcesses/sharpenPostProcess.js +7 -7
  439. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  440. package/PostProcesses/stereoscopicInterlacePostProcess.js +14 -14
  441. package/PostProcesses/stereoscopicInterlacePostProcess.js.map +1 -1
  442. package/PostProcesses/tonemapPostProcess.js +7 -7
  443. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  444. package/PostProcesses/volumetricLightScatteringPostProcess.js +11 -11
  445. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  446. package/PostProcesses/vrDistortionCorrectionPostProcess.js +7 -7
  447. package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
  448. package/Rendering/depthPeelingRenderer.js +36 -36
  449. package/Rendering/depthPeelingRenderer.js.map +1 -1
  450. package/Rendering/depthRenderer.js +8 -8
  451. package/Rendering/depthRenderer.js.map +1 -1
  452. package/Rendering/edgesRenderer.js +34 -34
  453. package/Rendering/edgesRenderer.js.map +1 -1
  454. package/Rendering/fluidRenderer/fluidRenderer.js +8 -8
  455. package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
  456. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +3 -3
  457. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
  458. package/Rendering/fluidRenderer/fluidRenderingObject.js +19 -19
  459. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  460. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +12 -12
  461. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  462. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +18 -18
  463. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  464. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +68 -68
  465. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  466. package/Rendering/fluidRenderer/fluidRenderingTextures.js +29 -29
  467. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
  468. package/Rendering/geometryBufferRenderer.js +44 -44
  469. package/Rendering/geometryBufferRenderer.js.map +1 -1
  470. package/Rendering/prePassRenderer.js +51 -51
  471. package/Rendering/prePassRenderer.js.map +1 -1
  472. package/Rendering/renderingGroup.js +25 -25
  473. package/Rendering/renderingGroup.js.map +1 -1
  474. package/Rendering/renderingManager.js +21 -21
  475. package/Rendering/renderingManager.js.map +1 -1
  476. package/Rendering/subSurfaceConfiguration.js +18 -18
  477. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  478. package/Rendering/utilityLayerRenderer.js +76 -76
  479. package/Rendering/utilityLayerRenderer.js.map +1 -1
  480. package/Sprites/sprite.js +16 -16
  481. package/Sprites/sprite.js.map +1 -1
  482. package/Sprites/spriteManager.js +81 -81
  483. package/Sprites/spriteManager.js.map +1 -1
  484. package/Sprites/spriteMap.js +32 -32
  485. package/Sprites/spriteMap.js.map +1 -1
  486. package/Sprites/spriteRenderer.js +6 -6
  487. package/Sprites/spriteRenderer.js.map +1 -1
  488. package/Sprites/thinSprite.js +22 -22
  489. package/Sprites/thinSprite.js.map +1 -1
  490. package/States/stencilStateComposer.js +10 -10
  491. package/States/stencilStateComposer.js.map +1 -1
  492. package/XR/features/WebXRAnchorSystem.js +7 -7
  493. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  494. package/XR/features/WebXRControllerMovement.d.ts +3 -3
  495. package/XR/features/WebXRControllerMovement.js +97 -97
  496. package/XR/features/WebXRControllerMovement.js.map +1 -1
  497. package/XR/features/WebXRControllerPhysics.js +24 -24
  498. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  499. package/XR/features/WebXRControllerTeleportation.js +26 -26
  500. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  501. package/XR/features/WebXRDOMOverlay.d.ts +1 -1
  502. package/XR/features/WebXRFeaturePointSystem.js +6 -6
  503. package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
  504. package/XR/features/WebXRHandTracking.d.ts +1 -1
  505. package/XR/features/WebXRHandTracking.js +95 -95
  506. package/XR/features/WebXRHandTracking.js.map +1 -1
  507. package/XR/features/WebXRWalkingLocomotion.js +21 -21
  508. package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
  509. package/XR/motionController/webXRAbstractMotionController.d.ts +3 -3
  510. package/XR/motionController/webXRMotionControllerManager.d.ts +1 -1
  511. package/XR/native/nativeXRFrame.js +3 -3
  512. package/XR/native/nativeXRFrame.js.map +1 -1
  513. package/XR/webXRFeaturesManager.d.ts +1 -1
  514. package/XR/webXRLayerWrapper.d.ts +2 -2
  515. package/XR/webXRLayerWrapper.js +17 -17
  516. package/XR/webXRLayerWrapper.js.map +1 -1
  517. package/abstractScene.d.ts +2 -2
  518. package/node.d.ts +1 -1
  519. package/node.js +71 -71
  520. package/node.js.map +1 -1
  521. package/package.json +1 -1
  522. package/scene.js +777 -777
  523. package/scene.js.map +1 -1
  524. package/sceneComponent.d.ts +12 -12
  525. package/types.d.ts +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"solidParticle.js","sourceRoot":"","sources":["../../../../lts/core/generated/Particles/solidParticle.ts"],"names":[],"mappings":"AAEA,OAAO,EAA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AAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;IACD,0BAA0B;IAC1B,IAAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Matrix } from \"../Maths/math.vector\";\r\nimport { Vector3, TmpVectors, Quaternion, Vector4, Vector2 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { BoundingSphere } from \"../Culling/boundingSphere\";\r\nimport type { SolidParticleSystem } from \"./solidParticleSystem\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Plane } from \"../Maths/math.plane\";\r\nimport type { Material } from \"../Materials/material\";\r\n/**\r\n * Represents one particle of a solid particle system.\r\n */\r\nexport class SolidParticle {\r\n /**\r\n * particle global index\r\n */\r\n public idx: number = 0;\r\n /**\r\n * particle identifier\r\n */\r\n public id: number = 0;\r\n /**\r\n * The color of the particle\r\n */\r\n public color: Nullable<Color4> = new Color4(1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * The world space position of the particle.\r\n */\r\n public position: Vector3 = Vector3.Zero();\r\n /**\r\n * The world space rotation of the particle. (Not use if rotationQuaternion is set)\r\n */\r\n public rotation: Vector3 = Vector3.Zero();\r\n /**\r\n * The world space rotation quaternion of the particle.\r\n */\r\n public rotationQuaternion: Nullable<Quaternion>;\r\n /**\r\n * The scaling of the particle.\r\n */\r\n public scaling: Vector3 = Vector3.One();\r\n /**\r\n * The uvs of the particle.\r\n */\r\n public uvs: Vector4 = new Vector4(0.0, 0.0, 1.0, 1.0);\r\n /**\r\n * The current speed of the particle.\r\n */\r\n public velocity: Vector3 = Vector3.Zero();\r\n /**\r\n * The pivot point in the particle local space.\r\n */\r\n public pivot: Vector3 = Vector3.Zero();\r\n /**\r\n * Must the particle be translated from its pivot point in its local space ?\r\n * In this case, the pivot point is set at the origin of the particle local space and the particle is translated.\r\n * Default : false\r\n */\r\n public translateFromPivot: boolean = false;\r\n /**\r\n * Is the particle active or not ?\r\n */\r\n public alive: boolean = true;\r\n /**\r\n * Is the particle visible or not ?\r\n */\r\n public isVisible: boolean = true;\r\n /**\r\n * Index of this particle in the global \"positions\" array (Internal use)\r\n * @internal\r\n */\r\n public _pos: number = 0;\r\n /**\r\n * @internal Index of this particle in the global \"indices\" array (Internal use)\r\n */\r\n public _ind: number = 0;\r\n /**\r\n * @internal ModelShape of this particle (Internal use)\r\n */\r\n public _model: ModelShape;\r\n /**\r\n * ModelShape id of this particle\r\n */\r\n public shapeId: number = 0;\r\n /**\r\n * Index of the particle in its shape id\r\n */\r\n public idxInShape: number = 0;\r\n /**\r\n * @internal Reference to the shape model BoundingInfo object (Internal use)\r\n */\r\n public _modelBoundingInfo: BoundingInfo;\r\n private _boundingInfo: BoundingInfo;\r\n /**\r\n * @internal Reference to the SPS what the particle belongs to (Internal use)\r\n */\r\n public _sps: SolidParticleSystem;\r\n /**\r\n * @internal Still set as invisible in order to skip useless computations (Internal use)\r\n */\r\n public _stillInvisible: boolean = false;\r\n /**\r\n * @internal Last computed particle rotation matrix\r\n */\r\n public _rotationMatrix: number[] = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];\r\n /**\r\n * Parent particle Id, if any.\r\n * Default null.\r\n */\r\n public parentId: Nullable<number> = null;\r\n /**\r\n * The particle material identifier (integer) when MultiMaterials are enabled in the SPS.\r\n */\r\n public materialIndex: Nullable<number> = null;\r\n /**\r\n * Custom object or properties.\r\n */\r\n public props: Nullable<any> = null;\r\n /**\r\n * The culling strategy to use to check whether the solid particle must be culled or not when using isInFrustum().\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * The default value for solid particles is AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * Please read each static variable documentation in the class AbstractMesh to get details about the culling process.\r\n * */\r\n public cullingStrategy = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n\r\n /**\r\n * @internal Internal global position in the SPS.\r\n */\r\n public _globalPosition: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Particle BoundingInfo object\r\n * @returns a BoundingInfo\r\n */\r\n public getBoundingInfo(): BoundingInfo {\r\n return this._boundingInfo;\r\n }\r\n\r\n /**\r\n * Returns true if there is already a bounding info\r\n */\r\n public get hasBoundingInfo(): boolean {\r\n return this._boundingInfo !== null;\r\n }\r\n\r\n /**\r\n * Creates a Solid Particle object.\r\n * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()\r\n * @param particleIndex (integer) is the particle index in the Solid Particle System pool.\r\n * @param particleId (integer) is the particle identifier. Unless some particles are removed from the SPS, it's the same value than the particle idx.\r\n * @param positionIndex (integer) is the starting index of the particle vertices in the SPS \"positions\" array.\r\n * @param indiceIndex (integer) is the starting index of the particle indices in the SPS \"indices\" array.\r\n * @param model (ModelShape) is a reference to the model shape on what the particle is designed.\r\n * @param shapeId (integer) is the model shape identifier in the SPS.\r\n * @param idxInShape (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))\r\n * @param sps defines the sps it is associated to\r\n * @param modelBoundingInfo is the reference to the model BoundingInfo used for intersection computations.\r\n * @param materialIndex is the particle material identifier (integer) when the MultiMaterials are enabled in the SPS.\r\n */\r\n constructor(\r\n particleIndex: number,\r\n particleId: number,\r\n positionIndex: number,\r\n indiceIndex: number,\r\n model: Nullable<ModelShape>,\r\n shapeId: number,\r\n idxInShape: number,\r\n sps: SolidParticleSystem,\r\n modelBoundingInfo: Nullable<BoundingInfo> = null,\r\n materialIndex: Nullable<number> = null\r\n ) {\r\n this.idx = particleIndex;\r\n this.id = particleId;\r\n this._pos = positionIndex;\r\n this._ind = indiceIndex;\r\n this._model = <ModelShape>model;\r\n this.shapeId = shapeId;\r\n this.idxInShape = idxInShape;\r\n this._sps = sps;\r\n if (modelBoundingInfo) {\r\n this._modelBoundingInfo = modelBoundingInfo;\r\n this._boundingInfo = new BoundingInfo(modelBoundingInfo.minimum, modelBoundingInfo.maximum);\r\n }\r\n if (materialIndex !== null) {\r\n this.materialIndex = materialIndex;\r\n }\r\n }\r\n /**\r\n * Copies the particle property values into the existing target : position, rotation, scaling, uvs, colors, pivot, parent, visibility, alive\r\n * @param target the particle target\r\n * @returns the current particle\r\n */\r\n public copyToRef(target: SolidParticle): SolidParticle {\r\n target.position.copyFrom(this.position);\r\n target.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n if (target.rotationQuaternion) {\r\n target.rotationQuaternion!.copyFrom(this.rotationQuaternion!);\r\n } else {\r\n target.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n }\r\n target.scaling.copyFrom(this.scaling);\r\n if (this.color) {\r\n if (target.color) {\r\n target.color!.copyFrom(this.color!);\r\n } else {\r\n target.color = this.color.clone();\r\n }\r\n }\r\n target.uvs.copyFrom(this.uvs);\r\n target.velocity.copyFrom(this.velocity);\r\n target.pivot.copyFrom(this.pivot);\r\n target.translateFromPivot = this.translateFromPivot;\r\n target.alive = this.alive;\r\n target.isVisible = this.isVisible;\r\n target.parentId = this.parentId;\r\n target.cullingStrategy = this.cullingStrategy;\r\n if (this.materialIndex !== null) {\r\n target.materialIndex = this.materialIndex;\r\n }\r\n return this;\r\n }\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n public get scale(): Vector3 {\r\n return this.scaling;\r\n }\r\n\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n public set scale(scale: Vector3) {\r\n this.scaling = scale;\r\n }\r\n\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n public get quaternion(): Nullable<Quaternion> {\r\n return this.rotationQuaternion;\r\n }\r\n\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n public set quaternion(q: Nullable<Quaternion>) {\r\n this.rotationQuaternion = q;\r\n }\r\n\r\n /**\r\n * Returns a boolean. True if the particle intersects another particle or another mesh, else false.\r\n * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)\r\n * @param target is the object (solid particle or mesh) what the intersection is computed against.\r\n * @returns true if it intersects\r\n */\r\n public intersectsMesh(target: Mesh | SolidParticle): boolean {\r\n if (!this._boundingInfo || !target.hasBoundingInfo) {\r\n return false;\r\n }\r\n if (this._sps._bSphereOnly) {\r\n return BoundingSphere.Intersects(this._boundingInfo.boundingSphere, target.getBoundingInfo().boundingSphere);\r\n }\r\n return this._boundingInfo.intersects(target.getBoundingInfo(), false);\r\n }\r\n\r\n /**\r\n * Returns `true` if the solid particle is within the frustum defined by the passed array of planes.\r\n * A particle is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the particle is in the frustum planes\r\n */\r\n public isInFrustum(frustumPlanes: Plane[]): boolean {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n }\r\n\r\n /**\r\n * get the rotation matrix of the particle\r\n * @internal\r\n */\r\n public getRotationMatrix(m: Matrix) {\r\n let quaternion: Quaternion;\r\n if (this.rotationQuaternion) {\r\n quaternion = this.rotationQuaternion;\r\n } else {\r\n quaternion = TmpVectors.Quaternion[0];\r\n const rotation = this.rotation;\r\n Quaternion.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, quaternion);\r\n }\r\n\r\n quaternion.toRotationMatrix(m);\r\n }\r\n}\r\n\r\n/**\r\n * Represents the shape of the model used by one particle of a solid particle system.\r\n * SPS internal tool, don't use it manually.\r\n */\r\nexport class ModelShape {\r\n /**\r\n * Get or set the shapeId\r\n * @deprecated Please use shapeId instead\r\n */\r\n public get shapeID(): number {\r\n return this.shapeId;\r\n }\r\n public set shapeID(shapeID: number) {\r\n this.shapeId = shapeID;\r\n }\r\n /**\r\n * The shape id\r\n * @internal\r\n */\r\n public shapeId: number;\r\n /**\r\n * flat array of model positions (internal use)\r\n * @internal\r\n */\r\n public _shape: Vector3[];\r\n /**\r\n * flat array of model UVs (internal use)\r\n * @internal\r\n */\r\n public _shapeUV: number[];\r\n /**\r\n * color array of the model\r\n * @internal\r\n */\r\n public _shapeColors: number[];\r\n /**\r\n * indices array of the model\r\n * @internal\r\n */\r\n public _indices: number[];\r\n /**\r\n * normals array of the model\r\n * @internal\r\n */\r\n public _normals: number[];\r\n /**\r\n * length of the shape in the model indices array (internal use)\r\n * @internal\r\n */\r\n public _indicesLength: number = 0;\r\n /**\r\n * Custom position function (internal use)\r\n * @internal\r\n */\r\n public _positionFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>;\r\n /**\r\n * Custom vertex function (internal use)\r\n * @internal\r\n */\r\n public _vertexFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>;\r\n /**\r\n * Model material (internal use)\r\n * @internal\r\n */\r\n public _material: Nullable<Material>;\r\n\r\n /**\r\n * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.\r\n * SPS internal tool, don't use it manually.\r\n * @internal\r\n */\r\n constructor(\r\n id: number,\r\n shape: Vector3[],\r\n indices: number[],\r\n normals: number[],\r\n colors: number[],\r\n shapeUV: number[],\r\n posFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>,\r\n vtxFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>,\r\n material: Nullable<Material>\r\n ) {\r\n this.shapeId = id;\r\n this._shape = shape;\r\n this._indices = indices;\r\n this._indicesLength = indices.length;\r\n this._shapeUV = shapeUV;\r\n this._shapeColors = colors;\r\n this._normals = normals;\r\n this._positionFunction = posFunction;\r\n this._vertexFunction = vtxFunction;\r\n this._material = material;\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Depth Sorted Particle in the solid particle system.\r\n * @internal\r\n */\r\nexport class DepthSortedParticle {\r\n /**\r\n * Particle index\r\n */\r\n public idx: number = 0;\r\n /**\r\n * Index of the particle in the \"indices\" array\r\n */\r\n public ind: number = 0;\r\n /**\r\n * Length of the particle shape in the \"indices\" array\r\n */\r\n public indicesLength: number = 0;\r\n /**\r\n * Squared distance from the particle to the camera\r\n */\r\n public sqDistance: number = 0.0;\r\n /**\r\n * Material index when used with MultiMaterials\r\n */\r\n public materialIndex: number = 0;\r\n\r\n /**\r\n * Creates a new sorted particle\r\n * @param idx\r\n * @param ind\r\n * @param indLength\r\n * @param materialIndex\r\n */\r\n constructor(idx: number, ind: number, indLength: number, materialIndex: number) {\r\n this.idx = idx;\r\n this.ind = ind;\r\n this.indicesLength = indLength;\r\n this.materialIndex = materialIndex;\r\n }\r\n}\r\n\r\n/**\r\n * Represents a solid particle vertex\r\n */\r\nexport class SolidParticleVertex {\r\n /**\r\n * Vertex position\r\n */\r\n public position: Vector3;\r\n /**\r\n * Vertex color\r\n */\r\n public color: Color4;\r\n /**\r\n * Vertex UV\r\n */\r\n public uv: Vector2;\r\n /**\r\n * Creates a new solid particle vertex\r\n */\r\n constructor() {\r\n this.position = Vector3.Zero();\r\n this.color = new Color4(1.0, 1.0, 1.0, 1.0);\r\n this.uv = Vector2.Zero();\r\n }\r\n // Getters and Setters for back-compatibility\r\n /** Vertex x coordinate */\r\n public get x(): number {\r\n return this.position.x;\r\n }\r\n public set x(val: number) {\r\n this.position.x = val;\r\n }\r\n /** Vertex y coordinate */\r\n public get y(): number {\r\n return this.position.y;\r\n }\r\n public set y(val: number) {\r\n this.position.y = val;\r\n }\r\n /** Vertex z coordinate */\r\n public get z(): number {\r\n return this.position.z;\r\n }\r\n public set z(val: number) {\r\n this.position.z = val;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"solidParticle.js","sourceRoot":"","sources":["../../../../lts/core/generated/Particles/solidParticle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD;;GAEG;AACH,MAAM,OAAO,aAAa;IA2HtB;;;OAGG;IACI,eAAe;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,YACI,aAAqB,EACrB,UAAkB,EAClB,aAAqB,EACrB,WAAmB,EACnB,KAA2B,EAC3B,OAAe,EACf,UAAkB,EAClB,GAAwB,EACxB,oBAA4C,IAAI,EAChD,gBAAkC,IAAI;QAjK1C;;WAEG;QACI,QAAG,GAAW,CAAC,CAAC;QACvB;;WAEG;QACI,OAAE,GAAW,CAAC,CAAC;QACtB;;WAEG;QACI,UAAK,GAAqB,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAChE;;WAEG;QACI,aAAQ,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QAC1C;;WAEG;QACI,aAAQ,G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GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7B,CAAC;IACD,6CAA6C;IAC7C,0BAA0B;IAC1B,IAAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;IACD,0BAA0B;IAC1B,IAAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;IACD,0BAA0B;IAC1B,IAAW,CAAC;QACR,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAW,CAAC,CAAC,GAAW;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { Matrix } from \"../Maths/math.vector\";\r\nimport { Vector3, TmpVectors, Quaternion, Vector4, Vector2 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { BoundingSphere } from \"../Culling/boundingSphere\";\r\nimport type { SolidParticleSystem } from \"./solidParticleSystem\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Plane } from \"../Maths/math.plane\";\r\nimport type { Material } from \"../Materials/material\";\r\n/**\r\n * Represents one particle of a solid particle system.\r\n */\r\nexport class SolidParticle {\r\n /**\r\n * particle global index\r\n */\r\n public idx: number = 0;\r\n /**\r\n * particle identifier\r\n */\r\n public id: number = 0;\r\n /**\r\n * The color of the particle\r\n */\r\n public color: Nullable<Color4> = new Color4(1.0, 1.0, 1.0, 1.0);\r\n /**\r\n * The world space position of the particle.\r\n */\r\n public position: Vector3 = Vector3.Zero();\r\n /**\r\n * The world space rotation of the particle. (Not use if rotationQuaternion is set)\r\n */\r\n public rotation: Vector3 = Vector3.Zero();\r\n /**\r\n * The world space rotation quaternion of the particle.\r\n */\r\n public rotationQuaternion: Nullable<Quaternion>;\r\n /**\r\n * The scaling of the particle.\r\n */\r\n public scaling: Vector3 = Vector3.One();\r\n /**\r\n * The uvs of the particle.\r\n */\r\n public uvs: Vector4 = new Vector4(0.0, 0.0, 1.0, 1.0);\r\n /**\r\n * The current speed of the particle.\r\n */\r\n public velocity: Vector3 = Vector3.Zero();\r\n /**\r\n * The pivot point in the particle local space.\r\n */\r\n public pivot: Vector3 = Vector3.Zero();\r\n /**\r\n * Must the particle be translated from its pivot point in its local space ?\r\n * In this case, the pivot point is set at the origin of the particle local space and the particle is translated.\r\n * Default : false\r\n */\r\n public translateFromPivot: boolean = false;\r\n /**\r\n * Is the particle active or not ?\r\n */\r\n public alive: boolean = true;\r\n /**\r\n * Is the particle visible or not ?\r\n */\r\n public isVisible: boolean = true;\r\n /**\r\n * Index of this particle in the global \"positions\" array (Internal use)\r\n * @internal\r\n */\r\n public _pos: number = 0;\r\n /**\r\n * @internal Index of this particle in the global \"indices\" array (Internal use)\r\n */\r\n public _ind: number = 0;\r\n /**\r\n * @internal ModelShape of this particle (Internal use)\r\n */\r\n public _model: ModelShape;\r\n /**\r\n * ModelShape id of this particle\r\n */\r\n public shapeId: number = 0;\r\n /**\r\n * Index of the particle in its shape id\r\n */\r\n public idxInShape: number = 0;\r\n /**\r\n * @internal Reference to the shape model BoundingInfo object (Internal use)\r\n */\r\n public _modelBoundingInfo: BoundingInfo;\r\n private _boundingInfo: BoundingInfo;\r\n /**\r\n * @internal Reference to the SPS what the particle belongs to (Internal use)\r\n */\r\n public _sps: SolidParticleSystem;\r\n /**\r\n * @internal Still set as invisible in order to skip useless computations (Internal use)\r\n */\r\n public _stillInvisible: boolean = false;\r\n /**\r\n * @internal Last computed particle rotation matrix\r\n */\r\n public _rotationMatrix: number[] = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0];\r\n /**\r\n * Parent particle Id, if any.\r\n * Default null.\r\n */\r\n public parentId: Nullable<number> = null;\r\n /**\r\n * The particle material identifier (integer) when MultiMaterials are enabled in the SPS.\r\n */\r\n public materialIndex: Nullable<number> = null;\r\n /**\r\n * Custom object or properties.\r\n */\r\n public props: Nullable<any> = null;\r\n /**\r\n * The culling strategy to use to check whether the solid particle must be culled or not when using isInFrustum().\r\n * The possible values are :\r\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\r\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\r\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\r\n * The default value for solid particles is AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\r\n * Please read each static variable documentation in the class AbstractMesh to get details about the culling process.\r\n * */\r\n public cullingStrategy = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\r\n\r\n /**\r\n * @internal Internal global position in the SPS.\r\n */\r\n public _globalPosition: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Particle BoundingInfo object\r\n * @returns a BoundingInfo\r\n */\r\n public getBoundingInfo(): BoundingInfo {\r\n return this._boundingInfo;\r\n }\r\n\r\n /**\r\n * Returns true if there is already a bounding info\r\n */\r\n public get hasBoundingInfo(): boolean {\r\n return this._boundingInfo !== null;\r\n }\r\n\r\n /**\r\n * Creates a Solid Particle object.\r\n * Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle()\r\n * @param particleIndex (integer) is the particle index in the Solid Particle System pool.\r\n * @param particleId (integer) is the particle identifier. Unless some particles are removed from the SPS, it's the same value than the particle idx.\r\n * @param positionIndex (integer) is the starting index of the particle vertices in the SPS \"positions\" array.\r\n * @param indiceIndex (integer) is the starting index of the particle indices in the SPS \"indices\" array.\r\n * @param model (ModelShape) is a reference to the model shape on what the particle is designed.\r\n * @param shapeId (integer) is the model shape identifier in the SPS.\r\n * @param idxInShape (integer) is the index of the particle in the current model (ex: the 10th box of addShape(box, 30))\r\n * @param sps defines the sps it is associated to\r\n * @param modelBoundingInfo is the reference to the model BoundingInfo used for intersection computations.\r\n * @param materialIndex is the particle material identifier (integer) when the MultiMaterials are enabled in the SPS.\r\n */\r\n constructor(\r\n particleIndex: number,\r\n particleId: number,\r\n positionIndex: number,\r\n indiceIndex: number,\r\n model: Nullable<ModelShape>,\r\n shapeId: number,\r\n idxInShape: number,\r\n sps: SolidParticleSystem,\r\n modelBoundingInfo: Nullable<BoundingInfo> = null,\r\n materialIndex: Nullable<number> = null\r\n ) {\r\n this.idx = particleIndex;\r\n this.id = particleId;\r\n this._pos = positionIndex;\r\n this._ind = indiceIndex;\r\n this._model = <ModelShape>model;\r\n this.shapeId = shapeId;\r\n this.idxInShape = idxInShape;\r\n this._sps = sps;\r\n if (modelBoundingInfo) {\r\n this._modelBoundingInfo = modelBoundingInfo;\r\n this._boundingInfo = new BoundingInfo(modelBoundingInfo.minimum, modelBoundingInfo.maximum);\r\n }\r\n if (materialIndex !== null) {\r\n this.materialIndex = materialIndex;\r\n }\r\n }\r\n /**\r\n * Copies the particle property values into the existing target : position, rotation, scaling, uvs, colors, pivot, parent, visibility, alive\r\n * @param target the particle target\r\n * @returns the current particle\r\n */\r\n public copyToRef(target: SolidParticle): SolidParticle {\r\n target.position.copyFrom(this.position);\r\n target.rotation.copyFrom(this.rotation);\r\n if (this.rotationQuaternion) {\r\n if (target.rotationQuaternion) {\r\n target.rotationQuaternion!.copyFrom(this.rotationQuaternion!);\r\n } else {\r\n target.rotationQuaternion = this.rotationQuaternion.clone();\r\n }\r\n }\r\n target.scaling.copyFrom(this.scaling);\r\n if (this.color) {\r\n if (target.color) {\r\n target.color!.copyFrom(this.color!);\r\n } else {\r\n target.color = this.color.clone();\r\n }\r\n }\r\n target.uvs.copyFrom(this.uvs);\r\n target.velocity.copyFrom(this.velocity);\r\n target.pivot.copyFrom(this.pivot);\r\n target.translateFromPivot = this.translateFromPivot;\r\n target.alive = this.alive;\r\n target.isVisible = this.isVisible;\r\n target.parentId = this.parentId;\r\n target.cullingStrategy = this.cullingStrategy;\r\n if (this.materialIndex !== null) {\r\n target.materialIndex = this.materialIndex;\r\n }\r\n return this;\r\n }\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n public get scale(): Vector3 {\r\n return this.scaling;\r\n }\r\n\r\n /**\r\n * Legacy support, changed scale to scaling\r\n */\r\n public set scale(scale: Vector3) {\r\n this.scaling = scale;\r\n }\r\n\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n public get quaternion(): Nullable<Quaternion> {\r\n return this.rotationQuaternion;\r\n }\r\n\r\n /**\r\n * Legacy support, changed quaternion to rotationQuaternion\r\n */\r\n public set quaternion(q: Nullable<Quaternion>) {\r\n this.rotationQuaternion = q;\r\n }\r\n\r\n /**\r\n * Returns a boolean. True if the particle intersects another particle or another mesh, else false.\r\n * The intersection is computed on the particle bounding sphere and Axis Aligned Bounding Box (AABB)\r\n * @param target is the object (solid particle or mesh) what the intersection is computed against.\r\n * @returns true if it intersects\r\n */\r\n public intersectsMesh(target: Mesh | SolidParticle): boolean {\r\n if (!this._boundingInfo || !target.hasBoundingInfo) {\r\n return false;\r\n }\r\n if (this._sps._bSphereOnly) {\r\n return BoundingSphere.Intersects(this._boundingInfo.boundingSphere, target.getBoundingInfo().boundingSphere);\r\n }\r\n return this._boundingInfo.intersects(target.getBoundingInfo(), false);\r\n }\r\n\r\n /**\r\n * Returns `true` if the solid particle is within the frustum defined by the passed array of planes.\r\n * A particle is in the frustum if its bounding box intersects the frustum\r\n * @param frustumPlanes defines the frustum to test\r\n * @returns true if the particle is in the frustum planes\r\n */\r\n public isInFrustum(frustumPlanes: Plane[]): boolean {\r\n return this._boundingInfo !== null && this._boundingInfo.isInFrustum(frustumPlanes, this.cullingStrategy);\r\n }\r\n\r\n /**\r\n * get the rotation matrix of the particle\r\n * @internal\r\n */\r\n public getRotationMatrix(m: Matrix) {\r\n let quaternion: Quaternion;\r\n if (this.rotationQuaternion) {\r\n quaternion = this.rotationQuaternion;\r\n } else {\r\n quaternion = TmpVectors.Quaternion[0];\r\n const rotation = this.rotation;\r\n Quaternion.RotationYawPitchRollToRef(rotation.y, rotation.x, rotation.z, quaternion);\r\n }\r\n\r\n quaternion.toRotationMatrix(m);\r\n }\r\n}\r\n\r\n/**\r\n * Represents the shape of the model used by one particle of a solid particle system.\r\n * SPS internal tool, don't use it manually.\r\n */\r\nexport class ModelShape {\r\n /**\r\n * Get or set the shapeId\r\n * @deprecated Please use shapeId instead\r\n */\r\n public get shapeID(): number {\r\n return this.shapeId;\r\n }\r\n public set shapeID(shapeID: number) {\r\n this.shapeId = shapeID;\r\n }\r\n /**\r\n * The shape id\r\n * @internal\r\n */\r\n public shapeId: number;\r\n /**\r\n * flat array of model positions (internal use)\r\n * @internal\r\n */\r\n public _shape: Vector3[];\r\n /**\r\n * flat array of model UVs (internal use)\r\n * @internal\r\n */\r\n public _shapeUV: number[];\r\n /**\r\n * color array of the model\r\n * @internal\r\n */\r\n public _shapeColors: number[];\r\n /**\r\n * indices array of the model\r\n * @internal\r\n */\r\n public _indices: number[];\r\n /**\r\n * normals array of the model\r\n * @internal\r\n */\r\n public _normals: number[];\r\n /**\r\n * length of the shape in the model indices array (internal use)\r\n * @internal\r\n */\r\n public _indicesLength: number = 0;\r\n /**\r\n * Custom position function (internal use)\r\n * @internal\r\n */\r\n public _positionFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>;\r\n /**\r\n * Custom vertex function (internal use)\r\n * @internal\r\n */\r\n public _vertexFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>;\r\n /**\r\n * Model material (internal use)\r\n * @internal\r\n */\r\n public _material: Nullable<Material>;\r\n\r\n /**\r\n * Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS.\r\n * SPS internal tool, don't use it manually.\r\n * @internal\r\n */\r\n constructor(\r\n id: number,\r\n shape: Vector3[],\r\n indices: number[],\r\n normals: number[],\r\n colors: number[],\r\n shapeUV: number[],\r\n posFunction: Nullable<(particle: SolidParticle, i: number, s: number) => void>,\r\n vtxFunction: Nullable<(particle: SolidParticle, vertex: Vector3, i: number) => void>,\r\n material: Nullable<Material>\r\n ) {\r\n this.shapeId = id;\r\n this._shape = shape;\r\n this._indices = indices;\r\n this._indicesLength = indices.length;\r\n this._shapeUV = shapeUV;\r\n this._shapeColors = colors;\r\n this._normals = normals;\r\n this._positionFunction = posFunction;\r\n this._vertexFunction = vtxFunction;\r\n this._material = material;\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Depth Sorted Particle in the solid particle system.\r\n * @internal\r\n */\r\nexport class DepthSortedParticle {\r\n /**\r\n * Particle index\r\n */\r\n public idx: number = 0;\r\n /**\r\n * Index of the particle in the \"indices\" array\r\n */\r\n public ind: number = 0;\r\n /**\r\n * Length of the particle shape in the \"indices\" array\r\n */\r\n public indicesLength: number = 0;\r\n /**\r\n * Squared distance from the particle to the camera\r\n */\r\n public sqDistance: number = 0.0;\r\n /**\r\n * Material index when used with MultiMaterials\r\n */\r\n public materialIndex: number = 0;\r\n\r\n /**\r\n * Creates a new sorted particle\r\n * @param idx\r\n * @param ind\r\n * @param indLength\r\n * @param materialIndex\r\n */\r\n constructor(idx: number, ind: number, indLength: number, materialIndex: number) {\r\n this.idx = idx;\r\n this.ind = ind;\r\n this.indicesLength = indLength;\r\n this.materialIndex = materialIndex;\r\n }\r\n}\r\n\r\n/**\r\n * Represents a solid particle vertex\r\n */\r\nexport class SolidParticleVertex {\r\n /**\r\n * Vertex position\r\n */\r\n public position: Vector3;\r\n /**\r\n * Vertex color\r\n */\r\n public color: Color4;\r\n /**\r\n * Vertex UV\r\n */\r\n public uv: Vector2;\r\n /**\r\n * Creates a new solid particle vertex\r\n */\r\n constructor() {\r\n this.position = Vector3.Zero();\r\n this.color = new Color4(1.0, 1.0, 1.0, 1.0);\r\n this.uv = Vector2.Zero();\r\n }\r\n // Getters and Setters for back-compatibility\r\n /** Vertex x coordinate */\r\n public get x(): number {\r\n return this.position.x;\r\n }\r\n public set x(val: number) {\r\n this.position.x = val;\r\n }\r\n /** Vertex y coordinate */\r\n public get y(): number {\r\n return this.position.y;\r\n }\r\n public set y(val: number) {\r\n this.position.y = val;\r\n }\r\n /** Vertex z coordinate */\r\n public get z(): number {\r\n return this.position.z;\r\n }\r\n public set z(val: number) {\r\n this.position.z = val;\r\n }\r\n}\r\n"]}
@@ -5,6 +5,20 @@ import { _WarnImport } from "../../Misc/devTools.js";
5
5
  * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
6
6
  */
7
7
  export class PhysicsEngine {
8
+ /**
9
+ *
10
+ * @returns version
11
+ */
12
+ getPluginVersion() {
13
+ return this._physicsPlugin.getPluginVersion();
14
+ }
15
+ /**
16
+ * Factory used to create the default physics plugin.
17
+ * @returns The default physics plugin
18
+ */
19
+ static DefaultPluginFactory() {
20
+ throw _WarnImport("CannonJSPlugin");
21
+ }
8
22
  /**
9
23
  * Creates a new Physics Engine
10
24
  * @param gravity defines the gravity vector used by the simulation
@@ -26,20 +40,6 @@ export class PhysicsEngine {
26
40
  this.setGravity(gravity);
27
41
  this.setTimeStep();
28
42
  }
29
- /**
30
- *
31
- * @returns version
32
- */
33
- getPluginVersion() {
34
- return this._physicsPlugin.getPluginVersion();
35
- }
36
- /**
37
- * Factory used to create the default physics plugin.
38
- * @returns The default physics plugin
39
- */
40
- static DefaultPluginFactory() {
41
- throw _WarnImport("CannonJSPlugin");
42
- }
43
43
  /**
44
44
  * Sets the gravity vector used by the simulation
45
45
  * @param gravity defines the gravity vector to use
@@ -1 +1 @@
1
- {"version":3,"file":"physicsEngine.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AC,cAAc,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { PhysicsImpostorJoint, IPhysicsEnginePlugin } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEngine } from \"../IPhysicsEngine\";\r\nimport type { PhysicsImpostor, IPhysicsEnabledObject } from \"./physicsImpostor\";\r\nimport type { PhysicsJoint } from \"./physicsJoint\";\r\nimport type { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\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 /**\r\n * Global value used to control the smallest number supported by the simulation\r\n */\r\n private _impostors: Array<PhysicsImpostor> = [];\r\n private _joints: Array<PhysicsImpostorJoint> = [];\r\n private _subTimeStep: number = 0;\r\n private _uniqueIdCounter = 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 version\r\n */\r\n public getPluginVersion(): number {\r\n return this._physicsPlugin.getPluginVersion();\r\n }\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(): IPhysicsEnginePlugin {\r\n throw _WarnImport(\"CannonJSPlugin\");\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(gravity: Nullable<Vector3>, private _physicsPlugin: IPhysicsEnginePlugin = PhysicsEngine.DefaultPluginFactory()) {\r\n if (!this._physicsPlugin.isSupported()) {\r\n throw new Error(\"Physics Engine \" + this._physicsPlugin.name + \" cannot be found. \" + \"Please make sure it is included.\");\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 * @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._impostors.forEach(function (impostor) {\r\n impostor.dispose();\r\n });\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 * Adding a new impostor for the impostor tracking.\r\n * This will be done by the impostor itself.\r\n * @param impostor the impostor to add\r\n */\r\n public addImpostor(impostor: PhysicsImpostor) {\r\n this._impostors.push(impostor);\r\n impostor.uniqueId = this._uniqueIdCounter++;\r\n //if no parent, generate the body\r\n if (!impostor.parent) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n }\r\n\r\n /**\r\n * Remove an impostor from the engine.\r\n * This impostor and its mesh will not longer be updated by the physics engine.\r\n * @param impostor the impostor to remove\r\n */\r\n public removeImpostor(impostor: PhysicsImpostor) {\r\n const index = this._impostors.indexOf(impostor);\r\n if (index > -1) {\r\n const removed = this._impostors.splice(index, 1);\r\n //Is it needed?\r\n if (removed.length) {\r\n this.getPhysicsPlugin().removePhysicsBody(impostor);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add a joint to the physics engine\r\n * @param mainImpostor defines the main impostor to which the joint is added.\r\n * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint\r\n * @param joint defines the joint that will connect both impostors.\r\n */\r\n public addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {\r\n const impostorJoint = {\r\n mainImpostor: mainImpostor,\r\n connectedImpostor: connectedImpostor,\r\n joint: joint,\r\n };\r\n joint.physicsPlugin = this._physicsPlugin;\r\n this._joints.push(impostorJoint);\r\n this._physicsPlugin.generateJoint(impostorJoint);\r\n }\r\n\r\n /**\r\n * Removes a joint from the simulation\r\n * @param mainImpostor defines the impostor used with the joint\r\n * @param connectedImpostor defines the other impostor connected to the main one by the joint\r\n * @param joint defines the joint to remove\r\n */\r\n public removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {\r\n const matchingJoints = this._joints.filter(function (impostorJoint) {\r\n return impostorJoint.connectedImpostor === connectedImpostor && impostorJoint.joint === joint && impostorJoint.mainImpostor === mainImpostor;\r\n });\r\n if (matchingJoints.length) {\r\n this._physicsPlugin.removeJoint(matchingJoints[0]);\r\n //TODO remove it from the list as well\r\n }\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 //check if any mesh has no body / requires an update\r\n this._impostors.forEach((impostor) => {\r\n if (impostor.isBodyInitRequired()) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n });\r\n\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._impostors);\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(): IPhysicsEnginePlugin {\r\n return this._physicsPlugin;\r\n }\r\n\r\n /**\r\n * Gets the list of physic impostors\r\n * @returns an array of PhysicsImpostor\r\n */\r\n public getImpostors(): Array<PhysicsImpostor> {\r\n return this._impostors;\r\n }\r\n\r\n /**\r\n * Gets the impostor for a physics enabled object\r\n * @param object defines the object impersonated by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n public getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor> {\r\n for (let i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].object === object) {\r\n return this._impostors[i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the impostor for a physics body object\r\n * @param body defines physics body used by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n public getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor> {\r\n for (let i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].physicsBody === body) {\r\n return this._impostors[i];\r\n }\r\n }\r\n\r\n return null;\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 * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n return this._physicsPlugin.raycast(from, to);\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\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult) {\r\n return this._physicsPlugin.raycastToRef(from, to, result);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsEngine.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/physicsEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAMlD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,aAAa;IActB;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;IAClD,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,oBAAoB;QAC9B,MAAM,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACH,YAAY,OAA0B,EAAU,iBAAuC,aAAa,CAAC,oBAAoB,EAAE;QAA3E,mBAAc,GAAd,cAAc,CAA6D;QAjC3H;;WAEG;QACK,eAAU,GAA2B,EAAE,CAAC;QACxC,YAAO,GAAgC,EAAE,CAAC;QAC1C,iBAAY,GAAW,CAAC,CAAC;QACzB,qBAAgB,GAAG,CAAC,CAAC;QA4BzB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,GAAG,oBAAoB,GAAG,kCAAkC,CAAC,CAAC;SAC7H;QACD,OAAO,GAAG,OAAO,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,OAAgB;QAC9B,IAAI,CAAC,OAAO,GAAG,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AC,IAAI,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,MAA4B;QACxE,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { PhysicsImpostorJoint, IPhysicsEnginePlugin } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEngine } from \"../IPhysicsEngine\";\r\nimport type { PhysicsImpostor, IPhysicsEnabledObject } from \"./physicsImpostor\";\r\nimport type { PhysicsJoint } from \"./physicsJoint\";\r\nimport type { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\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 /**\r\n * Global value used to control the smallest number supported by the simulation\r\n */\r\n private _impostors: Array<PhysicsImpostor> = [];\r\n private _joints: Array<PhysicsImpostorJoint> = [];\r\n private _subTimeStep: number = 0;\r\n private _uniqueIdCounter = 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 version\r\n */\r\n public getPluginVersion(): number {\r\n return this._physicsPlugin.getPluginVersion();\r\n }\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(): IPhysicsEnginePlugin {\r\n throw _WarnImport(\"CannonJSPlugin\");\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(gravity: Nullable<Vector3>, private _physicsPlugin: IPhysicsEnginePlugin = PhysicsEngine.DefaultPluginFactory()) {\r\n if (!this._physicsPlugin.isSupported()) {\r\n throw new Error(\"Physics Engine \" + this._physicsPlugin.name + \" cannot be found. \" + \"Please make sure it is included.\");\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 * @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._impostors.forEach(function (impostor) {\r\n impostor.dispose();\r\n });\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 * Adding a new impostor for the impostor tracking.\r\n * This will be done by the impostor itself.\r\n * @param impostor the impostor to add\r\n */\r\n public addImpostor(impostor: PhysicsImpostor) {\r\n this._impostors.push(impostor);\r\n impostor.uniqueId = this._uniqueIdCounter++;\r\n //if no parent, generate the body\r\n if (!impostor.parent) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n }\r\n\r\n /**\r\n * Remove an impostor from the engine.\r\n * This impostor and its mesh will not longer be updated by the physics engine.\r\n * @param impostor the impostor to remove\r\n */\r\n public removeImpostor(impostor: PhysicsImpostor) {\r\n const index = this._impostors.indexOf(impostor);\r\n if (index > -1) {\r\n const removed = this._impostors.splice(index, 1);\r\n //Is it needed?\r\n if (removed.length) {\r\n this.getPhysicsPlugin().removePhysicsBody(impostor);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add a joint to the physics engine\r\n * @param mainImpostor defines the main impostor to which the joint is added.\r\n * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint\r\n * @param joint defines the joint that will connect both impostors.\r\n */\r\n public addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {\r\n const impostorJoint = {\r\n mainImpostor: mainImpostor,\r\n connectedImpostor: connectedImpostor,\r\n joint: joint,\r\n };\r\n joint.physicsPlugin = this._physicsPlugin;\r\n this._joints.push(impostorJoint);\r\n this._physicsPlugin.generateJoint(impostorJoint);\r\n }\r\n\r\n /**\r\n * Removes a joint from the simulation\r\n * @param mainImpostor defines the impostor used with the joint\r\n * @param connectedImpostor defines the other impostor connected to the main one by the joint\r\n * @param joint defines the joint to remove\r\n */\r\n public removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {\r\n const matchingJoints = this._joints.filter(function (impostorJoint) {\r\n return impostorJoint.connectedImpostor === connectedImpostor && impostorJoint.joint === joint && impostorJoint.mainImpostor === mainImpostor;\r\n });\r\n if (matchingJoints.length) {\r\n this._physicsPlugin.removeJoint(matchingJoints[0]);\r\n //TODO remove it from the list as well\r\n }\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 //check if any mesh has no body / requires an update\r\n this._impostors.forEach((impostor) => {\r\n if (impostor.isBodyInitRequired()) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n });\r\n\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._impostors);\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(): IPhysicsEnginePlugin {\r\n return this._physicsPlugin;\r\n }\r\n\r\n /**\r\n * Gets the list of physic impostors\r\n * @returns an array of PhysicsImpostor\r\n */\r\n public getImpostors(): Array<PhysicsImpostor> {\r\n return this._impostors;\r\n }\r\n\r\n /**\r\n * Gets the impostor for a physics enabled object\r\n * @param object defines the object impersonated by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n public getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor> {\r\n for (let i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].object === object) {\r\n return this._impostors[i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the impostor for a physics body object\r\n * @param body defines physics body used by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n public getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor> {\r\n for (let i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].physicsBody === body) {\r\n return this._impostors[i];\r\n }\r\n }\r\n\r\n return null;\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 * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n return this._physicsPlugin.raycast(from, to);\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\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult) {\r\n return this._physicsPlugin.raycastToRef(from, to, result);\r\n }\r\n}\r\n"]}
@@ -17,6 +17,155 @@ Mesh._PhysicsImpostorParser = function (scene, physicObject, jsonObject) {
17
17
  * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
18
18
  */
19
19
  export class PhysicsImpostor {
20
+ /**
21
+ * Specifies if the physics imposter is disposed
22
+ */
23
+ get isDisposed() {
24
+ return this._isDisposed;
25
+ }
26
+ /**
27
+ * Gets the mass of the physics imposter
28
+ */
29
+ get mass() {
30
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;
31
+ }
32
+ set mass(value) {
33
+ this.setMass(value);
34
+ }
35
+ /**
36
+ * Gets the coefficient of friction
37
+ */
38
+ get friction() {
39
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;
40
+ }
41
+ /**
42
+ * Sets the coefficient of friction
43
+ */
44
+ set friction(value) {
45
+ if (!this._physicsEngine) {
46
+ return;
47
+ }
48
+ this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value);
49
+ }
50
+ /**
51
+ * Gets the coefficient of restitution
52
+ */
53
+ get restitution() {
54
+ return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;
55
+ }
56
+ /**
57
+ * Sets the coefficient of restitution
58
+ */
59
+ set restitution(value) {
60
+ if (!this._physicsEngine) {
61
+ return;
62
+ }
63
+ this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value);
64
+ }
65
+ /**
66
+ * Gets the pressure of a soft body; only supported by the AmmoJSPlugin
67
+ */
68
+ get pressure() {
69
+ if (!this._physicsEngine) {
70
+ return 0;
71
+ }
72
+ const plugin = this._physicsEngine.getPhysicsPlugin();
73
+ if (!plugin.setBodyPressure) {
74
+ return 0;
75
+ }
76
+ return plugin.getBodyPressure(this);
77
+ }
78
+ /**
79
+ * Sets the pressure of a soft body; only supported by the AmmoJSPlugin
80
+ */
81
+ set pressure(value) {
82
+ if (!this._physicsEngine) {
83
+ return;
84
+ }
85
+ const plugin = this._physicsEngine.getPhysicsPlugin();
86
+ if (!plugin.setBodyPressure) {
87
+ return;
88
+ }
89
+ plugin.setBodyPressure(this, value);
90
+ }
91
+ /**
92
+ * Gets the stiffness of a soft body; only supported by the AmmoJSPlugin
93
+ */
94
+ get stiffness() {
95
+ if (!this._physicsEngine) {
96
+ return 0;
97
+ }
98
+ const plugin = this._physicsEngine.getPhysicsPlugin();
99
+ if (!plugin.getBodyStiffness) {
100
+ return 0;
101
+ }
102
+ return plugin.getBodyStiffness(this);
103
+ }
104
+ /**
105
+ * Sets the stiffness of a soft body; only supported by the AmmoJSPlugin
106
+ */
107
+ set stiffness(value) {
108
+ if (!this._physicsEngine) {
109
+ return;
110
+ }
111
+ const plugin = this._physicsEngine.getPhysicsPlugin();
112
+ if (!plugin.setBodyStiffness) {
113
+ return;
114
+ }
115
+ plugin.setBodyStiffness(this, value);
116
+ }
117
+ /**
118
+ * Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin
119
+ */
120
+ get velocityIterations() {
121
+ if (!this._physicsEngine) {
122
+ return 0;
123
+ }
124
+ const plugin = this._physicsEngine.getPhysicsPlugin();
125
+ if (!plugin.getBodyVelocityIterations) {
126
+ return 0;
127
+ }
128
+ return plugin.getBodyVelocityIterations(this);
129
+ }
130
+ /**
131
+ * Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin
132
+ */
133
+ set velocityIterations(value) {
134
+ if (!this._physicsEngine) {
135
+ return;
136
+ }
137
+ const plugin = this._physicsEngine.getPhysicsPlugin();
138
+ if (!plugin.setBodyVelocityIterations) {
139
+ return;
140
+ }
141
+ plugin.setBodyVelocityIterations(this, value);
142
+ }
143
+ /**
144
+ * Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin
145
+ */
146
+ get positionIterations() {
147
+ if (!this._physicsEngine) {
148
+ return 0;
149
+ }
150
+ const plugin = this._physicsEngine.getPhysicsPlugin();
151
+ if (!plugin.getBodyPositionIterations) {
152
+ return 0;
153
+ }
154
+ return plugin.getBodyPositionIterations(this);
155
+ }
156
+ /**
157
+ * Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin
158
+ */
159
+ set positionIterations(value) {
160
+ if (!this._physicsEngine) {
161
+ return;
162
+ }
163
+ const plugin = this._physicsEngine.getPhysicsPlugin();
164
+ if (!plugin.setBodyPositionIterations) {
165
+ return;
166
+ }
167
+ plugin.setBodyPositionIterations(this, value);
168
+ }
20
169
  /**
21
170
  * Initializes the physics imposter
22
171
  * @param object The physics-enabled object used as the physics imposter
@@ -204,155 +353,6 @@ export class PhysicsImpostor {
204
353
  }
205
354
  }
206
355
  }
207
- /**
208
- * Specifies if the physics imposter is disposed
209
- */
210
- get isDisposed() {
211
- return this._isDisposed;
212
- }
213
- /**
214
- * Gets the mass of the physics imposter
215
- */
216
- get mass() {
217
- return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;
218
- }
219
- set mass(value) {
220
- this.setMass(value);
221
- }
222
- /**
223
- * Gets the coefficient of friction
224
- */
225
- get friction() {
226
- return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;
227
- }
228
- /**
229
- * Sets the coefficient of friction
230
- */
231
- set friction(value) {
232
- if (!this._physicsEngine) {
233
- return;
234
- }
235
- this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value);
236
- }
237
- /**
238
- * Gets the coefficient of restitution
239
- */
240
- get restitution() {
241
- return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;
242
- }
243
- /**
244
- * Sets the coefficient of restitution
245
- */
246
- set restitution(value) {
247
- if (!this._physicsEngine) {
248
- return;
249
- }
250
- this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value);
251
- }
252
- /**
253
- * Gets the pressure of a soft body; only supported by the AmmoJSPlugin
254
- */
255
- get pressure() {
256
- if (!this._physicsEngine) {
257
- return 0;
258
- }
259
- const plugin = this._physicsEngine.getPhysicsPlugin();
260
- if (!plugin.setBodyPressure) {
261
- return 0;
262
- }
263
- return plugin.getBodyPressure(this);
264
- }
265
- /**
266
- * Sets the pressure of a soft body; only supported by the AmmoJSPlugin
267
- */
268
- set pressure(value) {
269
- if (!this._physicsEngine) {
270
- return;
271
- }
272
- const plugin = this._physicsEngine.getPhysicsPlugin();
273
- if (!plugin.setBodyPressure) {
274
- return;
275
- }
276
- plugin.setBodyPressure(this, value);
277
- }
278
- /**
279
- * Gets the stiffness of a soft body; only supported by the AmmoJSPlugin
280
- */
281
- get stiffness() {
282
- if (!this._physicsEngine) {
283
- return 0;
284
- }
285
- const plugin = this._physicsEngine.getPhysicsPlugin();
286
- if (!plugin.getBodyStiffness) {
287
- return 0;
288
- }
289
- return plugin.getBodyStiffness(this);
290
- }
291
- /**
292
- * Sets the stiffness of a soft body; only supported by the AmmoJSPlugin
293
- */
294
- set stiffness(value) {
295
- if (!this._physicsEngine) {
296
- return;
297
- }
298
- const plugin = this._physicsEngine.getPhysicsPlugin();
299
- if (!plugin.setBodyStiffness) {
300
- return;
301
- }
302
- plugin.setBodyStiffness(this, value);
303
- }
304
- /**
305
- * Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin
306
- */
307
- get velocityIterations() {
308
- if (!this._physicsEngine) {
309
- return 0;
310
- }
311
- const plugin = this._physicsEngine.getPhysicsPlugin();
312
- if (!plugin.getBodyVelocityIterations) {
313
- return 0;
314
- }
315
- return plugin.getBodyVelocityIterations(this);
316
- }
317
- /**
318
- * Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin
319
- */
320
- set velocityIterations(value) {
321
- if (!this._physicsEngine) {
322
- return;
323
- }
324
- const plugin = this._physicsEngine.getPhysicsPlugin();
325
- if (!plugin.setBodyVelocityIterations) {
326
- return;
327
- }
328
- plugin.setBodyVelocityIterations(this, value);
329
- }
330
- /**
331
- * Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin
332
- */
333
- get positionIterations() {
334
- if (!this._physicsEngine) {
335
- return 0;
336
- }
337
- const plugin = this._physicsEngine.getPhysicsPlugin();
338
- if (!plugin.getBodyPositionIterations) {
339
- return 0;
340
- }
341
- return plugin.getBodyPositionIterations(this);
342
- }
343
- /**
344
- * Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin
345
- */
346
- set positionIterations(value) {
347
- if (!this._physicsEngine) {
348
- return;
349
- }
350
- const plugin = this._physicsEngine.getPhysicsPlugin();
351
- if (!plugin.setBodyPositionIterations) {
352
- return;
353
- }
354
- plugin.setBodyPositionIterations(this, value);
355
- }
356
356
  /**
357
357
  * This function will completely initialize this impostor.
358
358
  * It will create a new body - but only if this mesh has no parent.