@babylonjs/core 7.21.0 → 7.21.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 (200) hide show
  1. package/Animations/easing.d.ts +20 -20
  2. package/Animations/easing.js +10 -10
  3. package/Animations/easing.js.map +1 -1
  4. package/Buffers/buffer.nonFloatVertexBuffers.js +2 -1
  5. package/Buffers/buffer.nonFloatVertexBuffers.js.map +1 -1
  6. package/Cameras/VR/vrExperienceHelper.d.ts +2 -2
  7. package/Cameras/VR/vrExperienceHelper.js +1 -1
  8. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  9. package/Collisions/gpuPicker.d.ts +9 -4
  10. package/Collisions/gpuPicker.js +64 -44
  11. package/Collisions/gpuPicker.js.map +1 -1
  12. package/Collisions/index.d.ts +4 -0
  13. package/Collisions/index.js +4 -0
  14. package/Collisions/index.js.map +1 -1
  15. package/Culling/Helper/computeShaderBoundingHelper.js +0 -3
  16. package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
  17. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +0 -1
  18. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +0 -1
  19. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  20. package/Engines/abstractEngine.d.ts +2 -1
  21. package/Engines/abstractEngine.js +2 -2
  22. package/Engines/abstractEngine.js.map +1 -1
  23. package/Engines/nativeEngine.js +0 -3
  24. package/Engines/nativeEngine.js.map +1 -1
  25. package/Engines/thinEngine.d.ts +2 -1
  26. package/Engines/thinEngine.js +3 -2
  27. package/Engines/thinEngine.js.map +1 -1
  28. package/Engines/webgpuEngine.d.ts +3 -1
  29. package/Engines/webgpuEngine.js +6 -3
  30. package/Engines/webgpuEngine.js.map +1 -1
  31. package/Gizmos/gizmo.d.ts +2 -2
  32. package/Gizmos/gizmo.js +1 -1
  33. package/Gizmos/gizmo.js.map +1 -1
  34. package/Layers/effectLayer.d.ts +1 -1
  35. package/Layers/effectLayer.js +18 -16
  36. package/Layers/effectLayer.js.map +1 -1
  37. package/Layers/glowLayer.d.ts +1 -1
  38. package/Layers/glowLayer.js +3 -5
  39. package/Layers/glowLayer.js.map +1 -1
  40. package/Layers/highlightLayer.d.ts +1 -1
  41. package/Layers/highlightLayer.js +7 -9
  42. package/Layers/highlightLayer.js.map +1 -1
  43. package/Layers/layer.d.ts +0 -1
  44. package/Layers/layer.js +15 -17
  45. package/Layers/layer.js.map +1 -1
  46. package/Lights/Shadows/cascadedShadowGenerator.d.ts +0 -3
  47. package/Lights/Shadows/cascadedShadowGenerator.js +0 -3
  48. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  49. package/Materials/Background/backgroundMaterial.d.ts +0 -1
  50. package/Materials/Background/backgroundMaterial.js +20 -20
  51. package/Materials/Background/backgroundMaterial.js.map +1 -1
  52. package/Materials/PBR/pbrBaseMaterial.d.ts +0 -1
  53. package/Materials/PBR/pbrBaseMaterial.js +34 -39
  54. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  55. package/Materials/effect.d.ts +7 -2
  56. package/Materials/effect.js +7 -3
  57. package/Materials/effect.js.map +1 -1
  58. package/Materials/shaderMaterial.d.ts +4 -0
  59. package/Materials/shaderMaterial.js +1 -0
  60. package/Materials/shaderMaterial.js.map +1 -1
  61. package/Materials/standardMaterial.d.ts +0 -1
  62. package/Materials/standardMaterial.js +20 -20
  63. package/Materials/standardMaterial.js.map +1 -1
  64. package/Maths/math.isovector.js +6 -6
  65. package/Maths/math.isovector.js.map +1 -1
  66. package/Meshes/Builders/geodesicBuilder.js +2 -2
  67. package/Meshes/Builders/geodesicBuilder.js.map +1 -1
  68. package/Meshes/Builders/goldbergBuilder.js +2 -2
  69. package/Meshes/Builders/goldbergBuilder.js.map +1 -1
  70. package/Meshes/linesMesh.d.ts +0 -2
  71. package/Meshes/linesMesh.js +16 -20
  72. package/Meshes/linesMesh.js.map +1 -1
  73. package/Misc/assetsManager.d.ts +16 -16
  74. package/Misc/assetsManager.js +8 -8
  75. package/Misc/assetsManager.js.map +1 -1
  76. package/Misc/copyTextureToTexture.d.ts +9 -1
  77. package/Misc/copyTextureToTexture.js +23 -2
  78. package/Misc/copyTextureToTexture.js.map +1 -1
  79. package/Misc/environmentTextureTools.d.ts +0 -2
  80. package/Misc/environmentTextureTools.js +0 -2
  81. package/Misc/environmentTextureTools.js.map +1 -1
  82. package/Misc/index.d.ts +2 -0
  83. package/Misc/index.js +3 -0
  84. package/Misc/index.js.map +1 -1
  85. package/Misc/sceneOptimizer.d.ts +16 -16
  86. package/Misc/sceneOptimizer.js +8 -8
  87. package/Misc/sceneOptimizer.js.map +1 -1
  88. package/Particles/EmitterTypes/coneParticleEmitter.d.ts +4 -4
  89. package/Particles/EmitterTypes/coneParticleEmitter.js +2 -2
  90. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  91. package/Particles/EmitterTypes/cylinderParticleEmitter.d.ts +4 -4
  92. package/Particles/EmitterTypes/cylinderParticleEmitter.js +2 -2
  93. package/Particles/EmitterTypes/cylinderParticleEmitter.js.map +1 -1
  94. package/Particles/EmitterTypes/sphereParticleEmitter.d.ts +4 -4
  95. package/Particles/EmitterTypes/sphereParticleEmitter.js +2 -2
  96. package/Particles/EmitterTypes/sphereParticleEmitter.js.map +1 -1
  97. package/Particles/particleSystemComponent.d.ts +0 -1
  98. package/Particles/particleSystemComponent.js +8 -2
  99. package/Particles/particleSystemComponent.js.map +1 -1
  100. package/Particles/thinParticleSystem.d.ts +0 -2
  101. package/Particles/thinParticleSystem.js +0 -2
  102. package/Particles/thinParticleSystem.js.map +1 -1
  103. package/Physics/v1/physicsJoint.js +0 -3
  104. package/Physics/v1/physicsJoint.js.map +1 -1
  105. package/Physics/v2/physicsConstraint.d.ts +14 -20
  106. package/Physics/v2/physicsConstraint.js +14 -20
  107. package/Physics/v2/physicsConstraint.js.map +1 -1
  108. package/PostProcesses/anaglyphPostProcess.d.ts +1 -2
  109. package/PostProcesses/anaglyphPostProcess.js +4 -5
  110. package/PostProcesses/anaglyphPostProcess.js.map +1 -1
  111. package/PostProcesses/blackAndWhitePostProcess.d.ts +1 -1
  112. package/PostProcesses/blackAndWhitePostProcess.js +4 -4
  113. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  114. package/PostProcesses/bloomMergePostProcess.d.ts +1 -1
  115. package/PostProcesses/bloomMergePostProcess.js +4 -4
  116. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  117. package/PostProcesses/blurPostProcess.d.ts +1 -3
  118. package/PostProcesses/blurPostProcess.js +4 -6
  119. package/PostProcesses/blurPostProcess.js.map +1 -1
  120. package/PostProcesses/chromaticAberrationPostProcess.d.ts +1 -1
  121. package/PostProcesses/chromaticAberrationPostProcess.js +4 -4
  122. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  123. package/PostProcesses/circleOfConfusionPostProcess.d.ts +1 -1
  124. package/PostProcesses/circleOfConfusionPostProcess.js +4 -4
  125. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  126. package/PostProcesses/colorCorrectionPostProcess.d.ts +1 -1
  127. package/PostProcesses/colorCorrectionPostProcess.js +4 -4
  128. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  129. package/PostProcesses/convolutionPostProcess.d.ts +1 -1
  130. package/PostProcesses/convolutionPostProcess.js +4 -4
  131. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  132. package/PostProcesses/depthOfFieldMergePostProcess.d.ts +1 -1
  133. package/PostProcesses/depthOfFieldMergePostProcess.js +4 -4
  134. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  135. package/PostProcesses/displayPassPostProcess.d.ts +1 -1
  136. package/PostProcesses/displayPassPostProcess.js +10 -1
  137. package/PostProcesses/displayPassPostProcess.js.map +1 -1
  138. package/PostProcesses/extractHighlightsPostProcess.d.ts +1 -1
  139. package/PostProcesses/extractHighlightsPostProcess.js +4 -4
  140. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  141. package/PostProcesses/filterPostProcess.d.ts +1 -1
  142. package/PostProcesses/filterPostProcess.js +10 -1
  143. package/PostProcesses/filterPostProcess.js.map +1 -1
  144. package/PostProcesses/fxaaPostProcess.d.ts +1 -1
  145. package/PostProcesses/fxaaPostProcess.js +4 -4
  146. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  147. package/PostProcesses/grainPostProcess.d.ts +1 -2
  148. package/PostProcesses/grainPostProcess.js +4 -5
  149. package/PostProcesses/grainPostProcess.js.map +1 -1
  150. package/PostProcesses/highlightsPostProcess.d.ts +1 -1
  151. package/PostProcesses/highlightsPostProcess.js +10 -1
  152. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  153. package/PostProcesses/imageProcessingPostProcess.d.ts +1 -1
  154. package/PostProcesses/imageProcessingPostProcess.js +4 -4
  155. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  156. package/PostProcesses/index.d.ts +8 -0
  157. package/PostProcesses/index.js +12 -0
  158. package/PostProcesses/index.js.map +1 -1
  159. package/PostProcesses/motionBlurPostProcess.d.ts +1 -1
  160. package/PostProcesses/motionBlurPostProcess.js +4 -4
  161. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  162. package/PostProcesses/passPostProcess.d.ts +2 -2
  163. package/PostProcesses/passPostProcess.js +8 -8
  164. package/PostProcesses/passPostProcess.js.map +1 -1
  165. package/PostProcesses/postProcess.d.ts +5 -4
  166. package/PostProcesses/postProcess.js +14 -27
  167. package/PostProcesses/postProcess.js.map +1 -1
  168. package/PostProcesses/sharpenPostProcess.d.ts +1 -1
  169. package/PostProcesses/sharpenPostProcess.js +4 -4
  170. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  171. package/PostProcesses/tonemapPostProcess.d.ts +1 -1
  172. package/PostProcesses/tonemapPostProcess.js +10 -1
  173. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  174. package/PostProcesses/vrDistortionCorrectionPostProcess.d.ts +1 -1
  175. package/PostProcesses/vrDistortionCorrectionPostProcess.js +4 -4
  176. package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
  177. package/ShadersWGSL/copyTextureToTexture.fragment.d.ts +6 -0
  178. package/ShadersWGSL/copyTextureToTexture.fragment.js +21 -0
  179. package/ShadersWGSL/copyTextureToTexture.fragment.js.map +1 -0
  180. package/ShadersWGSL/displayPass.fragment.d.ts +5 -0
  181. package/ShadersWGSL/displayPass.fragment.js +12 -0
  182. package/ShadersWGSL/displayPass.fragment.js.map +1 -0
  183. package/ShadersWGSL/filter.fragment.d.ts +5 -0
  184. package/ShadersWGSL/filter.fragment.js +12 -0
  185. package/ShadersWGSL/filter.fragment.js.map +1 -0
  186. package/ShadersWGSL/highlights.fragment.d.ts +5 -0
  187. package/ShadersWGSL/highlights.fragment.js +12 -0
  188. package/ShadersWGSL/highlights.fragment.js.map +1 -0
  189. package/ShadersWGSL/picking.fragment.d.ts +5 -0
  190. package/ShadersWGSL/picking.fragment.js +21 -0
  191. package/ShadersWGSL/picking.fragment.js.map +1 -0
  192. package/ShadersWGSL/picking.vertex.d.ts +15 -0
  193. package/ShadersWGSL/picking.vertex.js +43 -0
  194. package/ShadersWGSL/picking.vertex.js.map +1 -0
  195. package/ShadersWGSL/tonemap.fragment.d.ts +5 -0
  196. package/ShadersWGSL/tonemap.fragment.js +29 -0
  197. package/ShadersWGSL/tonemap.fragment.js.map +1 -0
  198. package/XR/features/WebXRControllerPointerSelection.js +1 -1
  199. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  200. package/package.json +1 -1
