@onerjs/core 8.41.6 → 8.41.8

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 (342) hide show
  1. package/Animations/animation.d.ts +6 -2
  2. package/Animations/animation.js +28 -4
  3. package/Animations/animation.js.map +1 -1
  4. package/Animations/animationGroup.d.ts +2 -1
  5. package/Animations/animationGroup.js +3 -2
  6. package/Animations/animationGroup.js.map +1 -1
  7. package/Animations/animatorAvatar.d.ts +161 -0
  8. package/Animations/animatorAvatar.js +573 -0
  9. package/Animations/animatorAvatar.js.map +1 -0
  10. package/Animations/index.d.ts +1 -0
  11. package/Animations/index.js +1 -0
  12. package/Animations/index.js.map +1 -1
  13. package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -2
  14. package/AudioV2/webAudio/webAudioSoundSource.js +12 -2
  15. package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
  16. package/Bones/index.d.ts +1 -0
  17. package/Bones/index.js +1 -0
  18. package/Bones/index.js.map +1 -1
  19. package/Bones/skeleton.d.ts +13 -0
  20. package/Bones/skeleton.functions.d.ts +26 -0
  21. package/Bones/skeleton.functions.js +91 -0
  22. package/Bones/skeleton.functions.js.map +1 -0
  23. package/Bones/skeleton.js +26 -0
  24. package/Bones/skeleton.js.map +1 -1
  25. package/Cameras/geospatialCamera.js +21 -20
  26. package/Cameras/geospatialCamera.js.map +1 -1
  27. package/Cameras/geospatialCameraMovement.d.ts +8 -1
  28. package/Cameras/geospatialCameraMovement.js +29 -8
  29. package/Cameras/geospatialCameraMovement.js.map +1 -1
  30. package/Collisions/gpuPicker.d.ts +11 -0
  31. package/Collisions/gpuPicker.js +148 -19
  32. package/Collisions/gpuPicker.js.map +1 -1
  33. package/Debug/skeletonViewer.d.ts +4 -8
  34. package/Debug/skeletonViewer.js +13 -22
  35. package/Debug/skeletonViewer.js.map +1 -1
  36. package/Engines/AbstractEngine/abstractEngine.views.js +5 -2
  37. package/Engines/AbstractEngine/abstractEngine.views.js.map +1 -1
  38. package/Engines/Extensions/engine.multiview.d.ts +2 -0
  39. package/Engines/Extensions/engine.multiview.js +7 -3
  40. package/Engines/Extensions/engine.multiview.js.map +1 -1
  41. package/Engines/abstractEngine.d.ts +2 -0
  42. package/Engines/abstractEngine.js +11 -2
  43. package/Engines/abstractEngine.js.map +1 -1
  44. package/Engines/constants.d.ts +4 -0
  45. package/Engines/constants.js +4 -0
  46. package/Engines/constants.js.map +1 -1
  47. package/Instrumentation/engineInstrumentation.js +2 -1
  48. package/Instrumentation/engineInstrumentation.js.map +1 -1
  49. package/Layers/effectLayer.js +1 -3
  50. package/Layers/effectLayer.js.map +1 -1
  51. package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
  52. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  53. package/Lights/Shadows/shadowGenerator.js +2 -3
  54. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  55. package/Materials/Background/backgroundMaterial.js +37 -2
  56. package/Materials/Background/backgroundMaterial.js.map +1 -1
  57. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +109 -0
  58. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +210 -0
  59. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -0
  60. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +1 -0
  61. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +71 -15
  62. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  63. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +86 -0
  64. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +161 -0
  65. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -0
  66. package/Materials/GreasedLine/greasedLinePluginMaterial.js +0 -6
  67. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  68. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +0 -1
  69. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -1
  70. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +0 -1
  71. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -1
  72. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +14 -0
  73. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +14 -0
  74. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  75. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +20 -1
  76. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +20 -1
  77. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  78. package/Materials/Node/Blocks/Dual/depthSourceBlock.d.ts +13 -0
  79. package/Materials/Node/Blocks/Dual/depthSourceBlock.js +13 -0
  80. package/Materials/Node/Blocks/Dual/depthSourceBlock.js.map +1 -1
  81. package/Materials/Node/Blocks/Dual/fogBlock.d.ts +21 -0
  82. package/Materials/Node/Blocks/Dual/fogBlock.js +21 -0
  83. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  84. package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +21 -0
  85. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +21 -0
  86. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  87. package/Materials/Node/Blocks/Dual/lightBlock.d.ts +38 -0
  88. package/Materials/Node/Blocks/Dual/lightBlock.js +38 -0
  89. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  90. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +29 -0
  91. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +29 -0
  92. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  93. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.d.ts +5 -0
  94. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +5 -0
  95. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
  96. package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +16 -0
  97. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +16 -0
  98. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  99. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.d.ts +16 -0
  100. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +16 -0
  101. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
  102. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +34 -0
  103. package/Materials/Node/Blocks/Dual/textureBlock.js +34 -0
  104. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  105. package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +17 -0
  106. package/Materials/Node/Blocks/Fragment/TBNBlock.js +17 -2
  107. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  108. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.d.ts +7 -0
  109. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js +7 -0
  110. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js.map +1 -1
  111. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +21 -0
  112. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +21 -0
  113. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  114. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.d.ts +10 -0
  115. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +10 -0
  116. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  117. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +28 -0
  118. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +28 -0
  119. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  120. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +30 -0
  121. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +30 -1
  122. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  123. package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +4 -0
  124. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +4 -0
  125. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  126. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.d.ts +5 -0
  127. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +5 -0
  128. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
  129. package/Materials/Node/Blocks/Fragment/twirlBlock.d.ts +3 -0
  130. package/Materials/Node/Blocks/Fragment/twirlBlock.js +3 -0
  131. package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
  132. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.d.ts +6 -0
  133. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -0
  134. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  135. package/Materials/Node/Blocks/Input/inputBlock.d.ts +16 -0
  136. package/Materials/Node/Blocks/Input/inputBlock.js +16 -1
  137. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  138. package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +5 -0
  139. package/Materials/Node/Blocks/Input/prePassTextureBlock.js +5 -0
  140. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  141. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +10 -0
  142. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +10 -1
  143. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  144. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +23 -0
  145. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +23 -1
  146. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  147. package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +17 -0
  148. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +17 -0
  149. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  150. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +41 -0
  151. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +41 -0
  152. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  153. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +21 -0
  154. package/Materials/Node/Blocks/PBR/reflectionBlock.js +21 -0
  155. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  156. package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +29 -0
  157. package/Materials/Node/Blocks/PBR/refractionBlock.js +29 -0
  158. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  159. package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +14 -0
  160. package/Materials/Node/Blocks/PBR/sheenBlock.js +14 -0
  161. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  162. package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +7 -0
  163. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +7 -0
  164. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  165. package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +23 -0
  166. package/Materials/Node/Blocks/Particle/particleTextureBlock.js +23 -0
  167. package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
  168. package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +6 -0
  169. package/Materials/Node/Blocks/Teleport/teleportInBlock.js +6 -0
  170. package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  171. package/Materials/Node/Blocks/Teleport/teleportOutBlock.d.ts +17 -0
  172. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +17 -0
  173. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  174. package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +22 -0
  175. package/Materials/Node/Blocks/Vertex/bonesBlock.js +22 -0
  176. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  177. package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +13 -0
  178. package/Materials/Node/Blocks/Vertex/instancesBlock.js +13 -0
  179. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  180. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +20 -0
  181. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +20 -0
  182. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  183. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +27 -0
  184. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +27 -0
  185. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  186. package/Materials/Node/Blocks/clampBlock.d.ts +10 -0
  187. package/Materials/Node/Blocks/clampBlock.js +10 -0
  188. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  189. package/Materials/Node/Blocks/cloudBlock.d.ts +10 -0
  190. package/Materials/Node/Blocks/cloudBlock.js +10 -0
  191. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  192. package/Materials/Node/Blocks/colorMergerBlock.d.ts +10 -0
  193. package/Materials/Node/Blocks/colorMergerBlock.js +10 -0
  194. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  195. package/Materials/Node/Blocks/conditionalBlock.d.ts +14 -0
  196. package/Materials/Node/Blocks/conditionalBlock.js +14 -0
  197. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  198. package/Materials/Node/Blocks/curveBlock.d.ts +10 -0
  199. package/Materials/Node/Blocks/curveBlock.js +10 -0
  200. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  201. package/Materials/Node/Blocks/customBlock.d.ts +10 -0
  202. package/Materials/Node/Blocks/customBlock.js +10 -0
  203. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  204. package/Materials/Node/Blocks/debugBlock.d.ts +10 -0
  205. package/Materials/Node/Blocks/debugBlock.js +10 -0
  206. package/Materials/Node/Blocks/debugBlock.js.map +1 -1
  207. package/Materials/Node/Blocks/fresnelBlock.d.ts +4 -0
  208. package/Materials/Node/Blocks/fresnelBlock.js +4 -0
  209. package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
  210. package/Materials/Node/Blocks/gradientBlock.d.ts +10 -0
  211. package/Materials/Node/Blocks/gradientBlock.js +10 -0
  212. package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
  213. package/Materials/Node/Blocks/loopBlock.d.ts +10 -0
  214. package/Materials/Node/Blocks/loopBlock.js +10 -0
  215. package/Materials/Node/Blocks/loopBlock.js.map +1 -1
  216. package/Materials/Node/Blocks/matrixBuilderBlock.d.ts +1 -0
  217. package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -0
  218. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  219. package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +10 -0
  220. package/Materials/Node/Blocks/meshAttributeExistsBlock.js +10 -0
  221. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  222. package/Materials/Node/Blocks/pannerBlock.d.ts +5 -0
  223. package/Materials/Node/Blocks/pannerBlock.js +5 -0
  224. package/Materials/Node/Blocks/pannerBlock.js.map +1 -1
  225. package/Materials/Node/Blocks/remapBlock.d.ts +10 -0
  226. package/Materials/Node/Blocks/remapBlock.js +10 -0
  227. package/Materials/Node/Blocks/remapBlock.js.map +1 -1
  228. package/Materials/Node/Blocks/rotate2dBlock.d.ts +1 -0
  229. package/Materials/Node/Blocks/rotate2dBlock.js +1 -0
  230. package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
  231. package/Materials/Node/Blocks/transformBlock.d.ts +10 -0
  232. package/Materials/Node/Blocks/transformBlock.js +10 -0
  233. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  234. package/Materials/Node/Blocks/triPlanarBlock.d.ts +22 -0
  235. package/Materials/Node/Blocks/triPlanarBlock.js +22 -0
  236. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  237. package/Materials/Node/Blocks/trigonometryBlock.d.ts +10 -0
  238. package/Materials/Node/Blocks/trigonometryBlock.js +10 -0
  239. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  240. package/Materials/Node/Blocks/vectorMergerBlock.d.ts +10 -0
  241. package/Materials/Node/Blocks/vectorMergerBlock.js +10 -0
  242. package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
  243. package/Materials/Node/Blocks/viewDirectionBlock.d.ts +5 -0
  244. package/Materials/Node/Blocks/viewDirectionBlock.js +5 -0
  245. package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
  246. package/Materials/Node/Blocks/waveBlock.d.ts +10 -0
  247. package/Materials/Node/Blocks/waveBlock.js +10 -0
  248. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  249. package/Materials/Node/Blocks/worleyNoise3DBlock.d.ts +1 -0
  250. package/Materials/Node/Blocks/worleyNoise3DBlock.js +1 -0
  251. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  252. package/Materials/Node/nodeMaterial.d.ts +13 -0
  253. package/Materials/Node/nodeMaterial.js +14 -2
  254. package/Materials/Node/nodeMaterial.js.map +1 -1
  255. package/Materials/Node/nodeMaterialBlock.d.ts +0 -3
  256. package/Materials/Node/nodeMaterialBlock.js +1 -6
  257. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  258. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -2
  259. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  260. package/Materials/Textures/mirrorTexture.js +1 -1
  261. package/Materials/Textures/mirrorTexture.js.map +1 -1
  262. package/Materials/index.d.ts +2 -0
  263. package/Materials/index.js +2 -0
  264. package/Materials/index.js.map +1 -1
  265. package/Maths/math.constants.d.ts +2 -1
  266. package/Maths/math.constants.js +3 -2
  267. package/Maths/math.constants.js.map +1 -1
  268. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +17 -1
  269. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  270. package/Meshes/instancedMesh.js +1 -0
  271. package/Meshes/instancedMesh.js.map +1 -1
  272. package/Meshes/mesh.d.ts +5 -0
  273. package/Meshes/mesh.js +39 -16
  274. package/Meshes/mesh.js.map +1 -1
  275. package/Misc/dataStorage.d.ts +13 -0
  276. package/Misc/dataStorage.js +25 -0
  277. package/Misc/dataStorage.js.map +1 -1
  278. package/Morph/morphTarget.d.ts +9 -5
  279. package/Morph/morphTarget.js +15 -7
  280. package/Morph/morphTarget.js.map +1 -1
  281. package/Morph/morphTargetManager.d.ts +3 -1
  282. package/Morph/morphTargetManager.js +5 -2
  283. package/Morph/morphTargetManager.js.map +1 -1
  284. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +1 -1
  285. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  286. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +1 -1
  287. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
  288. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +1 -1
  289. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
  290. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +1 -1
  291. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
  292. package/Particles/Node/Blocks/Emitters/emitters.functions.js +3 -3
  293. package/Particles/Node/Blocks/Emitters/emitters.functions.js.map +1 -1
  294. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +1 -1
  295. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  296. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +1 -1
  297. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
  298. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +1 -1
  299. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
  300. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +2 -2
  301. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
  302. package/Particles/Node/Blocks/Update/updateNoiseBlock.js +7 -7
  303. package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
  304. package/Particles/Node/Blocks/particleLocalVariableBlock.js +2 -2
  305. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
  306. package/Particles/Node/nodeParticleBuildState.js +7 -7
  307. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  308. package/Particles/Node/nodeParticleSystemSet.helper.js +9 -4
  309. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  310. package/Particles/particle.d.ts +73 -61
  311. package/Particles/particle.js +106 -91
  312. package/Particles/particle.js.map +1 -1
  313. package/Particles/particleSystem.js +5 -5
  314. package/Particles/particleSystem.js.map +1 -1
  315. package/Particles/thinParticleSystem.function.js +83 -83
  316. package/Particles/thinParticleSystem.function.js.map +1 -1
  317. package/Particles/thinParticleSystem.js +8 -8
  318. package/Particles/thinParticleSystem.js.map +1 -1
  319. package/Physics/v2/Plugins/havokPlugin.d.ts +14 -1
  320. package/Physics/v2/Plugins/havokPlugin.js +154 -10
  321. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  322. package/Probes/reflectionProbe.js +9 -6
  323. package/Probes/reflectionProbe.js.map +1 -1
  324. package/Rendering/objectRenderer.d.ts +3 -1
  325. package/Rendering/objectRenderer.js +28 -8
  326. package/Rendering/objectRenderer.js.map +1 -1
  327. package/Rendering/reflectiveShadowMap.js +1 -1
  328. package/Rendering/reflectiveShadowMap.js.map +1 -1
  329. package/Rendering/thinDepthPeelingRenderer.js +8 -0
  330. package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
  331. package/Shaders/gaussianSplatting.fragment.js +8 -2
  332. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  333. package/Shaders/gaussianSplatting.vertex.js +8 -2
  334. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  335. package/ShadersWGSL/gaussianSplatting.fragment.js +7 -1
  336. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  337. package/ShadersWGSL/gaussianSplatting.vertex.js +8 -2
  338. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  339. package/package.json +1 -1
  340. package/scene.d.ts +22 -1
  341. package/scene.js +15 -15
  342. package/scene.js.map +1 -1
