@babylonjs/core 8.23.1 → 8.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/Buffers/storageBuffer.d.ts +6 -0
  2. package/Buffers/storageBuffer.js +8 -0
  3. package/Buffers/storageBuffer.js.map +1 -1
  4. package/Engines/Extensions/engine.multiRender.d.ts +2 -1
  5. package/Engines/Extensions/engine.multiRender.js +12 -7
  6. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  7. package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +2 -1
  8. package/Engines/WebGPU/Extensions/engine.multiRender.js +12 -7
  9. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  10. package/Engines/WebGPU/webgpuDrawContext.d.ts +6 -0
  11. package/Engines/WebGPU/webgpuDrawContext.js +9 -0
  12. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  13. package/Engines/abstractEngine.js +2 -2
  14. package/Engines/abstractEngine.js.map +1 -1
  15. package/Engines/engineCapabilities.d.ts +4 -0
  16. package/Engines/engineCapabilities.js.map +1 -1
  17. package/Engines/nativeEngine.js +2 -0
  18. package/Engines/nativeEngine.js.map +1 -1
  19. package/Engines/nullEngine.js +2 -0
  20. package/Engines/nullEngine.js.map +1 -1
  21. package/Engines/thinEngine.js +15 -0
  22. package/Engines/thinEngine.js.map +1 -1
  23. package/Engines/webgpuEngine.d.ts +7 -0
  24. package/Engines/webgpuEngine.js +12 -1
  25. package/Engines/webgpuEngine.js.map +1 -1
  26. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +12 -0
  27. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +52 -0
  28. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  29. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +0 -3
  30. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  31. package/FrameGraph/Node/nodeRenderGraph.js +7 -2
  32. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  33. package/FrameGraph/Tasks/Layers/baseLayerTask.js +1 -1
  34. package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
  35. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +11 -2
  36. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  37. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +6 -6
  38. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  39. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +27 -1
  40. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +76 -8
  41. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  42. package/FrameGraph/Tasks/Texture/clearTextureTask.js +2 -1
  43. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  44. package/FrameGraph/frameGraph.js +0 -7
  45. package/FrameGraph/frameGraph.js.map +1 -1
  46. package/FrameGraph/frameGraphRenderTarget.js +1 -1
  47. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  48. package/Lights/Clustered/clusteredLightContainer.d.ts +90 -0
  49. package/Lights/Clustered/clusteredLightContainer.js +401 -0
  50. package/Lights/Clustered/clusteredLightContainer.js.map +1 -0
  51. package/Lights/Clustered/clusteredLightingSceneComponent.d.ts +34 -0
  52. package/Lights/Clustered/clusteredLightingSceneComponent.js +47 -0
  53. package/Lights/Clustered/clusteredLightingSceneComponent.js.map +1 -0
  54. package/Lights/Clustered/index.d.ts +6 -0
  55. package/Lights/Clustered/index.js +7 -0
  56. package/Lights/Clustered/index.js.map +1 -0
  57. package/Lights/Shadows/shadowGenerator.js +9 -8
  58. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  59. package/Lights/index.d.ts +1 -0
  60. package/Lights/index.js +1 -0
  61. package/Lights/index.js.map +1 -1
  62. package/Lights/light.d.ts +2 -1
  63. package/Lights/light.js +2 -1
  64. package/Lights/light.js.map +1 -1
  65. package/Lights/lightConstants.d.ts +4 -0
  66. package/Lights/lightConstants.js +4 -0
  67. package/Lights/lightConstants.js.map +1 -1
  68. package/Lights/spotLight.d.ts +6 -3
  69. package/Lights/spotLight.js.map +1 -1
  70. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  71. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  72. package/Materials/materialHelper.functions.d.ts +2 -1
  73. package/Materials/materialHelper.functions.js +9 -3
  74. package/Materials/materialHelper.functions.js.map +1 -1
  75. package/Materials/standardMaterial.js +2 -2
  76. package/Materials/standardMaterial.js.map +1 -1
  77. package/Materials/uniformBuffer.d.ts +1 -1
  78. package/Materials/uniformBuffer.js +2 -2
  79. package/Materials/uniformBuffer.js.map +1 -1
  80. package/Meshes/abstractMesh.d.ts +4 -0
  81. package/Meshes/abstractMesh.js +4 -0
  82. package/Meshes/abstractMesh.js.map +1 -1
  83. package/Meshes/csg2.js +1 -1
  84. package/Meshes/csg2.js.map +1 -1
  85. package/Meshes/geometry.js +1 -1
  86. package/Meshes/geometry.js.map +1 -1
  87. package/Meshes/mesh.js +2 -7
  88. package/Meshes/mesh.js.map +1 -1
  89. package/Misc/dumpTools.d.ts +1 -1
  90. package/Misc/dumpTools.js +23 -14
  91. package/Misc/dumpTools.js.map +1 -1
  92. package/Misc/fileTools.js +7 -0
  93. package/Misc/fileTools.js.map +1 -1
  94. package/Misc/index.d.ts +1 -0
  95. package/Misc/index.js +1 -0
  96. package/Misc/index.js.map +1 -1
  97. package/Misc/lazy.d.ts +16 -0
  98. package/Misc/lazy.js +25 -0
  99. package/Misc/lazy.js.map +1 -0
  100. package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +4 -0
  101. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +13 -3
  102. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
  103. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +3 -1
  104. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  105. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +31 -0
  106. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +67 -0
  107. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -0
  108. package/Particles/Node/Blocks/index.d.ts +1 -0
  109. package/Particles/Node/Blocks/index.js +1 -0
  110. package/Particles/Node/Blocks/index.js.map +1 -1
  111. package/Particles/Node/Blocks/particleInputBlock.js +1 -0
  112. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  113. package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +2 -2
  114. package/Particles/Node/Blocks/particleSourceTextureBlock.js +3 -3
  115. package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
  116. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +3 -1
  117. package/Particles/Node/Enums/nodeParticleContextualSources.js +2 -0
  118. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  119. package/Particles/Node/nodeParticleBuildState.js +3 -1
  120. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  121. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +2 -1
  122. package/Particles/Node/nodeParticleSystemSet.helper.js +98 -61
  123. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  124. package/Particles/particle.d.ts +4 -0
  125. package/Particles/particle.js +5 -0
  126. package/Particles/particle.js.map +1 -1
  127. package/Rendering/objectRenderer.d.ts +17 -3
  128. package/Rendering/objectRenderer.js +111 -26
  129. package/Rendering/objectRenderer.js.map +1 -1
  130. package/Shaders/ShadersInclude/clusteredLightingFunctions.d.ts +5 -0
  131. package/Shaders/ShadersInclude/clusteredLightingFunctions.js +18 -0
  132. package/Shaders/ShadersInclude/clusteredLightingFunctions.js.map +1 -0
  133. package/Shaders/ShadersInclude/helperFunctions.js +5 -1
  134. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  135. package/Shaders/ShadersInclude/lightFragment.js +33 -1
  136. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  137. package/Shaders/ShadersInclude/lightFragmentDeclaration.js +3 -0
  138. package/Shaders/ShadersInclude/lightFragmentDeclaration.js.map +1 -1
  139. package/Shaders/ShadersInclude/lightUboDeclaration.js +5 -0
  140. package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
  141. package/Shaders/ShadersInclude/lightVxUboDeclaration.js +2 -0
  142. package/Shaders/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  143. package/Shaders/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
  144. package/Shaders/ShadersInclude/lightsFragmentFunctions.js +20 -0
  145. package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  146. package/Shaders/ShadersInclude/pbrBlockPrePass.js +3 -1
  147. package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  148. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.d.ts +7 -0
  149. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +125 -0
  150. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -0
  151. package/Shaders/default.fragment.js +2 -0
  152. package/Shaders/default.fragment.js.map +1 -1
  153. package/Shaders/lightProxy.fragment.d.ts +5 -0
  154. package/Shaders/lightProxy.fragment.js +13 -0
  155. package/Shaders/lightProxy.fragment.js.map +1 -0
  156. package/Shaders/lightProxy.vertex.d.ts +8 -0
  157. package/Shaders/lightProxy.vertex.js +19 -0
  158. package/Shaders/lightProxy.vertex.js.map +1 -0
  159. package/Shaders/pbr.fragment.d.ts +1 -0
  160. package/Shaders/pbr.fragment.js +4 -0
  161. package/Shaders/pbr.fragment.js.map +1 -1
  162. package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.d.ts +5 -0
  163. package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.js +23 -0
  164. package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.js.map +1 -0
  165. package/ShadersWGSL/ShadersInclude/lightFragment.js +33 -1
  166. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  167. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +5 -0
  168. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
  169. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +2 -0
  170. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  171. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
  172. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +21 -1
  173. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  174. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +3 -1
  175. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  176. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.d.ts +2 -0
  177. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +114 -0
  178. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  179. package/ShadersWGSL/default.fragment.js +2 -0
  180. package/ShadersWGSL/default.fragment.js.map +1 -1
  181. package/ShadersWGSL/lightProxy.fragment.d.ts +5 -0
  182. package/ShadersWGSL/lightProxy.fragment.js +13 -0
  183. package/ShadersWGSL/lightProxy.fragment.js.map +1 -0
  184. package/ShadersWGSL/lightProxy.vertex.d.ts +7 -0
  185. package/ShadersWGSL/lightProxy.vertex.js +19 -0
  186. package/ShadersWGSL/lightProxy.vertex.js.map +1 -0
  187. package/package.json +1 -1
  188. package/scene.d.ts +1 -0
  189. package/scene.js +140 -30
  190. package/scene.js.map +1 -1
  191. package/sceneComponent.d.ts +2 -0
  192. package/sceneComponent.js +2 -0
  193. package/sceneComponent.js.map +1 -1
