@babylonjs/core 8.23.1 → 8.23.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 (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 +88 -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
@@ -18,6 +18,7 @@ export class CreateParticleBlock extends NodeParticleBlock {
18
18
  this.registerInput("emitPower", NodeParticleBlockConnectionPointTypes.Float, true, 1);
19
19
  this.registerInput("lifeTime", NodeParticleBlockConnectionPointTypes.Float, true, 1);
20
20
  this.registerInput("color", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(1, 1, 1, 1));
21
+ this.registerInput("colorDead", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(0, 0, 0, 0));
21
22
  this.registerInput("scale", NodeParticleBlockConnectionPointTypes.Vector2, true, new Vector2(1, 1));
22
23
  this.registerInput("angle", NodeParticleBlockConnectionPointTypes.Float, true, 0);
23
24
  this.registerOutput("particle", NodeParticleBlockConnectionPointTypes.Particle);
@@ -47,17 +48,23 @@ export class CreateParticleBlock extends NodeParticleBlock {
47
48
  get color() {
48
49
  return this._inputs[2];
49
50
  }
51
+ /**
52
+ * Gets the color dead input component
53
+ */
54
+ get colorDead() {
55
+ return this._inputs[3];
56
+ }
50
57
  /**
51
58
  * Gets the scale input component
52
59
  */
53
60
  get scale() {
54
- return this._inputs[3];
61
+ return this._inputs[4];
55
62
  }
56
63
  /**
57
64
  * Gets the angle input component
58
65
  */
59
66
  get angle() {
60
- return this._inputs[4];
67
+ return this._inputs[5];
61
68
  }
62
69
  /**
63
70
  * Gets the particle output component
@@ -80,7 +87,10 @@ export class CreateParticleBlock extends NodeParticleBlock {
80
87
  system._colorCreation.process = (particle) => {
81
88
  state.particleContext = particle;
82
89
  particle.color.copyFrom(this.color.getConnectedValue(state));
83
- particle.colorStep.copyFrom(particle.color);
90
+ system.colorDead.copyFrom(this.colorDead.getConnectedValue(state));
91
+ particle.initialColor.copyFrom(particle.color);
92
+ system.colorDead.subtractToRef(particle.initialColor, system._colorDiff);
93
+ system._colorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);
84
94
  };
85
95
  system._sizeCreation.process = (particle) => {
86
96
  state.particleContext = particle;
@@ -1 +1 @@
1
- {"version":3,"file":"createParticleBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/createPartic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GAAG,QAAQ,CAAC;YACjC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7D,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAChD,CAAC,CAAC;QAEF,MAAM,CAAC,aAAa,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YAClD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;YAClB,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YACnD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACzD,CAAC,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,MAAM,CAAC;IACxC,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nimport type { _IExecutionQueueItem } from \"core/Particles/Queue/executionQueue\";\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nimport { _RemoveFromQueue } from \"core/Particles/Queue/executionQueue\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { PointParticleEmitter } from \"core/Particles/EmitterTypes/pointParticleEmitter\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class CreateParticleBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new CreateParticleBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"emitPower\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"lifeTime\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"color\", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(1, 1, 1, 1));\r\n this.registerInput(\"scale\", NodeParticleBlockConnectionPointTypes.Vector2, true, new Vector2(1, 1));\r\n this.registerInput(\"angle\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerOutput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"CreateParticleBlock\";\r\n }\r\n\r\n /**\r\n * Gets the emitPower input component\r\n */\r\n public get emitPower(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the lifeTime input component\r\n */\r\n public get lifeTime(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the color input component\r\n */\r\n public get color(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the scale input component\r\n */\r\n public get scale(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the angle input component\r\n */\r\n public get angle(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the particle output component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = new ParticleSystem(this.name, state.capacity, state.scene, null, false, undefined, true);\r\n system.particleEmitterType = new PointParticleEmitter();\r\n\r\n // Creation\r\n system._lifeTimeCreation.process = (particle: Particle, system: ThinParticleSystem) => {\r\n state.particleContext = particle;\r\n particle.lifeTime = this.lifeTime.getConnectedValue(state);\r\n system._emitPower = this.emitPower.getConnectedValue(state);\r\n };\r\n\r\n system._colorCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.color.copyFrom(this.color.getConnectedValue(state));\r\n particle.colorStep.copyFrom(particle.color);\r\n };\r\n\r\n system._sizeCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.size = 1;\r\n particle.scale.copyFrom(this.scale.getConnectedValue(state));\r\n };\r\n\r\n system._angleCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.angle = this.angle.getConnectedValue(state);\r\n };\r\n\r\n this.particle._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CreateParticleBlock\", CreateParticleBlock);\r\n"]}
1
+ {"version":3,"file":"createParticleBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/createParticleBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,mCAAsC;AAQ/D,OAAO,EAAE,MAAM,EAAE,wCAA8B;AAC/C,OAAO,EAAE,OAAO,EAAE,yCAA+B;AACjD,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,oBAAoB,EAAE,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AI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7D,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;YACnE,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;YACzE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC9E,CAAC,CAAC;QAEF,MAAM,CAAC,aAAa,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YAClD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;YAClB,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC;QAEF,MAAM,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YACnD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACzD,CAAC,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,YAAY,GAAG,MAAM,CAAC;IACxC,CAAC;CACJ;AAED,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nimport type { _IExecutionQueueItem } from \"core/Particles/Queue/executionQueue\";\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nimport { _RemoveFromQueue } from \"core/Particles/Queue/executionQueue\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { PointParticleEmitter } from \"core/Particles/EmitterTypes/pointParticleEmitter\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class CreateParticleBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new CreateParticleBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"emitPower\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"lifeTime\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"color\", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(1, 1, 1, 1));\r\n this.registerInput(\"colorDead\", NodeParticleBlockConnectionPointTypes.Color4, true, new Color4(0, 0, 0, 0));\r\n this.registerInput(\"scale\", NodeParticleBlockConnectionPointTypes.Vector2, true, new Vector2(1, 1));\r\n this.registerInput(\"angle\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerOutput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"CreateParticleBlock\";\r\n }\r\n\r\n /**\r\n * Gets the emitPower input component\r\n */\r\n public get emitPower(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the lifeTime input component\r\n */\r\n public get lifeTime(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the color input component\r\n */\r\n public get color(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the color dead input component\r\n */\r\n public get colorDead(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the scale input component\r\n */\r\n public get scale(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the angle input component\r\n */\r\n public get angle(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the particle output component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = new ParticleSystem(this.name, state.capacity, state.scene, null, false, undefined, true);\r\n system.particleEmitterType = new PointParticleEmitter();\r\n\r\n // Creation\r\n system._lifeTimeCreation.process = (particle: Particle, system: ThinParticleSystem) => {\r\n state.particleContext = particle;\r\n particle.lifeTime = this.lifeTime.getConnectedValue(state);\r\n system._emitPower = this.emitPower.getConnectedValue(state);\r\n };\r\n\r\n system._colorCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.color.copyFrom(this.color.getConnectedValue(state));\r\n system.colorDead.copyFrom(this.colorDead.getConnectedValue(state));\r\n particle.initialColor.copyFrom(particle.color);\r\n system.colorDead.subtractToRef(particle.initialColor, system._colorDiff);\r\n system._colorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);\r\n };\r\n\r\n system._sizeCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.size = 1;\r\n particle.scale.copyFrom(this.scale.getConnectedValue(state));\r\n };\r\n\r\n system._angleCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n particle.angle = this.angle.getConnectedValue(state);\r\n };\r\n\r\n this.particle._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CreateParticleBlock\", CreateParticleBlock);\r\n"]}
@@ -187,7 +187,9 @@ export class MeshShapeBlock extends NodeParticleBlock {
187
187
  Vector4.FromArrayToRef(this._colors, faceIndexB * 4, TmpVectors.Vector4[1]);
188
188
  Vector4.FromArrayToRef(this._colors, faceIndexC * 4, TmpVectors.Vector4[2]);
189
189
  particle.color.copyFromFloats(bu * TmpVectors.Vector4[0].x + bv * TmpVectors.Vector4[1].x + bw * TmpVectors.Vector4[2].x, bu * TmpVectors.Vector4[0].y + bv * TmpVectors.Vector4[1].y + bw * TmpVectors.Vector4[2].y, bu * TmpVectors.Vector4[0].z + bv * TmpVectors.Vector4[1].z + bw * TmpVectors.Vector4[2].z, bu * TmpVectors.Vector4[0].w + bv * TmpVectors.Vector4[1].w + bw * TmpVectors.Vector4[2].w);
190
- particle.colorStep.copyFrom(particle.color);
190
+ particle.initialColor.copyFrom(particle.color);
191
+ system.colorDead.subtractToRef(particle.initialColor, system._colorDiff);
192
+ system._colorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);
191
193
  }
192
194
  };
193
195
  this.output._storedValue = system;
@@ -1 +1 @@
1
- {"version":3,"file":"meshShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/meshShapeBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAA0B,sBAAsB,EAAE,gDAAsC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAI1G,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAC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oBAAoB,CAAC;QACvE,IAAI,CAAC,0BAA0B,GAAG,CAAC,CAAC,mBAAmB,CAAC,0BAA0B,CAAC;QACnF,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;QACvE,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC;IACvD,CAAC;CACJ;AA5PU;IADN,sBAAsB,CAAC,uBAAuB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4DAC1G;AAM7B;IADN,sBAAsB,CAAC,2BAA2B,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kEACxG;AAMnC;IADN,sBAAsB,CAAC,4BAA4B,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4DAC/G;AAM7B;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC1G;AA4O9B,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport { VertexData } from \"../../../../Meshes/mesh.vertexData\";\r\nimport type { FloatArray, IndicesArray, Nullable } from \"../../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { TmpVectors, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Defines a block used to generate particle shape from mesh geometry data\r\n */\r\nexport class MeshShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n private _mesh: Nullable<Mesh>;\r\n private _cachedVertexData: Nullable<VertexData> = null;\r\n private _indices: Nullable<IndicesArray> = null;\r\n private _positions: Nullable<FloatArray> = null;\r\n private _normals: Nullable<FloatArray> = null;\r\n private _colors: Nullable<FloatArray> = null;\r\n private _storedNormal = Vector3.Zero();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block should serialize its cached data\r\n */\r\n @editableInPropertyPage(\"Serialize cached data\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public serializedCachedData = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the mesh normals should be used for particle direction\r\n */\r\n @editableInPropertyPage(\"Use normals for direction\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public useMeshNormalsForDirection = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the mesh colors should be used for particle color\r\n */\r\n @editableInPropertyPage(\"Use vertex color for color\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public useMeshColorForColor = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the coordinates should be in world space (local space by default)\r\n */\r\n @editableInPropertyPage(\"World space\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public worldSpace = false;\r\n\r\n /**\r\n * Gets or sets the mesh to use to get vertex data\r\n */\r\n public get mesh() {\r\n return this._mesh;\r\n }\r\n\r\n public set mesh(value: Nullable<Mesh>) {\r\n this._mesh = value;\r\n }\r\n\r\n /**\r\n * Create a new MeshShapeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"direction1\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));\r\n this.registerInput(\"direction2\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"MeshShapeBlock\";\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the block is using cached data\r\n */\r\n public get isUsingCachedData() {\r\n return !this.mesh && !!this._cachedVertexData;\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the direction1 input component\r\n */\r\n public get direction1(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the direction2 input component\r\n */\r\n public get direction2(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Remove stored data\r\n */\r\n public cleanData() {\r\n this._mesh = null;\r\n this._cachedVertexData = null;\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state);\r\n\r\n if (!this._mesh && !this._cachedVertexData) {\r\n this.output._storedValue = system;\r\n return;\r\n }\r\n\r\n if (this._mesh) {\r\n this._cachedVertexData = VertexData.ExtractFromMesh(this._mesh, false, true);\r\n }\r\n\r\n if (!this._cachedVertexData) {\r\n this.output._storedValue = system;\r\n return;\r\n }\r\n\r\n this._indices = this._cachedVertexData.indices;\r\n this._positions = this._cachedVertexData.positions;\r\n this._normals = this._cachedVertexData.normals;\r\n this._colors = this._cachedVertexData.colors;\r\n\r\n if (this.useMeshColorForColor && this._colors) {\r\n system._colorCreation.process = () => {};\r\n }\r\n\r\n system._directionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n if (this.useMeshNormalsForDirection && this._normals) {\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformNormalToRef(this._storedNormal, state.emitterWorldMatrix!, particle.direction);\r\n } else {\r\n particle.direction.copyFrom(this._storedNormal);\r\n }\r\n return;\r\n }\r\n\r\n const direction1 = this.direction1.getConnectedValue(state) as Vector3;\r\n const direction2 = this.direction2.getConnectedValue(state) as Vector3;\r\n\r\n const randX = RandomRange(direction1.x, direction2.x);\r\n const randY = RandomRange(direction1.y, direction2.y);\r\n const randZ = RandomRange(direction1.z, direction2.z);\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.direction);\r\n } else {\r\n particle.direction.copyFromFloats(randX, randY, randZ);\r\n }\r\n };\r\n\r\n system._positionCreation.process = (particle: Particle) => {\r\n if (!this._indices || !this._positions) {\r\n return;\r\n }\r\n\r\n const randomFaceIndex = 3 * ((Math.random() * (this._indices.length / 3)) | 0);\r\n const bu = Math.random();\r\n const bv = Math.random() * (1.0 - bu);\r\n const bw = 1.0 - bu - bv;\r\n\r\n const faceIndexA = this._indices[randomFaceIndex];\r\n const faceIndexB = this._indices[randomFaceIndex + 1];\r\n const faceIndexC = this._indices[randomFaceIndex + 2];\r\n const vertexA = TmpVectors.Vector3[0];\r\n const vertexB = TmpVectors.Vector3[1];\r\n const vertexC = TmpVectors.Vector3[2];\r\n const randomVertex = TmpVectors.Vector3[3];\r\n\r\n Vector3.FromArrayToRef(this._positions, faceIndexA * 3, vertexA);\r\n Vector3.FromArrayToRef(this._positions, faceIndexB * 3, vertexB);\r\n Vector3.FromArrayToRef(this._positions, faceIndexC * 3, vertexC);\r\n\r\n randomVertex.x = bu * vertexA.x + bv * vertexB.x + bw * vertexC.x;\r\n randomVertex.y = bu * vertexA.y + bv * vertexB.y + bw * vertexC.y;\r\n randomVertex.z = bu * vertexA.z + bv * vertexB.z + bw * vertexC.z;\r\n\r\n if (this.worldSpace && this.mesh) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randomVertex.x, randomVertex.y, randomVertex.z, this.mesh.getWorldMatrix(), randomVertex);\r\n }\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randomVertex.x, randomVertex.y, randomVertex.z, state.emitterWorldMatrix!, particle.position);\r\n } else {\r\n particle.position.copyFromFloats(randomVertex.x, randomVertex.y, randomVertex.z);\r\n }\r\n\r\n if (this.useMeshNormalsForDirection && this._normals) {\r\n Vector3.FromArrayToRef(this._normals, faceIndexA * 3, vertexA);\r\n Vector3.FromArrayToRef(this._normals, faceIndexB * 3, vertexB);\r\n Vector3.FromArrayToRef(this._normals, faceIndexC * 3, vertexC);\r\n\r\n this._storedNormal.x = bu * vertexA.x + bv * vertexB.x + bw * vertexC.x;\r\n this._storedNormal.y = bu * vertexA.y + bv * vertexB.y + bw * vertexC.y;\r\n this._storedNormal.z = bu * vertexA.z + bv * vertexB.z + bw * vertexC.z;\r\n }\r\n\r\n if (this.useMeshColorForColor && this._colors) {\r\n Vector4.FromArrayToRef(this._colors, faceIndexA * 4, TmpVectors.Vector4[0]);\r\n Vector4.FromArrayToRef(this._colors, faceIndexB * 4, TmpVectors.Vector4[1]);\r\n Vector4.FromArrayToRef(this._colors, faceIndexC * 4, TmpVectors.Vector4[2]);\r\n\r\n particle.color.copyFromFloats(\r\n bu * TmpVectors.Vector4[0].x + bv * TmpVectors.Vector4[1].x + bw * TmpVectors.Vector4[2].x,\r\n bu * TmpVectors.Vector4[0].y + bv * TmpVectors.Vector4[1].y + bw * TmpVectors.Vector4[2].y,\r\n bu * TmpVectors.Vector4[0].z + bv * TmpVectors.Vector4[1].z + bw * TmpVectors.Vector4[2].z,\r\n bu * TmpVectors.Vector4[0].w + bv * TmpVectors.Vector4[1].w + bw * TmpVectors.Vector4[2].w\r\n );\r\n\r\n particle.colorStep.copyFrom(particle.color);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n\r\n if (this.serializedCachedData) {\r\n if (this._mesh) {\r\n serializationObject.cachedVertexData = VertexData.ExtractFromMesh(this._mesh, false, true).serialize();\r\n } else if (this._cachedVertexData) {\r\n serializationObject.cachedVertexData = this._cachedVertexData.serialize();\r\n }\r\n }\r\n\r\n serializationObject.useMeshNormalsForDirection = this.useMeshNormalsForDirection;\r\n serializationObject.useMeshColorForColor = this.useMeshColorForColor;\r\n serializationObject.worldSpace = this.worldSpace;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.cachedVertexData) {\r\n this._cachedVertexData = VertexData.Parse(serializationObject.cachedVertexData);\r\n }\r\n\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n this.useMeshNormalsForDirection = !!serializationObject.useMeshNormalsForDirection;\r\n this.useMeshColorForColor = !!serializationObject.useMeshColorForColor;\r\n this.worldSpace = !!serializationObject.worldSpace;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MeshShapeBlock\", MeshShapeBlock);\r\n"]}
1
+ {"version":3,"file":"meshShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/meshShapeB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AE,CAAC;4DAC/G;AAM7B;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC1G;AA8O9B,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport { VertexData } from \"../../../../Meshes/mesh.vertexData\";\r\nimport type { FloatArray, IndicesArray, Nullable } from \"../../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { TmpVectors, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Defines a block used to generate particle shape from mesh geometry data\r\n */\r\nexport class MeshShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n private _mesh: Nullable<Mesh>;\r\n private _cachedVertexData: Nullable<VertexData> = null;\r\n private _indices: Nullable<IndicesArray> = null;\r\n private _positions: Nullable<FloatArray> = null;\r\n private _normals: Nullable<FloatArray> = null;\r\n private _colors: Nullable<FloatArray> = null;\r\n private _storedNormal = Vector3.Zero();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this block should serialize its cached data\r\n */\r\n @editableInPropertyPage(\"Serialize cached data\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public serializedCachedData = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the mesh normals should be used for particle direction\r\n */\r\n @editableInPropertyPage(\"Use normals for direction\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public useMeshNormalsForDirection = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the mesh colors should be used for particle color\r\n */\r\n @editableInPropertyPage(\"Use vertex color for color\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public useMeshColorForColor = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the coordinates should be in world space (local space by default)\r\n */\r\n @editableInPropertyPage(\"World space\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public worldSpace = false;\r\n\r\n /**\r\n * Gets or sets the mesh to use to get vertex data\r\n */\r\n public get mesh() {\r\n return this._mesh;\r\n }\r\n\r\n public set mesh(value: Nullable<Mesh>) {\r\n this._mesh = value;\r\n }\r\n\r\n /**\r\n * Create a new MeshShapeBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"direction1\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));\r\n this.registerInput(\"direction2\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"MeshShapeBlock\";\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the block is using cached data\r\n */\r\n public get isUsingCachedData() {\r\n return !this.mesh && !!this._cachedVertexData;\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the direction1 input component\r\n */\r\n public get direction1(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the direction2 input component\r\n */\r\n public get direction2(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Remove stored data\r\n */\r\n public cleanData() {\r\n this._mesh = null;\r\n this._cachedVertexData = null;\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state);\r\n\r\n if (!this._mesh && !this._cachedVertexData) {\r\n this.output._storedValue = system;\r\n return;\r\n }\r\n\r\n if (this._mesh) {\r\n this._cachedVertexData = VertexData.ExtractFromMesh(this._mesh, false, true);\r\n }\r\n\r\n if (!this._cachedVertexData) {\r\n this.output._storedValue = system;\r\n return;\r\n }\r\n\r\n this._indices = this._cachedVertexData.indices;\r\n this._positions = this._cachedVertexData.positions;\r\n this._normals = this._cachedVertexData.normals;\r\n this._colors = this._cachedVertexData.colors;\r\n\r\n if (this.useMeshColorForColor && this._colors) {\r\n system._colorCreation.process = () => {};\r\n }\r\n\r\n system._directionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n if (this.useMeshNormalsForDirection && this._normals) {\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformNormalToRef(this._storedNormal, state.emitterWorldMatrix!, particle.direction);\r\n } else {\r\n particle.direction.copyFrom(this._storedNormal);\r\n }\r\n return;\r\n }\r\n\r\n const direction1 = this.direction1.getConnectedValue(state) as Vector3;\r\n const direction2 = this.direction2.getConnectedValue(state) as Vector3;\r\n\r\n const randX = RandomRange(direction1.x, direction2.x);\r\n const randY = RandomRange(direction1.y, direction2.y);\r\n const randZ = RandomRange(direction1.z, direction2.z);\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.direction);\r\n } else {\r\n particle.direction.copyFromFloats(randX, randY, randZ);\r\n }\r\n };\r\n\r\n system._positionCreation.process = (particle: Particle) => {\r\n if (!this._indices || !this._positions) {\r\n return;\r\n }\r\n\r\n const randomFaceIndex = 3 * ((Math.random() * (this._indices.length / 3)) | 0);\r\n const bu = Math.random();\r\n const bv = Math.random() * (1.0 - bu);\r\n const bw = 1.0 - bu - bv;\r\n\r\n const faceIndexA = this._indices[randomFaceIndex];\r\n const faceIndexB = this._indices[randomFaceIndex + 1];\r\n const faceIndexC = this._indices[randomFaceIndex + 2];\r\n const vertexA = TmpVectors.Vector3[0];\r\n const vertexB = TmpVectors.Vector3[1];\r\n const vertexC = TmpVectors.Vector3[2];\r\n const randomVertex = TmpVectors.Vector3[3];\r\n\r\n Vector3.FromArrayToRef(this._positions, faceIndexA * 3, vertexA);\r\n Vector3.FromArrayToRef(this._positions, faceIndexB * 3, vertexB);\r\n Vector3.FromArrayToRef(this._positions, faceIndexC * 3, vertexC);\r\n\r\n randomVertex.x = bu * vertexA.x + bv * vertexB.x + bw * vertexC.x;\r\n randomVertex.y = bu * vertexA.y + bv * vertexB.y + bw * vertexC.y;\r\n randomVertex.z = bu * vertexA.z + bv * vertexB.z + bw * vertexC.z;\r\n\r\n if (this.worldSpace && this.mesh) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randomVertex.x, randomVertex.y, randomVertex.z, this.mesh.getWorldMatrix(), randomVertex);\r\n }\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randomVertex.x, randomVertex.y, randomVertex.z, state.emitterWorldMatrix!, particle.position);\r\n } else {\r\n particle.position.copyFromFloats(randomVertex.x, randomVertex.y, randomVertex.z);\r\n }\r\n\r\n if (this.useMeshNormalsForDirection && this._normals) {\r\n Vector3.FromArrayToRef(this._normals, faceIndexA * 3, vertexA);\r\n Vector3.FromArrayToRef(this._normals, faceIndexB * 3, vertexB);\r\n Vector3.FromArrayToRef(this._normals, faceIndexC * 3, vertexC);\r\n\r\n this._storedNormal.x = bu * vertexA.x + bv * vertexB.x + bw * vertexC.x;\r\n this._storedNormal.y = bu * vertexA.y + bv * vertexB.y + bw * vertexC.y;\r\n this._storedNormal.z = bu * vertexA.z + bv * vertexB.z + bw * vertexC.z;\r\n }\r\n\r\n if (this.useMeshColorForColor && this._colors) {\r\n Vector4.FromArrayToRef(this._colors, faceIndexA * 4, TmpVectors.Vector4[0]);\r\n Vector4.FromArrayToRef(this._colors, faceIndexB * 4, TmpVectors.Vector4[1]);\r\n Vector4.FromArrayToRef(this._colors, faceIndexC * 4, TmpVectors.Vector4[2]);\r\n\r\n particle.color.copyFromFloats(\r\n bu * TmpVectors.Vector4[0].x + bv * TmpVectors.Vector4[1].x + bw * TmpVectors.Vector4[2].x,\r\n bu * TmpVectors.Vector4[0].y + bv * TmpVectors.Vector4[1].y + bw * TmpVectors.Vector4[2].y,\r\n bu * TmpVectors.Vector4[0].z + bv * TmpVectors.Vector4[1].z + bw * TmpVectors.Vector4[2].z,\r\n bu * TmpVectors.Vector4[0].w + bv * TmpVectors.Vector4[1].w + bw * TmpVectors.Vector4[2].w\r\n );\r\n\r\n particle.initialColor.copyFrom(particle.color);\r\n system.colorDead.subtractToRef(particle.initialColor, system._colorDiff);\r\n system._colorDiff.scaleToRef(1.0 / particle.lifeTime, particle.colorStep);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n\r\n if (this.serializedCachedData) {\r\n if (this._mesh) {\r\n serializationObject.cachedVertexData = VertexData.ExtractFromMesh(this._mesh, false, true).serialize();\r\n } else if (this._cachedVertexData) {\r\n serializationObject.cachedVertexData = this._cachedVertexData.serialize();\r\n }\r\n }\r\n\r\n serializationObject.useMeshNormalsForDirection = this.useMeshNormalsForDirection;\r\n serializationObject.useMeshColorForColor = this.useMeshColorForColor;\r\n serializationObject.worldSpace = this.worldSpace;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n if (serializationObject.cachedVertexData) {\r\n this._cachedVertexData = VertexData.Parse(serializationObject.cachedVertexData);\r\n }\r\n\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n this.useMeshNormalsForDirection = !!serializationObject.useMeshNormalsForDirection;\r\n this.useMeshColorForColor = !!serializationObject.useMeshColorForColor;\r\n this.worldSpace = !!serializationObject.worldSpace;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.MeshShapeBlock\", MeshShapeBlock);\r\n"]}
@@ -0,0 +1,31 @@
1
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
2
+ import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
3
+ import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
4
+ /**
5
+ * Block used to provide the basic update functionality for particle colors.
6
+ */
7
+ export declare class BasicColorUpdateBlock extends NodeParticleBlock {
8
+ /**
9
+ * Create a new UpdateScaleBlock
10
+ * @param name defines the block name
11
+ */
12
+ constructor(name: string);
13
+ /**
14
+ * Gets the particle component
15
+ */
16
+ get particle(): NodeParticleConnectionPoint;
17
+ /**
18
+ * Gets the output component
19
+ */
20
+ get output(): NodeParticleConnectionPoint;
21
+ /**
22
+ * Gets the current class name
23
+ * @returns the class name
24
+ */
25
+ getClassName(): string;
26
+ /**
27
+ * Builds the block
28
+ * @param state defines the current build state
29
+ */
30
+ _build(state: NodeParticleBuildState): void;
31
+ }
@@ -0,0 +1,67 @@
1
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
2
+ import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
3
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
4
+ import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
5
+ /**
6
+ * Block used to provide the basic update functionality for particle colors.
7
+ */
8
+ export class BasicColorUpdateBlock extends NodeParticleBlock {
9
+ /**
10
+ * Create a new UpdateScaleBlock
11
+ * @param name defines the block name
12
+ */
13
+ constructor(name) {
14
+ super(name);
15
+ this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
16
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
17
+ }
18
+ /**
19
+ * Gets the particle component
20
+ */
21
+ get particle() {
22
+ return this._inputs[0];
23
+ }
24
+ /**
25
+ * Gets the output component
26
+ */
27
+ get output() {
28
+ return this._outputs[0];
29
+ }
30
+ /**
31
+ * Gets the current class name
32
+ * @returns the class name
33
+ */
34
+ getClassName() {
35
+ return "BasicColorUpdateBlock";
36
+ }
37
+ /**
38
+ * Builds the block
39
+ * @param state defines the current build state
40
+ */
41
+ _build(state) {
42
+ const system = this.particle.getConnectedValue(state);
43
+ const processColor = (particle) => {
44
+ state.particleContext = particle;
45
+ state.systemContext = system;
46
+ particle.colorStep.scaleToRef(system._scaledUpdateSpeed, system._scaledColorStep);
47
+ particle.color.addInPlace(system._scaledColorStep);
48
+ if (particle.color.a < 0) {
49
+ particle.color.a = 0;
50
+ }
51
+ };
52
+ const colorProcessing = {
53
+ process: processColor,
54
+ previousItem: null,
55
+ nextItem: null,
56
+ };
57
+ if (system._updateQueueStart) {
58
+ _ConnectAtTheEnd(colorProcessing, system._updateQueueStart);
59
+ }
60
+ else {
61
+ system._updateQueueStart = colorProcessing;
62
+ }
63
+ this.output._storedValue = system;
64
+ }
65
+ }
66
+ RegisterClass("BABYLON.BasicColorUpdateBlock", BasicColorUpdateBlock);
67
+ //# sourceMappingURL=basicColorUpdateBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basicColorUpdateBlock.js","sourceRo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M,CAAC,gBAAgB,CAAC,CAAC;YAEnD,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,eAAe,GAAG;YACpB,OAAO,EAAE,YAAY;YACrB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,eAAe,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to provide the basic update functionality for particle colors.\r\n */\r\nexport class BasicColorUpdateBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateScaleBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"BasicColorUpdateBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n\r\n const processColor = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n particle.colorStep.scaleToRef(system._scaledUpdateSpeed, system._scaledColorStep);\r\n particle.color.addInPlace(system._scaledColorStep);\r\n\r\n if (particle.color.a < 0) {\r\n particle.color.a = 0;\r\n }\r\n };\r\n\r\n const colorProcessing = {\r\n process: processColor,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(colorProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = colorProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BasicColorUpdateBlock\", BasicColorUpdateBlock);\r\n"]}
@@ -11,6 +11,7 @@ export * from "./Update/updateAngleBlock.js";
11
11
  export * from "./Update/updateAgeBlock.js";
12
12
  export * from "./Update/basicPositionUpdateBlock.js";
13
13
  export * from "./Update/basicSpriteUpdateBlock.js";
14
+ export * from "./Update/basicColorUpdateBlock.js";
14
15
  export * from "./Update/updateSpriteCellIndexBlock.js";
15
16
  export * from "./Update/updateFlowMapBlock.js";
16
17
  export * from "./Update/updateAttractorBlock.js";
@@ -12,6 +12,7 @@ export * from "./Update/updateAngleBlock.js";
12
12
  export * from "./Update/updateAgeBlock.js";
13
13
  export * from "./Update/basicPositionUpdateBlock.js";
14
14
  export * from "./Update/basicSpriteUpdateBlock.js";
15
+ export * from "./Update/basicColorUpdateBlock.js";
15
16
  export * from "./Update/updateSpriteCellIndexBlock.js";
16
17
  export * from "./Update/updateFlowMapBlock.js";
17
18
  export * from "./Update/updateAttractorBlock.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\n"]}