@@ -4,6 +4,77 @@ import { Color4 } from "../Maths/math.color.js";
4
4
  import type { SubEmitter } from "./subEmitter.js";
5
5
  import type { ColorGradient, FactorGradient } from "../Misc/gradients.js";
6
6
  import type { ThinParticleSystem } from "./thinParticleSystem.js";
7
+ /**
8
+ * @internal
9
+ * Holds all internal properties of a Particle, grouped into a single sub-object
10
+ * to keep the Particle's own property count low (V8 in-object property limit).
11
+ */
12
+ declare class ParticleInternalProperties {
13
+ /** @internal */
14
+ randomCellOffset?: number;
15
+ /** @internal */
16
+ initialDirection: Nullable<Vector3>;
17
+ /** @internal */
18
+ attachedSubEmitters: Nullable<Array<SubEmitter>>;
19
+ /** @internal */
20
+ initialStartSpriteCellId: number;
21
+ /** @internal */
22
+ initialEndSpriteCellId: number;
23
+ /** @internal */
24
+ initialSpriteCellLoop: boolean;
25
+ /** @internal */
26
+ currentColorGradient: Nullable<ColorGradient>;
27
+ /** @internal */
28
+ currentColor1: Color4;
29
+ /** @internal */
30
+ currentColor2: Color4;
31
+ /** @internal */
32
+ currentSizeGradient: Nullable<FactorGradient>;
33
+ /** @internal */
34
+ currentSize1: number;
35
+ /** @internal */
36
+ currentSize2: number;
37
+ /** @internal */
38
+ currentAngularSpeedGradient: Nullable<FactorGradient>;
39
+ /** @internal */
40
+ currentAngularSpeed1: number;
41
+ /** @internal */
42
+ currentAngularSpeed2: number;
43
+ /** @internal */
44
+ currentVelocityGradient: Nullable<FactorGradient>;
45
+ /** @internal */
46
+ currentVelocity1: number;
47
+ /** @internal */
48
+ currentVelocity2: number;
49
+ /** @internal */
50
+ directionScale: number;
51
+ /** @internal */
52
+ scaledDirection: Vector3;
53
+ /** @internal */
54
+ currentLimitVelocityGradient: Nullable<FactorGradient>;
55
+ /** @internal */
56
+ currentLimitVelocity1: number;
57
+ /** @internal */
58
+ currentLimitVelocity2: number;
59
+ /** @internal */
60
+ currentDragGradient: Nullable<FactorGradient>;
61
+ /** @internal */
62
+ currentDrag1: number;
63
+ /** @internal */
64
+ currentDrag2: number;
65
+ /** @internal */
66
+ randomNoiseCoordinates1: Nullable<Vector3>;
67
+ /** @internal */
68
+ randomNoiseCoordinates2: Nullable<Vector3>;
69
+ /** @internal */
70
+ localPosition?: Vector3;
71
+ /**
72
+ * Callback triggered when the particle is reset
73
+ */
74
+ onReset: Nullable<() => void>;
75
+ /** @internal */
76
+ reset(): void;
77
+ }
7
78
  /**
8
79
  * A particle represents one of the element emitted by a particle system.
9
80
  * This is mainly define by its coordinates, direction, velocity and age.
@@ -75,67 +146,7 @@ export declare class Particle {
75
146
  */