@@ -81,7 +81,9 @@ export class NodeParticleBuildState {
81
81
  case NodeParticleContextualSources.Color:
82
82
  return this.particleContext.color;
83
83
  case NodeParticleContextualSources.InitialColor:
84
- return this.particleContext.colorStep;
84
+ return this.particleContext.initialColor;
85
+ case NodeParticleContextualSources.ColorDead:
86
+ return this.systemContext.colorDead;
85
87
  case NodeParticleContextualSources.Age:
86
88
  return this.particleContext.age;
87
89
  case NodeParticleContextualSources.Lifetime:
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAE1D,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAG9E;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAcI,8DAA8D;QACvD,kCAA6B,GAAkC,EAAE,CAAC;QAKzE;;WAEG;QACI,oBAAe,GAAuB,IAAI,CAAC;QAElD;;WAEG;QACI,kBAAa,GAAiC,IAAI,CAAC;QAE1D;;WAEG;QACI,kBAAa,GAAW,CAAC,CAAC;QACjC;;WAEG;QACI,sBAAiB,GAAW,CAAC,CAAC;IAwKzC,CAAC;IAlKG;;OAEG;IACI,UAAU;QACb,IAAI,YAAY,GAAG,EAAE,CAAC;QAEtB,KAAK,MAAM,iBAAiB,IAAI,IAAI,CAAC,6BAA6B,EAAE,CAAC;YACjE,YAAY,IAAI,SAAS,iBAAiB,CAAC,IAAI,eAC3C,iBAAiB,CAAC,UAAU,CAAC,IACjC,IAAI,iBAAiB,CAAC,UAAU,CAAC,YAAY,EAAE,2CAA2C,CAAC;QAC/F,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACf,4CAA4C;YAC5C,MAAM,6CAA6C,GAAG,YAAY,CAAC;Q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AAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport type { Particle } from \"../particle\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { ThinParticleSystem } from \"../thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { NodeParticleSystemSources } from \"./Enums/nodeParticleSystemSources\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.systemContext._directionScale, this.systemContext._scaledDirection);\r\n return this.systemContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.colorStep;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the emitter is a transform node (or a simple vector3)\r\n */\r\n public get isEmitterTransformNode() {\r\n if (!this.systemContext) {\r\n return false;\r\n }\r\n\r\n if ((<AbstractMesh>this.systemContext.emitter).position) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (this.isEmitterTransformNode) {\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n return this.systemContext.emitter as Vector3;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n if (this.isEmitterTransformNode) {\r\n const emitterMesh = <AbstractMesh>this.systemContext.emitter;\r\n return emitterMesh.absolutePosition;\r\n } else {\r\n return this.systemContext.emitter;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAE1D,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAG9E;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAcI,8DAA8D;QACvD,kCAA6B,GAAkC,EAAE,CAAC;QAKzE;;WAEG;QACI,oBAAe,GAAuB,IAAI,CAAC;QAElD;;WAEG;QACI,kBAAa,GAAiC,IAAI,CAAC;QAE1D;;WAEG;QACI,kBAAa,GAAW,CAAC,CAAC;QACjC;;WAEG;QACI,sBAAiB,GAAW,CAAC,CAAC;IA0KzC,CAAC;IApKG;;OAEG;IACI,UAAU;QACb,IAAI,YAAY,GAAG,EAAE,CAAC;QAEtB,KAAK,MAAM,iBAAiB,IAAI,IAAI,CAAC,6BAA6B,EAAE,CAAC;YACjE,YAAY,IAAI,SAAS,iBAAiB,CAAC,IAAI,eAC3C,iBAAiB,CAAC,UAAU,CAAC,IACjC,IAAI,iBAAiB,CAAC,UAAU,CAAC,YAAY,EAAE,2CAA2C,CAAC;QAC/F,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACf,4CAA4C;YAC5C,MAAM,6CAA6C,GAAG,YAAY,CAAC;QACvE,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAmC,EAAE,UAAiD;QACxF,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CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport type { Particle } from \"../particle\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { ThinParticleSystem } from \"../thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { NodeParticleSystemSources } from \"./Enums/nodeParticleSystemSources\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.systemContext._directionScale, this.systemContext._scaledDirection);\r\n return this.systemContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.systemContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the emitter is a transform node (or a simple vector3)\r\n */\r\n public get isEmitterTransformNode() {\r\n if (!this.systemContext) {\r\n return false;\r\n }\r\n\r\n if ((<AbstractMesh>this.systemContext.emitter).position) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (this.isEmitterTransformNode) {\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n return this.systemContext.emitter as Vector3;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n if (this.isEmitterTransformNode) {\r\n const emitterMesh = <AbstractMesh>this.systemContext.emitter;\r\n return emitterMesh.absolutePosition;\r\n } else {\r\n return this.systemContext.emitter;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
@@ -6,5 +6,6 @@ import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
6
6
  * @param name The name of the node particle system set.
7
7
  * @param particleSystems The particle systems to convert.
8
8
  * @returns The converted node particle system set or null if conversion failed.
9
+ * #0K3AQ2#3625
9
10
  */
10
- export declare function ConvertToNodeParticleSystemSet(name: string, particleSystems: ParticleSystem[]): Nullable<NodeParticleSystemSet>;
11
+ export declare function ConvertToNodeParticleSystemSetAsync(name: string, particleSystems: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>>;
@@ -7,84 +7,121 @@ import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
7
7
  import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
8
8
  import { CylinderShapeBlock } from "./Blocks/Emitters/cylinderShapeBlock.js";
9
9
  import { MeshShapeBlock } from "./Blocks/Emitters/meshShapeBlock.js";
10
+ import { ParticleTextureSourceBlock } from "./Blocks/particleSourceTextureBlock.js";
11
+ import { BasicPositionUpdateBlock } from "./Blocks/Update/basicPositionUpdateBlock.js";
12
+ import { BasicColorUpdateBlock } from "./Blocks/Update/basicColorUpdateBlock.js";
13
+ import { ParticleRandomBlock } from "./Blocks/particleRandomBlock.js";
10
14
  function _CreateAndConnectInput(connectionPoint, name, defaultValue) {
11
15
  const input = new ParticleInputBlock(name);
12
16
  input.value = defaultValue;
13
17
  input.output.connectTo(connectionPoint);
14
18
  }
19
+ async function _ExtractDatafromParticleSystemAsync(particleSystem, target) {
20
+ // Main system
21
+ const system = new SystemBlock(particleSystem.name);
22
+ // Create particle
23
+ const createParticleBlock = new CreateParticleBlock("Create particle");
24
+ // Shape
25
+ let shapeBlock = null;
26
+ switch (particleSystem.particleEmitterType.getClassName()) {
27
+ case "BoxParticleEmitter": {
28
+ const source = particleSystem.particleEmitterType;
29
+ shapeBlock = new BoxShapeBlock("Box shape");
30
+ const target = shapeBlock;
31
+ _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
32
+ _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
33
+ _CreateAndConnectInput(target.minEmitBox, "Min Emit Box", source.minEmitBox);
34
+ _CreateAndConnectInput(target.maxEmitBox, "Max Emit Box", source.maxEmitBox);
35
+ break;
36
+ }
37
+ case "PointParticleEmitter": {
38
+ const source = particleSystem.particleEmitterType;
39
+ shapeBlock = new PointShapeBlock("Point shape");
40
+ const target = shapeBlock;
41
+ _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
42
+ _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
43
+ break;
44
+ }
45
+ case "SphereParticleEmitter": {
46
+ const source = particleSystem.particleEmitterType;
47
+ shapeBlock = new SphereShapeBlock("Sphere shape");
48
+ const target = shapeBlock;
49
+ _CreateAndConnectInput(target.radius, "Radius", source.radius);
50
+ _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
51
+ _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
52
+ break;
53
+ }
54
+ case "CylinderParticleEmitter": {
55
+ const source = particleSystem.particleEmitterType;
56
+ shapeBlock = new CylinderShapeBlock("Cylinder shape");
57
+ const target = shapeBlock;
58
+ _CreateAndConnectInput(target.height, "Height", source.height);
59
+ _CreateAndConnectInput(target.radius, "Radius", source.radius);
60
+ _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
61
+ _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
62
+ break;
63
+ }
64
+ case "MeshParticleEmitter": {
65
+ const source = particleSystem.particleEmitterType;
66
+ shapeBlock = new MeshShapeBlock("Mesh shape");
67
+ const target = shapeBlock;
68
+ _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
69
+ _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
70
+ target.mesh = source.mesh;
71
+ break;
72
+ }
73
+ }
74
+ if (!shapeBlock) {
75
+ throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);
76
+ }
77
+ createParticleBlock.particle.connectTo(shapeBlock.particle);
78
+ createParticleBlock.colorDead.value = particleSystem.colorDead;
79
+ // Color
80
+ const color0Block = new ParticleInputBlock("Color0");
81
+ color0Block.value = particleSystem.color1;
82
+ const color1Block = new ParticleInputBlock("Color1");
83
+ color1Block.value = particleSystem.color2;
84
+ const randomBlock = new ParticleRandomBlock("Random");
85
+ color0Block.output.connectTo(randomBlock.min);
86
+ color1Block.output.connectTo(randomBlock.max);
87
+ randomBlock.output.connectTo(createParticleBlock.color);
88
+ // Texture
89
+ const textureBlock = new ParticleTextureSourceBlock("Texture");
90
+ const url = particleSystem.particleTexture.url || "";
91
+ if (url) {
92
+ textureBlock.url = url;
93
+ }
94
+ else {
95
+ textureBlock.sourceTexture = particleSystem.particleTexture;
96
+ }
97
+ textureBlock.texture.connectTo(system.texture);
98
+ // Default position update
99
+ const basicPositionUpdateBlock = new BasicPositionUpdateBlock("Position update");
100
+ shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);
101
+ // Default color update
102
+ const basicColorUpdateBlock = new BasicColorUpdateBlock("Color update");
103
+ basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);
104
+ basicColorUpdateBlock.output.connectTo(system.particle);
105
+ // Register
106
+ target.systemBlocks.push(system);
107
+ }
15
108
  /**
16
109
  * Converts a ParticleSystem to a NodeParticleSystemSet.
17
110
  * @param name The name of the node particle system set.
18
111
  * @param particleSystems The particle systems to convert.
19
112
  * @returns The converted node particle system set or null if conversion failed.
113
+ * #0K3AQ2#3625
20
114
  */