@@ -96,6 +96,7 @@ export class ParticleInputBlock extends NodeParticleBlock {
96
96
  break;
97
97
  case NodeParticleContextualSources.Color:
98
98
  case NodeParticleContextualSources.InitialColor:
99
+ case NodeParticleContextualSources.ColorDead:
99
100
  this._type = NodeParticleBlockConnectionPointTypes.Color4;
100
101
  break;
101
102
  case NodeParticleContextualSources.Age:
@@ -1 +1 @@
1
- {"version":3,"file":"particleInputBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleInputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAsBrD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,qCAAqC,CAAC,UAAU,EAAE,CAAC;YAClE,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;gBACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBACrB,IAAI,CAAC,KAAK,GAAG,qCAAqC,CAAC,KAAK,CAAC;oBACzD,OAAO,IAAI,CAAC,KAAK,CAAC;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AAyB,CAAC,IAAI,CAAC;QAEvF,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,IAAI,EAAE,CAAC;QACnE,IAAI,mBAAmB,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACvD,IAAI,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,kBAAkB,CAAC;QACrE,CAAC;QAED,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC;YACjC,OAAO;QACX,CAAC;QAED,IAAI,mBAAmB,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC7C,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC;QAClD,CAAC;aAAM,CAAC;YACJ,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAE1D,IAAI,SAAS,EAAE,CAAC;gBACZ,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACvE,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Observable } from \"../../../Misc/observable\";\r\nimport { GetClass, RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Matrix, Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { NodeParticleContextualSources } from \"../Enums/nodeParticleContextualSources\";\r\nimport { NodeParticleSystemSources } from \"../Enums/nodeParticleSystemSources\";\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nexport class ParticleInputBlock extends NodeParticleBlock {\r\n private _storedValue: any;\r\n private _valueCallback: () => any;\r\n private _type: NodeParticleBlockConnectionPointTypes = NodeParticleBlockConnectionPointTypes.Undefined;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public min: number = 0;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public max: number = 0;\r\n\r\n /** Gets or sets the group to use to display this block in the Inspector */\r\n public groupInInspector = \"\";\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this input is displayed in the Inspector\r\n */\r\n public displayInInspector = true;\r\n\r\n /** Gets an observable raised when the value is changed */\r\n public onValueChangedObservable = new Observable<ParticleInputBlock>();\r\n\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n public get type(): NodeParticleBlockConnectionPointTypes {\r\n if (this._type === NodeParticleBlockConnectionPointTypes.AutoDetect) {\r\n if (this.value != null) {\r\n if (!isNaN(this.value)) {\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n return this._type;\r\n }\r\n\r\n switch (this.value.getClassName()) {\r\n case \"Vector2\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector2;\r\n return this._type;\r\n case \"Vector3\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n return this._type;\r\n case \"Color4\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Color4;\r\n return this._type;\r\n case \"Matrix\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Matrix;\r\n return this._type;\r\n }\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n /** @internal */\r\n private _systemSource: NodeParticleSystemSources = NodeParticleSystemSources.None;\r\n\r\n /**\r\n * Gets a boolean indicating that the current connection point is a system source\r\n */\r\n public get isSystemSource(): boolean {\r\n return this._contextualSource === NodeParticleContextualSources.None && this._systemSource !== NodeParticleSystemSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the system source used by this input block\r\n */\r\n public get systemSource(): NodeParticleSystemSources {\r\n return this._systemSource;\r\n }\r\n\r\n public set systemSource(value: NodeParticleSystemSources) {\r\n this._systemSource = value;\r\n\r\n if (value !== NodeParticleSystemSources.None) {\r\n this._contextualSource = NodeParticleContextualSources.None;\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n\r\n switch (value) {\r\n case NodeParticleSystemSources.Time:\r\n case NodeParticleSystemSources.Delta:\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n break;\r\n case NodeParticleSystemSources.Emitter:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n break;\r\n }\r\n\r\n if (this.output) {\r\n this.output.type = this._type;\r\n }\r\n }\r\n }\r\n\r\n private _contextualSource = NodeParticleContextualSources.None;\r\n /**\r\n * Gets a boolean indicating that the current connection point is a contextual value\r\n */\r\n public get isContextual(): boolean {\r\n return this._contextualSource !== NodeParticleContextualSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the current contextual value\r\n */\r\n public get contextualValue(): NodeParticleContextualSources {\r\n return this._contextualSource;\r\n }\r\n\r\n public set contextualValue(value: NodeParticleContextualSources) {\r\n this._contextualSource = value;\r\n\r\n if (value !== NodeParticleContextualSources.None) {\r\n this._systemSource = NodeParticleSystemSources.None;\r\n\r\n switch (value) {\r\n case NodeParticleContextualSources.Scale:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector2;\r\n break;\r\n case NodeParticleContextualSources.Position:\r\n case NodeParticleContextualSources.Direction:\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n break;\r\n case NodeParticleContextualSources.Color:\r\n case NodeParticleContextualSources.InitialColor:\r\n this._type = NodeParticleBlockConnectionPointTypes.Color4;\r\n break;\r\n case NodeParticleContextualSources.Age:\r\n case NodeParticleContextualSources.Lifetime:\r\n case NodeParticleContextualSources.Angle:\r\n case NodeParticleContextualSources.AgeGradient:\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n break;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n this._type = NodeParticleBlockConnectionPointTypes.Int;\r\n break;\r\n }\r\n\r\n if (this.output) {\r\n this.output.type = this._type;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new InputBlock\r\n * @param name defines the block name\r\n * @param type defines the type of the input (can be set to NodeParticleBlockConnectionPointTypes.AutoDetect)\r\n */\r\n public constructor(name: string, type: NodeParticleBlockConnectionPointTypes = NodeParticleBlockConnectionPointTypes.AutoDetect) {\r\n super(name);\r\n\r\n this._type = type;\r\n this._isInput = true;\r\n this._storedValue = null;\r\n\r\n this.setDefaultValue();\r\n\r\n this.registerOutput(\"output\", type);\r\n }\r\n\r\n /**\r\n * Gets or sets the value of that point.\r\n * Please note that this value will be ignored if valueCallback is defined\r\n */\r\n public get value(): any {\r\n return this._storedValue;\r\n }\r\n\r\n public set value(value: any) {\r\n if (this.type === NodeParticleBlockConnectionPointTypes.Float) {\r\n if (this.min !== this.max) {\r\n value = Math.max(this.min, value);\r\n value = Math.min(this.max, value);\r\n }\r\n }\r\n\r\n this._storedValue = value;\r\n\r\n this.onValueChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets a callback used to get the value of that point.\r\n * Please note that setting this value will force the connection point to ignore the value property\r\n */\r\n public get valueCallback(): () => any {\r\n return this._valueCallback;\r\n }\r\n\r\n public set valueCallback(value: () => any) {\r\n this._valueCallback = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleInputBlock\";\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Set the input block to its default value (based on its type)\r\n */\r\n public setDefaultValue() {\r\n switch (this.type) {\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float:\r\n this.value = 0;\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n this.value = Vector2.Zero();\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n this.value = Vector3.Zero();\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n this.value = new Color4(1, 1, 1, 1);\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Matrix:\r\n this.value = Matrix.Identity();\r\n break;\r\n }\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n super._build(state);\r\n\r\n if (this.isSystemSource) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getSystemValue(this._systemSource);\r\n };\r\n } else if (this.isContextual) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getContextualValue(this._contextualSource);\r\n };\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = this.value;\r\n }\r\n }\r\n\r\n public override dispose() {\r\n this.onValueChangedObservable.clear();\r\n\r\n super.dispose();\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.type = this.type;\r\n serializationObject.contextualValue = this.contextualValue;\r\n serializationObject.systemSource = this.systemSource;\r\n serializationObject.min = this.min;\r\n serializationObject.max = this.max;\r\n serializationObject.groupInInspector = this.groupInInspector;\r\n serializationObject.displayInInspector = this.displayInInspector;\r\n\r\n if (this._storedValue !== null && !this.isContextual && !this.isSystemSource) {\r\n if (this._storedValue.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this._storedValue.getClassName();\r\n serializationObject.value = this._storedValue.asArray();\r\n } else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this._storedValue;\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this._type = serializationObject.type;\r\n this.contextualValue = serializationObject.contextualValue;\r\n this.systemSource = serializationObject.systemSource || NodeParticleSystemSources.None;\r\n\r\n this.min = serializationObject.min || 0;\r\n this.max = serializationObject.max || 0;\r\n this.groupInInspector = serializationObject.groupInInspector || \"\";\r\n if (serializationObject.displayInInspector !== undefined) {\r\n this.displayInInspector = serializationObject.displayInInspector;\r\n }\r\n\r\n if (!serializationObject.valueType) {\r\n return;\r\n }\r\n\r\n if (serializationObject.valueType === \"number\") {\r\n this._storedValue = serializationObject.value;\r\n } else {\r\n const valueType = GetClass(serializationObject.valueType);\r\n\r\n if (valueType) {\r\n this._storedValue = valueType.FromArray(serializationObject.value);\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleInputBlock\", ParticleInputBlock);\r\n"]}
1
+ {"version":3,"file":"particleInputBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleInputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAsBrD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,qCAAqC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AO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,YAAY,IAAI,yBAAyB,CAAC,IAAI,CAAC;QAEvF,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,IAAI,EAAE,CAAC;QACnE,IAAI,mBAAmB,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACvD,IAAI,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,kBAAkB,CAAC;QACrE,CAAC;QAED,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC;YACjC,OAAO;QACX,CAAC;QAED,IAAI,mBAAmB,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC7C,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC;QAClD,CAAC;aAAM,CAAC;YACJ,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAE1D,IAAI,SAAS,EAAE,CAAC;gBACZ,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACvE,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Observable } from \"../../../Misc/observable\";\r\nimport { GetClass, RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Matrix, Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { NodeParticleContextualSources } from \"../Enums/nodeParticleContextualSources\";\r\nimport { NodeParticleSystemSources } from \"../Enums/nodeParticleSystemSources\";\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nexport class ParticleInputBlock extends NodeParticleBlock {\r\n private _storedValue: any;\r\n private _valueCallback: () => any;\r\n private _type: NodeParticleBlockConnectionPointTypes = NodeParticleBlockConnectionPointTypes.Undefined;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public min: number = 0;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public max: number = 0;\r\n\r\n /** Gets or sets the group to use to display this block in the Inspector */\r\n public groupInInspector = \"\";\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this input is displayed in the Inspector\r\n */\r\n public displayInInspector = true;\r\n\r\n /** Gets an observable raised when the value is changed */\r\n public onValueChangedObservable = new Observable<ParticleInputBlock>();\r\n\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n public get type(): NodeParticleBlockConnectionPointTypes {\r\n if (this._type === NodeParticleBlockConnectionPointTypes.AutoDetect) {\r\n if (this.value != null) {\r\n if (!isNaN(this.value)) {\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n return this._type;\r\n }\r\n\r\n switch (this.value.getClassName()) {\r\n case \"Vector2\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector2;\r\n return this._type;\r\n case \"Vector3\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n return this._type;\r\n case \"Color4\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Color4;\r\n return this._type;\r\n case \"Matrix\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Matrix;\r\n return this._type;\r\n }\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n /** @internal */\r\n private _systemSource: NodeParticleSystemSources = NodeParticleSystemSources.None;\r\n\r\n /**\r\n * Gets a boolean indicating that the current connection point is a system source\r\n */\r\n public get isSystemSource(): boolean {\r\n return this._contextualSource === NodeParticleContextualSources.None && this._systemSource !== NodeParticleSystemSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the system source used by this input block\r\n */\r\n public get systemSource(): NodeParticleSystemSources {\r\n return this._systemSource;\r\n }\r\n\r\n public set systemSource(value: NodeParticleSystemSources) {\r\n this._systemSource = value;\r\n\r\n if (value !== NodeParticleSystemSources.None) {\r\n this._contextualSource = NodeParticleContextualSources.None;\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n\r\n switch (value) {\r\n case NodeParticleSystemSources.Time:\r\n case NodeParticleSystemSources.Delta:\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n break;\r\n case NodeParticleSystemSources.Emitter:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n break;\r\n }\r\n\r\n if (this.output) {\r\n this.output.type = this._type;\r\n }\r\n }\r\n }\r\n\r\n private _contextualSource = NodeParticleContextualSources.None;\r\n /**\r\n * Gets a boolean indicating that the current connection point is a contextual value\r\n */\r\n public get isContextual(): boolean {\r\n return this._contextualSource !== NodeParticleContextualSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the current contextual value\r\n */\r\n public get contextualValue(): NodeParticleContextualSources {\r\n return this._contextualSource;\r\n }\r\n\r\n public set contextualValue(value: NodeParticleContextualSources) {\r\n this._contextualSource = value;\r\n\r\n if (value !== NodeParticleContextualSources.None) {\r\n this._systemSource = NodeParticleSystemSources.None;\r\n\r\n switch (value) {\r\n case NodeParticleContextualSources.Scale:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector2;\r\n break;\r\n case NodeParticleContextualSources.Position:\r\n case NodeParticleContextualSources.Direction:\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n break;\r\n case NodeParticleContextualSources.Color:\r\n case NodeParticleContextualSources.InitialColor:\r\n case NodeParticleContextualSources.ColorDead:\r\n this._type = NodeParticleBlockConnectionPointTypes.Color4;\r\n break;\r\n case NodeParticleContextualSources.Age:\r\n case NodeParticleContextualSources.Lifetime:\r\n case NodeParticleContextualSources.Angle:\r\n case NodeParticleContextualSources.AgeGradient:\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n break;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n this._type = NodeParticleBlockConnectionPointTypes.Int;\r\n break;\r\n }\r\n\r\n if (this.output) {\r\n this.output.type = this._type;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new InputBlock\r\n * @param name defines the block name\r\n * @param type defines the type of the input (can be set to NodeParticleBlockConnectionPointTypes.AutoDetect)\r\n */\r\n public constructor(name: string, type: NodeParticleBlockConnectionPointTypes = NodeParticleBlockConnectionPointTypes.AutoDetect) {\r\n super(name);\r\n\r\n this._type = type;\r\n this._isInput = true;\r\n this._storedValue = null;\r\n\r\n this.setDefaultValue();\r\n\r\n this.registerOutput(\"output\", type);\r\n }\r\n\r\n /**\r\n * Gets or sets the value of that point.\r\n * Please note that this value will be ignored if valueCallback is defined\r\n */\r\n public get value(): any {\r\n return this._storedValue;\r\n }\r\n\r\n public set value(value: any) {\r\n if (this.type === NodeParticleBlockConnectionPointTypes.Float) {\r\n if (this.min !== this.max) {\r\n value = Math.max(this.min, value);\r\n value = Math.min(this.max, value);\r\n }\r\n }\r\n\r\n this._storedValue = value;\r\n\r\n this.onValueChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets a callback used to get the value of that point.\r\n * Please note that setting this value will force the connection point to ignore the value property\r\n */\r\n public get valueCallback(): () => any {\r\n return this._valueCallback;\r\n }\r\n\r\n public set valueCallback(value: () => any) {\r\n this._valueCallback = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleInputBlock\";\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Set the input block to its default value (based on its type)\r\n */\r\n public setDefaultValue() {\r\n switch (this.type) {\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float:\r\n this.value = 0;\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n this.value = Vector2.Zero();\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n this.value = Vector3.Zero();\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n this.value = new Color4(1, 1, 1, 1);\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Matrix:\r\n this.value = Matrix.Identity();\r\n break;\r\n }\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n super._build(state);\r\n\r\n if (this.isSystemSource) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getSystemValue(this._systemSource);\r\n };\r\n } else if (this.isContextual) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getContextualValue(this._contextualSource);\r\n };\r\n } else {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = this.value;\r\n }\r\n }\r\n\r\n public override dispose() {\r\n this.onValueChangedObservable.clear();\r\n\r\n super.dispose();\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.type = this.type;\r\n serializationObject.contextualValue = this.contextualValue;\r\n serializationObject.systemSource = this.systemSource;\r\n serializationObject.min = this.min;\r\n serializationObject.max = this.max;\r\n serializationObject.groupInInspector = this.groupInInspector;\r\n serializationObject.displayInInspector = this.displayInInspector;\r\n\r\n if (this._storedValue !== null && !this.isContextual && !this.isSystemSource) {\r\n if (this._storedValue.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this._storedValue.getClassName();\r\n serializationObject.value = this._storedValue.asArray();\r\n } else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this._storedValue;\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this._type = serializationObject.type;\r\n this.contextualValue = serializationObject.contextualValue;\r\n this.systemSource = serializationObject.systemSource || NodeParticleSystemSources.None;\r\n\r\n this.min = serializationObject.min || 0;\r\n this.max = serializationObject.max || 0;\r\n this.groupInInspector = serializationObject.groupInInspector || \"\";\r\n if (serializationObject.displayInInspector !== undefined) {\r\n this.displayInInspector = serializationObject.displayInInspector;\r\n }\r\n\r\n if (!serializationObject.valueType) {\r\n return;\r\n }\r\n\r\n if (serializationObject.valueType === \"number\") {\r\n this._storedValue = serializationObject.value;\r\n } else {\r\n const valueType = GetClass(serializationObject.valueType);\r\n\r\n if (valueType) {\r\n this._storedValue = valueType.FromArray(serializationObject.value);\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleInputBlock\", ParticleInputBlock);\r\n"]}
@@ -1,8 +1,8 @@
1
- import { Texture } from "../../../Materials/Textures/texture.js";
2
1
  import { NodeParticleBlock } from "../nodeParticleBlock.js";