76
147
  remapData: Vector4;
77
148
  /** @internal */
78
- _randomCellOffset?: number;
79
- /** @internal */
80
- _initialDirection: Nullable<Vector3>;
81
- /** @internal */
82
- _attachedSubEmitters: Nullable<Array<SubEmitter>>;
83
- /** @internal */
84
- _initialStartSpriteCellId: number;
85
- /** @internal */
86
- _initialEndSpriteCellId: number;
87
- /** @internal */
88
- _initialSpriteCellLoop: boolean;
89
- /** @internal */
90
- _currentColorGradient: Nullable<ColorGradient>;
91
- /** @internal */
92
- _currentColor1: Color4;
93
- /** @internal */
94
- _currentColor2: Color4;
95
- /** @internal */
96
- _currentSizeGradient: Nullable<FactorGradient>;
97
- /** @internal */
98
- _currentSize1: number;
99
- /** @internal */
100
- _currentSize2: number;
101
- /** @internal */
102
- _currentAngularSpeedGradient: Nullable<FactorGradient>;
103
- /** @internal */
104
- _currentAngularSpeed1: number;
105
- /** @internal */
106
- _currentAngularSpeed2: number;
107
- /** @internal */
108
- _currentVelocityGradient: Nullable<FactorGradient>;
109
- /** @internal */
110
- _currentVelocity1: number;
111
- /** @internal */
112
- _currentVelocity2: number;
113
- /** @internal */
114
- _directionScale: number;
115
- /** @internal */
116
- _scaledDirection: Vector3;
117
- /** @internal */
118
- _currentLimitVelocityGradient: Nullable<FactorGradient>;
119
- /** @internal */
120
- _currentLimitVelocity1: number;
121
- /** @internal */
122
- _currentLimitVelocity2: number;
123
- /** @internal */
124
- _currentDragGradient: Nullable<FactorGradient>;
125
- /** @internal */
126
- _currentDrag1: number;
127
- /** @internal */
128
- _currentDrag2: number;
129
- /** @internal */
130
- _randomNoiseCoordinates1: Nullable<Vector3>;
131
- /** @internal */
132
- _randomNoiseCoordinates2: Nullable<Vector3>;
133
- /** @internal */
134
- _localPosition?: Vector3;
135
- /**
136
- * Callback triggered when the particle is reset
137
- */
138
- onReset: Nullable<() => void>;
149
+ _properties: ParticleInternalProperties;
139
150
  /**
140
151
  * Creates a new instance Particle
141
152
  * @param particleSystem the particle system the particle belongs to
@@ -164,3 +175,4 @@ export declare class Particle {
164
175
  */
165
176
  copyTo(other: Particle): void;
166
177
  }
178
+ export {};
@@ -1,6 +1,55 @@
1
1
  import { Vector2, Vector3, TmpVectors, Vector4 } from "../Maths/math.vector.js";
2
2
  import { Color4 } from "../Maths/math.color.js";
3
3
  import { Clamp } from "../Maths/math.scalar.functions.js";
4
+ /**
5
+ * @internal
6
+ * Holds all internal properties of a Particle, grouped into a single sub-object
7
+ * to keep the Particle's own property count low (V8 in-object property limit).
8
+ */
9
+ class ParticleInternalProperties {
10
+ constructor() {
11
+ /** @internal */
12
+ this.attachedSubEmitters = null;
13
+ /** @internal */
14
+ this.currentColor1 = new Color4(0, 0, 0, 0);
15
+ /** @internal */
16
+ this.currentColor2 = new Color4(0, 0, 0, 0);
17
+ /** @internal */
18
+ this.currentSize1 = 0;
19
+ /** @internal */
20
+ this.currentSize2 = 0;
21
+ /** @internal */
22
+ this.currentAngularSpeed1 = 0;
23
+ /** @internal */
24
+ this.currentAngularSpeed2 = 0;
25
+ /** @internal */
26
+ this.currentVelocity1 = 0;
27
+ /** @internal */
28
+ this.currentVelocity2 = 0;
29
+ /** @internal */
30
+ this.scaledDirection = Vector3.Zero();
31
+ /** @internal */
32
+ this.currentLimitVelocity1 = 0;
33
+ /** @internal */
34
+ this.currentLimitVelocity2 = 0;
35
+ /** @internal */
36
+ this.currentDrag1 = 0;
37
+ /** @internal */
38
+ this.currentDrag2 = 0;
39
+ }
40
+ /** @internal */
41
+ reset() {
42
+ this.currentColorGradient = null;
43
+ this.currentSizeGradient = null;
44
+ this.currentAngularSpeedGradient = null;
45
+ this.currentVelocityGradient = null;
46
+ this.currentLimitVelocityGradient = null;
47
+ this.currentDragGradient = null;
48
+ this.randomCellOffset = undefined;
49
+ this.randomNoiseCoordinates1 = null;
50
+ this.randomNoiseCoordinates2 = null;
51
+ }
52
+ }
4
53
  /**
5
54
  * A particle represents one of the element emitted by a particle system.
6
55
  * This is mainly define by its coordinates, direction, velocity and age.
@@ -69,33 +118,7 @@ export class Particle {
69
118
  */