21
- export function ConvertToNodeParticleSystemSet(name, particleSystems) {
115
+ export async function ConvertToNodeParticleSystemSetAsync(name, particleSystems) {
22
116
  if (!particleSystems || !particleSystems.length) {
23
117
  return null;
24
118
  }
25
119
  const nodeParticleSystemSet = new NodeParticleSystemSet(name);
120
+ const promises = [];
26
121
  for (const particleSystem of particleSystems) {
27
- // Main system
28
- const system = new SystemBlock(particleSystem.name);
29
- // Create particle
30
- const createParticleBlock = new CreateParticleBlock("Create particle");
31
- // Shape
32
- let shapeBlock = null;
33
- switch (particleSystem.particleEmitterType.getClassName()) {
34
- case "BoxParticleEmitter": {
35
- const source = particleSystem.particleEmitterType;
36
- shapeBlock = new BoxShapeBlock("Box shape");
37
- const target = shapeBlock;
38
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
39
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
40
- _CreateAndConnectInput(target.minEmitBox, "Min Emit Box", source.minEmitBox);
41
- _CreateAndConnectInput(target.maxEmitBox, "Max Emit Box", source.maxEmitBox);
42
- break;
43
- }
44
- case "PointParticleEmitter": {
45
- const source = particleSystem.particleEmitterType;
46
- shapeBlock = new PointShapeBlock("Point shape");
47
- const target = shapeBlock;
48
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
49
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
50
- break;
51
- }
52
- case "SphereParticleEmitter": {
53
- const source = particleSystem.particleEmitterType;
54
- shapeBlock = new SphereShapeBlock("Sphere shape");
55
- const target = shapeBlock;
56
- _CreateAndConnectInput(target.radius, "Radius", source.radius);
57
- _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
58
- _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
59
- break;
60
- }
61
- case "CylinderParticleEmitter": {
62
- const source = particleSystem.particleEmitterType;
63
- shapeBlock = new CylinderShapeBlock("Cylinder shape");
64
- const target = shapeBlock;
65
- _CreateAndConnectInput(target.height, "Height", source.height);
66
- _CreateAndConnectInput(target.radius, "Radius", source.radius);
67
- _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
68
- _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
69
- break;
70
- }
71
- case "MeshParticleEmitter": {
72
- const source = particleSystem.particleEmitterType;
73
- shapeBlock = new MeshShapeBlock("Mesh shape");
74
- const target = shapeBlock;
75
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
76
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
77
- target.mesh = source.mesh;
78
- break;
79
- }
80
- }
81
- if (!shapeBlock) {
82
- throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);
83
- }
84
- createParticleBlock.particle.connectTo(shapeBlock.particle);
85
- shapeBlock.output.connectTo(system.particle);
86
- nodeParticleSystemSet.systemBlocks.push(system);
122
+ promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));
87
123
  }