3
2
  import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
4
3
  import type { NodeParticleBuildState } from "../nodeParticleBuildState.js";
5
4
  import type { Nullable } from "../../../types.js";
5
+ import type { BaseTexture } from "../../../Materials/Textures/baseTexture.js";
6
6
  /**
7
7
  * Block used to provide a texture for particles in a particle system
8
8
  */
@@ -30,7 +30,7 @@ export declare class ParticleTextureSourceBlock extends NodeParticleBlock {
30
30
  * Directly sets the texture to be used by this block.
31
31
  * This value will not be serialized.
32
32
  */
33
- set sourceTexture(value: Nullable<Texture>);
33
+ set sourceTexture(value: Nullable<BaseTexture>);
34
34
  /**
35
35
  * Create a new ParticleTextureSourceBlock
36
36
  * @param name defines the block name
@@ -48,7 +48,7 @@ export class ParticleTextureSourceBlock extends NodeParticleBlock {
48
48
  }
49
49
  this._cachedData = null;
50
50
  this._sourceTexture = value;
51
- this._url = "";
51
+ this._url = value.url || "";
52
52
  this._textureDataUrl = "";
53
53
  }
54
54
  /**
@@ -85,13 +85,13 @@ export class ParticleTextureSourceBlock extends NodeParticleBlock {
85
85
  * @returns a promise that resolves to the texture content, including width, height, and pixel data
86
86
  */
87
87
  async extractTextureContentAsync() {
88
- if (!this.texture._storedValue) {
88
+ if (!this.texture._storedValue && !this._sourceTexture) {
89
89
  return null;
90
90
  }
91
91
  if (this._cachedData) {
92
92
  return this._cachedData;
93
93
  }
94
- const texture = this.texture._storedValue;
94
+ const texture = this.texture._storedValue || this._sourceTexture;
95
95
  return await new Promise((resolve, reject) => {
96
96
  if (!texture.isReady()) {
97
97
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
@@ -1 +1 @@
1
- {"version":3,"file":"particleSourceTextureBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleSourceTextureBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+CAAwC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,sCAA+B;AAEtD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAe7D;;OAEG;IACH,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAA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c,CAAC;QAC7D,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,CAAC;QACnC,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;QAEvE,IAAI,mBAAmB,CAAC,cAAc,EAAE,CAAC;YACrC,IAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QAC7D,CAAC;IACL,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;YACrC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAED,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { Texture } from \"core/Materials/Textures/texture\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\n\r\n/**\r\n * Block used to provide a texture for particles in a particle system\r\n */\r\nexport class ParticleTextureSourceBlock extends NodeParticleBlock {\r\n private _url: string = \"\";\r\n private _textureDataUrl: string = \"\";\r\n private _sourceTexture: Nullable<Texture> = null;\r\n private _cachedData: Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }> = null;\r\n\r\n /**\r\n * Indicates if the texture data should be serialized as a base64 string.\r\n */\r\n public serializedCachedData: boolean = false;\r\n\r\n /**\r\n * Gets or sets the URL of the texture to be used by this block.\r\n */\r\n public get url(): string {\r\n return this._url;\r\n }\r\n\r\n public set url(value: string) {\r\n if (this._url === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._url = value;\r\n this._textureDataUrl = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Gets or sets the data URL of the texture to be used by this block.\r\n * This is a base64 encoded string representing the texture data.\r\n */\r\n public get textureDataUrl(): string {\r\n return this._textureDataUrl;\r\n }\r\n\r\n public set textureDataUrl(value: string) {\r\n if (this._textureDataUrl === value) {\r\n return;\r\n }\r\n\r\n this._cachedData = null;\r\n this._textureDataUrl = value;\r\n this._url = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Directly sets the texture to be used by this block.\r\n * This value will not be serialized.\r\n */\r\n public set sourceTexture(value: Nullable<Texture>) {\r\n if (this._sourceTexture === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._sourceTexture = value;\r\n this._url = \"\";\r\n this._textureDataUrl = \"\";\r\n }\r\n\r\n /**\r\n * Create a new ParticleTextureSourceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerOutput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleTextureSourceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture output component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture content as a promise\r\n * @returns a promise that resolves to the texture content, including width, height, and pixel data\r\n */\r\n async extractTextureContentAsync() {\r\n if (!this.texture._storedValue) {\r\n return null;\r\n }\r\n\r\n if (this._cachedData) {\r\n return this._cachedData;\r\n }\r\n\r\n const texture = this.texture._storedValue;\r\n return await new Promise<\r\n Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }>\r\n >((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n texture.onLoadObservable.addOnce(async () => {\r\n try {\r\n this._cachedData = await this.extractTextureContentAsync();\r\n resolve(this._cachedData);\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n // eslint-disable-next-line github/no-then\r\n .then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: new Uint8ClampedArray(data),\r\n };\r\n texture.dispose();\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n });\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n if (this._sourceTexture) {\r\n this.texture._storedValue = this._sourceTexture;\r\n return;\r\n }\r\n\r\n if (!this._textureDataUrl && !this._url) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n if (this._textureDataUrl) {\r\n this.texture._storedValue = new Texture(this._textureDataUrl, state.scene);\r\n return;\r\n }\r\n\r\n this.texture._storedValue = new Texture(this._url, state.scene);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.url = this.url;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n\r\n if (this.serializedCachedData) {\r\n serializationObject.textureDataUrl = this.textureDataUrl;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.url = serializationObject.url;\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n\r\n if (serializationObject.textureDataUrl) {\r\n this.textureDataUrl = serializationObject.textureDataUrl;\r\n }\r\n }\r\n\r\n public override dispose(): void {\r\n if (!this._sourceTexture) {\r\n if (this.texture._storedValue) {\r\n this.texture._storedValue.dispose();\r\n this.texture._storedValue = null;\r\n }\r\n }\r\n super.dispose();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleTextureSourceBlock\", ParticleTextureSourceBlock);\r\n"]}
1
+ {"version":3,"file":"particleSourceTextureBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleSourceTextureBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+CAAwC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,sCAA+B;AAGtD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAe7D;;OAEG;IACH,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,GAAG,CAAC,KAAa;QACxB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAW,cAAc,CAAC,KAAa;QACn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;YACrC,IAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QAC7D,CAAC;IACL,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;YACrC,CAAC;QACL,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;CACJ;AAED,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { Texture } from \"core/Materials/Textures/texture\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\nimport type { BaseTexture } from \"../../../Materials/Textures/baseTexture\";\r\n\r\n/**\r\n * Block used to provide a texture for particles in a particle system\r\n */\r\nexport class ParticleTextureSourceBlock extends NodeParticleBlock {\r\n private _url: string = \"\";\r\n private _textureDataUrl: string = \"\";\r\n private _sourceTexture: Nullable<BaseTexture> = null;\r\n private _cachedData: Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }> = null;\r\n\r\n /**\r\n * Indicates if the texture data should be serialized as a base64 string.\r\n */\r\n public serializedCachedData: boolean = false;\r\n\r\n /**\r\n * Gets or sets the URL of the texture to be used by this block.\r\n */\r\n public get url(): string {\r\n return this._url;\r\n }\r\n\r\n public set url(value: string) {\r\n if (this._url === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._url = value;\r\n this._textureDataUrl = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Gets or sets the data URL of the texture to be used by this block.\r\n * This is a base64 encoded string representing the texture data.\r\n */\r\n public get textureDataUrl(): string {\r\n return this._textureDataUrl;\r\n }\r\n\r\n public set textureDataUrl(value: string) {\r\n if (this._textureDataUrl === value) {\r\n return;\r\n }\r\n\r\n this._cachedData = null;\r\n this._textureDataUrl = value;\r\n this._url = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Directly sets the texture to be used by this block.\r\n * This value will not be serialized.\r\n */\r\n public set sourceTexture(value: Nullable<BaseTexture>) {\r\n if (this._sourceTexture === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._sourceTexture = value;\r\n this._url = (value as Texture).url || \"\";\r\n this._textureDataUrl = \"\";\r\n }\r\n\r\n /**\r\n * Create a new ParticleTextureSourceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerOutput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleTextureSourceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture output component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture content as a promise\r\n * @returns a promise that resolves to the texture content, including width, height, and pixel data\r\n */\r\n async extractTextureContentAsync() {\r\n if (!this.texture._storedValue && !this._sourceTexture) {\r\n return null;\r\n }\r\n\r\n if (this._cachedData) {\r\n return this._cachedData;\r\n }\r\n\r\n const texture = this.texture._storedValue || this._sourceTexture;\r\n return await new Promise<\r\n Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }>\r\n >((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\r\n texture.onLoadObservable.addOnce(async () => {\r\n try {\r\n this._cachedData = await this.extractTextureContentAsync();\r\n resolve(this._cachedData);\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n // eslint-disable-next-line github/no-then\r\n .then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: new Uint8ClampedArray(data),\r\n };\r\n texture.dispose();\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n });\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n if (this._sourceTexture) {\r\n this.texture._storedValue = this._sourceTexture;\r\n return;\r\n }\r\n\r\n if (!this._textureDataUrl && !this._url) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n if (this._textureDataUrl) {\r\n this.texture._storedValue = new Texture(this._textureDataUrl, state.scene);\r\n return;\r\n }\r\n\r\n this.texture._storedValue = new Texture(this._url, state.scene);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.url = this.url;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n\r\n if (this.serializedCachedData) {\r\n serializationObject.textureDataUrl = this.textureDataUrl;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.url = serializationObject.url;\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n\r\n if (serializationObject.textureDataUrl) {\r\n this.textureDataUrl = serializationObject.textureDataUrl;\r\n }\r\n }\r\n\r\n public override dispose(): void {\r\n if (!this._sourceTexture) {\r\n if (this.texture._storedValue) {\r\n this.texture._storedValue.dispose();\r\n this.texture._storedValue = null;\r\n }\r\n }\r\n super.dispose();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleTextureSourceBlock\", ParticleTextureSourceBlock);\r\n"]}
@@ -29,5 +29,7 @@ export declare enum NodeParticleContextualSources {
29
29
  /** SpriteCellEnd */
30
30
  SpriteCellEnd = 18,
31
31
  /** Initial Color */
32
- InitialColor = 19
32
+ InitialColor = 19,
33
+ /** Color Dead*/
34
+ ColorDead = 20
33
35
  }
@@ -32,5 +32,7 @@ export var NodeParticleContextualSources;
32
32
  NodeParticleContextualSources[NodeParticleContextualSources["SpriteCellEnd"] = 18] = "SpriteCellEnd";
33
33
  /** Initial Color */
34
34
  NodeParticleContextualSources[NodeParticleContextualSources["InitialColor"] = 19] = "InitialColor";
35
+ /** Color Dead*/
36
+ NodeParticleContextualSources[NodeParticleContextualSources["ColorDead"] = 20] = "ColorDead";
35
37
  })(NodeParticleContextualSources || (NodeParticleContextualSources = {}));
36
38
  //# sourceMappingURL=nodeParticleContextualSources.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParticleContextualSources.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Enums/nodeParticleContextualSources.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD;;GAEG;AACH,MAAM,CAAN,IAAY,6BA6BX;AA7BD,WAAY,6BAA6B;IACrC,WAAW;IACX,iFAAa,CAAA;IACb,eAAe;IACf,yFAAiB,CAAA;IACjB,gBAAgB;IAChB,2FAAkB,CAAA;IAClB,UAAU;IACV,+EAAY,CAAA;IACZ,eAAe;IACf,yFAAiB,CAAA;IACjB,YAAY;IACZ,mFAAc,CAAA;IACd,sBAAsB;IACtB,uGAAwB,CAAA;IACxB,YAAY;IACZ,mFAAc,CAAA;IACd,kBAAkB;IAClB,+FAAoB,CAAA;IACpB,YAAY;IACZ,mFAAc,CAAA;IACd,sBAAsB;IACtB,wGAAwB,CAAA;IACxB,sBAAsB;IACtB,wGAAwB,CAAA;IACxB,oBAAoB;IACpB,oGAAsB,CAAA;IACtB,oBAAoB;IACpB,kGAAqB,CAAA;AACzB,CAAC,EA7BW,6BAA6B,KAA7B,6BAA6B,QA6BxC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/**\r\n * Defines the kind of contextual sources for node particles\r\n */\r\nexport enum NodeParticleContextualSources {\r\n /** None */\r\n None = 0x0000,\r\n /** Position */\r\n Position = 0x0001,\r\n /** Direction */\r\n Direction = 0x0002,\r\n /** Age */\r\n Age = 0x0003,\r\n /** Lifetime */\r\n Lifetime = 0x0004,\r\n /** Color */\r\n Color = 0x0005,\r\n /** ScaledDirection */\r\n ScaledDirection = 0x0006,\r\n /** Scale */\r\n Scale = 0x0007,\r\n /** AgeGradient */\r\n AgeGradient = 0x0008,\r\n /** Angle */\r\n Angle = 0x0009,\r\n /** SpriteCellIndex */\r\n SpriteCellIndex = 0x0010,\r\n /** SpriteCellStart */\r\n SpriteCellStart = 0x0011,\r\n /** SpriteCellEnd */\r\n SpriteCellEnd = 0x0012,\r\n /** Initial Color */\r\n InitialColor = 0x0013,\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeParticleContextualSources.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Enums/nodeParticleContextualSources.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD;;GAEG;AACH,MAAM,CAAN,IAAY,6BA+BX;AA/BD,WAAY,6BAA6B;IACrC,WAAW;IACX,iFAAa,CAAA;IACb,eAAe;IACf,yFAAiB,CAAA;IACjB,gBAAgB;IAChB,2FAAkB,CAAA;IAClB,UAAU;IACV,+EAAY,CAAA;IACZ,eAAe;IACf,yFAAiB,CAAA;IACjB,YAAY;IACZ,mFAAc,CAAA;IACd,sBAAsB;IACtB,uGAAwB,CAAA;IACxB,YAAY;IACZ,mFAAc,CAAA;IACd,kBAAkB;IAClB,+FAAoB,CAAA;IACpB,YAAY;IACZ,mFAAc,CAAA;IACd,sBAAsB;IACtB,wGAAwB,CAAA;IACxB,sBAAsB;IACtB,wGAAwB,CAAA;IACxB,oBAAoB;IACpB,oGAAsB,CAAA;IACtB,oBAAoB;IACpB,kGAAqB,CAAA;IACrB,gBAAgB;IAChB,4FAAkB,CAAA;AACtB,CAAC,EA/BW,6BAA6B,KAA7B,6BAA6B,QA+BxC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/**\r\n * Defines the kind of contextual sources for node particles\r\n */\r\nexport enum NodeParticleContextualSources {\r\n /** None */\r\n None = 0x0000,\r\n /** Position */\r\n Position = 0x0001,\r\n /** Direction */\r\n Direction = 0x0002,\r\n /** Age */\r\n Age = 0x0003,\r\n /** Lifetime */\r\n Lifetime = 0x0004,\r\n /** Color */\r\n Color = 0x0005,\r\n /** ScaledDirection */\r\n ScaledDirection = 0x0006,\r\n /** Scale */\r\n Scale = 0x0007,\r\n /** AgeGradient */\r\n AgeGradient = 0x0008,\r\n /** Angle */\r\n Angle = 0x0009,\r\n /** SpriteCellIndex */\r\n SpriteCellIndex = 0x0010,\r\n /** SpriteCellStart */\r\n SpriteCellStart = 0x0011,\r\n /** SpriteCellEnd */\r\n SpriteCellEnd = 0x0012,\r\n /** Initial Color */\r\n InitialColor = 0x0013,\r\n /** Color Dead*/\r\n ColorDead = 0x0014,\r\n}\r\n"]}