70
119
  this.cellIndex = 0;
71
120
  /** @internal */
72
- this._attachedSubEmitters = null;
73
- /** @internal */
74
- this._currentColor1 = new Color4(0, 0, 0, 0);
75
- /** @internal */
76
- this._currentColor2 = new Color4(0, 0, 0, 0);
77
- /** @internal */
78
- this._currentSize1 = 0;
79
- /** @internal */
80
- this._currentSize2 = 0;
81
- /** @internal */
82
- this._currentAngularSpeed1 = 0;
83
- /** @internal */
84
- this._currentAngularSpeed2 = 0;
85
- /** @internal */
86
- this._currentVelocity1 = 0;
87
- /** @internal */
88
- this._currentVelocity2 = 0;
89
- /** @internal */
90
- this._scaledDirection = Vector3.Zero();
91
- /** @internal */
92
- this._currentLimitVelocity1 = 0;
93
- /** @internal */
94
- this._currentLimitVelocity2 = 0;
95
- /** @internal */
96
- this._currentDrag1 = 0;
97
- /** @internal */
98
- this._currentDrag2 = 0;
121
+ this._properties = new ParticleInternalProperties();
99
122
  this.id = Particle._Count++;
100
123
  if (!this.particleSystem.isAnimationSheetEnabled) {
101
124
  return;
@@ -112,27 +135,27 @@ export class Particle {
112
135
  let offsetAge = this.age;
113
136
  let changeSpeed = this.particleSystem.spriteCellChangeSpeed;
114
137
  if (this.particleSystem.spriteRandomStartCell) {
115
- if (this._randomCellOffset === undefined) {
116
- this._randomCellOffset = Math.random() * this.lifeTime;
138
+ if (this._properties.randomCellOffset === undefined) {
139
+ this._properties.randomCellOffset = Math.random() * this.lifeTime;
117
140
  }
118
141
  if (changeSpeed === 0) {
119
142
  // Special case when speed = 0 meaning we want to stay on initial cell
120
143
  changeSpeed = 1;
121
- offsetAge = this._randomCellOffset;
144
+ offsetAge = this._properties.randomCellOffset;
122
145
  }
123
146
  else {
124
- offsetAge += this._randomCellOffset;
147
+ offsetAge += this._properties.randomCellOffset;
125
148
  }
126
149
  }
127
- const dist = this._initialEndSpriteCellId - this._initialStartSpriteCellId + 1;
150
+ const dist = this._properties.initialEndSpriteCellId - this._properties.initialStartSpriteCellId + 1;
128
151
  let ratio;
129
- if (this._initialSpriteCellLoop) {
152
+ if (this._properties.initialSpriteCellLoop) {
130
153
  ratio = Clamp(((offsetAge * changeSpeed) % this.lifeTime) / this.lifeTime);
131
154
  }
132
155
  else {
133
156
  ratio = Clamp((offsetAge * changeSpeed) / this.lifeTime);
134
157
  }
135
- this.cellIndex = (this._initialStartSpriteCellId + ratio * dist) | 0;
158
+ this.cellIndex = (this._properties.initialStartSpriteCellId + ratio * dist) | 0;
136
159
  }
137
160
  /**
138
161
  * @internal
@@ -157,29 +180,21 @@ export class Particle {
157
180
  }
158
181
  /** @internal */
159
182
  _inheritParticleInfoToSubEmitters() {
160
- if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {
161
- for (const subEmitter of this._attachedSubEmitters) {
183
+ if (this._properties.attachedSubEmitters && this._properties.attachedSubEmitters.length > 0) {
184
+ for (const subEmitter of this._properties.attachedSubEmitters) {
162
185
  this._inheritParticleInfoToSubEmitter(subEmitter);
163
186
  }
164
187
  }
165
188
  }
166
189
  /** @internal */
167
190
  _reset() {
168
- if (this.onReset) {
169
- this.onReset();
191
+ if (this._properties.onReset) {
192
+ this._properties.onReset();
170
193
  }
171
194
  this.age = 0;
172
195
  this.id = Particle._Count++;
173
- this._currentColorGradient = null;
174
- this._currentSizeGradient = null;
175
- this._currentAngularSpeedGradient = null;
176
- this._currentVelocityGradient = null;
177
- this._currentLimitVelocityGradient = null;
178
- this._currentDragGradient = null;
196
+ this._properties.reset();
179
197
  this.cellIndex = this.particleSystem.startSpriteCellID;
180
- this._randomCellOffset = undefined;
181
- this._randomNoiseCoordinates1 = null;
182
- this._randomNoiseCoordinates2 = null;
183
198
  }
184
199
  /**
185
200
  * Copy the properties of particle to another one.
@@ -187,24 +202,24 @@ export class Particle {
187
202
  */
188
203
  copyTo(other) {
189
204
  other.position.copyFrom(this.position);
190
- if (this._initialDirection) {
191
- if (other._initialDirection) {
192
- other._initialDirection.copyFrom(this._initialDirection);
205
+ if (this._properties.initialDirection) {
206
+ if (other._properties.initialDirection) {
207
+ other._properties.initialDirection.copyFrom(this._properties.initialDirection);
193
208
  }
194
209
  else {
195
- other._initialDirection = this._initialDirection.clone();
210
+ other._properties.initialDirection = this._properties.initialDirection.clone();
196
211
  }
197
212
  }
198
213
  else {
199
- other._initialDirection = null;
214
+ other._properties.initialDirection = null;
200
215
  }
201
216
  other.direction.copyFrom(this.direction);
202
- if (this._localPosition) {
203
- if (other._localPosition) {
204
- other._localPosition.copyFrom(this._localPosition);
217
+ if (this._properties.localPosition) {
218
+ if (other._properties.localPosition) {
219
+ other._properties.localPosition.copyFrom(this._properties.localPosition);
205
220
  }
206
221
  else {
207
- other._localPosition = this._localPosition.clone();
222
+ other._properties.localPosition = this._properties.localPosition.clone();
208
223
  }
209
224
  }
210
225
  other.color.copyFrom(this.color);
@@ -213,7 +228,7 @@ export class Particle {
213
228
  other.colorDead.copyFrom(this.colorDead);
214
229
  other.lifeTime = this.lifeTime;
215
230
  other.age = this.age;
216
- other._randomCellOffset = this._randomCellOffset;
231
+ other._properties.randomCellOffset = this._properties.randomCellOffset;
217
232
  other.size = this.size;
218
233
  other.scale.copyFrom(this.scale);
219
234
  other.angle = this.angle;
@@ -221,41 +236,41 @@ export class Particle {
221
236
  other.particleSystem = this.particleSystem;
222
237
  other.cellIndex = this.cellIndex;
223
238
  other.id = this.id;
224
- other._attachedSubEmitters = this._attachedSubEmitters;
225
- if (this._currentColorGradient) {
226
- other._currentColorGradient = this._currentColorGradient;
227
- other._currentColor1.copyFrom(this._currentColor1);
228
- other._currentColor2.copyFrom(this._currentColor2);
239
+ other._properties.attachedSubEmitters = this._properties.attachedSubEmitters;
240
+ if (this._properties.currentColorGradient) {
241
+ other._properties.currentColorGradient = this._properties.currentColorGradient;
242
+ other._properties.currentColor1.copyFrom(this._properties.currentColor1);
243
+ other._properties.currentColor2.copyFrom(this._properties.currentColor2);
229
244
  }
230
- if (this._currentSizeGradient) {
231
- other._currentSizeGradient = this._currentSizeGradient;
232
- other._currentSize1 = this._currentSize1;
233
- other._currentSize2 = this._currentSize2;
245
+ if (this._properties.currentSizeGradient) {
246
+ other._properties.currentSizeGradient = this._properties.currentSizeGradient;
247
+ other._properties.currentSize1 = this._properties.currentSize1;
248
+ other._properties.currentSize2 = this._properties.currentSize2;
234
249
  }
235
- if (this._currentAngularSpeedGradient) {
236
- other._currentAngularSpeedGradient = this._currentAngularSpeedGradient;
237
- other._currentAngularSpeed1 = this._currentAngularSpeed1;
238
- other._currentAngularSpeed2 = this._currentAngularSpeed2;
250
+ if (this._properties.currentAngularSpeedGradient) {
251
+ other._properties.currentAngularSpeedGradient = this._properties.currentAngularSpeedGradient;
252
+ other._properties.currentAngularSpeed1 = this._properties.currentAngularSpeed1;
253
+ other._properties.currentAngularSpeed2 = this._properties.currentAngularSpeed2;
239
254
  }
240
- if (this._currentVelocityGradient) {
241
- other._currentVelocityGradient = this._currentVelocityGradient;
242
- other._currentVelocity1 = this._currentVelocity1;
243
- other._currentVelocity2 = this._currentVelocity2;
255
+ if (this._properties.currentVelocityGradient) {
256
+ other._properties.currentVelocityGradient = this._properties.currentVelocityGradient;
257
+ other._properties.currentVelocity1 = this._properties.currentVelocity1;
258
+ other._properties.currentVelocity2 = this._properties.currentVelocity2;
244
259
  }
245
- if (this._currentLimitVelocityGradient) {
246
- other._currentLimitVelocityGradient = this._currentLimitVelocityGradient;
247
- other._currentLimitVelocity1 = this._currentLimitVelocity1;
248
- other._currentLimitVelocity2 = this._currentLimitVelocity2;
260
+ if (this._properties.currentLimitVelocityGradient) {
261
+ other._properties.currentLimitVelocityGradient = this._properties.currentLimitVelocityGradient;
262
+ other._properties.currentLimitVelocity1 = this._properties.currentLimitVelocity1;
263
+ other._properties.currentLimitVelocity2 = this._properties.currentLimitVelocity2;
249
264
  }
250
- if (this._currentDragGradient) {
251
- other._currentDragGradient = this._currentDragGradient;
252
- other._currentDrag1 = this._currentDrag1;
253
- other._currentDrag2 = this._currentDrag2;
265
+ if (this._properties.currentDragGradient) {
266
+ other._properties.currentDragGradient = this._properties.currentDragGradient;
267
+ other._properties.currentDrag1 = this._properties.currentDrag1;
268
+ other._properties.currentDrag2 = this._properties.currentDrag2;
254
269
  }
255
270
  if (this.particleSystem.isAnimationSheetEnabled) {
256
- other._initialStartSpriteCellId = this._initialStartSpriteCellId;
257
- other._initialEndSpriteCellId = this._initialEndSpriteCellId;
258
- other._initialSpriteCellLoop = this._initialSpriteCellLoop;
271
+ other._properties.initialStartSpriteCellId = this._properties.initialStartSpriteCellId;
272
+ other._properties.initialEndSpriteCellId = this._properties.initialEndSpriteCellId;
273
+ other._properties.initialSpriteCellLoop = this._properties.initialSpriteCellLoop;
259
274
  }
260
275
  if (this.particleSystem.useRampGradients) {
261
276
  if (other.remapData && this.remapData) {
@@ -265,14 +280,14 @@ export class Particle {
265
280
  other.remapData = new Vector4(0, 0, 0, 0);
266
281
  }
267
282
  }
268
- if (this._randomNoiseCoordinates1 && this._randomNoiseCoordinates2) {
269
- if (other._randomNoiseCoordinates1 && other._randomNoiseCoordinates2) {
270
- other._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1);
271
- other._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2);
283
+ if (this._properties.randomNoiseCoordinates1 && this._properties.randomNoiseCoordinates2) {
284
+ if (other._properties.randomNoiseCoordinates1 && other._properties.randomNoiseCoordinates2) {
285
+ other._properties.randomNoiseCoordinates1.copyFrom(this._properties.randomNoiseCoordinates1);
286
+ other._properties.randomNoiseCoordinates2.copyFrom(this._properties.randomNoiseCoordinates2);
272
287
  }
273
288
  else {
274
- other._randomNoiseCoordinates1 = this._randomNoiseCoordinates1.clone();
275
- other._randomNoiseCoordinates2 = this._randomNoiseCoordinates2.clone();
289
+ other._properties.randomNoiseCoordinates1 = this._properties.randomNoiseCoordinates1.clone();
290
+ other._properties.randomNoiseCoordinates2 = this._properties.randomNoiseCoordinates2.clone();
276
291
  }
277
292
  }
278
293
  }
@@ -1 +1 @@
1
- {"version":3,"file":"particle.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/particle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAyJjB;;;OAGG;IACH;IACI;;OAEG;IACI,cAAkC;QAAlC,mBAAc,GAAd,cAAc,CAAoB;QA3J7C;;WAEG;QACI,aAAQ,GAAG,OAAO,CA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,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC;QACD,IAAI,IAAI,CAAC,wBAAwB,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACjE,IAAI,KAAK,CAAC,wBAAwB,IAAI,KAAK,CAAC,wBAAwB,EAAE,CAAC;gBACnE,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;gBACvE,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAC3E,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;gBACvE,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;YAC3E,CAAC;QACL,CAAC;IACL,CAAC;;AAvVc,eAAM,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector2, Vector3, TmpVectors, Vector4 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { SubEmitter } from \"./subEmitter\";\r\nimport type { ColorGradient, FactorGradient } from \"../Misc/gradients\";\r\n\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { ThinParticleSystem } from \"./thinParticleSystem\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\n\r\n/**\r\n * A particle represents one of the element emitted by a particle system.\r\n * This is mainly define by its coordinates, direction, velocity and age.\r\n */\r\nexport class Particle {\r\n private static _Count = 0;\r\n /**\r\n * Unique ID of the particle\r\n */\r\n public id: number;\r\n /**\r\n * The world position of the particle in the scene.\r\n */\r\n public position = Vector3.Zero();\r\n\r\n /**\r\n * The world direction of the particle in the scene.\r\n */\r\n public direction = Vector3.Zero();\r\n\r\n /**\r\n * The color of the particle.\r\n */\r\n public color = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The color change of the particle per step.\r\n */\r\n public colorStep = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The creation color of the particle.\r\n */\r\n public initialColor = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The color used when the end of life of the particle.\r\n */\r\n public colorDead = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * Defines how long will the life of the particle be.\r\n */\r\n public lifeTime = 1.0;\r\n\r\n /**\r\n * The current age of the particle.\r\n */\r\n public age = 0;\r\n\r\n /**\r\n * The current size of the particle.\r\n */\r\n public size = 0;\r\n\r\n /**\r\n * The current scale of the particle.\r\n */\r\n public scale = new Vector2(1, 1);\r\n\r\n /**\r\n * The current angle of the particle.\r\n */\r\n public angle = 0;\r\n\r\n /**\r\n * Defines how fast is the angle changing.\r\n */\r\n public angularSpeed = 0;\r\n\r\n /**\r\n * Defines the cell index used by the particle to be rendered from a sprite.\r\n */\r\n public cellIndex: number = 0;\r\n\r\n /**\r\n * The information required to support color remapping\r\n */\r\n public remapData: Vector4;\r\n\r\n /** @internal */\r\n public _randomCellOffset?: number;\r\n\r\n /** @internal */\r\n public _initialDirection: Nullable<Vector3>;\r\n\r\n /** @internal */\r\n public _attachedSubEmitters: Nullable<Array<SubEmitter>> = null;\r\n\r\n /** @internal */\r\n public _initialStartSpriteCellId: number;\r\n /** @internal */\r\n public _initialEndSpriteCellId: number;\r\n /** @internal */\r\n public _initialSpriteCellLoop: boolean;\r\n\r\n /** @internal */\r\n public _currentColorGradient: Nullable<ColorGradient>;\r\n /** @internal */\r\n public _currentColor1 = new Color4(0, 0, 0, 0);\r\n /** @internal */\r\n public _currentColor2 = new Color4(0, 0, 0, 0);\r\n\r\n /** @internal */\r\n public _currentSizeGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentSize1 = 0;\r\n /** @internal */\r\n public _currentSize2 = 0;\r\n\r\n /** @internal */\r\n public _currentAngularSpeedGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentAngularSpeed1 = 0;\r\n /** @internal */\r\n public _currentAngularSpeed2 = 0;\r\n\r\n /** @internal */\r\n public _currentVelocityGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentVelocity1 = 0;\r\n /** @internal */\r\n public _currentVelocity2 = 0;\r\n\r\n /** @internal */\r\n public _directionScale: number;\r\n\r\n /** @internal */\r\n public _scaledDirection = Vector3.Zero();\r\n\r\n /** @internal */\r\n public _currentLimitVelocityGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentLimitVelocity1 = 0;\r\n /** @internal */\r\n public _currentLimitVelocity2 = 0;\r\n\r\n /** @internal */\r\n public _currentDragGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentDrag1 = 0;\r\n /** @internal */\r\n public _currentDrag2 = 0;\r\n\r\n /** @internal */\r\n public _randomNoiseCoordinates1: Nullable<Vector3>;\r\n /** @internal */\r\n public _randomNoiseCoordinates2: Nullable<Vector3>;\r\n\r\n /** @internal */\r\n public _localPosition?: Vector3;\r\n\r\n /**\r\n * Callback triggered when the particle is reset\r\n */\r\n public onReset: Nullable<() => void>;\r\n\r\n /**\r\n * Creates a new instance Particle\r\n * @param particleSystem the particle system the particle belongs to\r\n */\r\n constructor(\r\n /**\r\n * The particle system the particle belongs to.\r\n */\r\n public particleSystem: ThinParticleSystem\r\n ) {\r\n this.id = Particle._Count++;\r\n if (!this.particleSystem.isAnimationSheetEnabled) {\r\n return;\r\n }\r\n\r\n this._updateCellInfoFromSystem();\r\n }\r\n\r\n private _updateCellInfoFromSystem(): void {\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n }\r\n\r\n /**\r\n * Defines how the sprite cell index is updated for the particle\r\n */\r\n public updateCellIndex(): void {\r\n let offsetAge = this.age;\r\n let changeSpeed = this.particleSystem.spriteCellChangeSpeed;\r\n\r\n if (this.particleSystem.spriteRandomStartCell) {\r\n if (this._randomCellOffset === undefined) {\r\n this._randomCellOffset = Math.random() * this.lifeTime;\r\n }\r\n\r\n if (changeSpeed === 0) {\r\n // Special case when speed = 0 meaning we want to stay on initial cell\r\n changeSpeed = 1;\r\n offsetAge = this._randomCellOffset;\r\n } else {\r\n offsetAge += this._randomCellOffset;\r\n }\r\n }\r\n\r\n const dist = this._initialEndSpriteCellId - this._initialStartSpriteCellId + 1;\r\n let ratio: number;\r\n if (this._initialSpriteCellLoop) {\r\n ratio = Clamp(((offsetAge * changeSpeed) % this.lifeTime) / this.lifeTime);\r\n } else {\r\n ratio = Clamp((offsetAge * changeSpeed) / this.lifeTime);\r\n }\r\n this.cellIndex = (this._initialStartSpriteCellId + ratio * dist) | 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _inheritParticleInfoToSubEmitter(subEmitter: SubEmitter) {\r\n if ((<AbstractMesh>subEmitter.particleSystem.emitter).position) {\r\n const emitterMesh = <AbstractMesh>subEmitter.particleSystem.emitter;\r\n emitterMesh.position.copyFrom(this.position);\r\n if (subEmitter.inheritDirection) {\r\n const temp = TmpVectors.Vector3[0];\r\n this.direction.normalizeToRef(temp);\r\n emitterMesh.setDirection(temp, 0, Math.PI / 2);\r\n }\r\n } else {\r\n const emitterPosition = <Vector3>subEmitter.particleSystem.emitter;\r\n emitterPosition.copyFrom(this.position);\r\n }\r\n // Set inheritedVelocityOffset to be used when new particles are created\r\n this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, TmpVectors.Vector3[0]);\r\n subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(TmpVectors.Vector3[0]);\r\n }\r\n\r\n /** @internal */\r\n public _inheritParticleInfoToSubEmitters() {\r\n if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {\r\n for (const subEmitter of this._attachedSubEmitters) {\r\n this._inheritParticleInfoToSubEmitter(subEmitter);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _reset() {\r\n if (this.onReset) {\r\n this.onReset();\r\n }\r\n this.age = 0;\r\n this.id = Particle._Count++;\r\n this._currentColorGradient = null;\r\n this._currentSizeGradient = null;\r\n this._currentAngularSpeedGradient = null;\r\n this._currentVelocityGradient = null;\r\n this._currentLimitVelocityGradient = null;\r\n this._currentDragGradient = null;\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n this._randomCellOffset = undefined;\r\n this._randomNoiseCoordinates1 = null;\r\n this._randomNoiseCoordinates2 = null;\r\n }\r\n\r\n /**\r\n * Copy the properties of particle to another one.\r\n * @param other the particle to copy the information to.\r\n */\r\n public copyTo(other: Particle) {\r\n other.position.copyFrom(this.position);\r\n if (this._initialDirection) {\r\n if (other._initialDirection) {\r\n other._initialDirection.copyFrom(this._initialDirection);\r\n } else {\r\n other._initialDirection = this._initialDirection.clone();\r\n }\r\n } else {\r\n other._initialDirection = null;\r\n }\r\n other.direction.copyFrom(this.direction);\r\n if (this._localPosition) {\r\n if (other._localPosition) {\r\n other._localPosition.copyFrom(this._localPosition);\r\n } else {\r\n other._localPosition = this._localPosition.clone();\r\n }\r\n }\r\n other.color.copyFrom(this.color);\r\n other.colorStep.copyFrom(this.colorStep);\r\n other.initialColor.copyFrom(this.initialColor);\r\n other.colorDead.copyFrom(this.colorDead);\r\n other.lifeTime = this.lifeTime;\r\n other.age = this.age;\r\n other._randomCellOffset = this._randomCellOffset;\r\n other.size = this.size;\r\n other.scale.copyFrom(this.scale);\r\n other.angle = this.angle;\r\n other.angularSpeed = this.angularSpeed;\r\n other.particleSystem = this.particleSystem;\r\n other.cellIndex = this.cellIndex;\r\n other.id = this.id;\r\n other._attachedSubEmitters = this._attachedSubEmitters;\r\n if (this._currentColorGradient) {\r\n other._currentColorGradient = this._currentColorGradient;\r\n other._currentColor1.copyFrom(this._currentColor1);\r\n other._currentColor2.copyFrom(this._currentColor2);\r\n }\r\n if (this._currentSizeGradient) {\r\n other._currentSizeGradient = this._currentSizeGradient;\r\n other._currentSize1 = this._currentSize1;\r\n other._currentSize2 = this._currentSize2;\r\n }\r\n if (this._currentAngularSpeedGradient) {\r\n other._currentAngularSpeedGradient = this._currentAngularSpeedGradient;\r\n other._currentAngularSpeed1 = this._currentAngularSpeed1;\r\n other._currentAngularSpeed2 = this._currentAngularSpeed2;\r\n }\r\n if (this._currentVelocityGradient) {\r\n other._currentVelocityGradient = this._currentVelocityGradient;\r\n other._currentVelocity1 = this._currentVelocity1;\r\n other._currentVelocity2 = this._currentVelocity2;\r\n }\r\n if (this._currentLimitVelocityGradient) {\r\n other._currentLimitVelocityGradient = this._currentLimitVelocityGradient;\r\n other._currentLimitVelocity1 = this._currentLimitVelocity1;\r\n other._currentLimitVelocity2 = this._currentLimitVelocity2;\r\n }\r\n if (this._currentDragGradient) {\r\n other._currentDragGradient = this._currentDragGradient;\r\n other._currentDrag1 = this._currentDrag1;\r\n other._currentDrag2 = this._currentDrag2;\r\n }\r\n if (this.particleSystem.isAnimationSheetEnabled) {\r\n other._initialStartSpriteCellId = this._initialStartSpriteCellId;\r\n other._initialEndSpriteCellId = this._initialEndSpriteCellId;\r\n other._initialSpriteCellLoop = this._initialSpriteCellLoop;\r\n }\r\n if (this.particleSystem.useRampGradients) {\r\n if (other.remapData && this.remapData) {\r\n other.remapData.copyFrom(this.remapData);\r\n } else {\r\n other.remapData = new Vector4(0, 0, 0, 0);\r\n }\r\n }\r\n if (this._randomNoiseCoordinates1 && this._randomNoiseCoordinates2) {\r\n if (other._randomNoiseCoordinates1 && other._randomNoiseCoordinates2) {\r\n other._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1);\r\n other._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2);\r\n } else {\r\n other._randomNoiseCoordinates1 = this._randomNoiseCoordinates1.clone();\r\n other._randomNoiseCoordinates2 = this._randomNoiseCoordinates2.clone();\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"particle.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/particle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,O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ACD,IAAI,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;YACvC,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,CAAC,uBAAuB,IAAI,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,CAAC;YACvF,IAAI,KAAK,CAAC,WAAW,CAAC,uBAAuB,IAAI,KAAK,CAAC,WAAW,CAAC,uBAAuB,EAAE,CAAC;gBACzF,KAAK,CAAC,WAAW,CAAC,uBAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;gBAC7F,KAAK,CAAC,WAAW,CAAC,uBAAuB,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;YACjG,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,WAAW,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;gBAC7F,KAAK,CAAC,WAAW,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;YACjG,CAAC;QACL,CAAC;IACL,CAAC;;AArQc,eAAM,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector2, Vector3, TmpVectors, Vector4 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { SubEmitter } from \"./subEmitter\";\r\nimport type { ColorGradient, FactorGradient } from \"../Misc/gradients\";\r\n\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { ThinParticleSystem } from \"./thinParticleSystem\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\n\r\n/**\r\n * @internal\r\n * Holds all internal properties of a Particle, grouped into a single sub-object\r\n * to keep the Particle's own property count low (V8 in-object property limit).\r\n */\r\nclass ParticleInternalProperties {\r\n /** @internal */\r\n public randomCellOffset?: number;\r\n\r\n /** @internal */\r\n public initialDirection: Nullable<Vector3>;\r\n\r\n /** @internal */\r\n public attachedSubEmitters: Nullable<Array<SubEmitter>> = null;\r\n\r\n /** @internal */\r\n public initialStartSpriteCellId: number;\r\n /** @internal */\r\n public initialEndSpriteCellId: number;\r\n /** @internal */\r\n public initialSpriteCellLoop: boolean;\r\n\r\n /** @internal */\r\n public currentColorGradient: Nullable<ColorGradient>;\r\n /** @internal */\r\n public currentColor1 = new Color4(0, 0, 0, 0);\r\n /** @internal */\r\n public currentColor2 = new Color4(0, 0, 0, 0);\r\n\r\n /** @internal */\r\n public currentSizeGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public currentSize1 = 0;\r\n /** @internal */\r\n public currentSize2 = 0;\r\n\r\n /** @internal */\r\n public currentAngularSpeedGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public currentAngularSpeed1 = 0;\r\n /** @internal */\r\n public currentAngularSpeed2 = 0;\r\n\r\n /** @internal */\r\n public currentVelocityGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public currentVelocity1 = 0;\r\n /** @internal */\r\n public currentVelocity2 = 0;\r\n\r\n /** @internal */\r\n public directionScale: number;\r\n /** @internal */\r\n public scaledDirection = Vector3.Zero();\r\n\r\n /** @internal */\r\n public currentLimitVelocityGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public currentLimitVelocity1 = 0;\r\n /** @internal */\r\n public currentLimitVelocity2 = 0;\r\n\r\n /** @internal */\r\n public currentDragGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public currentDrag1 = 0;\r\n /** @internal */\r\n public currentDrag2 = 0;\r\n\r\n /** @internal */\r\n public randomNoiseCoordinates1: Nullable<Vector3>;\r\n /** @internal */\r\n public randomNoiseCoordinates2: Nullable<Vector3>;\r\n\r\n /** @internal */\r\n public localPosition?: Vector3;\r\n\r\n /**\r\n * Callback triggered when the particle is reset\r\n */\r\n public onReset: Nullable<() => void>;\r\n\r\n /** @internal */\r\n public reset(): void {\r\n this.currentColorGradient = null;\r\n this.currentSizeGradient = null;\r\n this.currentAngularSpeedGradient = null;\r\n this.currentVelocityGradient = null;\r\n this.currentLimitVelocityGradient = null;\r\n this.currentDragGradient = null;\r\n this.randomCellOffset = undefined;\r\n this.randomNoiseCoordinates1 = null;\r\n this.randomNoiseCoordinates2 = null;\r\n }\r\n}\r\n\r\n/**\r\n * A particle represents one of the element emitted by a particle system.\r\n * This is mainly define by its coordinates, direction, velocity and age.\r\n */\r\nexport class Particle {\r\n private static _Count = 0;\r\n /**\r\n * Unique ID of the particle\r\n */\r\n public id: number;\r\n /**\r\n * The world position of the particle in the scene.\r\n */\r\n public position = Vector3.Zero();\r\n\r\n /**\r\n * The world direction of the particle in the scene.\r\n */\r\n public direction = Vector3.Zero();\r\n\r\n /**\r\n * The color of the particle.\r\n */\r\n public color = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The color change of the particle per step.\r\n */\r\n public colorStep = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The creation color of the particle.\r\n */\r\n public initialColor = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The color used when the end of life of the particle.\r\n */\r\n public colorDead = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * Defines how long will the life of the particle be.\r\n */\r\n public lifeTime = 1.0;\r\n\r\n /**\r\n * The current age of the particle.\r\n */\r\n public age = 0;\r\n\r\n /**\r\n * The current size of the particle.\r\n */\r\n public size = 0;\r\n\r\n /**\r\n * The current scale of the particle.\r\n */\r\n public scale = new Vector2(1, 1);\r\n\r\n /**\r\n * The current angle of the particle.\r\n */\r\n public angle = 0;\r\n\r\n /**\r\n * Defines how fast is the angle changing.\r\n */\r\n public angularSpeed = 0;\r\n\r\n /**\r\n * Defines the cell index used by the particle to be rendered from a sprite.\r\n */\r\n public cellIndex: number = 0;\r\n\r\n /**\r\n * The information required to support color remapping\r\n */\r\n public remapData: Vector4;\r\n\r\n /** @internal */\r\n public _properties = new ParticleInternalProperties();\r\n\r\n /**\r\n * Creates a new instance Particle\r\n * @param particleSystem the particle system the particle belongs to\r\n */\r\n constructor(\r\n /**\r\n * The particle system the particle belongs to.\r\n */\r\n public particleSystem: ThinParticleSystem\r\n ) {\r\n this.id = Particle._Count++;\r\n if (!this.particleSystem.isAnimationSheetEnabled) {\r\n return;\r\n }\r\n\r\n this._updateCellInfoFromSystem();\r\n }\r\n\r\n private _updateCellInfoFromSystem(): void {\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n }\r\n\r\n /**\r\n * Defines how the sprite cell index is updated for the particle\r\n */\r\n public updateCellIndex(): void {\r\n let offsetAge = this.age;\r\n let changeSpeed = this.particleSystem.spriteCellChangeSpeed;\r\n\r\n if (this.particleSystem.spriteRandomStartCell) {\r\n if (this._properties.randomCellOffset === undefined) {\r\n this._properties.randomCellOffset = Math.random() * this.lifeTime;\r\n }\r\n\r\n if (changeSpeed === 0) {\r\n // Special case when speed = 0 meaning we want to stay on initial cell\r\n changeSpeed = 1;\r\n offsetAge = this._properties.randomCellOffset;\r\n } else {\r\n offsetAge += this._properties.randomCellOffset;\r\n }\r\n }\r\n\r\n const dist = this._properties.initialEndSpriteCellId - this._properties.initialStartSpriteCellId + 1;\r\n let ratio: number;\r\n if (this._properties.initialSpriteCellLoop) {\r\n ratio = Clamp(((offsetAge * changeSpeed) % this.lifeTime) / this.lifeTime);\r\n } else {\r\n ratio = Clamp((offsetAge * changeSpeed) / this.lifeTime);\r\n }\r\n this.cellIndex = (this._properties.initialStartSpriteCellId + ratio * dist) | 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _inheritParticleInfoToSubEmitter(subEmitter: SubEmitter) {\r\n if ((<AbstractMesh>subEmitter.particleSystem.emitter).position) {\r\n const emitterMesh = <AbstractMesh>subEmitter.particleSystem.emitter;\r\n emitterMesh.position.copyFrom(this.position);\r\n if (subEmitter.inheritDirection) {\r\n const temp = TmpVectors.Vector3[0];\r\n this.direction.normalizeToRef(temp);\r\n emitterMesh.setDirection(temp, 0, Math.PI / 2);\r\n }\r\n } else {\r\n const emitterPosition = <Vector3>subEmitter.particleSystem.emitter;\r\n emitterPosition.copyFrom(this.position);\r\n }\r\n // Set inheritedVelocityOffset to be used when new particles are created\r\n this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, TmpVectors.Vector3[0]);\r\n subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(TmpVectors.Vector3[0]);\r\n }\r\n\r\n /** @internal */\r\n public _inheritParticleInfoToSubEmitters() {\r\n if (this._properties.attachedSubEmitters && this._properties.attachedSubEmitters.length > 0) {\r\n for (const subEmitter of this._properties.attachedSubEmitters) {\r\n this._inheritParticleInfoToSubEmitter(subEmitter);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _reset() {\r\n if (this._properties.onReset) {\r\n this._properties.onReset();\r\n }\r\n this.age = 0;\r\n this.id = Particle._Count++;\r\n this._properties.reset();\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n }\r\n\r\n /**\r\n * Copy the properties of particle to another one.\r\n * @param other the particle to copy the information to.\r\n */\r\n public copyTo(other: Particle) {\r\n other.position.copyFrom(this.position);\r\n if (this._properties.initialDirection) {\r\n if (other._properties.initialDirection) {\r\n other._properties.initialDirection.copyFrom(this._properties.initialDirection);\r\n } else {\r\n other._properties.initialDirection = this._properties.initialDirection.clone();\r\n }\r\n } else {\r\n other._properties.initialDirection = null;\r\n }\r\n other.direction.copyFrom(this.direction);\r\n if (this._properties.localPosition) {\r\n if (other._properties.localPosition) {\r\n other._properties.localPosition.copyFrom(this._properties.localPosition);\r\n } else {\r\n other._properties.localPosition = this._properties.localPosition.clone();\r\n }\r\n }\r\n other.color.copyFrom(this.color);\r\n other.colorStep.copyFrom(this.colorStep);\r\n other.initialColor.copyFrom(this.initialColor);\r\n other.colorDead.copyFrom(this.colorDead);\r\n other.lifeTime = this.lifeTime;\r\n other.age = this.age;\r\n other._properties.randomCellOffset = this._properties.randomCellOffset;\r\n other.size = this.size;\r\n other.scale.copyFrom(this.scale);\r\n other.angle = this.angle;\r\n other.angularSpeed = this.angularSpeed;\r\n other.particleSystem = this.particleSystem;\r\n other.cellIndex = this.cellIndex;\r\n other.id = this.id;\r\n other._properties.attachedSubEmitters = this._properties.attachedSubEmitters;\r\n if (this._properties.currentColorGradient) {\r\n other._properties.currentColorGradient = this._properties.currentColorGradient;\r\n other._properties.currentColor1.copyFrom(this._properties.currentColor1);\r\n other._properties.currentColor2.copyFrom(this._properties.currentColor2);\r\n }\r\n if (this._properties.currentSizeGradient) {\r\n other._properties.currentSizeGradient = this._properties.currentSizeGradient;\r\n other._properties.currentSize1 = this._properties.currentSize1;\r\n other._properties.currentSize2 = this._properties.currentSize2;\r\n }\r\n if (this._properties.currentAngularSpeedGradient) {\r\n other._properties.currentAngularSpeedGradient = this._properties.currentAngularSpeedGradient;\r\n other._properties.currentAngularSpeed1 = this._properties.currentAngularSpeed1;\r\n other._properties.currentAngularSpeed2 = this._properties.currentAngularSpeed2;\r\n }\r\n if (this._properties.currentVelocityGradient) {\r\n other._properties.currentVelocityGradient = this._properties.currentVelocityGradient;\r\n other._properties.currentVelocity1 = this._properties.currentVelocity1;\r\n other._properties.currentVelocity2 = this._properties.currentVelocity2;\r\n }\r\n if (this._properties.currentLimitVelocityGradient) {\r\n other._properties.currentLimitVelocityGradient = this._properties.currentLimitVelocityGradient;\r\n other._properties.currentLimitVelocity1 = this._properties.currentLimitVelocity1;\r\n other._properties.currentLimitVelocity2 = this._properties.currentLimitVelocity2;\r\n }\r\n if (this._properties.currentDragGradient) {\r\n other._properties.currentDragGradient = this._properties.currentDragGradient;\r\n other._properties.currentDrag1 = this._properties.currentDrag1;\r\n other._properties.currentDrag2 = this._properties.currentDrag2;\r\n }\r\n if (this.particleSystem.isAnimationSheetEnabled) {\r\n other._properties.initialStartSpriteCellId = this._properties.initialStartSpriteCellId;\r\n other._properties.initialEndSpriteCellId = this._properties.initialEndSpriteCellId;\r\n other._properties.initialSpriteCellLoop = this._properties.initialSpriteCellLoop;\r\n }\r\n if (this.particleSystem.useRampGradients) {\r\n if (other.remapData && this.remapData) {\r\n other.remapData.copyFrom(this.remapData);\r\n } else {\r\n other.remapData = new Vector4(0, 0, 0, 0);\r\n }\r\n }\r\n if (this._properties.randomNoiseCoordinates1 && this._properties.randomNoiseCoordinates2) {\r\n if (other._properties.randomNoiseCoordinates1 && other._properties.randomNoiseCoordinates2) {\r\n other._properties.randomNoiseCoordinates1.copyFrom(this._properties.randomNoiseCoordinates1);\r\n other._properties.randomNoiseCoordinates2.copyFrom(this._properties.randomNoiseCoordinates2);\r\n } else {\r\n other._properties.randomNoiseCoordinates1 = this._properties.randomNoiseCoordinates1.clone();\r\n other._properties.randomNoiseCoordinates2 = this._properties.randomNoiseCoordinates2.clone();\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -326,11 +326,11 @@ export class ParticleSystem extends ThinParticleSystem {
326
326
  // Attach emitters
327
327
  if (this._subEmitters && this._subEmitters.length > 0) {
328
328
  const subEmitters = this._subEmitters[Math.floor(Math.random() * this._subEmitters.length)];
329
- particle._attachedSubEmitters = [];
329
+ particle._properties.attachedSubEmitters = [];
330
330
  for (const subEmitter of subEmitters) {
331
331
  if (subEmitter.type === 0 /* SubEmitterType.ATTACHED */) {
332
332
  const newEmitter = subEmitter.clone();
333
- particle._attachedSubEmitters.push(newEmitter);
333
+ particle._properties.attachedSubEmitters.push(newEmitter);
334
334
  newEmitter.particleSystem.start();
335
335
  }
336
336
  }
@@ -345,9 +345,9 @@ export class ParticleSystem extends ThinParticleSystem {
345
345
  if (disposeAttachedSubEmitters) {
346
346
  if (this.particles) {
347
347
  for (const particle of this.particles) {
348
- if (particle._attachedSubEmitters) {
349
- for (let i = particle._attachedSubEmitters.length - 1; i >= 0; i -= 1) {
350
- particle._attachedSubEmitters[i].dispose();
348
+ if (particle._properties.attachedSubEmitters) {
349
+ for (let i = particle._properties.attachedSubEmitters.length - 1; i >= 0; i -= 1) {
350
+ particle._properties.attachedSubEmitters[i].dispose();
351
351
  }
352
352
  }
353
353
  }