124
+ await Promise.all(promises);
88
125
  return nodeParticleSystemSet;
89
126
  }
90
127
  //# sourceMappingURL=nodeParticleSystemSet.helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParticleSystemSet.helper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAShE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE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{ Nullable } from \"core/types\";\r\nimport type { ParticleSystem } from \"../particleSystem\";\r\nimport { NodeParticleSystemSet } from \"./nodeParticleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport type { IShapeBlock } from \"./Blocks/Emitters/IShapeBlock\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport type { BoxParticleEmitter } from \"../EmitterTypes/boxParticleEmitter\";\r\nimport type { PointParticleEmitter } from \"../EmitterTypes/pointParticleEmitter\";\r\nimport type { SphereParticleEmitter } from \"../EmitterTypes/sphereParticleEmitter\";\r\nimport type { CylinderParticleEmitter, MeshParticleEmitter } from \"../EmitterTypes\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { PointShapeBlock } from \"./Blocks/Emitters/pointShapeBlock\";\r\nimport { SphereShapeBlock } from \"./Blocks/Emitters/sphereShapeBlock\";\r\nimport { CylinderShapeBlock } from \"./Blocks/Emitters/cylinderShapeBlock\";\r\nimport { MeshShapeBlock } from \"./Blocks/Emitters/meshShapeBlock\";\r\n\r\nfunction _CreateAndConnectInput(connectionPoint: NodeParticleConnectionPoint, name: string, defaultValue: Vector3 | number) {\r\n const input = new ParticleInputBlock(name);\r\n input.value = defaultValue;\r\n input.output.connectTo(connectionPoint);\r\n}\r\n\r\n/**\r\n * Converts a ParticleSystem to a NodeParticleSystemSet.\r\n * @param name The name of the node particle system set.\r\n * @param particleSystems The particle systems to convert.\r\n * @returns The converted node particle system set or null if conversion failed.\r\n */\r\nexport function ConvertToNodeParticleSystemSet(name: string, particleSystems: ParticleSystem[]): Nullable<NodeParticleSystemSet> {\r\n if (!particleSystems || !particleSystems.length) {\r\n return null;\r\n }\r\n\r\n const nodeParticleSystemSet = new NodeParticleSystemSet(name);\r\n\r\n for (const particleSystem of particleSystems) {\r\n // Main system\r\n const system = new SystemBlock(particleSystem.name);\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n let shapeBlock: Nullable<IShapeBlock> = null;\r\n switch (particleSystem.particleEmitterType.getClassName()) {\r\n case \"BoxParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as BoxParticleEmitter;\r\n shapeBlock = new BoxShapeBlock(\"Box shape\");\r\n\r\n const target = shapeBlock as BoxShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n _CreateAndConnectInput(target.minEmitBox, \"Min Emit Box\", source.minEmitBox);\r\n _CreateAndConnectInput(target.maxEmitBox, \"Max Emit Box\", source.maxEmitBox);\r\n break;\r\n }\r\n case \"PointParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as PointParticleEmitter;\r\n shapeBlock = new PointShapeBlock(\"Point shape\");\r\n\r\n const target = shapeBlock as PointShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n break;\r\n }\r\n case \"SphereParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as SphereParticleEmitter;\r\n shapeBlock = new SphereShapeBlock(\"Sphere shape\");\r\n\r\n const target = shapeBlock as SphereShapeBlock;\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"CylinderParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as CylinderParticleEmitter;\r\n shapeBlock = new CylinderShapeBlock(\"Cylinder shape\");\r\n\r\n const target = shapeBlock as CylinderShapeBlock;\r\n _CreateAndConnectInput(target.height, \"Height\", source.height);\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"MeshParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as MeshParticleEmitter;\r\n shapeBlock = new MeshShapeBlock(\"Mesh shape\");\r\n\r\n const target = shapeBlock as MeshShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n\r\n target.mesh = source.mesh as Mesh;\r\n break;\r\n }\r\n }\r\n\r\n if (!shapeBlock) {\r\n throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);\r\n }\r\n\r\n createParticleBlock.particle.connectTo(shapeBlock.particle);\r\n shapeBlock.output.connectTo(system.particle);\r\n\r\n nodeParticleSystemSet.systemBlocks.push(system);\r\n }\r\n\r\n return nodeParticleSystemSet;\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeParticleSystemSet.helper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAShE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,k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AAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CAAC,IAAY,EAAE,eAAiC;IACrG,IAAI,CAAC,eAAe,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC3C,QAAQ,CAAC,IAAI,CAAC,mCAAmC,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,qBAAqB,CAAC;AACjC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ParticleSystem } from \"../particleSystem\";\r\nimport { NodeParticleSystemSet } from \"./nodeParticleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport type { IShapeBlock } from \"./Blocks/Emitters/IShapeBlock\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport type { BoxParticleEmitter } from \"../EmitterTypes/boxParticleEmitter\";\r\nimport type { PointParticleEmitter } from \"../EmitterTypes/pointParticleEmitter\";\r\nimport type { SphereParticleEmitter } from \"../EmitterTypes/sphereParticleEmitter\";\r\nimport type { CylinderParticleEmitter, MeshParticleEmitter } from \"../EmitterTypes\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { PointShapeBlock } from \"./Blocks/Emitters/pointShapeBlock\";\r\nimport { SphereShapeBlock } from \"./Blocks/Emitters/sphereShapeBlock\";\r\nimport { CylinderShapeBlock } from \"./Blocks/Emitters/cylinderShapeBlock\";\r\nimport { MeshShapeBlock } from \"./Blocks/Emitters/meshShapeBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport type { Texture } from \"../../Materials/Textures/texture\";\r\nimport { BasicPositionUpdateBlock } from \"./Blocks/Update/basicPositionUpdateBlock\";\r\nimport { BasicColorUpdateBlock } from \"./Blocks/Update/basicColorUpdateBlock\";\r\nimport { ParticleRandomBlock } from \"./Blocks/particleRandomBlock\";\r\n\r\nfunction _CreateAndConnectInput(connectionPoint: NodeParticleConnectionPoint, name: string, defaultValue: Vector3 | number) {\r\n const input = new ParticleInputBlock(name);\r\n input.value = defaultValue;\r\n input.output.connectTo(connectionPoint);\r\n}\r\n\r\nasync function _ExtractDatafromParticleSystemAsync(particleSystem: ParticleSystem, target: NodeParticleSystemSet) {\r\n // Main system\r\n const system = new SystemBlock(particleSystem.name);\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n let shapeBlock: Nullable<IShapeBlock> = null;\r\n switch (particleSystem.particleEmitterType.getClassName()) {\r\n case \"BoxParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as BoxParticleEmitter;\r\n shapeBlock = new BoxShapeBlock(\"Box shape\");\r\n\r\n const target = shapeBlock as BoxShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n _CreateAndConnectInput(target.minEmitBox, \"Min Emit Box\", source.minEmitBox);\r\n _CreateAndConnectInput(target.maxEmitBox, \"Max Emit Box\", source.maxEmitBox);\r\n break;\r\n }\r\n case \"PointParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as PointParticleEmitter;\r\n shapeBlock = new PointShapeBlock(\"Point shape\");\r\n\r\n const target = shapeBlock as PointShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n break;\r\n }\r\n case \"SphereParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as SphereParticleEmitter;\r\n shapeBlock = new SphereShapeBlock(\"Sphere shape\");\r\n\r\n const target = shapeBlock as SphereShapeBlock;\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"CylinderParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as CylinderParticleEmitter;\r\n shapeBlock = new CylinderShapeBlock(\"Cylinder shape\");\r\n\r\n const target = shapeBlock as CylinderShapeBlock;\r\n _CreateAndConnectInput(target.height, \"Height\", source.height);\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"MeshParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as MeshParticleEmitter;\r\n shapeBlock = new MeshShapeBlock(\"Mesh shape\");\r\n\r\n const target = shapeBlock as MeshShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n\r\n target.mesh = source.mesh as Mesh;\r\n break;\r\n }\r\n }\r\n\r\n if (!shapeBlock) {\r\n throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);\r\n }\r\n\r\n createParticleBlock.particle.connectTo(shapeBlock.particle);\r\n createParticleBlock.colorDead.value = particleSystem.colorDead;\r\n\r\n // Color\r\n const color0Block = new ParticleInputBlock(\"Color0\");\r\n color0Block.value = particleSystem.color1;\r\n\r\n const color1Block = new ParticleInputBlock(\"Color1\");\r\n color1Block.value = particleSystem.color2;\r\n\r\n const randomBlock = new ParticleRandomBlock(\"Random\");\r\n color0Block.output.connectTo(randomBlock.min);\r\n color1Block.output.connectTo(randomBlock.max);\r\n\r\n randomBlock.output.connectTo(createParticleBlock.color);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n const url = (particleSystem.particleTexture as Texture).url || \"\";\r\n if (url) {\r\n textureBlock.url = url;\r\n } else {\r\n textureBlock.sourceTexture = particleSystem.particleTexture;\r\n }\r\n textureBlock.texture.connectTo(system.texture);\r\n\r\n // Default position update\r\n const basicPositionUpdateBlock = new BasicPositionUpdateBlock(\"Position update\");\r\n shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);\r\n\r\n // Default color update\r\n const basicColorUpdateBlock = new BasicColorUpdateBlock(\"Color update\");\r\n basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);\r\n basicColorUpdateBlock.output.connectTo(system.particle);\r\n\r\n // Register\r\n target.systemBlocks.push(system);\r\n}\r\n\r\n/**\r\n * Converts a ParticleSystem to a NodeParticleSystemSet.\r\n * @param name The name of the node particle system set.\r\n * @param particleSystems The particle systems to convert.\r\n * @returns The converted node particle system set or null if conversion failed.\r\n * #0K3AQ2#3625\r\n */\r\nexport async function ConvertToNodeParticleSystemSetAsync(name: string, particleSystems: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>> {\r\n if (!particleSystems || !particleSystems.length) {\r\n return null;\r\n }\r\n\r\n const nodeParticleSystemSet = new NodeParticleSystemSet(name);\r\n const promises: Promise<void>[] = [];\r\n\r\n for (const particleSystem of particleSystems) {\r\n promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));\r\n }\r\n\r\n await Promise.all(promises);\r\n return nodeParticleSystemSet;\r\n}\r\n"]}