@@ -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,C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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 * [1] The radius of the emission sphere.\r\n */\r\n public radius = 1,\r\n /**\r\n * [1] The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n public radiusRange = 1,\r\n /**\r\n * [0] 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"]}
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,CAA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+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 * [1] The radius of the emission sphere.\r\n */\r\n public radius = 1,\r\n /**\r\n * [1] The range of emission [0-1] 0 Surface only, 1 Entire Radius.\r\n */\r\n public radiusRange = 1,\r\n /**\r\n * [0] 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 * [Up vector] The min limit of the emission direction.\r\n */\r\n public direction1 = new Vector3(0, 1, 0),\r\n /**\r\n * [Up vector] 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"]}
@@ -1,6 +1,5 @@
1
1
  import type { IParticleSystem } from "./IParticleSystem";
2
2
  import type { Effect } from "../Materials/effect";
3
- import "../Shaders/particles.vertex";
4
3
  import type { EffectFallbacks } from "../Materials/effectFallbacks";
5
4
  import { ShaderLanguage } from "../Materials/shaderLanguage.js";
6
5
  declare module "../Engines/abstractEngine" {
@@ -3,7 +3,6 @@ import { GPUParticleSystem } from "./gpuParticleSystem.js";
3
3
  import { AbstractScene } from "../abstractScene.js";
4
4
  import { ParticleSystem } from "./particleSystem.js";
5
5
  import { SceneComponentConstants } from "../sceneComponent.js";
6
- import "../Shaders/particles.vertex.js";
7
6
  import { AbstractEngine } from "../Engines/abstractEngine.js";
8
7
  // Adds the parsers to the scene parsers.
9
8
  AbstractScene.AddParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedData, scene, container, rootUrl) => {
@@ -54,7 +53,14 @@ AbstractEngine.prototype.createEffectForParticles = function (fragmentName, unif
54
53
  return this.createEffect({
55
54
  vertex: particleSystem?.vertexShaderName ?? "particles",
56
55
  fragmentElement: fragmentName,
57
- }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), allSamplers.concat(samplers), defines, fallbacks, onCompiled, onError, undefined, shaderLanguage);
56
+ }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), allSamplers.concat(samplers), defines, fallbacks, onCompiled, onError, undefined, shaderLanguage, async () => {
57
+ if (shaderLanguage === 0 /* ShaderLanguage.GLSL */) {
58
+ await import("../Shaders/particles.vertex.js");
59
+ }
60
+ else {
61
+ await import("../ShadersWGSL/particles.vertex.js");
62
+ }
63
+ });
58
64
  };
