@babylonjs/core 7.3.0 → 7.3.2

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 (454) hide show
  1. package/Actions/condition.js.map +1 -1
  2. package/Actions/directActions.js.map +1 -1
  3. package/Actions/directAudioActions.js.map +1 -1
  4. package/Actions/interpolateValueAction.js.map +1 -1
  5. package/Animations/easing.js.map +1 -1
  6. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  7. package/Bones/bone.js.map +1 -1
  8. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  9. package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
  10. package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
  11. package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
  12. package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
  13. package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
  14. package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
  15. package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
  16. package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
  17. package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
  18. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  19. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
  20. package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
  21. package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
  22. package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
  23. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  24. package/Cameras/arcRotateCamera.js.map +1 -1
  25. package/Cameras/camera.js.map +1 -1
  26. package/Cameras/deviceOrientationCamera.js.map +1 -1
  27. package/Cameras/flyCamera.js.map +1 -1
  28. package/Cameras/followCamera.js.map +1 -1
  29. package/Cameras/freeCamera.js.map +1 -1
  30. package/Cameras/freeCameraInputsManager.js.map +1 -1
  31. package/Cameras/gamepadCamera.js.map +1 -1
  32. package/Cameras/targetCamera.js.map +1 -1
  33. package/Cameras/touchCamera.js.map +1 -1
  34. package/Cameras/universalCamera.js.map +1 -1
  35. package/Cameras/virtualJoysticksCamera.js.map +1 -1
  36. package/Debug/boneAxesViewer.js.map +1 -1
  37. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  38. package/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js.map +1 -1
  39. package/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js.map +1 -1
  40. package/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js.map +1 -1
  41. package/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js.map +1 -1
  42. package/Engines/Processors/shaderCodeConditionNode.js.map +1 -1
  43. package/Engines/Processors/shaderCodeTestNode.js.map +1 -1
  44. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  45. package/Engines/WebGPU/Extensions/engine.rawTexture.js +10 -10
  46. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  47. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  48. package/Engines/WebGPU/webgpuDepthCullingState.js.map +1 -1
  49. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +2 -0
  50. package/Engines/WebGPU/webgpuHardwareTexture.js +2 -0
  51. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  52. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  53. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  54. package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
  55. package/Engines/abstractEngine.js +14 -2
  56. package/Engines/abstractEngine.js.map +1 -1
  57. package/Engines/engine.d.ts +0 -8
  58. package/Engines/engine.js +0 -28
  59. package/Engines/engine.js.map +1 -1
  60. package/Engines/nativeEngine.js.map +1 -1
  61. package/Engines/nullEngine.js.map +1 -1
  62. package/Engines/thinEngine.js.map +1 -1
  63. package/Engines/webgpuEngine.d.ts +4 -0
  64. package/Engines/webgpuEngine.js +4 -0
  65. package/Engines/webgpuEngine.js.map +1 -1
  66. package/Events/keyboardEvents.js.map +1 -1
  67. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  68. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  69. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  71. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  72. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  73. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  74. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  75. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  77. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  78. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  79. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  80. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  83. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  85. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  86. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  87. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  88. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  89. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  90. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  91. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  92. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  93. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  94. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  95. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  96. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  97. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  98. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  99. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  100. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  101. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  102. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  103. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  104. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  105. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  106. package/Gamepads/dualShockGamepad.js.map +1 -1
  107. package/Gamepads/gamepad.js.map +1 -1
  108. package/Gamepads/xboxGamepad.js.map +1 -1
  109. package/Gizmos/axisDragGizmo.js.map +1 -1
  110. package/Gizmos/axisScaleGizmo.js.map +1 -1
  111. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  112. package/Gizmos/cameraGizmo.js.map +1 -1
  113. package/Gizmos/lightGizmo.js.map +1 -1
  114. package/Gizmos/planeDragGizmo.js.map +1 -1
  115. package/Gizmos/planeRotationGizmo.js.map +1 -1
  116. package/Gizmos/positionGizmo.js.map +1 -1
  117. package/Gizmos/rotationGizmo.js.map +1 -1
  118. package/Gizmos/scaleGizmo.js.map +1 -1
  119. package/Helpers/photoDome.js.map +1 -1
  120. package/Helpers/textureDome.js.map +1 -1
  121. package/Helpers/videoDome.js.map +1 -1
  122. package/Layers/glowLayer.js.map +1 -1
  123. package/Layers/highlightLayer.js.map +1 -1
  124. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  125. package/Lights/directionalLight.js.map +1 -1
  126. package/Lights/hemisphericLight.js.map +1 -1
  127. package/Lights/light.js.map +1 -1
  128. package/Lights/pointLight.js.map +1 -1
  129. package/Lights/shadowLight.js.map +1 -1
  130. package/Lights/spotLight.js.map +1 -1
  131. package/Materials/Background/backgroundMaterial.js.map +1 -1
  132. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  133. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  134. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  135. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  136. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  137. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  138. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  139. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  140. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  141. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
  142. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  143. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  144. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  145. package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
  146. package/Materials/Node/Blocks/Fragment/discardBlock.js.map +1 -1
  147. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  148. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
  149. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  150. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  151. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  152. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  153. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  154. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -1
  155. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  156. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
  157. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
  158. package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
  159. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  160. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  161. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  162. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  163. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  164. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  165. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  166. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  167. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  168. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  169. package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js.map +1 -1
  170. package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js.map +1 -1
  171. package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
  172. package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  173. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  174. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  175. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  176. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  177. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  178. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  179. package/Materials/Node/Blocks/addBlock.js.map +1 -1
  180. package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
  181. package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
  182. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  183. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  184. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  185. package/Materials/Node/Blocks/colorSplitterBlock.js.map +1 -1
  186. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  187. package/Materials/Node/Blocks/crossBlock.js.map +1 -1
  188. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  189. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  190. package/Materials/Node/Blocks/desaturateBlock.js.map +1 -1
  191. package/Materials/Node/Blocks/distanceBlock.js.map +1 -1
  192. package/Materials/Node/Blocks/divideBlock.js.map +1 -1
  193. package/Materials/Node/Blocks/dotBlock.js.map +1 -1
  194. package/Materials/Node/Blocks/elbowBlock.js.map +1 -1
  195. package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
  196. package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
  197. package/Materials/Node/Blocks/lengthBlock.js.map +1 -1
  198. package/Materials/Node/Blocks/lerpBlock.js.map +1 -1
  199. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  200. package/Materials/Node/Blocks/matrixDeterminantBlock.js.map +1 -1
  201. package/Materials/Node/Blocks/matrixTransposeBlock.js.map +1 -1
  202. package/Materials/Node/Blocks/maxBlock.js.map +1 -1
  203. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  204. package/Materials/Node/Blocks/minBlock.js.map +1 -1
  205. package/Materials/Node/Blocks/modBlock.js.map +1 -1
  206. package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
  207. package/Materials/Node/Blocks/nLerpBlock.js.map +1 -1
  208. package/Materials/Node/Blocks/negateBlock.js.map +1 -1
  209. package/Materials/Node/Blocks/normalBlendBlock.js.map +1 -1
  210. package/Materials/Node/Blocks/normalizeBlock.js.map +1 -1
  211. package/Materials/Node/Blocks/oneMinusBlock.js.map +1 -1
  212. package/Materials/Node/Blocks/posterizeBlock.js.map +1 -1
  213. package/Materials/Node/Blocks/powBlock.js.map +1 -1
  214. package/Materials/Node/Blocks/randomNumberBlock.js.map +1 -1
  215. package/Materials/Node/Blocks/reciprocalBlock.js.map +1 -1
  216. package/Materials/Node/Blocks/reflectBlock.js.map +1 -1
  217. package/Materials/Node/Blocks/refractBlock.js.map +1 -1
  218. package/Materials/Node/Blocks/remapBlock.js.map +1 -1
  219. package/Materials/Node/Blocks/replaceColorBlock.js.map +1 -1
  220. package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
  221. package/Materials/Node/Blocks/scaleBlock.js.map +1 -1
  222. package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
  223. package/Materials/Node/Blocks/smoothStepBlock.js.map +1 -1
  224. package/Materials/Node/Blocks/stepBlock.js.map +1 -1
  225. package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
  226. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  227. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  228. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  229. package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
  230. package/Materials/Node/Blocks/vectorSplitterBlock.js.map +1 -1
  231. package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
  232. package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
  233. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  234. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  235. package/Materials/Node/nodeMaterial.js.map +1 -1
  236. package/Materials/Node/nodeMaterialConnectionPointCustomObject.js.map +1 -1
  237. package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
  238. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  239. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  240. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  241. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  242. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  243. package/Materials/PBR/pbrMaterial.js.map +1 -1
  244. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  245. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  246. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  247. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  248. package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
  249. package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
  250. package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
  251. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  252. package/Materials/Textures/baseTexture.js.map +1 -1
  253. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  254. package/Materials/Textures/cubeTexture.js.map +1 -1
  255. package/Materials/Textures/dynamicTexture.js.map +1 -1
  256. package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
  257. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  258. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  259. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  260. package/Materials/Textures/internalTexture.js.map +1 -1
  261. package/Materials/Textures/mirrorTexture.js.map +1 -1
  262. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  263. package/Materials/Textures/prePassRenderTarget.js.map +1 -1
  264. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  265. package/Materials/Textures/refractionTexture.js.map +1 -1
  266. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  267. package/Materials/Textures/texture.js.map +1 -1
  268. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  269. package/Materials/Textures/videoTexture.js.map +1 -1
  270. package/Materials/material.decalMapConfiguration.js.map +1 -1
  271. package/Materials/material.detailMapConfiguration.js.map +1 -1
  272. package/Materials/materialHelper.d.ts +2 -2
  273. package/Materials/materialHelper.js.map +1 -1
  274. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  275. package/Materials/multiMaterial.js.map +1 -1
  276. package/Materials/pushMaterial.js.map +1 -1
  277. package/Materials/shaderMaterial.js.map +1 -1
  278. package/Materials/standardMaterial.js.map +1 -1
  279. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  280. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  281. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  282. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  283. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  284. package/Meshes/Node/Blocks/Instances/instantiateBlock.js.map +1 -1
  285. package/Meshes/Node/Blocks/Instances/instantiateLinearBlock.js.map +1 -1
  286. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  287. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  288. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  289. package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js.map +1 -1
  290. package/Meshes/Node/Blocks/Matrices/alignBlock.js.map +1 -1
  291. package/Meshes/Node/Blocks/Matrices/rotationXBlock.js.map +1 -1
  292. package/Meshes/Node/Blocks/Matrices/rotationYBlock.js.map +1 -1
  293. package/Meshes/Node/Blocks/Matrices/rotationZBlock.js.map +1 -1
  294. package/Meshes/Node/Blocks/Matrices/scalingBlock.js.map +1 -1
  295. package/Meshes/Node/Blocks/Matrices/translationBlock.js.map +1 -1
  296. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  297. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  298. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  299. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  300. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  301. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  302. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  303. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  304. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  305. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  306. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  307. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  308. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  309. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  310. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  311. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  312. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  313. package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  314. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  315. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  316. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  317. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  318. package/Meshes/Node/Blocks/boundingBlock.js.map +1 -1
  319. package/Meshes/Node/Blocks/computeNormalsBlock.js.map +1 -1
  320. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  321. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  322. package/Meshes/Node/Blocks/geometryArcTan2Block.js.map +1 -1
  323. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  324. package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
  325. package/Meshes/Node/Blocks/geometryCrossBlock.js.map +1 -1
  326. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
  327. package/Meshes/Node/Blocks/geometryDesaturateBlock.js.map +1 -1
  328. package/Meshes/Node/Blocks/geometryDistanceBlock.js.map +1 -1
  329. package/Meshes/Node/Blocks/geometryDotBlock.js.map +1 -1
  330. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  331. package/Meshes/Node/Blocks/geometryInfoBlock.js.map +1 -1
  332. package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
  333. package/Meshes/Node/Blocks/geometryLengthBlock.js.map +1 -1
  334. package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -1
  335. package/Meshes/Node/Blocks/geometryModBlock.js.map +1 -1
  336. package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -1
  337. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  338. package/Meshes/Node/Blocks/geometryOutputBlock.js.map +1 -1
  339. package/Meshes/Node/Blocks/geometryPosterizeBlock.js.map +1 -1
  340. package/Meshes/Node/Blocks/geometryPowBlock.js.map +1 -1
  341. package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -1
  342. package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -1
  343. package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -1
  344. package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -1
  345. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  346. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  347. package/Meshes/Node/Blocks/intFloatConverterBlock.js.map +1 -1
  348. package/Meshes/Node/Blocks/mapRangeBlock.js.map +1 -1
  349. package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
  350. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  351. package/Meshes/Node/Blocks/matrixComposeBlock.js.map +1 -1
  352. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  353. package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
  354. package/Meshes/Node/Blocks/normalizeVectorBlock.js.map +1 -1
  355. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  356. package/Meshes/Node/Blocks/vectorConverterBlock.js.map +1 -1
  357. package/Meshes/WebGL/webGLDataBuffer.js.map +1 -1
  358. package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
  359. package/Meshes/abstractMesh.js.map +1 -1
  360. package/Meshes/geodesicMesh.js.map +1 -1
  361. package/Meshes/goldbergMesh.js.map +1 -1
  362. package/Meshes/groundMesh.js.map +1 -1
  363. package/Meshes/instancedMesh.js.map +1 -1
  364. package/Meshes/linesMesh.js.map +1 -1
  365. package/Meshes/mesh.js.map +1 -1
  366. package/Meshes/trailMesh.js.map +1 -1
  367. package/Meshes/transformNode.js.map +1 -1
  368. package/Misc/assetsManager.js.map +1 -1
  369. package/Misc/depthReducer.js.map +1 -1
  370. package/Misc/sceneOptimizer.js.map +1 -1
  371. package/Misc/smartArray.js.map +1 -1
  372. package/Misc/workerPool.js.map +1 -1
  373. package/Particles/EmitterTypes/cylinderParticleEmitter.js.map +1 -1
  374. package/Particles/EmitterTypes/sphereParticleEmitter.js.map +1 -1
  375. package/Particles/gpuParticleSystem.js.map +1 -1
  376. package/Particles/particleSystem.js.map +1 -1
  377. package/Particles/thinParticleSystem.js.map +1 -1
  378. package/Physics/physicsRaycastResult.js.map +1 -1
  379. package/Physics/proximityCastResult.js.map +1 -1
  380. package/Physics/v1/physicsJoint.js.map +1 -1
  381. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  382. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
  383. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  384. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  385. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  386. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  387. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  388. package/PostProcesses/anaglyphPostProcess.js.map +1 -1
  389. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  390. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  391. package/PostProcesses/blurPostProcess.js.map +1 -1
  392. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  393. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  394. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  395. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  396. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  397. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  398. package/PostProcesses/displayPassPostProcess.js.map +1 -1
  399. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  400. package/PostProcesses/filterPostProcess.js.map +1 -1
  401. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  402. package/PostProcesses/grainPostProcess.js.map +1 -1
  403. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  404. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  405. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  406. package/PostProcesses/passPostProcess.js.map +1 -1
  407. package/PostProcesses/refractionPostProcess.js.map +1 -1
  408. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  409. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  410. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  411. package/PostProcesses/stereoscopicInterlacePostProcess.js.map +1 -1
  412. package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
  413. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  414. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  415. package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
  416. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
  417. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  418. package/Rendering/edgesRenderer.js.map +1 -1
  419. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  420. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  421. package/Rendering/reflectiveShadowMap.js.map +1 -1
  422. package/Sprites/sprite.js.map +1 -1
  423. package/Sprites/spritePackedManager.js.map +1 -1
  424. package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
  425. package/XR/features/Layers/WebXRProjectionLayer.js.map +1 -1
  426. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  427. package/XR/features/WebXRBackgroundRemover.js.map +1 -1
  428. package/XR/features/WebXRControllerMovement.js.map +1 -1
  429. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  430. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  431. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  432. package/XR/features/WebXRDOMOverlay.js.map +1 -1
  433. package/XR/features/WebXRDepthSensing.js.map +1 -1
  434. package/XR/features/WebXREyeTracking.js.map +1 -1
  435. package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
  436. package/XR/features/WebXRHandTracking.js.map +1 -1
  437. package/XR/features/WebXRHitTest.js.map +1 -1
  438. package/XR/features/WebXRHitTestLegacy.js.map +1 -1
  439. package/XR/features/WebXRImageTracking.js.map +1 -1
  440. package/XR/features/WebXRLayers.js.map +1 -1
  441. package/XR/features/WebXRLightEstimation.js.map +1 -1
  442. package/XR/features/WebXRMeshDetector.js.map +1 -1
  443. package/XR/features/WebXRNearInteraction.js.map +1 -1
  444. package/XR/features/WebXRPlaneDetector.js.map +1 -1
  445. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  446. package/XR/features/WebXRSpaceWarp.js.map +1 -1
  447. package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
  448. package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
  449. package/XR/native/nativeXRRenderTarget.js.map +1 -1
  450. package/XR/webXRCamera.js.map +1 -1
  451. package/XR/webXRWebGLLayer.js.map +1 -1
  452. package/assets/Draco/draco_wasm_wrapper.js +115 -115
  453. package/package.json +1 -1
  454. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"smartArray.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/smartArray.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,OAAO,UAAU;IAanB;;;OAGG;IACH,YAAY,QAAgB;QAX5B;;WAEG;QACI,WAAM,GAAW,CAAC,CAAC;QAStB,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,IAAI,CAAC,KAAQ;QAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC;QAEjC,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,C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I,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACpB,OAAO;SACV;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAC/C,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACvD;QAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC/C,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SAC9B;IACL,CAAC;CACJ","sourcesContent":["/**\r\n * Defines an array and its length.\r\n * It can be helpful to group result from both Arrays and smart arrays in one structure.\r\n */\r\nexport interface ISmartArrayLike<T> {\r\n /**\r\n * The data of the array.\r\n */\r\n data: Array<T>;\r\n /**\r\n * The active length of the array.\r\n */\r\n length: number;\r\n}\r\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n */\r\nexport class SmartArray<T> implements ISmartArrayLike<T> {\r\n /**\r\n * The full set of data from the array.\r\n */\r\n public data: Array<T>;\r\n\r\n /**\r\n * The active length of the array.\r\n */\r\n public length: number = 0;\r\n\r\n protected _id: number;\r\n\r\n /**\r\n * Instantiates a Smart Array.\r\n * @param capacity defines the default capacity of the array.\r\n */\r\n constructor(capacity: number) {\r\n this.data = new Array(capacity);\r\n this._id = SmartArray._GlobalId++;\r\n }\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * @param value defines the object to push in the array.\r\n */\r\n public push(value: T): void {\r\n this.data[this.length++] = value;\r\n\r\n if (this.length > this.data.length) {\r\n this.data.length *= 2;\r\n }\r\n }\r\n\r\n /**\r\n * Iterates over the active data and apply the lambda to them.\r\n * @param func defines the action to apply on each value.\r\n */\r\n public forEach(func: (content: T) => void): void {\r\n for (let index = 0; index < this.length; index++) {\r\n func(this.data[index]);\r\n }\r\n }\r\n\r\n /**\r\n * Sorts the full sets of data.\r\n * @param compareFn defines the comparison function to apply.\r\n */\r\n public sort(compareFn: (a: T, b: T) => number): void {\r\n this.data.sort(compareFn);\r\n }\r\n\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n public reset(): void {\r\n this.length = 0;\r\n }\r\n\r\n /**\r\n * Releases all the data from the array as well as the array.\r\n */\r\n public dispose(): void {\r\n this.reset();\r\n\r\n if (this.data) {\r\n this.data.length = 0;\r\n }\r\n }\r\n\r\n /**\r\n * Concats the active data with a given array.\r\n * @param array defines the data to concatenate with.\r\n */\r\n public concat(array: any): void {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n\r\n for (let index = 0; index < array.length; index++) {\r\n this.data[this.length++] = (array.data || array)[index];\r\n }\r\n }\r\n\r\n /**\r\n * Returns the position of a value in the active data.\r\n * @param value defines the value to find the index for\r\n * @returns the index if found in the active data otherwise -1\r\n */\r\n public indexOf(value: T): number {\r\n const position = this.data.indexOf(value);\r\n\r\n if (position >= this.length) {\r\n return -1;\r\n }\r\n\r\n return position;\r\n }\r\n\r\n /**\r\n * Returns whether an element is part of the active data.\r\n * @param value defines the value to look for\r\n * @returns true if found in the active data otherwise false\r\n */\r\n public contains(value: T): boolean {\r\n return this.indexOf(value) !== -1;\r\n }\r\n\r\n // Statics\r\n private static _GlobalId = 0;\r\n}\r\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n * The data in this array can only be present once\r\n */\r\nexport class SmartArrayNoDuplicate<T> extends SmartArray<T> {\r\n private _duplicateId = 0;\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * THIS DOES NOT PREVENT DUPPLICATE DATA\r\n * @param value defines the object to push in the array.\r\n */\r\n public push(value: T): void {\r\n super.push(value);\r\n\r\n if (!(<any>value).__smartArrayFlags) {\r\n (<any>value).__smartArrayFlags = {};\r\n }\r\n\r\n (<any>value).__smartArrayFlags[this._id] = this._duplicateId;\r\n }\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * If the data is already present, it won t be added again\r\n * @param value defines the object to push in the array.\r\n * @returns true if added false if it was already present\r\n */\r\n public pushNoDuplicate(value: T): boolean {\r\n if ((<any>value).__smartArrayFlags && (<any>value).__smartArrayFlags[this._id] === this._duplicateId) {\r\n return false;\r\n }\r\n this.push(value);\r\n return true;\r\n }\r\n\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n public reset(): void {\r\n super.reset();\r\n this._duplicateId++;\r\n }\r\n\r\n /**\r\n * Concats the active data with a given array.\r\n * This ensures no duplicate will be present in the result.\r\n * @param array defines the data to concatenate with.\r\n */\r\n public concatWithNoDuplicate(array: any): void {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n\r\n for (let index = 0; index < array.length; index++) {\r\n const item = (array.data || array)[index];\r\n this.pushNoDuplicate(item);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"smartArray.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/smartArray.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,OAAO,UAAU;IAanB;;;OAGG;IACH,YAAY,QAAgB;QAX5B;;WAEG;QACI,WAAM,GAAW,CAAC,CAAC;QAStB,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,IAAI,CAAC,KAAQ;QAChB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,K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,CAAC;IAED;;;;OAIG;IACI,qBAAqB,CAAC,KAAU;QACnC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACpB,OAAO;SACV;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAC/C,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACvD;QAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC/C,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SAC9B;IACL,CAAC;CACJ","sourcesContent":["/**\r\n * Defines an array and its length.\r\n * It can be helpful to group result from both Arrays and smart arrays in one structure.\r\n */\r\nexport interface ISmartArrayLike<T> {\r\n /**\r\n * The data of the array.\r\n */\r\n data: Array<T>;\r\n /**\r\n * The active length of the array.\r\n */\r\n length: number;\r\n}\r\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n */\r\nexport class SmartArray<T> implements ISmartArrayLike<T> {\r\n /**\r\n * The full set of data from the array.\r\n */\r\n public data: Array<T>;\r\n\r\n /**\r\n * The active length of the array.\r\n */\r\n public length: number = 0;\r\n\r\n protected _id: number;\r\n\r\n /**\r\n * Instantiates a Smart Array.\r\n * @param capacity defines the default capacity of the array.\r\n */\r\n constructor(capacity: number) {\r\n this.data = new Array(capacity);\r\n this._id = SmartArray._GlobalId++;\r\n }\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * @param value defines the object to push in the array.\r\n */\r\n public push(value: T): void {\r\n this.data[this.length++] = value;\r\n\r\n if (this.length > this.data.length) {\r\n this.data.length *= 2;\r\n }\r\n }\r\n\r\n /**\r\n * Iterates over the active data and apply the lambda to them.\r\n * @param func defines the action to apply on each value.\r\n */\r\n public forEach(func: (content: T) => void): void {\r\n for (let index = 0; index < this.length; index++) {\r\n func(this.data[index]);\r\n }\r\n }\r\n\r\n /**\r\n * Sorts the full sets of data.\r\n * @param compareFn defines the comparison function to apply.\r\n */\r\n public sort(compareFn: (a: T, b: T) => number): void {\r\n this.data.sort(compareFn);\r\n }\r\n\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n public reset(): void {\r\n this.length = 0;\r\n }\r\n\r\n /**\r\n * Releases all the data from the array as well as the array.\r\n */\r\n public dispose(): void {\r\n this.reset();\r\n\r\n if (this.data) {\r\n this.data.length = 0;\r\n }\r\n }\r\n\r\n /**\r\n * Concats the active data with a given array.\r\n * @param array defines the data to concatenate with.\r\n */\r\n public concat(array: any): void {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n\r\n for (let index = 0; index < array.length; index++) {\r\n this.data[this.length++] = (array.data || array)[index];\r\n }\r\n }\r\n\r\n /**\r\n * Returns the position of a value in the active data.\r\n * @param value defines the value to find the index for\r\n * @returns the index if found in the active data otherwise -1\r\n */\r\n public indexOf(value: T): number {\r\n const position = this.data.indexOf(value);\r\n\r\n if (position >= this.length) {\r\n return -1;\r\n }\r\n\r\n return position;\r\n }\r\n\r\n /**\r\n * Returns whether an element is part of the active data.\r\n * @param value defines the value to look for\r\n * @returns true if found in the active data otherwise false\r\n */\r\n public contains(value: T): boolean {\r\n return this.indexOf(value) !== -1;\r\n }\r\n\r\n // Statics\r\n private static _GlobalId = 0;\r\n}\r\n\r\n/**\r\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\r\n * The data in this array can only be present once\r\n */\r\nexport class SmartArrayNoDuplicate<T> extends SmartArray<T> {\r\n private _duplicateId = 0;\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * THIS DOES NOT PREVENT DUPPLICATE DATA\r\n * @param value defines the object to push in the array.\r\n */\r\n public override push(value: T): void {\r\n super.push(value);\r\n\r\n if (!(<any>value).__smartArrayFlags) {\r\n (<any>value).__smartArrayFlags = {};\r\n }\r\n\r\n (<any>value).__smartArrayFlags[this._id] = this._duplicateId;\r\n }\r\n\r\n /**\r\n * Pushes a value at the end of the active data.\r\n * If the data is already present, it won t be added again\r\n * @param value defines the object to push in the array.\r\n * @returns true if added false if it was already present\r\n */\r\n public pushNoDuplicate(value: T): boolean {\r\n if ((<any>value).__smartArrayFlags && (<any>value).__smartArrayFlags[this._id] === this._duplicateId) {\r\n return false;\r\n }\r\n this.push(value);\r\n return true;\r\n }\r\n\r\n /**\r\n * Resets the active data to an empty array.\r\n */\r\n public override reset(): void {\r\n super.reset();\r\n this._duplicateId++;\r\n }\r\n\r\n /**\r\n * Concats the active data with a given array.\r\n * This ensures no duplicate will be present in the result.\r\n * @param array defines the data to concatenate with.\r\n */\r\n public concatWithNoDuplicate(array: any): void {\r\n if (array.length === 0) {\r\n return;\r\n }\r\n if (this.length + array.length > this.data.length) {\r\n this.data.length = (this.length + array.length) * 2;\r\n }\r\n\r\n for (let index = 0; index < array.length; index++) {\r\n const item = (array.data || array)[index];\r\n this.pushNoDuplicate(item);\r\n }\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"workerPool.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/workerPool.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,OAAO,UAAU;IAInB;;;OAGG;IACH,YAAY,OAAsB;QANxB,oBAAe,GAAG,IAAI,KAAK,EAAoD,CAAC;QAOtF,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACzC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;YACtC,IAAI,EAAE,IAAI;SAC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AAS,GAAG,UAAU,CAAC,GAAG,EAAE;wBACnC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;4BACrC,MAAM,CAAC,SAAS,EAAE,CAAC;wBACvB,CAAC,CAAC,CAAC;wBAEH,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;wBACtD,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE;4BAChB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;yBACxC;oBACL,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC;iBAClD;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;;AA7DD;;;GAGG;AACW,oCAAc,GAAiC;IACzD,4BAA4B,EAAE,IAAI;CACrC,CAAC","sourcesContent":["import type { IDisposable } from \"../scene\";\r\n\r\n/** @ignore */\r\ninterface WorkerInfo {\r\n workerPromise: Promise<Worker>;\r\n idle: boolean;\r\n timeoutId?: ReturnType<typeof setTimeout>;\r\n}\r\n\r\n/**\r\n * Helper class to push actions to a pool of workers.\r\n */\r\nexport class WorkerPool implements IDisposable {\r\n protected _workerInfos: Array<WorkerInfo>;\r\n protected _pendingActions = new Array<(worker: Worker, onComplete: () => void) => void>();\r\n\r\n /**\r\n * Constructor\r\n * @param workers Array of workers to use for actions\r\n */\r\n constructor(workers: Array<Worker>) {\r\n this._workerInfos = workers.map((worker) => ({\r\n workerPromise: Promise.resolve(worker),\r\n idle: true,\r\n }));\r\n }\r\n\r\n /**\r\n * Terminates all workers and clears any pending actions.\r\n */\r\n public dispose(): void {\r\n for (const workerInfo of this._workerInfos) {\r\n workerInfo.workerPromise.then((worker) => {\r\n worker.terminate();\r\n });\r\n }\r\n\r\n this._workerInfos.length = 0;\r\n this._pendingActions.length = 0;\r\n }\r\n\r\n /**\r\n * Pushes an action to the worker pool. If all the workers are active, the action will be\r\n * pended until a worker has completed its action.\r\n * @param action The action to perform. Call onComplete when the action is complete.\r\n */\r\n public push(action: (worker: Worker, onComplete: () => void) => void): void {\r\n if (!this._executeOnIdleWorker(action)) {\r\n this._pendingActions.push(action);\r\n }\r\n }\r\n\r\n protected _executeOnIdleWorker(action: (worker: Worker, onComplete: () => void) => void): boolean {\r\n for (const workerInfo of this._workerInfos) {\r\n if (workerInfo.idle) {\r\n this._execute(workerInfo, action);\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n protected _execute(workerInfo: WorkerInfo, action: (worker: Worker, onComplete: () => void) => void): void {\r\n workerInfo.idle = false;\r\n workerInfo.workerPromise.then((worker) => {\r\n action(worker, () => {\r\n const nextAction = this._pendingActions.shift();\r\n if (nextAction) {\r\n this._execute(workerInfo, nextAction);\r\n } else {\r\n workerInfo.idle = true;\r\n }\r\n });\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Options for AutoReleaseWorkerPool\r\n */\r\nexport interface AutoReleaseWorkerPoolOptions {\r\n /**\r\n * Idle time elapsed before workers are terminated.\r\n */\r\n idleTimeElapsedBeforeRelease: number;\r\n}\r\n\r\n/**\r\n * Similar to the WorkerPool class except it creates and destroys workers automatically with a maximum of `maxWorkers` workers.\r\n * Workers are terminated when it is idle for at least `idleTimeElapsedBeforeRelease` milliseconds.\r\n */\r\nexport class AutoReleaseWorkerPool extends WorkerPool {\r\n /**\r\n * Default options for the constructor.\r\n * Override to change the defaults.\r\n */\r\n public static DefaultOptions: AutoReleaseWorkerPoolOptions = {\r\n idleTimeElapsedBeforeRelease: 1000,\r\n };\r\n\r\n private readonly _maxWorkers: number;\r\n private readonly _createWorkerAsync: () => Promise<Worker>;\r\n private readonly _options: AutoReleaseWorkerPoolOptions;\r\n\r\n constructor(maxWorkers: number, createWorkerAsync: () => Promise<Worker>, options = AutoReleaseWorkerPool.DefaultOptions) {\r\n super([]);\r\n\r\n this._maxWorkers = maxWorkers;\r\n this._createWorkerAsync = createWorkerAsync;\r\n this._options = options;\r\n }\r\n\r\n public push(action: (worker: Worker, onComplete: () => void) => void): void {\r\n if (!this._executeOnIdleWorker(action)) {\r\n if (this._workerInfos.length < this._maxWorkers) {\r\n const workerInfo: WorkerInfo = {\r\n workerPromise: this._createWorkerAsync(),\r\n idle: false,\r\n };\r\n this._workerInfos.push(workerInfo);\r\n this._execute(workerInfo, action);\r\n } else {\r\n this._pendingActions.push(action);\r\n }\r\n }\r\n }\r\n\r\n protected _execute(workerInfo: WorkerInfo, action: (worker: Worker, onComplete: () => void) => void): void {\r\n // Reset the idle timeout.\r\n if (workerInfo.timeoutId) {\r\n clearTimeout(workerInfo.timeoutId);\r\n delete workerInfo.timeoutId;\r\n }\r\n\r\n super._execute(workerInfo, (worker, onComplete) => {\r\n action(worker, () => {\r\n onComplete();\r\n\r\n if (workerInfo.idle) {\r\n // Schedule the worker to be terminated after the elapsed time.\r\n workerInfo.timeoutId = setTimeout(() => {\r\n workerInfo.workerPromise.then((worker) => {\r\n worker.terminate();\r\n });\r\n\r\n const indexOf = this._workerInfos.indexOf(workerInfo);\r\n if (indexOf !== -1) {\r\n this._workerInfos.splice(indexOf, 1);\r\n }\r\n }, this._options.idleTimeElapsedBeforeRelease);\r\n }\r\n });\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"workerPool.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/workerPool.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,OAAO,UAAU;IAInB;;;OAGG;IACH,YAAY,OAAsB;QANxB,oBAAe,GAAG,IAAI,KAAK,EAAoD,CAAC;QAOtF,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACzC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;YACtC,IAAI,EAAE,IAAI;SACb,CAAC,CAAC,CAAC;IACR,CAAC;IAED;;OAEG;IACI,OAA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AC,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;4BACrC,MAAM,CAAC,SAAS,EAAE,CAAC;wBACvB,CAAC,CAAC,CAAC;wBAEH,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;wBACtD,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE;4BAChB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;yBACxC;oBACL,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC;iBAClD;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;;AA7DD;;;GAGG;AACW,oCAAc,GAAiC;IACzD,4BAA4B,EAAE,IAAI;CACrC,CAAC","sourcesContent":["import type { IDisposable } from \"../scene\";\r\n\r\n/** @ignore */\r\ninterface WorkerInfo {\r\n workerPromise: Promise<Worker>;\r\n idle: boolean;\r\n timeoutId?: ReturnType<typeof setTimeout>;\r\n}\r\n\r\n/**\r\n * Helper class to push actions to a pool of workers.\r\n */\r\nexport class WorkerPool implements IDisposable {\r\n protected _workerInfos: Array<WorkerInfo>;\r\n protected _pendingActions = new Array<(worker: Worker, onComplete: () => void) => void>();\r\n\r\n /**\r\n * Constructor\r\n * @param workers Array of workers to use for actions\r\n */\r\n constructor(workers: Array<Worker>) {\r\n this._workerInfos = workers.map((worker) => ({\r\n workerPromise: Promise.resolve(worker),\r\n idle: true,\r\n }));\r\n }\r\n\r\n /**\r\n * Terminates all workers and clears any pending actions.\r\n */\r\n public dispose(): void {\r\n for (const workerInfo of this._workerInfos) {\r\n workerInfo.workerPromise.then((worker) => {\r\n worker.terminate();\r\n });\r\n }\r\n\r\n this._workerInfos.length = 0;\r\n this._pendingActions.length = 0;\r\n }\r\n\r\n /**\r\n * Pushes an action to the worker pool. If all the workers are active, the action will be\r\n * pended until a worker has completed its action.\r\n * @param action The action to perform. Call onComplete when the action is complete.\r\n */\r\n public push(action: (worker: Worker, onComplete: () => void) => void): void {\r\n if (!this._executeOnIdleWorker(action)) {\r\n this._pendingActions.push(action);\r\n }\r\n }\r\n\r\n protected _executeOnIdleWorker(action: (worker: Worker, onComplete: () => void) => void): boolean {\r\n for (const workerInfo of this._workerInfos) {\r\n if (workerInfo.idle) {\r\n this._execute(workerInfo, action);\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n protected _execute(workerInfo: WorkerInfo, action: (worker: Worker, onComplete: () => void) => void): void {\r\n workerInfo.idle = false;\r\n workerInfo.workerPromise.then((worker) => {\r\n action(worker, () => {\r\n const nextAction = this._pendingActions.shift();\r\n if (nextAction) {\r\n this._execute(workerInfo, nextAction);\r\n } else {\r\n workerInfo.idle = true;\r\n }\r\n });\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Options for AutoReleaseWorkerPool\r\n */\r\nexport interface AutoReleaseWorkerPoolOptions {\r\n /**\r\n * Idle time elapsed before workers are terminated.\r\n */\r\n idleTimeElapsedBeforeRelease: number;\r\n}\r\n\r\n/**\r\n * Similar to the WorkerPool class except it creates and destroys workers automatically with a maximum of `maxWorkers` workers.\r\n * Workers are terminated when it is idle for at least `idleTimeElapsedBeforeRelease` milliseconds.\r\n */\r\nexport class AutoReleaseWorkerPool extends WorkerPool {\r\n /**\r\n * Default options for the constructor.\r\n * Override to change the defaults.\r\n */\r\n public static DefaultOptions: AutoReleaseWorkerPoolOptions = {\r\n idleTimeElapsedBeforeRelease: 1000,\r\n };\r\n\r\n private readonly _maxWorkers: number;\r\n private readonly _createWorkerAsync: () => Promise<Worker>;\r\n private readonly _options: AutoReleaseWorkerPoolOptions;\r\n\r\n constructor(maxWorkers: number, createWorkerAsync: () => Promise<Worker>, options = AutoReleaseWorkerPool.DefaultOptions) {\r\n super([]);\r\n\r\n this._maxWorkers = maxWorkers;\r\n this._createWorkerAsync = createWorkerAsync;\r\n this._options = options;\r\n }\r\n\r\n public override push(action: (worker: Worker, onComplete: () => void) => void): void {\r\n if (!this._executeOnIdleWorker(action)) {\r\n if (this._workerInfos.length < this._maxWorkers) {\r\n const workerInfo: WorkerInfo = {\r\n workerPromise: this._createWorkerAsync(),\r\n idle: false,\r\n };\r\n this._workerInfos.push(workerInfo);\r\n this._execute(workerInfo, action);\r\n } else {\r\n this._pendingActions.push(action);\r\n }\r\n }\r\n }\r\n\r\n protected override _execute(workerInfo: WorkerInfo, action: (worker: Worker, onComplete: () => void) => void): void {\r\n // Reset the idle timeout.\r\n if (workerInfo.timeoutId) {\r\n clearTimeout(workerInfo.timeoutId);\r\n delete workerInfo.timeoutId;\r\n }\r\n\r\n super._execute(workerInfo, (worker, onComplete) => {\r\n action(worker, () => {\r\n onComplete();\r\n\r\n if (workerInfo.idle) {\r\n // Schedule the worker to be terminated after the elapsed time.\r\n workerInfo.timeoutId = setTimeout(() => {\r\n workerInfo.workerPromise.then((worker) => {\r\n worker.terminate();\r\n });\r\n\r\n const indexOf = this._workerInfos.indexOf(workerInfo);\r\n if (indexOf !== -1) {\r\n this._workerInfos.splice(indexOf, 1);\r\n }\r\n }, this._options.idleTimeElapsedBeforeRelease);\r\n }\r\n });\r\n });\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"cylinderParticleEmitter.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/EmitterTypes/cylinderParticleEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAGhC;;;;;;OAMG;IACH;IACI;;OAEG;IACI,SAAS,CAAC;IACjB;;OAEG;IACI,SAAS,CAAC;IACjB;;OAEG;IACI,cAAc,CAAC;IACtB;;OAEG;IACI,sBAAsB,CAAC;QAZv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C5B,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC5B,GAAG,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QACjC,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;QAChC,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,OAAO,0DAA0D,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,iCAAiC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC3D,mBAAmB,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAwB;QACjC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACjC,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3E,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/E,CAAC;CACJ","sourcesContent":["import type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport type { Particle } from \"../../Particles/particle\";\r\nimport type { IParticleEmitterType } from \"./IParticleEmitterType\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport type { UniformBufferEffectCommonAccessor } from \"../../Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\n/**\r\n * Particle emitter emitting particles from the inside of a cylinder.\r\n * It emits the particles alongside the cylinder radius. The emission direction might be randomized.\r\n */\r\nexport class CylinderParticleEmitter implements IParticleEmitterType {\r\n private _tempVector = Vector3.Zero();\r\n\r\n /**\r\n * Creates a new instance CylinderParticleEmitter\r\n * @param radius the radius of the emission cylinder (1 by default)\r\n * @param height the height of the emission cylinder (1 by default)\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n constructor(\r\n /**\r\n * The radius of the emission cylinder.\r\n */\r\n public radius = 1,\r\n /**\r\n * The height of the emission cylinder.\r\n */\r\n public height = 1,\r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n public radiusRange = 1,\r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n public directionRandomizer = 0\r\n ) {}\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n * @param inverseWorldMatrix defines the inverted world matrix to use if isLocal is false\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean, inverseWorldMatrix: Matrix): void {\r\n particle.position.subtractToRef(worldMatrix.getTranslation(), this._tempVector);\r\n\r\n this._tempVector.normalize();\r\n\r\n Vector3.TransformNormalToRef(this._tempVector, inverseWorldMatrix, this._tempVector);\r\n\r\n const randY = Scalar.RandomRange(-this.directionRandomizer / 2, this.directionRandomizer / 2);\r\n\r\n let angle = Math.atan2(this._tempVector.x, this._tempVector.z);\r\n angle += Scalar.RandomRange(-Math.PI / 2, Math.PI / 2) * this.directionRandomizer;\r\n\r\n this._tempVector.y = randY; // set direction y to rand y to mirror normal of cylinder surface\r\n this._tempVector.x = Math.sin(angle);\r\n this._tempVector.z = Math.cos(angle);\r\n this._tempVector.normalize();\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFrom(this._tempVector);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalFromFloatsToRef(this._tempVector.x, this._tempVector.y, this._tempVector.z, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the position should be set in local space\r\n */\r\n public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const yPos = Scalar.RandomRange(-this.height / 2, this.height / 2);\r\n const angle = Scalar.RandomRange(0, 2 * Math.PI);\r\n\r\n // Pick a properly distributed point within the circle https://programming.guide/random-point-within-circle.html\r\n const radiusDistribution = Scalar.RandomRange((1 - this.radiusRange) * (1 - this.radiusRange), 1);\r\n const positionRadius = Math.sqrt(radiusDistribution) * this.radius;\r\n const xPos = positionRadius * Math.cos(angle);\r\n const zPos = positionRadius * Math.sin(angle);\r\n\r\n if (isLocal) {\r\n positionToUpdate.copyFromFloats(xPos, yPos, zPos);\r\n return;\r\n }\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(xPos, yPos, zPos, worldMatrix, positionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): CylinderParticleEmitter {\r\n const newOne = new CylinderParticleEmitter(this.radius, this.directionRandomizer);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"height\", this.height);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"height\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"directionRandomizer\", 1);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n return \"#define CYLINDEREMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"CylinderParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"CylinderParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.height = this.height;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n this.radius = serializationObject.radius;\r\n this.height = serializationObject.height;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n }\r\n}\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cylinder.\r\n * It emits the particles randomly between two vectors.\r\n */\r\nexport class CylinderDirectedParticleEmitter extends CylinderParticleEmitter {\r\n /**\r\n * Creates a new instance CylinderDirectedParticleEmitter\r\n * @param radius the radius of the emission cylinder (1 by default)\r\n * @param height the height of the emission cylinder (1 by default)\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 the min limit of the emission direction (up vector by default)\r\n * @param direction2 the max limit of the emission direction (up vector by default)\r\n */\r\n constructor(\r\n radius = 1,\r\n height = 1,\r\n radiusRange = 1,\r\n /**\r\n * The min limit of the emission direction.\r\n */\r\n public direction1 = new Vector3(0, 1, 0),\r\n /**\r\n * The max limit of the emission direction.\r\n */\r\n public direction2 = new Vector3(0, 1, 0)\r\n ) {\r\n super(radius, height, radiusRange);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param _particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, _particle: Particle, isLocal: boolean): void {\r\n const randX = Scalar.RandomRange(this.direction1.x, this.direction2.x);\r\n const randY = Scalar.RandomRange(this.direction1.y, this.direction2.y);\r\n const randZ = Scalar.RandomRange(this.direction1.z, this.direction2.z);\r\n if (isLocal) {\r\n directionToUpdate.copyFromFloats(randX, randY, randZ);\r\n return;\r\n }\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): CylinderDirectedParticleEmitter {\r\n const newOne = new CylinderDirectedParticleEmitter(this.radius, this.height, this.radiusRange, this.direction1, this.direction2);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"height\", this.height);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setVector3(\"direction1\", this.direction1);\r\n uboOrEffect.setVector3(\"direction2\", this.direction2);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"height\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"direction1\", 3);\r\n ubo.addUniform(\"direction2\", 3);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n return \"#define CYLINDEREMITTER\\n#define DIRECTEDCYLINDEREMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"CylinderDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"CylinderDirectedParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n super.parse(serializationObject);\r\n Vector3.FromArrayToRef(serializationObject.direction1, 0, this.direction1);\r\n Vector3.FromArrayToRef(serializationObject.direction2, 0, this.direction2);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"cylinderParticleEmitter.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/EmitterTypes/cylinderParticleEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CA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\"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport type { Particle } from \"../../Particles/particle\";\r\nimport type { IParticleEmitterType } from \"./IParticleEmitterType\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport type { UniformBufferEffectCommonAccessor } from \"../../Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\n/**\r\n * Particle emitter emitting particles from the inside of a cylinder.\r\n * It emits the particles alongside the cylinder radius. The emission direction might be randomized.\r\n */\r\nexport class CylinderParticleEmitter implements IParticleEmitterType {\r\n private _tempVector = Vector3.Zero();\r\n\r\n /**\r\n * Creates a new instance CylinderParticleEmitter\r\n * @param radius the radius of the emission cylinder (1 by default)\r\n * @param height the height of the emission cylinder (1 by default)\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n constructor(\r\n /**\r\n * The radius of the emission cylinder.\r\n */\r\n public radius = 1,\r\n /**\r\n * The height of the emission cylinder.\r\n */\r\n public height = 1,\r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n public radiusRange = 1,\r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n public directionRandomizer = 0\r\n ) {}\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n * @param inverseWorldMatrix defines the inverted world matrix to use if isLocal is false\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean, inverseWorldMatrix: Matrix): void {\r\n particle.position.subtractToRef(worldMatrix.getTranslation(), this._tempVector);\r\n\r\n this._tempVector.normalize();\r\n\r\n Vector3.TransformNormalToRef(this._tempVector, inverseWorldMatrix, this._tempVector);\r\n\r\n const randY = Scalar.RandomRange(-this.directionRandomizer / 2, this.directionRandomizer / 2);\r\n\r\n let angle = Math.atan2(this._tempVector.x, this._tempVector.z);\r\n angle += Scalar.RandomRange(-Math.PI / 2, Math.PI / 2) * this.directionRandomizer;\r\n\r\n this._tempVector.y = randY; // set direction y to rand y to mirror normal of cylinder surface\r\n this._tempVector.x = Math.sin(angle);\r\n this._tempVector.z = Math.cos(angle);\r\n this._tempVector.normalize();\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFrom(this._tempVector);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalFromFloatsToRef(this._tempVector.x, this._tempVector.y, this._tempVector.z, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the position should be set in local space\r\n */\r\n public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const yPos = Scalar.RandomRange(-this.height / 2, this.height / 2);\r\n const angle = Scalar.RandomRange(0, 2 * Math.PI);\r\n\r\n // Pick a properly distributed point within the circle https://programming.guide/random-point-within-circle.html\r\n const radiusDistribution = Scalar.RandomRange((1 - this.radiusRange) * (1 - this.radiusRange), 1);\r\n const positionRadius = Math.sqrt(radiusDistribution) * this.radius;\r\n const xPos = positionRadius * Math.cos(angle);\r\n const zPos = positionRadius * Math.sin(angle);\r\n\r\n if (isLocal) {\r\n positionToUpdate.copyFromFloats(xPos, yPos, zPos);\r\n return;\r\n }\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(xPos, yPos, zPos, worldMatrix, positionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): CylinderParticleEmitter {\r\n const newOne = new CylinderParticleEmitter(this.radius, this.directionRandomizer);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"height\", this.height);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"height\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"directionRandomizer\", 1);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n return \"#define CYLINDEREMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"CylinderParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"CylinderParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.height = this.height;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n this.radius = serializationObject.radius;\r\n this.height = serializationObject.height;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n }\r\n}\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a cylinder.\r\n * It emits the particles randomly between two vectors.\r\n */\r\nexport class CylinderDirectedParticleEmitter extends CylinderParticleEmitter {\r\n /**\r\n * Creates a new instance CylinderDirectedParticleEmitter\r\n * @param radius the radius of the emission cylinder (1 by default)\r\n * @param height the height of the emission cylinder (1 by default)\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 the min limit of the emission direction (up vector by default)\r\n * @param direction2 the max limit of the emission direction (up vector by default)\r\n */\r\n constructor(\r\n radius = 1,\r\n height = 1,\r\n radiusRange = 1,\r\n /**\r\n * The min limit of the emission direction.\r\n */\r\n public direction1 = new Vector3(0, 1, 0),\r\n /**\r\n * The max limit of the emission direction.\r\n */\r\n public direction2 = new Vector3(0, 1, 0)\r\n ) {\r\n super(radius, height, radiusRange);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param _particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public override startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, _particle: Particle, isLocal: boolean): void {\r\n const randX = Scalar.RandomRange(this.direction1.x, this.direction2.x);\r\n const randY = Scalar.RandomRange(this.direction1.y, this.direction2.y);\r\n const randZ = Scalar.RandomRange(this.direction1.z, this.direction2.z);\r\n if (isLocal) {\r\n directionToUpdate.copyFromFloats(randX, randY, randZ);\r\n return;\r\n }\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public override clone(): CylinderDirectedParticleEmitter {\r\n const newOne = new CylinderDirectedParticleEmitter(this.radius, this.height, this.radiusRange, this.direction1, this.direction2);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public override applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"height\", this.height);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setVector3(\"direction1\", this.direction1);\r\n uboOrEffect.setVector3(\"direction2\", this.direction2);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public override buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"height\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"direction1\", 3);\r\n ubo.addUniform(\"direction2\", 3);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public override getEffectDefines(): string {\r\n return \"#define CYLINDEREMITTER\\n#define DIRECTEDCYLINDEREMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"CylinderDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public override getClassName(): string {\r\n return \"CylinderDirectedParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public override parse(serializationObject: any): void {\r\n super.parse(serializationObject);\r\n Vector3.FromArrayToRef(serializationObject.direction1, 0, this.direction1);\r\n Vector3.FromArrayToRef(serializationObject.direction2, 0, this.direction2);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sphereParticleEmitter.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/EmitterTypes/sphereParticleEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IAC9B;;;;;OAKG;IACH;IACI;;OAEG;IACI,SAAS,CAAC;IACjB;;OAEG;IACI,cAAc,CAAC;IACtB;;OAEG;IACI,sBAAsB,CAAC;QARvB,WAAM,GAAN,MAAM,CAAI;QAIV,gBAAW,GAAX,WAAW,CAAI;QAIf,wBAAmB,GAAnB,mBAAmB,CAAI;IAC/B,CAAC;IAEJ;;;;;;OAMG;IACI,sBAAsB,CAAC,WAAmB,EAAE,iBAA0B,EAAE,QAAkB,EAAE,OAAgB;QAC/G,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;QACvF,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC9D,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC;QACrB,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC;QACrB,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC;QACrB,SAAS,CAAC,SAAS,EA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AAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAwB;QACjC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC;CACJ","sourcesContent":["import type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport type { Particle } from \"../../Particles/particle\";\r\nimport type { IParticleEmitterType } from \"./IParticleEmitterType\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport type { UniformBufferEffectCommonAccessor } from \"../../Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\n/**\r\n * Particle emitter emitting particles from the inside of a sphere.\r\n * It emits the particles alongside the sphere radius. The emission direction might be randomized.\r\n */\r\nexport class SphereParticleEmitter implements IParticleEmitterType {\r\n /**\r\n * Creates a new instance SphereParticleEmitter\r\n * @param radius the radius of the emission sphere (1 by default)\r\n * @param radiusRange the range of the emission sphere [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n constructor(\r\n /**\r\n * The radius of the emission sphere.\r\n */\r\n public radius = 1,\r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n public radiusRange = 1,\r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n public directionRandomizer = 0\r\n ) {}\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n const randX = Scalar.RandomRange(0, this.directionRandomizer);\r\n const randY = Scalar.RandomRange(0, this.directionRandomizer);\r\n const randZ = Scalar.RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFrom(direction);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the position should be set in local space\r\n */\r\n public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const randRadius = this.radius - Scalar.RandomRange(0, this.radius * this.radiusRange);\r\n const v = Scalar.RandomRange(0, 1.0);\r\n const phi = Scalar.RandomRange(0, 2 * Math.PI);\r\n const theta = Math.acos(2 * v - 1);\r\n const randX = randRadius * Math.cos(phi) * Math.sin(theta);\r\n const randY = randRadius * Math.cos(theta);\r\n const randZ = randRadius * Math.sin(phi) * Math.sin(theta);\r\n\r\n if (isLocal) {\r\n positionToUpdate.copyFromFloats(randX, randY, randZ);\r\n return;\r\n }\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): SphereParticleEmitter {\r\n const newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"directionRandomizer\", 1);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n return \"#define SPHEREEMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"SphereParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"SphereParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n this.radius = serializationObject.radius;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n }\r\n}\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a sphere.\r\n * It emits the particles randomly between two vectors.\r\n */\r\nexport class SphereDirectedParticleEmitter extends SphereParticleEmitter {\r\n /**\r\n * Creates a new instance SphereDirectedParticleEmitter\r\n * @param radius the radius of the emission sphere (1 by default)\r\n * @param direction1 the min limit of the emission direction (up vector by default)\r\n * @param direction2 the max limit of the emission direction (up vector by default)\r\n */\r\n constructor(\r\n radius = 1,\r\n /**\r\n * The min limit of the emission direction.\r\n */\r\n public direction1 = new Vector3(0, 1, 0),\r\n /**\r\n * The max limit of the emission direction.\r\n */\r\n public direction2 = new Vector3(0, 1, 0)\r\n ) {\r\n super(radius);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3): void {\r\n const randX = Scalar.RandomRange(this.direction1.x, this.direction2.x);\r\n const randY = Scalar.RandomRange(this.direction1.y, this.direction2.y);\r\n const randZ = Scalar.RandomRange(this.direction1.z, this.direction2.z);\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): SphereDirectedParticleEmitter {\r\n const newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setVector3(\"direction1\", this.direction1);\r\n uboOrEffect.setVector3(\"direction2\", this.direction2);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"direction1\", 3);\r\n ubo.addUniform(\"direction2\", 3);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n return \"#define SPHEREEMITTER\\n#define DIRECTEDSPHEREEMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"SphereDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"SphereDirectedParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n super.parse(serializationObject);\r\n this.direction1.copyFrom(serializationObject.direction1);\r\n this.direction2.copyFrom(serializationObject.direction2);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"sphereParticleEmitter.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/EmitterTypes/sphereParticleEmitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IAC9B;;;;;OAKG;IACH;IACI;;OAEG;IACI,SAAS,CAAC;IACjB;;OAEG;IACI,cAAc,CAAC;IACtB;;OAEG;IACI,sBAAsB,CAAC;QARvB,WAAM,GAAN,MAAM,CAAI;QAIV,gBAAW,GAAX,WAAW,CAAI;QAIf,wBAAmB,GAAnB,mBAAmB,CAAI;IAC/B,CAAC;IAEJ;;;;;;OAMG;IACI,sBAAsB,CAAC,WAAmB,EAAE,iB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5B,GAAG,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QACjC,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;QAChC,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACa,gBAAgB;QAC5B,OAAO,sDAAsD,CAAC;IAClE,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,+BAA+B,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC3D,mBAAmB,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAE3D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACa,KAAK,CAAC,mBAAwB;QAC1C,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC;CACJ","sourcesContent":["import type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport type { Particle } from \"../../Particles/particle\";\r\nimport type { IParticleEmitterType } from \"./IParticleEmitterType\";\r\nimport { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport type { UniformBufferEffectCommonAccessor } from \"../../Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\n/**\r\n * Particle emitter emitting particles from the inside of a sphere.\r\n * It emits the particles alongside the sphere radius. The emission direction might be randomized.\r\n */\r\nexport class SphereParticleEmitter implements IParticleEmitterType {\r\n /**\r\n * Creates a new instance SphereParticleEmitter\r\n * @param radius the radius of the emission sphere (1 by default)\r\n * @param radiusRange the range of the emission sphere [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param directionRandomizer defines how much to randomize the particle direction [0-1]\r\n */\r\n constructor(\r\n /**\r\n * The radius of the emission sphere.\r\n */\r\n public radius = 1,\r\n /**\r\n * The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n public radiusRange = 1,\r\n /**\r\n * How much to randomize the particle direction [0-1].\r\n */\r\n public directionRandomizer = 0\r\n ) {}\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const direction = particle.position.subtract(worldMatrix.getTranslation()).normalize();\r\n const randX = Scalar.RandomRange(0, this.directionRandomizer);\r\n const randY = Scalar.RandomRange(0, this.directionRandomizer);\r\n const randZ = Scalar.RandomRange(0, this.directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFrom(direction);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the position should be set in local space\r\n */\r\n public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const randRadius = this.radius - Scalar.RandomRange(0, this.radius * this.radiusRange);\r\n const v = Scalar.RandomRange(0, 1.0);\r\n const phi = Scalar.RandomRange(0, 2 * Math.PI);\r\n const theta = Math.acos(2 * v - 1);\r\n const randX = randRadius * Math.cos(phi) * Math.sin(theta);\r\n const randY = randRadius * Math.cos(theta);\r\n const randZ = randRadius * Math.sin(phi) * Math.sin(theta);\r\n\r\n if (isLocal) {\r\n positionToUpdate.copyFromFloats(randX, randY, randZ);\r\n return;\r\n }\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): SphereParticleEmitter {\r\n const newOne = new SphereParticleEmitter(this.radius, this.directionRandomizer);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setFloat(\"directionRandomizer\", this.directionRandomizer);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"directionRandomizer\", 1);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n return \"#define SPHEREEMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"SphereParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"SphereParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.type = this.getClassName();\r\n serializationObject.radius = this.radius;\r\n serializationObject.radiusRange = this.radiusRange;\r\n serializationObject.directionRandomizer = this.directionRandomizer;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n this.radius = serializationObject.radius;\r\n this.radiusRange = serializationObject.radiusRange;\r\n this.directionRandomizer = serializationObject.directionRandomizer;\r\n }\r\n}\r\n\r\n/**\r\n * Particle emitter emitting particles from the inside of a sphere.\r\n * It emits the particles randomly between two vectors.\r\n */\r\nexport class SphereDirectedParticleEmitter extends SphereParticleEmitter {\r\n /**\r\n * Creates a new instance SphereDirectedParticleEmitter\r\n * @param radius the radius of the emission sphere (1 by default)\r\n * @param direction1 the min limit of the emission direction (up vector by default)\r\n * @param direction2 the max limit of the emission direction (up vector by default)\r\n */\r\n constructor(\r\n radius = 1,\r\n /**\r\n * The min limit of the emission direction.\r\n */\r\n public direction1 = new Vector3(0, 1, 0),\r\n /**\r\n * The max limit of the emission direction.\r\n */\r\n public direction2 = new Vector3(0, 1, 0)\r\n ) {\r\n super(radius);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n */\r\n public override startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3): void {\r\n const randX = Scalar.RandomRange(this.direction1.x, this.direction2.x);\r\n const randY = Scalar.RandomRange(this.direction1.y, this.direction2.y);\r\n const randZ = Scalar.RandomRange(this.direction1.z, this.direction2.z);\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public override clone(): SphereDirectedParticleEmitter {\r\n const newOne = new SphereDirectedParticleEmitter(this.radius, this.direction1, this.direction2);\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n public override applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {\r\n uboOrEffect.setFloat(\"radius\", this.radius);\r\n uboOrEffect.setFloat(\"radiusRange\", this.radiusRange);\r\n uboOrEffect.setVector3(\"direction1\", this.direction1);\r\n uboOrEffect.setVector3(\"direction2\", this.direction2);\r\n }\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n public override buildUniformLayout(ubo: UniformBuffer): void {\r\n ubo.addUniform(\"radius\", 1);\r\n ubo.addUniform(\"radiusRange\", 1);\r\n ubo.addUniform(\"direction1\", 3);\r\n ubo.addUniform(\"direction2\", 3);\r\n }\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public override getEffectDefines(): string {\r\n return \"#define SPHEREEMITTER\\n#define DIRECTEDSPHEREEMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"SphereDirectedParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public override getClassName(): string {\r\n return \"SphereDirectedParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.direction1 = this.direction1.asArray();\r\n serializationObject.direction2 = this.direction2.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public override parse(serializationObject: any): void {\r\n super.parse(serializationObject);\r\n this.direction1.copyFrom(serializationObject.direction1);\r\n this.direction2.copyFrom(serializationObject.direction2);\r\n }\r\n}\r\n"]}