@@ -34,6 +34,10 @@ export declare class Particle {
34
34
  * The color change of the particle per step.
35
35
  */
36
36
  colorStep: Color4;
37
+ /**
38
+ * The creation color of the particle.
39
+ */
40
+ initialColor: Color4;
37
41
  /**
38
42
  * Defines how long will the life of the particle be.
39
43
  */
@@ -32,6 +32,10 @@ export class Particle {
32
32
  * The color change of the particle per step.
33
33
  */
34
34
  this.colorStep = new Color4(0, 0, 0, 0);
35
+ /**
36
+ * The creation color of the particle.
37
+ */
38
+ this.initialColor = new Color4(0, 0, 0, 0);
35
39
  /**
36
40
  * Defines how long will the life of the particle be.
37
41
  */
@@ -194,6 +198,7 @@ export class Particle {
194
198
  }
195
199
  other.color.copyFrom(this.color);
196
200
  other.colorStep.copyFrom(this.colorStep);
201
+ other.initialColor.copyFrom(this.initialColor);
197
202
  other.lifeTime = this.lifeTime;
198
203
  other.age = this.age;
199
204
  other._randomCellOffset = this._randomCellOffset;
@@ -1 +1 @@
1
- {"version":3,"file":"particle.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/particle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAoIjB;;;OAGG;IACH;IACI;;OAEG;IACI,cAAkC;QAAlC,mBAAc,GAAd,cAAc,CAAoB;QAtI7C;;WAEG;QACI,aAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAEjC;;WAEG;QACI,cAAS,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAElC;;WAEG;QACI,UAAK,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;Q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E,CAAC;YAC9C,KAAK,CAAC,yBAAyB,GAAG,IAAI,CAAC,yBAAyB,CAAC;YACjE,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,uBAAuB,CAAC;YAC7D,KAAK,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;QAC/D,CAAC;QACD,IAAI,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;YACvC,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC;QACD,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,wBAAwB,EAAE,CAAC;gBACjC,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;gBACvE,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAC3E,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;gBACvE,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;YAC3E,CAAC;QACL,CAAC;IACL,CAAC;;AA3Tc,eAAM,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector2, Vector3, TmpVectors, Vector4 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { SubEmitter } from \"./subEmitter\";\r\nimport type { ColorGradient, FactorGradient } from \"../Misc/gradients\";\r\n\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { ThinParticleSystem } from \"./thinParticleSystem\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\n\r\n/**\r\n * A particle represents one of the element emitted by a particle system.\r\n * This is mainly define by its coordinates, direction, velocity and age.\r\n */\r\nexport class Particle {\r\n private static _Count = 0;\r\n /**\r\n * Unique ID of the particle\r\n */\r\n public id: number;\r\n /**\r\n * The world position of the particle in the scene.\r\n */\r\n public position = Vector3.Zero();\r\n\r\n /**\r\n * The world direction of the particle in the scene.\r\n */\r\n public direction = Vector3.Zero();\r\n\r\n /**\r\n * The color of the particle.\r\n */\r\n public color = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The color change of the particle per step.\r\n */\r\n public colorStep = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * Defines how long will the life of the particle be.\r\n */\r\n public lifeTime = 1.0;\r\n\r\n /**\r\n * The current age of the particle.\r\n */\r\n public age = 0;\r\n\r\n /**\r\n * The current size of the particle.\r\n */\r\n public size = 0;\r\n\r\n /**\r\n * The current scale of the particle.\r\n */\r\n public scale = new Vector2(1, 1);\r\n\r\n /**\r\n * The current angle of the particle.\r\n */\r\n public angle = 0;\r\n\r\n /**\r\n * Defines how fast is the angle changing.\r\n */\r\n public angularSpeed = 0;\r\n\r\n /**\r\n * Defines the cell index used by the particle to be rendered from a sprite.\r\n */\r\n public cellIndex: number = 0;\r\n\r\n /**\r\n * The information required to support color remapping\r\n */\r\n public remapData: Vector4;\r\n\r\n /** @internal */\r\n public _randomCellOffset?: number;\r\n\r\n /** @internal */\r\n public _initialDirection: Nullable<Vector3>;\r\n\r\n /** @internal */\r\n public _attachedSubEmitters: Nullable<Array<SubEmitter>> = null;\r\n\r\n /** @internal */\r\n public _initialStartSpriteCellId: number;\r\n /** @internal */\r\n public _initialEndSpriteCellId: number;\r\n /** @internal */\r\n public _initialSpriteCellLoop: boolean;\r\n\r\n /** @internal */\r\n public _currentColorGradient: Nullable<ColorGradient>;\r\n /** @internal */\r\n public _currentColor1 = new Color4(0, 0, 0, 0);\r\n /** @internal */\r\n public _currentColor2 = new Color4(0, 0, 0, 0);\r\n\r\n /** @internal */\r\n public _currentSizeGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentSize1 = 0;\r\n /** @internal */\r\n public _currentSize2 = 0;\r\n\r\n /** @internal */\r\n public _currentAngularSpeedGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentAngularSpeed1 = 0;\r\n /** @internal */\r\n public _currentAngularSpeed2 = 0;\r\n\r\n /** @internal */\r\n public _currentVelocityGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentVelocity1 = 0;\r\n /** @internal */\r\n public _currentVelocity2 = 0;\r\n\r\n /** @internal */\r\n public _currentLimitVelocityGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentLimitVelocity1 = 0;\r\n /** @internal */\r\n public _currentLimitVelocity2 = 0;\r\n\r\n /** @internal */\r\n public _currentDragGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentDrag1 = 0;\r\n /** @internal */\r\n public _currentDrag2 = 0;\r\n\r\n /** @internal */\r\n public _randomNoiseCoordinates1: Vector3;\r\n /** @internal */\r\n public _randomNoiseCoordinates2: Vector3;\r\n\r\n /** @internal */\r\n public _localPosition?: Vector3;\r\n\r\n /**\r\n * Creates a new instance Particle\r\n * @param particleSystem the particle system the particle belongs to\r\n */\r\n constructor(\r\n /**\r\n * The particle system the particle belongs to.\r\n */\r\n public particleSystem: ThinParticleSystem\r\n ) {\r\n this.id = Particle._Count++;\r\n if (!this.particleSystem.isAnimationSheetEnabled) {\r\n return;\r\n }\r\n\r\n this._updateCellInfoFromSystem();\r\n }\r\n\r\n private _updateCellInfoFromSystem(): void {\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n }\r\n\r\n /**\r\n * Defines how the sprite cell index is updated for the particle\r\n */\r\n public updateCellIndex(): void {\r\n let offsetAge = this.age;\r\n let changeSpeed = this.particleSystem.spriteCellChangeSpeed;\r\n\r\n if (this.particleSystem.spriteRandomStartCell) {\r\n if (this._randomCellOffset === undefined) {\r\n this._randomCellOffset = Math.random() * this.lifeTime;\r\n }\r\n\r\n if (changeSpeed === 0) {\r\n // Special case when speed = 0 meaning we want to stay on initial cell\r\n changeSpeed = 1;\r\n offsetAge = this._randomCellOffset;\r\n } else {\r\n offsetAge += this._randomCellOffset;\r\n }\r\n }\r\n\r\n const dist = this._initialEndSpriteCellId - this._initialStartSpriteCellId + 1;\r\n let ratio: number;\r\n if (this._initialSpriteCellLoop) {\r\n ratio = Clamp(((offsetAge * changeSpeed) % this.lifeTime) / this.lifeTime);\r\n } else {\r\n ratio = Clamp((offsetAge * changeSpeed) / this.lifeTime);\r\n }\r\n this.cellIndex = (this._initialStartSpriteCellId + ratio * dist) | 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _inheritParticleInfoToSubEmitter(subEmitter: SubEmitter) {\r\n if ((<AbstractMesh>subEmitter.particleSystem.emitter).position) {\r\n const emitterMesh = <AbstractMesh>subEmitter.particleSystem.emitter;\r\n emitterMesh.position.copyFrom(this.position);\r\n if (subEmitter.inheritDirection) {\r\n const temp = TmpVectors.Vector3[0];\r\n this.direction.normalizeToRef(temp);\r\n emitterMesh.setDirection(temp, 0, Math.PI / 2);\r\n }\r\n } else {\r\n const emitterPosition = <Vector3>subEmitter.particleSystem.emitter;\r\n emitterPosition.copyFrom(this.position);\r\n }\r\n // Set inheritedVelocityOffset to be used when new particles are created\r\n this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, TmpVectors.Vector3[0]);\r\n subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(TmpVectors.Vector3[0]);\r\n }\r\n\r\n /** @internal */\r\n public _inheritParticleInfoToSubEmitters() {\r\n if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {\r\n for (const subEmitter of this._attachedSubEmitters) {\r\n this._inheritParticleInfoToSubEmitter(subEmitter);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _reset() {\r\n this.age = 0;\r\n this.id = Particle._Count++;\r\n this._currentColorGradient = null;\r\n this._currentSizeGradient = null;\r\n this._currentAngularSpeedGradient = null;\r\n this._currentVelocityGradient = null;\r\n this._currentLimitVelocityGradient = null;\r\n this._currentDragGradient = null;\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n this._randomCellOffset = undefined;\r\n }\r\n\r\n /**\r\n * Copy the properties of particle to another one.\r\n * @param other the particle to copy the information to.\r\n */\r\n public copyTo(other: Particle) {\r\n other.position.copyFrom(this.position);\r\n if (this._initialDirection) {\r\n if (other._initialDirection) {\r\n other._initialDirection.copyFrom(this._initialDirection);\r\n } else {\r\n other._initialDirection = this._initialDirection.clone();\r\n }\r\n } else {\r\n other._initialDirection = null;\r\n }\r\n other.direction.copyFrom(this.direction);\r\n if (this._localPosition) {\r\n if (other._localPosition) {\r\n other._localPosition.copyFrom(this._localPosition);\r\n } else {\r\n other._localPosition = this._localPosition.clone();\r\n }\r\n }\r\n other.color.copyFrom(this.color);\r\n other.colorStep.copyFrom(this.colorStep);\r\n other.lifeTime = this.lifeTime;\r\n other.age = this.age;\r\n other._randomCellOffset = this._randomCellOffset;\r\n other.size = this.size;\r\n other.scale.copyFrom(this.scale);\r\n other.angle = this.angle;\r\n other.angularSpeed = this.angularSpeed;\r\n other.particleSystem = this.particleSystem;\r\n other.cellIndex = this.cellIndex;\r\n other.id = this.id;\r\n other._attachedSubEmitters = this._attachedSubEmitters;\r\n if (this._currentColorGradient) {\r\n other._currentColorGradient = this._currentColorGradient;\r\n other._currentColor1.copyFrom(this._currentColor1);\r\n other._currentColor2.copyFrom(this._currentColor2);\r\n }\r\n if (this._currentSizeGradient) {\r\n other._currentSizeGradient = this._currentSizeGradient;\r\n other._currentSize1 = this._currentSize1;\r\n other._currentSize2 = this._currentSize2;\r\n }\r\n if (this._currentAngularSpeedGradient) {\r\n other._currentAngularSpeedGradient = this._currentAngularSpeedGradient;\r\n other._currentAngularSpeed1 = this._currentAngularSpeed1;\r\n other._currentAngularSpeed2 = this._currentAngularSpeed2;\r\n }\r\n if (this._currentVelocityGradient) {\r\n other._currentVelocityGradient = this._currentVelocityGradient;\r\n other._currentVelocity1 = this._currentVelocity1;\r\n other._currentVelocity2 = this._currentVelocity2;\r\n }\r\n if (this._currentLimitVelocityGradient) {\r\n other._currentLimitVelocityGradient = this._currentLimitVelocityGradient;\r\n other._currentLimitVelocity1 = this._currentLimitVelocity1;\r\n other._currentLimitVelocity2 = this._currentLimitVelocity2;\r\n }\r\n if (this._currentDragGradient) {\r\n other._currentDragGradient = this._currentDragGradient;\r\n other._currentDrag1 = this._currentDrag1;\r\n other._currentDrag2 = this._currentDrag2;\r\n }\r\n if (this.particleSystem.isAnimationSheetEnabled) {\r\n other._initialStartSpriteCellId = this._initialStartSpriteCellId;\r\n other._initialEndSpriteCellId = this._initialEndSpriteCellId;\r\n other._initialSpriteCellLoop = this._initialSpriteCellLoop;\r\n }\r\n if (this.particleSystem.useRampGradients) {\r\n if (other.remapData && this.remapData) {\r\n other.remapData.copyFrom(this.remapData);\r\n } else {\r\n other.remapData = new Vector4(0, 0, 0, 0);\r\n }\r\n }\r\n if (this._randomNoiseCoordinates1) {\r\n if (other._randomNoiseCoordinates1) {\r\n other._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1);\r\n other._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2);\r\n } else {\r\n other._randomNoiseCoordinates1 = this._randomNoiseCoordinates1.clone();\r\n other._randomNoiseCoordinates2 = this._randomNoiseCoordinates2.clone();\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"particle.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/particle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OA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,CAAC,wBAAwB,EAAE,CAAC;gBACjC,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;gBACvE,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAC3E,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;gBACvE,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;YAC3E,CAAC;QACL,CAAC;IACL,CAAC;;AAjUc,eAAM,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Vector2, Vector3, TmpVectors, Vector4 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { SubEmitter } from \"./subEmitter\";\r\nimport type { ColorGradient, FactorGradient } from \"../Misc/gradients\";\r\n\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { ThinParticleSystem } from \"./thinParticleSystem\";\r\nimport { Clamp } from \"../Maths/math.scalar.functions\";\r\n\r\n/**\r\n * A particle represents one of the element emitted by a particle system.\r\n * This is mainly define by its coordinates, direction, velocity and age.\r\n */\r\nexport class Particle {\r\n private static _Count = 0;\r\n /**\r\n * Unique ID of the particle\r\n */\r\n public id: number;\r\n /**\r\n * The world position of the particle in the scene.\r\n */\r\n public position = Vector3.Zero();\r\n\r\n /**\r\n * The world direction of the particle in the scene.\r\n */\r\n public direction = Vector3.Zero();\r\n\r\n /**\r\n * The color of the particle.\r\n */\r\n public color = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The color change of the particle per step.\r\n */\r\n public colorStep = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * The creation color of the particle.\r\n */\r\n public initialColor = new Color4(0, 0, 0, 0);\r\n\r\n /**\r\n * Defines how long will the life of the particle be.\r\n */\r\n public lifeTime = 1.0;\r\n\r\n /**\r\n * The current age of the particle.\r\n */\r\n public age = 0;\r\n\r\n /**\r\n * The current size of the particle.\r\n */\r\n public size = 0;\r\n\r\n /**\r\n * The current scale of the particle.\r\n */\r\n public scale = new Vector2(1, 1);\r\n\r\n /**\r\n * The current angle of the particle.\r\n */\r\n public angle = 0;\r\n\r\n /**\r\n * Defines how fast is the angle changing.\r\n */\r\n public angularSpeed = 0;\r\n\r\n /**\r\n * Defines the cell index used by the particle to be rendered from a sprite.\r\n */\r\n public cellIndex: number = 0;\r\n\r\n /**\r\n * The information required to support color remapping\r\n */\r\n public remapData: Vector4;\r\n\r\n /** @internal */\r\n public _randomCellOffset?: number;\r\n\r\n /** @internal */\r\n public _initialDirection: Nullable<Vector3>;\r\n\r\n /** @internal */\r\n public _attachedSubEmitters: Nullable<Array<SubEmitter>> = null;\r\n\r\n /** @internal */\r\n public _initialStartSpriteCellId: number;\r\n /** @internal */\r\n public _initialEndSpriteCellId: number;\r\n /** @internal */\r\n public _initialSpriteCellLoop: boolean;\r\n\r\n /** @internal */\r\n public _currentColorGradient: Nullable<ColorGradient>;\r\n /** @internal */\r\n public _currentColor1 = new Color4(0, 0, 0, 0);\r\n /** @internal */\r\n public _currentColor2 = new Color4(0, 0, 0, 0);\r\n\r\n /** @internal */\r\n public _currentSizeGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentSize1 = 0;\r\n /** @internal */\r\n public _currentSize2 = 0;\r\n\r\n /** @internal */\r\n public _currentAngularSpeedGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentAngularSpeed1 = 0;\r\n /** @internal */\r\n public _currentAngularSpeed2 = 0;\r\n\r\n /** @internal */\r\n public _currentVelocityGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentVelocity1 = 0;\r\n /** @internal */\r\n public _currentVelocity2 = 0;\r\n\r\n /** @internal */\r\n public _currentLimitVelocityGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentLimitVelocity1 = 0;\r\n /** @internal */\r\n public _currentLimitVelocity2 = 0;\r\n\r\n /** @internal */\r\n public _currentDragGradient: Nullable<FactorGradient>;\r\n /** @internal */\r\n public _currentDrag1 = 0;\r\n /** @internal */\r\n public _currentDrag2 = 0;\r\n\r\n /** @internal */\r\n public _randomNoiseCoordinates1: Vector3;\r\n /** @internal */\r\n public _randomNoiseCoordinates2: Vector3;\r\n\r\n /** @internal */\r\n public _localPosition?: Vector3;\r\n\r\n /**\r\n * Creates a new instance Particle\r\n * @param particleSystem the particle system the particle belongs to\r\n */\r\n constructor(\r\n /**\r\n * The particle system the particle belongs to.\r\n */\r\n public particleSystem: ThinParticleSystem\r\n ) {\r\n this.id = Particle._Count++;\r\n if (!this.particleSystem.isAnimationSheetEnabled) {\r\n return;\r\n }\r\n\r\n this._updateCellInfoFromSystem();\r\n }\r\n\r\n private _updateCellInfoFromSystem(): void {\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n }\r\n\r\n /**\r\n * Defines how the sprite cell index is updated for the particle\r\n */\r\n public updateCellIndex(): void {\r\n let offsetAge = this.age;\r\n let changeSpeed = this.particleSystem.spriteCellChangeSpeed;\r\n\r\n if (this.particleSystem.spriteRandomStartCell) {\r\n if (this._randomCellOffset === undefined) {\r\n this._randomCellOffset = Math.random() * this.lifeTime;\r\n }\r\n\r\n if (changeSpeed === 0) {\r\n // Special case when speed = 0 meaning we want to stay on initial cell\r\n changeSpeed = 1;\r\n offsetAge = this._randomCellOffset;\r\n } else {\r\n offsetAge += this._randomCellOffset;\r\n }\r\n }\r\n\r\n const dist = this._initialEndSpriteCellId - this._initialStartSpriteCellId + 1;\r\n let ratio: number;\r\n if (this._initialSpriteCellLoop) {\r\n ratio = Clamp(((offsetAge * changeSpeed) % this.lifeTime) / this.lifeTime);\r\n } else {\r\n ratio = Clamp((offsetAge * changeSpeed) / this.lifeTime);\r\n }\r\n this.cellIndex = (this._initialStartSpriteCellId + ratio * dist) | 0;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _inheritParticleInfoToSubEmitter(subEmitter: SubEmitter) {\r\n if ((<AbstractMesh>subEmitter.particleSystem.emitter).position) {\r\n const emitterMesh = <AbstractMesh>subEmitter.particleSystem.emitter;\r\n emitterMesh.position.copyFrom(this.position);\r\n if (subEmitter.inheritDirection) {\r\n const temp = TmpVectors.Vector3[0];\r\n this.direction.normalizeToRef(temp);\r\n emitterMesh.setDirection(temp, 0, Math.PI / 2);\r\n }\r\n } else {\r\n const emitterPosition = <Vector3>subEmitter.particleSystem.emitter;\r\n emitterPosition.copyFrom(this.position);\r\n }\r\n // Set inheritedVelocityOffset to be used when new particles are created\r\n this.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, TmpVectors.Vector3[0]);\r\n subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(TmpVectors.Vector3[0]);\r\n }\r\n\r\n /** @internal */\r\n public _inheritParticleInfoToSubEmitters() {\r\n if (this._attachedSubEmitters && this._attachedSubEmitters.length > 0) {\r\n for (const subEmitter of this._attachedSubEmitters) {\r\n this._inheritParticleInfoToSubEmitter(subEmitter);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _reset() {\r\n this.age = 0;\r\n this.id = Particle._Count++;\r\n this._currentColorGradient = null;\r\n this._currentSizeGradient = null;\r\n this._currentAngularSpeedGradient = null;\r\n this._currentVelocityGradient = null;\r\n this._currentLimitVelocityGradient = null;\r\n this._currentDragGradient = null;\r\n this.cellIndex = this.particleSystem.startSpriteCellID;\r\n this._randomCellOffset = undefined;\r\n }\r\n\r\n /**\r\n * Copy the properties of particle to another one.\r\n * @param other the particle to copy the information to.\r\n */\r\n public copyTo(other: Particle) {\r\n other.position.copyFrom(this.position);\r\n if (this._initialDirection) {\r\n if (other._initialDirection) {\r\n other._initialDirection.copyFrom(this._initialDirection);\r\n } else {\r\n other._initialDirection = this._initialDirection.clone();\r\n }\r\n } else {\r\n other._initialDirection = null;\r\n }\r\n other.direction.copyFrom(this.direction);\r\n if (this._localPosition) {\r\n if (other._localPosition) {\r\n other._localPosition.copyFrom(this._localPosition);\r\n } else {\r\n other._localPosition = this._localPosition.clone();\r\n }\r\n }\r\n other.color.copyFrom(this.color);\r\n other.colorStep.copyFrom(this.colorStep);\r\n other.initialColor.copyFrom(this.initialColor);\r\n other.lifeTime = this.lifeTime;\r\n other.age = this.age;\r\n other._randomCellOffset = this._randomCellOffset;\r\n other.size = this.size;\r\n other.scale.copyFrom(this.scale);\r\n other.angle = this.angle;\r\n other.angularSpeed = this.angularSpeed;\r\n other.particleSystem = this.particleSystem;\r\n other.cellIndex = this.cellIndex;\r\n other.id = this.id;\r\n other._attachedSubEmitters = this._attachedSubEmitters;\r\n if (this._currentColorGradient) {\r\n other._currentColorGradient = this._currentColorGradient;\r\n other._currentColor1.copyFrom(this._currentColor1);\r\n other._currentColor2.copyFrom(this._currentColor2);\r\n }\r\n if (this._currentSizeGradient) {\r\n other._currentSizeGradient = this._currentSizeGradient;\r\n other._currentSize1 = this._currentSize1;\r\n other._currentSize2 = this._currentSize2;\r\n }\r\n if (this._currentAngularSpeedGradient) {\r\n other._currentAngularSpeedGradient = this._currentAngularSpeedGradient;\r\n other._currentAngularSpeed1 = this._currentAngularSpeed1;\r\n other._currentAngularSpeed2 = this._currentAngularSpeed2;\r\n }\r\n if (this._currentVelocityGradient) {\r\n other._currentVelocityGradient = this._currentVelocityGradient;\r\n other._currentVelocity1 = this._currentVelocity1;\r\n other._currentVelocity2 = this._currentVelocity2;\r\n }\r\n if (this._currentLimitVelocityGradient) {\r\n other._currentLimitVelocityGradient = this._currentLimitVelocityGradient;\r\n other._currentLimitVelocity1 = this._currentLimitVelocity1;\r\n other._currentLimitVelocity2 = this._currentLimitVelocity2;\r\n }\r\n if (this._currentDragGradient) {\r\n other._currentDragGradient = this._currentDragGradient;\r\n other._currentDrag1 = this._currentDrag1;\r\n other._currentDrag2 = this._currentDrag2;\r\n }\r\n if (this.particleSystem.isAnimationSheetEnabled) {\r\n other._initialStartSpriteCellId = this._initialStartSpriteCellId;\r\n other._initialEndSpriteCellId = this._initialEndSpriteCellId;\r\n other._initialSpriteCellLoop = this._initialSpriteCellLoop;\r\n }\r\n if (this.particleSystem.useRampGradients) {\r\n if (other.remapData && this.remapData) {\r\n other.remapData.copyFrom(this.remapData);\r\n } else {\r\n other.remapData = new Vector4(0, 0, 0, 0);\r\n }\r\n }\r\n if (this._randomNoiseCoordinates1) {\r\n if (other._randomNoiseCoordinates1) {\r\n other._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1);\r\n other._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2);\r\n } else {\r\n other._randomNoiseCoordinates1 = this._randomNoiseCoordinates1.clone();\r\n other._randomNoiseCoordinates2 = this._randomNoiseCoordinates2.clone();\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -1,6 +1,7 @@
1
- import type { SmartArray, Nullable, Immutable, Camera, Scene, AbstractMesh, SubMesh, Material, IParticleSystem } from "../index.js";
1
+ import type { Nullable, Immutable, Camera, Scene, AbstractMesh, SubMesh, Material, IParticleSystem, BoundingBox } from "../index.js";
2
2
  import { Observable } from "../Misc/observable.js";
3
3
  import { RenderingManager } from "../Rendering/renderingManager.js";
4
+ import { SmartArray } from "../Misc/smartArray.js";
4
5
  /**
5
6
  * Defines the options of the object renderer
6
7
  */
@@ -117,13 +118,14 @@ export declare class ObjectRenderer {
117
118
  */
118
119
  readonly onFastPathRenderObservable: Observable<number>;
119
120
  protected _scene: Scene;
120
- /** @internal */
121
- _renderingManager: RenderingManager;
121
+ protected _renderingManager: RenderingManager;
122
122
  /** @internal */
123
123
  _waitingRenderList?: string[];
124
124
  protected _currentRefreshId: number;
125
125
  protected _refreshRate: number;
126
126
  protected _currentApplyByPostProcessSetting: boolean;
127
+ protected _activeMeshes: SmartArray<AbstractMesh>;
128
+ protected _activeBoundingBoxes: SmartArray<BoundingBox>;
127
129
  /**
128
130
  * The options used by the object renderer
129
131
  */
@@ -153,6 +155,14 @@ export declare class ObjectRenderer {
153
155
  * @param material material or array of materials to use for this render pass. If undefined is passed, no specific material will be used but the regular material instead (mesh.material). It's possible to provide an array of materials to use a different material for each rendering pass.
154
156
  */
155
157
  setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material | Material[]): void;
158
+ /** @internal */
159
+ _isFrozen: boolean;
160
+ /** @internal */
161
+ _freezeActiveMeshesCancel: Nullable<() => void>;
162
+ /** @internal */
163
+ _freezeActiveMeshes(freezeMeshes: boolean): void;
164
+ /** @internal */
165
+ _unfreezeActiveMeshes(): void;
156
166
  /**
157
167
  * Instantiates an object renderer.
158
168
  * @param name The friendly name of the object renderer
@@ -212,6 +222,10 @@ export declare class ObjectRenderer {
212
222
  /** @internal */
213
223
  _checkReadiness(): boolean;
214
224
  private _prepareRenderingManager;
225
+ /**
226
+ * Gets the rendering manager
227
+ */
228
+ get renderingManager(): RenderingManager;
215
229
  /**
216
230
  * Overrides the default sort function applied in the rendering group to prepare the meshes.
217
231
  * This allowed control for front to back rendering or reversely depending of the special needs.