59
65
  Mesh.prototype.getEmittedParticleSystems = function () {
60
66
  const results = [];
@@ -1 +1 @@
1
- {"version":3,"file":"particleSystemComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/particleSystemComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,6BAA6B,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,2B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AAM,OAAO,GAAsB,EAAE,CAAC;IACtC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACzE,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC9D,IAAI,cAAc,CAAC,OAAO,KAAK,IAAI,EAAE;YACjC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAChC;KACJ;IACD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,IAAI,CAAC,SAAS,CAAC,kCAAkC,GAAG;IAChD,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IAC1C,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEvB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACzE,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAQ,cAAc,CAAC,OAAO,CAAC;QAE5C,IAAI,OAAO,CAAC,QAAQ,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;YACzD,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAChC;KACJ;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { Mesh } from \"../Meshes/mesh\";\r\nimport type { IParticleSystem } from \"./IParticleSystem\";\r\nimport { GPUParticleSystem } from \"./gpuParticleSystem\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { ParticleSystem } from \"./particleSystem\";\r\nimport type { Scene } from \"../scene\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport \"../Shaders/particles.vertex\";\r\nimport type { EffectFallbacks } from \"../Materials/effectFallbacks\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n// Adds the parsers to the scene parsers.\r\nAbstractScene.AddParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n const individualParser = AbstractScene.GetIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM);\r\n\r\n if (!individualParser) {\r\n return;\r\n }\r\n\r\n // Particles Systems\r\n if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {\r\n for (let index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {\r\n const parsedParticleSystem = parsedData.particleSystems[index];\r\n container.particleSystems.push(individualParser(parsedParticleSystem, scene, rootUrl));\r\n }\r\n }\r\n});\r\n\r\nAbstractScene.AddIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedParticleSystem: any, scene: Scene, rootUrl: string) => {\r\n if (parsedParticleSystem.activeParticleCount) {\r\n const ps = GPUParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);\r\n return ps;\r\n } else {\r\n const ps = ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);\r\n return ps;\r\n }\r\n});\r\n\r\ndeclare module \"../Engines/abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Create an effect to use with particle systems.\r\n * Please note that some parameters like animation sheets or not being billboard are not supported in this configuration, except if you pass\r\n * the particle system for which you want to create a custom effect in the last parameter\r\n * @param fragmentName defines the base name of the effect (The name of file without .fragment.fx)\r\n * @param uniformsNames defines a list of attribute names\r\n * @param samplers defines an array of string used to represent textures\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param fallbacks defines the list of potential fallbacks to use if shader compilation fails\r\n * @param onCompiled defines a function to call when the effect creation is successful\r\n * @param onError defines a function to call when the effect creation has failed\r\n * @param particleSystem the particle system you want to create the effect for\r\n * @param shaderLanguage defines the shader language to use\r\n * @returns the new Effect\r\n */\r\n createEffectForParticles(\r\n fragmentName: string,\r\n uniformsNames: string[],\r\n samplers: string[],\r\n defines: string,\r\n fallbacks?: EffectFallbacks,\r\n onCompiled?: (effect: Effect) => void,\r\n onError?: (effect: Effect, errors: string) => void,\r\n particleSystem?: IParticleSystem,\r\n shaderLanguage?: ShaderLanguage\r\n ): Effect;\r\n }\r\n}\r\n\r\nAbstractEngine.prototype.createEffectForParticles = function (\r\n fragmentName: string,\r\n uniformsNames: string[] = [],\r\n samplers: string[] = [],\r\n defines = \"\",\r\n fallbacks?: EffectFallbacks,\r\n onCompiled?: (effect: Effect) => void,\r\n onError?: (effect: Effect, errors: string) => void,\r\n particleSystem?: IParticleSystem,\r\n shaderLanguage = ShaderLanguage.GLSL\r\n): Effect {\r\n let attributesNamesOrOptions: Array<string> = [];\r\n let effectCreationOption: Array<string> = [];\r\n const allSamplers: Array<string> = [];\r\n\r\n if (particleSystem) {\r\n particleSystem.fillUniformsAttributesAndSamplerNames(effectCreationOption, attributesNamesOrOptions, allSamplers);\r\n } else {\r\n attributesNamesOrOptions = ParticleSystem._GetAttributeNamesOrOptions();\r\n effectCreationOption = ParticleSystem._GetEffectCreationOptions();\r\n }\r\n\r\n if (defines.indexOf(\" BILLBOARD\") === -1) {\r\n defines += \"\\n#define BILLBOARD\\n\";\r\n }\r\n\r\n if (particleSystem?.isAnimationSheetEnabled) {\r\n if (defines.indexOf(\" ANIMATESHEET\") === -1) {\r\n defines += \"\\n#define ANIMATESHEET\\n\";\r\n }\r\n }\r\n\r\n if (samplers.indexOf(\"diffuseSampler\") === -1) {\r\n samplers.push(\"diffuseSampler\");\r\n }\r\n\r\n return this.createEffect(\r\n {\r\n vertex: particleSystem?.vertexShaderName ?? \"particles\",\r\n fragmentElement: fragmentName,\r\n },\r\n attributesNamesOrOptions,\r\n effectCreationOption.concat(uniformsNames),\r\n allSamplers.concat(samplers),\r\n defines,\r\n fallbacks,\r\n onCompiled,\r\n onError,\r\n undefined,\r\n shaderLanguage\r\n );\r\n};\r\n\r\ndeclare module \"../Meshes/mesh\" {\r\n export interface Mesh {\r\n /**\r\n * Returns an array populated with IParticleSystem objects whose the mesh is the emitter\r\n * @returns an array of IParticleSystem\r\n */\r\n getEmittedParticleSystems(): IParticleSystem[];\r\n\r\n /**\r\n * Returns an array populated with IParticleSystem objects whose the mesh or its children are the emitter\r\n * @returns an array of IParticleSystem\r\n */\r\n getHierarchyEmittedParticleSystems(): IParticleSystem[];\r\n }\r\n}\r\n\r\nMesh.prototype.getEmittedParticleSystems = function (): IParticleSystem[] {\r\n const results: IParticleSystem[] = [];\r\n for (let index = 0; index < this.getScene().particleSystems.length; index++) {\r\n const particleSystem = this.getScene().particleSystems[index];\r\n if (particleSystem.emitter === this) {\r\n results.push(particleSystem);\r\n }\r\n }\r\n return results;\r\n};\r\n\r\nMesh.prototype.getHierarchyEmittedParticleSystems = function (): IParticleSystem[] {\r\n const results: IParticleSystem[] = [];\r\n const descendants = this.getDescendants();\r\n descendants.push(this);\r\n\r\n for (let index = 0; index < this.getScene().particleSystems.length; index++) {\r\n const particleSystem = this.getScene().particleSystems[index];\r\n const emitter: any = particleSystem.emitter;\r\n\r\n if (emitter.position && descendants.indexOf(emitter) !== -1) {\r\n results.push(particleSystem);\r\n }\r\n }\r\n\r\n return results;\r\n};\r\n"]}
1
+ {"version":3,"file":"particleSystemComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/particleSystemComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAA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AC,CAAC,EAAE;YACzD,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAChC;KACJ;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { Mesh } from \"../Meshes/mesh\";\r\nimport type { IParticleSystem } from \"./IParticleSystem\";\r\nimport { GPUParticleSystem } from \"./gpuParticleSystem\";\r\nimport { AbstractScene } from \"../abstractScene\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { ParticleSystem } from \"./particleSystem\";\r\nimport type { Scene } from \"../scene\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport type { EffectFallbacks } from \"../Materials/effectFallbacks\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n// Adds the parsers to the scene parsers.\r\nAbstractScene.AddParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => {\r\n const individualParser = AbstractScene.GetIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM);\r\n\r\n if (!individualParser) {\r\n return;\r\n }\r\n\r\n // Particles Systems\r\n if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {\r\n for (let index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {\r\n const parsedParticleSystem = parsedData.particleSystems[index];\r\n container.particleSystems.push(individualParser(parsedParticleSystem, scene, rootUrl));\r\n }\r\n }\r\n});\r\n\r\nAbstractScene.AddIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedParticleSystem: any, scene: Scene, rootUrl: string) => {\r\n if (parsedParticleSystem.activeParticleCount) {\r\n const ps = GPUParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);\r\n return ps;\r\n } else {\r\n const ps = ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);\r\n return ps;\r\n }\r\n});\r\n\r\ndeclare module \"../Engines/abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Create an effect to use with particle systems.\r\n * Please note that some parameters like animation sheets or not being billboard are not supported in this configuration, except if you pass\r\n * the particle system for which you want to create a custom effect in the last parameter\r\n * @param fragmentName defines the base name of the effect (The name of file without .fragment.fx)\r\n * @param uniformsNames defines a list of attribute names\r\n * @param samplers defines an array of string used to represent textures\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param fallbacks defines the list of potential fallbacks to use if shader compilation fails\r\n * @param onCompiled defines a function to call when the effect creation is successful\r\n * @param onError defines a function to call when the effect creation has failed\r\n * @param particleSystem the particle system you want to create the effect for\r\n * @param shaderLanguage defines the shader language to use\r\n * @returns the new Effect\r\n */\r\n createEffectForParticles(\r\n fragmentName: string,\r\n uniformsNames: string[],\r\n samplers: string[],\r\n defines: string,\r\n fallbacks?: EffectFallbacks,\r\n onCompiled?: (effect: Effect) => void,\r\n onError?: (effect: Effect, errors: string) => void,\r\n particleSystem?: IParticleSystem,\r\n shaderLanguage?: ShaderLanguage\r\n ): Effect;\r\n }\r\n}\r\n\r\nAbstractEngine.prototype.createEffectForParticles = function (\r\n fragmentName: string,\r\n uniformsNames: string[] = [],\r\n samplers: string[] = [],\r\n defines = \"\",\r\n fallbacks?: EffectFallbacks,\r\n onCompiled?: (effect: Effect) => void,\r\n onError?: (effect: Effect, errors: string) => void,\r\n particleSystem?: IParticleSystem,\r\n shaderLanguage = ShaderLanguage.GLSL\r\n): Effect {\r\n let attributesNamesOrOptions: Array<string> = [];\r\n let effectCreationOption: Array<string> = [];\r\n const allSamplers: Array<string> = [];\r\n\r\n if (particleSystem) {\r\n particleSystem.fillUniformsAttributesAndSamplerNames(effectCreationOption, attributesNamesOrOptions, allSamplers);\r\n } else {\r\n attributesNamesOrOptions = ParticleSystem._GetAttributeNamesOrOptions();\r\n effectCreationOption = ParticleSystem._GetEffectCreationOptions();\r\n }\r\n\r\n if (defines.indexOf(\" BILLBOARD\") === -1) {\r\n defines += \"\\n#define BILLBOARD\\n\";\r\n }\r\n\r\n if (particleSystem?.isAnimationSheetEnabled) {\r\n if (defines.indexOf(\" ANIMATESHEET\") === -1) {\r\n defines += \"\\n#define ANIMATESHEET\\n\";\r\n }\r\n }\r\n\r\n if (samplers.indexOf(\"diffuseSampler\") === -1) {\r\n samplers.push(\"diffuseSampler\");\r\n }\r\n\r\n return this.createEffect(\r\n {\r\n vertex: particleSystem?.vertexShaderName ?? \"particles\",\r\n fragmentElement: fragmentName,\r\n },\r\n attributesNamesOrOptions,\r\n effectCreationOption.concat(uniformsNames),\r\n allSamplers.concat(samplers),\r\n defines,\r\n fallbacks,\r\n onCompiled,\r\n onError,\r\n undefined,\r\n shaderLanguage,\r\n async () => {\r\n if (shaderLanguage === ShaderLanguage.GLSL) {\r\n await import(\"../Shaders/particles.vertex\");\r\n } else {\r\n await import(\"../ShadersWGSL/particles.vertex\");\r\n }\r\n }\r\n );\r\n};\r\n\r\ndeclare module \"../Meshes/mesh\" {\r\n export interface Mesh {\r\n /**\r\n * Returns an array populated with IParticleSystem objects whose the mesh is the emitter\r\n * @returns an array of IParticleSystem\r\n */\r\n getEmittedParticleSystems(): IParticleSystem[];\r\n\r\n /**\r\n * Returns an array populated with IParticleSystem objects whose the mesh or its children are the emitter\r\n * @returns an array of IParticleSystem\r\n */\r\n getHierarchyEmittedParticleSystems(): IParticleSystem[];\r\n }\r\n}\r\n\r\nMesh.prototype.getEmittedParticleSystems = function (): IParticleSystem[] {\r\n const results: IParticleSystem[] = [];\r\n for (let index = 0; index < this.getScene().particleSystems.length; index++) {\r\n const particleSystem = this.getScene().particleSystems[index];\r\n if (particleSystem.emitter === this) {\r\n results.push(particleSystem);\r\n }\r\n }\r\n return results;\r\n};\r\n\r\nMesh.prototype.getHierarchyEmittedParticleSystems = function (): IParticleSystem[] {\r\n const results: IParticleSystem[] = [];\r\n const descendants = this.getDescendants();\r\n descendants.push(this);\r\n\r\n for (let index = 0; index < this.getScene().particleSystems.length; index++) {\r\n const particleSystem = this.getScene().particleSystems[index];\r\n const emitter: any = particleSystem.emitter;\r\n\r\n if (emitter.position && descendants.indexOf(emitter) !== -1) {\r\n results.push(particleSystem);\r\n }\r\n }\r\n\r\n return results;\r\n};\r\n"]}
@@ -10,8 +10,6 @@ import { BaseParticleSystem } from "./baseParticleSystem";
10
10
  import { Particle } from "./particle";
11
11
  import type { IAnimatable } from "../Animations/animatable.interface";
12
12
  import { DrawWrapper } from "../Materials/drawWrapper";
13
- import "../Shaders/particles.fragment";
14
- import "../Shaders/particles.vertex";
15
13
  import type { DataBuffer } from "../Buffers/dataBuffer";
16
14
  import { Color4, Color3 } from "../Maths/math.color";
17
15
  import type { AbstractEngine } from "../Engines/abstractEngine";
@@ -8,8 +8,6 @@ import { BaseParticleSystem } from "./baseParticleSystem.js";
8
8
  import { Particle } from "./particle.js";
9
9
 
10
10
  import { DrawWrapper } from "../Materials/drawWrapper.js";
11
- import "../Shaders/particles.fragment.js";
12
- import "../Shaders/particles.vertex.js";
13
11
  import { Color4, Color3, TmpColors } from "../Maths/math.color.js";
14
12
  import "../Engines/Extensions/engine.alpha.js";
15
13
  import { addClipPlaneUniforms, prepareStringDefinesForClipPlanes, bindClipPlane } from "../Materials/clipPlaneMaterialHelper.js";