@onerjs/core 8.30.4 → 8.30.5

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 (141) hide show
  1. package/Audio/audioSceneComponent.d.ts +9 -5
  2. package/Audio/audioSceneComponent.js +1 -0
  3. package/Audio/audioSceneComponent.js.map +1 -1
  4. package/AudioV2/abstractAudio/audioEngineV2.d.ts +8 -0
  5. package/AudioV2/abstractAudio/audioEngineV2.js +19 -0
  6. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  7. package/AudioV2/webAudio/webAudioEngine.d.ts +5 -0
  8. package/AudioV2/webAudio/webAudioEngine.js +8 -0
  9. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  10. package/AudioV2/webAudio/webAudioStaticSound.js +2 -2
  11. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  12. package/AudioV2/webAudio/webAudioStreamingSound.js +5 -2
  13. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  14. package/Cameras/camera.d.ts +4 -0
  15. package/Cameras/camera.js +18 -9
  16. package/Cameras/camera.js.map +1 -1
  17. package/Engines/WebGPU/webgpuDrawContext.d.ts +8 -0
  18. package/Engines/WebGPU/webgpuDrawContext.js +8 -0
  19. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  20. package/Engines/abstractEngine.js +2 -2
  21. package/Engines/abstractEngine.js.map +1 -1
  22. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +1 -1
  23. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
  24. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +1 -1
  25. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -1
  26. package/FrameGraph/Node/Blocks/computeShaderBlock.d.ts +42 -0
  27. package/FrameGraph/Node/Blocks/computeShaderBlock.js +74 -0
  28. package/FrameGraph/Node/Blocks/computeShaderBlock.js.map +1 -0
  29. package/FrameGraph/Node/Blocks/executeBlock.d.ts +11 -1
  30. package/FrameGraph/Node/Blocks/executeBlock.js +18 -0
  31. package/FrameGraph/Node/Blocks/executeBlock.js.map +1 -1
  32. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  33. package/FrameGraph/Node/Blocks/index.js +1 -0
  34. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  35. package/FrameGraph/Node/Blocks/inputBlock.js +2 -0
  36. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  37. package/FrameGraph/Node/Blocks/outputBlock.js +1 -0
  38. package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -1
  39. package/FrameGraph/Node/nodeRenderGraph.d.ts +1 -1
  40. package/FrameGraph/Node/nodeRenderGraph.js +7 -3
  41. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  42. package/FrameGraph/Node/nodeRenderGraphBlock.js +7 -0
  43. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  44. package/FrameGraph/Passes/pass.d.ts +11 -1
  45. package/FrameGraph/Passes/pass.js +11 -1
  46. package/FrameGraph/Passes/pass.js.map +1 -1
  47. package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +115 -0
  48. package/FrameGraph/Tasks/Misc/computeShaderTask.js +174 -0
  49. package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -0
  50. package/FrameGraph/Tasks/Misc/executeTask.d.ts +5 -0
  51. package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
  52. package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
  53. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -1
  54. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
  55. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  56. package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
  57. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +7 -0
  58. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
  59. package/FrameGraph/frameGraph.d.ts +1 -1
  60. package/FrameGraph/frameGraph.js +3 -6
  61. package/FrameGraph/frameGraph.js.map +1 -1
  62. package/FrameGraph/frameGraphTask.d.ts +3 -2
  63. package/FrameGraph/frameGraphTask.js +5 -2
  64. package/FrameGraph/frameGraphTask.js.map +1 -1
  65. package/FrameGraph/frameGraphTextureManager.js +2 -2
  66. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  67. package/FrameGraph/index.d.ts +1 -0
  68. package/FrameGraph/index.js +1 -0
  69. package/FrameGraph/index.js.map +1 -1
  70. package/Lights/directionalLight.js +1 -4
  71. package/Lights/directionalLight.js.map +1 -1
  72. package/Lights/pointLight.js +2 -5
  73. package/Lights/pointLight.js.map +1 -1
  74. package/Materials/materialHelper.functions.d.ts +8 -0
  75. package/Materials/materialHelper.functions.js +31 -0
  76. package/Materials/materialHelper.functions.js.map +1 -1
  77. package/Materials/shaderMaterial.js +20 -0
  78. package/Materials/shaderMaterial.js.map +1 -1
  79. package/Maths/math.vector.functions.d.ts +26 -13
  80. package/Maths/math.vector.functions.js +29 -8
  81. package/Maths/math.vector.functions.js.map +1 -1
  82. package/Misc/decorators.d.ts +1 -1
  83. package/Misc/decorators.js.map +1 -1
  84. package/Misc/dumpTools.d.ts +20 -0
  85. package/Misc/dumpTools.js +60 -49
  86. package/Misc/dumpTools.js.map +1 -1
  87. package/Misc/index.d.ts +1 -2
  88. package/Misc/index.js +1 -2
  89. package/Misc/index.js.map +1 -1
  90. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  91. package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +57 -0
  92. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +163 -0
  93. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -0
  94. package/Particles/Node/Blocks/Emitters/index.d.ts +5 -4
  95. package/Particles/Node/Blocks/Emitters/index.js +5 -4
  96. package/Particles/Node/Blocks/Emitters/index.js.map +1 -1
  97. package/Particles/Node/Blocks/particleInputBlock.js +2 -0
  98. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  99. package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
  100. package/Particles/Node/Blocks/systemBlock.js +8 -0
  101. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  102. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +5 -1
  103. package/Particles/Node/Enums/nodeParticleContextualSources.js +4 -0
  104. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  105. package/Particles/Node/nodeParticleBuildState.js +5 -0
  106. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  107. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +4 -3
  108. package/Particles/Node/nodeParticleSystemSet.helper.js +182 -115
  109. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  110. package/Physics/physicsRaycastResult.d.ts +3 -0
  111. package/Physics/physicsRaycastResult.js.map +1 -1
  112. package/Physics/v2/Plugins/havokPlugin.js +1 -1
  113. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  114. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -0
  115. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +9 -1
  116. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  117. package/PostProcesses/thinSSAO2PostProcess.d.ts +1 -0
  118. package/PostProcesses/thinSSAO2PostProcess.js +18 -6
  119. package/PostProcesses/thinSSAO2PostProcess.js.map +1 -1
  120. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +1 -0
  121. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  122. package/Shaders/ShadersInclude/openpbrDirectLighting.js +5 -2
  123. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  124. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +1 -1
  125. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  126. package/Shaders/particles.vertex.js +1 -1
  127. package/Shaders/particles.vertex.js.map +1 -1
  128. package/ShadersWGSL/ShadersInclude/bonesDeclaration.js +2 -2
  129. package/ShadersWGSL/ShadersInclude/bonesDeclaration.js.map +1 -1
  130. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +5 -2
  131. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  132. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
  133. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  134. package/ShadersWGSL/iblVoxelGrid.vertex.js +77 -3
  135. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  136. package/ShadersWGSL/particles.vertex.js +1 -1
  137. package/ShadersWGSL/particles.vertex.js.map +1 -1
  138. package/package.json +1 -1
  139. package/scene.d.ts +2 -0
  140. package/scene.js +9 -1
  141. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"boxShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/boxShapeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAG/D;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAChD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAA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OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YACtD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;YAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAY,CAAC;YACvE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAY,CAAC;YAEvE,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;YACtD,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;YACtD,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;YAEtD,IAAI,KAAK,CAAC,sBAAsB,EAAE,CAAC;gBAC/B,OAAO,CAAC,mCAAmC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnH,CAAC;iBAAM,CAAC;gBACJ,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBACtD,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,eAAgB,CAAC,CAAC;YACzD,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a box shape.\r\n */\r\nexport class BoxShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new BoxShapeBlock\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.registerInput(\"minEmitBox\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(-0.5, -0.5, -0.5));\r\n this.registerInput(\"maxEmitBox\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0.5, 0.5, 0.5));\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 \"BoxShapeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input 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 minEmitBox input component\r\n */\r\n public get minEmitBox(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the maxEmitBox input component\r\n */\r\n public get maxEmitBox(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\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 * 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 system._directionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\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 particle._initialDirection = particle.direction.clone();\r\n };\r\n\r\n system._positionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n const minEmitBox = this.minEmitBox.getConnectedValue(state) as Vector3;\r\n const maxEmitBox = this.maxEmitBox.getConnectedValue(state) as Vector3;\r\n\r\n const randX = RandomRange(minEmitBox.x, maxEmitBox.x);\r\n const randY = RandomRange(minEmitBox.y, maxEmitBox.y);\r\n const randZ = RandomRange(minEmitBox.z, maxEmitBox.z);\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n } else {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BoxShapeBlock\", BoxShapeBlock);\r\n"]}
1
+ {"version":3,"file":"boxShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/boxShapeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,OAAO,EAAE,yCAA+B;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAG/D;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAChD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9G,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9G,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACrH,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAClH,IAAI,CAAC,cAA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AC,mCAAmC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnH,CAAC;iBAAM,CAAC;gBACJ,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;gBACtD,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,eAAgB,CAAC,CAAC;YACzD,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a box shape.\r\n */\r\nexport class BoxShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new BoxShapeBlock\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.registerInput(\"minEmitBox\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(-0.5, -0.5, -0.5));\r\n this.registerInput(\"maxEmitBox\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0.5, 0.5, 0.5));\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 \"BoxShapeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input 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 minEmitBox input component\r\n */\r\n public get minEmitBox(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the maxEmitBox input component\r\n */\r\n public get maxEmitBox(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\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 * 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 system._directionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\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 particle._initialDirection = particle.direction.clone();\r\n };\r\n\r\n system._positionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n const minEmitBox = this.minEmitBox.getConnectedValue(state) as Vector3;\r\n const maxEmitBox = this.maxEmitBox.getConnectedValue(state) as Vector3;\r\n\r\n const randX = RandomRange(minEmitBox.x, maxEmitBox.x);\r\n const randY = RandomRange(minEmitBox.y, maxEmitBox.y);\r\n const randZ = RandomRange(minEmitBox.z, maxEmitBox.z);\r\n\r\n if (state.isEmitterTransformNode) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n } else {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BoxShapeBlock\", BoxShapeBlock);\r\n"]}
@@ -0,0 +1,57 @@
1
+ import type { IShapeBlock } from "./IShapeBlock.js";
2
+ import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
3
+ import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
4
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
5
+ /**
6
+ * Block used to provide a flow of particles emitted from a cone shape.
7
+ */
8
+ export declare class ConeShapeBlock extends NodeParticleBlock implements IShapeBlock {
9
+ /**
10
+ * Create a new ConeShapeBlock
11
+ * @param name defines the block name
12
+ */
13
+ constructor(name: string);
14
+ /**
15
+ * Gets the current class name
16
+ * @returns the class name
17
+ */
18
+ getClassName(): string;
19
+ /**
20
+ * Gets the particle input component
21
+ */
22
+ get particle(): NodeParticleConnectionPoint;
23
+ /**
24
+ * Gets the radius input component
25
+ */
26
+ get radius(): NodeParticleConnectionPoint;
27
+ /**
28
+ * Gets the angle input component
29
+ */
30
+ get angle(): NodeParticleConnectionPoint;
31
+ /**
32
+ * Gets the radiusRange input component
33
+ */
34
+ get radiusRange(): NodeParticleConnectionPoint;
35
+ /**
36
+ * Gets the heightRange input component
37
+ */
38
+ get heightRange(): NodeParticleConnectionPoint;
39
+ /**
40
+ * Gets the emitFromSpawnPointOnly input component
41
+ */
42
+ get emitFromSpawnPointOnly(): NodeParticleConnectionPoint;
43
+ /**
44
+ * Gets the directionRandomizer input component
45
+ */
46
+ get directionRandomizer(): NodeParticleConnectionPoint;
47
+ /**
48
+ * Gets the output component
49
+ */
50
+ get output(): NodeParticleConnectionPoint;
51
+ /**
52
+ * Builds the block
53
+ * @param state defines the build state
54
+ */
55
+ _build(state: NodeParticleBuildState): void;
56
+ private _calculateHeight;
57
+ }
@@ -0,0 +1,163 @@
1
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
2
+ import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
3
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
4
+ import { RandomRange } from "../../../../Maths/math.scalar.functions.js";
5
+ import { TmpVectors, Vector3 } from "../../../../Maths/math.vector.js";
6
+ /**
7
+ * Block used to provide a flow of particles emitted from a cone shape.
8
+ */
9
+ export class ConeShapeBlock extends NodeParticleBlock {
10
+ /**
11
+ * Create a new ConeShapeBlock
12
+ * @param name defines the block name
13
+ */
14
+ constructor(name) {
15
+ super(name);
16
+ this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
17
+ this.registerInput("radius", NodeParticleBlockConnectionPointTypes.Float, true, 1);
18
+ this.registerInput("angle", NodeParticleBlockConnectionPointTypes.Float, true, Math.PI);
19
+ this.registerInput("radiusRange", NodeParticleBlockConnectionPointTypes.Float, true, 1);
20
+ this.registerInput("heightRange", NodeParticleBlockConnectionPointTypes.Float, true, 1);
21
+ this.registerInput("emitFromSpawnPointOnly", NodeParticleBlockConnectionPointTypes.Int, true, 0);
22
+ this.registerInput("directionRandomizer", NodeParticleBlockConnectionPointTypes.Float, true, 0);
23
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
24
+ }
25
+ /**
26
+ * Gets the current class name
27
+ * @returns the class name
28
+ */
29
+ getClassName() {
30
+ return "ConeShapeBlock";
31
+ }
32
+ /**
33
+ * Gets the particle input component
34
+ */
35
+ get particle() {
36
+ return this._inputs[0];
37
+ }
38
+ /**
39
+ * Gets the radius input component
40
+ */
41
+ get radius() {
42
+ return this._inputs[1];
43
+ }
44
+ /**
45
+ * Gets the angle input component
46
+ */
47
+ get angle() {
48
+ return this._inputs[2];
49
+ }
50
+ /**
51
+ * Gets the radiusRange input component
52
+ */
53
+ get radiusRange() {
54
+ return this._inputs[3];
55
+ }
56
+ /**
57
+ * Gets the heightRange input component
58
+ */
59
+ get heightRange() {
60
+ return this._inputs[4];
61
+ }
62
+ /**
63
+ * Gets the emitFromSpawnPointOnly input component
64
+ */
65
+ get emitFromSpawnPointOnly() {
66
+ return this._inputs[5];
67
+ }
68
+ /**
69
+ * Gets the directionRandomizer input component
70
+ */
71
+ get directionRandomizer() {
72
+ return this._inputs[6];
73
+ }
74
+ /**
75
+ * Gets the output component
76
+ */
77
+ get output() {
78
+ return this._outputs[0];
79
+ }
80
+ /**
81
+ * Builds the block
82
+ * @param state defines the build state
83
+ */
84
+ _build(state) {
85
+ const system = this.particle.getConnectedValue(state);
86
+ system._directionCreation.process = (particle) => {
87
+ state.particleContext = particle;
88
+ state.systemContext = system;
89
+ // Connected values
90
+ let directionRandomizer = this.directionRandomizer.getConnectedValue(state);
91
+ directionRandomizer = Math.max(0, Math.min(directionRandomizer, 1));
92
+ // Calculate create direction logic
93
+ if (system.isLocal) {
94
+ TmpVectors.Vector3[0].copyFrom(particle.position).normalize();
95
+ }
96
+ else {
97
+ particle.position.subtractToRef(state.emitterWorldMatrix.getTranslation(), TmpVectors.Vector3[0]).normalize();
98
+ }
99
+ const randX = RandomRange(0, directionRandomizer);
100
+ const randY = RandomRange(0, directionRandomizer);
101
+ const randZ = RandomRange(0, directionRandomizer);
102
+ const directionToUpdate = new Vector3();
103
+ directionToUpdate.x = TmpVectors.Vector3[0].x + randX;
104
+ directionToUpdate.y = TmpVectors.Vector3[0].y + randY;
105
+ directionToUpdate.z = TmpVectors.Vector3[0].z + randZ;
106
+ directionToUpdate.normalize();
107
+ if (system.isLocal) {
108
+ particle.direction.copyFromFloats(directionToUpdate.x, directionToUpdate.y, directionToUpdate.z);
109
+ }
110
+ else {
111
+ Vector3.TransformNormalFromFloatsToRef(directionToUpdate.x, directionToUpdate.y, directionToUpdate.z, state.emitterWorldMatrix, particle.direction);
112
+ }
113
+ particle._initialDirection = particle.direction.clone();
114
+ };
115
+ system._positionCreation.process = (particle) => {
116
+ state.particleContext = particle;
117
+ state.systemContext = system;
118
+ // Connected values
119
+ const radius = this.radius.getConnectedValue(state);
120
+ const angle = this.angle.getConnectedValue(state);
121
+ let radiusRange = this.radiusRange.getConnectedValue(state);
122
+ radiusRange = Math.max(0, Math.min(radiusRange, 1));
123
+ let heightRange = this.heightRange.getConnectedValue(state);
124
+ heightRange = Math.max(0, Math.min(heightRange, 1));
125
+ const emitFromSpawnPointOnly = this.emitFromSpawnPointOnly.getConnectedValue(state) !== 0;
126
+ // Calculate position creation logic
127
+ let h;
128
+ if (!emitFromSpawnPointOnly) {
129
+ h = RandomRange(0, heightRange);
130
+ // Better distribution in a cone at normal angles.
131
+ h = 1 - h * h;
132
+ }
133
+ else {
134
+ h = 0.0001;
135
+ }
136
+ let newRadius = radius - RandomRange(0, radius * radiusRange);
137
+ newRadius = newRadius * h;
138
+ const s = RandomRange(0, Math.PI * 2);
139
+ const height = this._calculateHeight(angle, radius);
140
+ const randX = newRadius * Math.sin(s);
141
+ const randZ = newRadius * Math.cos(s);
142
+ const randY = h * height;
143
+ if (system.isLocal) {
144
+ particle.position.copyFromFloats(randX, randY, randZ);
145
+ particle.position.addInPlace(state.emitterPosition);
146
+ }
147
+ else {
148
+ Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix, particle.position);
149
+ }
150
+ };
151
+ this.output._storedValue = system;
152
+ }
153
+ _calculateHeight(angle, radius) {
154
+ if (angle !== 0) {
155
+ return radius / Math.tan(angle / 2);
156
+ }
157
+ else {
158
+ return 1;
159
+ }
160
+ }
161
+ }
162
+ RegisterClass("BABYLON.ConeShapeBlock", ConeShapeBlock);
163
+ //# sourceMappingURL=coneShapeBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coneShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/coneShapeBlock.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,qCAAqC,EAAE,6DAAwE;AACxH,OAAO,EAAE,iBAAiB,EAAE,mCAA8C;AAC1E,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAC/D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,yCAA+B;AAE7D;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,iBAAiB;IACjD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnF,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACxF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,C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AO,CAAC,mCAAmC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnH,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;IAEO,gBAAgB,CAAC,KAAa,EAAE,MAAc;QAClD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YACd,OAAO,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,CAAC;QACb,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import type { IShapeBlock } from \"./IShapeBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\n\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a cone shape.\r\n */\r\nexport class ConeShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new ConeShapeBlock\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(\"radius\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"angle\", NodeParticleBlockConnectionPointTypes.Float, true, Math.PI);\r\n this.registerInput(\"radiusRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"heightRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerInput(\"emitFromSpawnPointOnly\", NodeParticleBlockConnectionPointTypes.Int, true, 0);\r\n this.registerInput(\"directionRandomizer\", NodeParticleBlockConnectionPointTypes.Float, true, 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 \"ConeShapeBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input 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 radius input component\r\n */\r\n public get radius(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\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[2];\r\n }\r\n\r\n /**\r\n * Gets the radiusRange input component\r\n */\r\n public get radiusRange(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the heightRange input component\r\n */\r\n public get heightRange(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the emitFromSpawnPointOnly input component\r\n */\r\n public get emitFromSpawnPointOnly(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the directionRandomizer input component\r\n */\r\n public get directionRandomizer(): NodeParticleConnectionPoint {\r\n return this._inputs[6];\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 * 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 system._directionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n // Connected values\r\n let directionRandomizer = this.directionRandomizer.getConnectedValue(state) as number;\r\n directionRandomizer = Math.max(0, Math.min(directionRandomizer, 1));\r\n\r\n // Calculate create direction logic\r\n if (system.isLocal) {\r\n TmpVectors.Vector3[0].copyFrom(particle.position).normalize();\r\n } else {\r\n particle.position.subtractToRef(state.emitterWorldMatrix!.getTranslation(), TmpVectors.Vector3[0]).normalize();\r\n }\r\n\r\n const randX = RandomRange(0, directionRandomizer);\r\n const randY = RandomRange(0, directionRandomizer);\r\n const randZ = RandomRange(0, directionRandomizer);\r\n const directionToUpdate = new Vector3();\r\n directionToUpdate.x = TmpVectors.Vector3[0].x + randX;\r\n directionToUpdate.y = TmpVectors.Vector3[0].y + randY;\r\n directionToUpdate.z = TmpVectors.Vector3[0].z + randZ;\r\n directionToUpdate.normalize();\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFromFloats(directionToUpdate.x, directionToUpdate.y, directionToUpdate.z);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(directionToUpdate.x, directionToUpdate.y, directionToUpdate.z, state.emitterWorldMatrix!, particle.direction);\r\n }\r\n\r\n particle._initialDirection = particle.direction.clone();\r\n };\r\n\r\n system._positionCreation.process = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n // Connected values\r\n const radius = this.radius.getConnectedValue(state) as number;\r\n const angle = this.angle.getConnectedValue(state) as number;\r\n let radiusRange = this.radiusRange.getConnectedValue(state) as number;\r\n radiusRange = Math.max(0, Math.min(radiusRange, 1));\r\n let heightRange = this.heightRange.getConnectedValue(state) as number;\r\n heightRange = Math.max(0, Math.min(heightRange, 1));\r\n const emitFromSpawnPointOnly = (this.emitFromSpawnPointOnly.getConnectedValue(state) as number) !== 0;\r\n\r\n // Calculate position creation logic\r\n let h: number;\r\n if (!emitFromSpawnPointOnly) {\r\n h = RandomRange(0, heightRange);\r\n // Better distribution in a cone at normal angles.\r\n h = 1 - h * h;\r\n } else {\r\n h = 0.0001;\r\n }\r\n\r\n let newRadius = radius - RandomRange(0, radius * radiusRange);\r\n newRadius = newRadius * h;\r\n\r\n const s = RandomRange(0, Math.PI * 2);\r\n const height = this._calculateHeight(angle, radius);\r\n\r\n const randX = newRadius * Math.sin(s);\r\n const randZ = newRadius * Math.cos(s);\r\n const randY = h * height;\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n } else {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n private _calculateHeight(angle: number, radius: number): number {\r\n if (angle !== 0) {\r\n return radius / Math.tan(angle / 2);\r\n } else {\r\n return 1;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ConeShapeBlock\", ConeShapeBlock);\r\n"]}
@@ -1,8 +1,9 @@
1
+ export * from "./createParticleBlock.js";
1
2
  export * from "./boxShapeBlock.js";
2
- export * from "./sphereShapeBlock.js";
3
- export * from "./pointShapeBlock.js";
4
- export * from "./customShapeBlock.js";
3
+ export * from "./coneShapeBlock.js";
5
4
  export * from "./cylinderShapeBlock.js";
5
+ export * from "./customShapeBlock.js";
6
6
  export * from "./meshShapeBlock.js";
7
+ export * from "./pointShapeBlock.js";
7
8
  export * from "./setupSpriteSheetBlock.js";
8
- export * from "./createParticleBlock.js";
9
+ export * from "./sphereShapeBlock.js";
@@ -1,9 +1,10 @@
1
+ export * from "./createParticleBlock.js";
1
2
  export * from "./boxShapeBlock.js";
2
- export * from "./sphereShapeBlock.js";
3
- export * from "./pointShapeBlock.js";
4
- export * from "./customShapeBlock.js";
3
+ export * from "./coneShapeBlock.js";
5
4
  export * from "./cylinderShapeBlock.js";
5
+ export * from "./customShapeBlock.js";
6
6
  export * from "./meshShapeBlock.js";
7
+ export * from "./pointShapeBlock.js";
7
8
  export * from "./setupSpriteSheetBlock.js";
8
- export * from "./createParticleBlock.js";
9
+ export * from "./sphereShapeBlock.js";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from \"./boxShapeBlock\";\r\nexport * from \"./sphereShapeBlock\";\r\nexport * from \"./pointShapeBlock\";\r\nexport * from \"./customShapeBlock\";\r\nexport * from \"./cylinderShapeBlock\";\r\nexport * from \"./meshShapeBlock\";\r\nexport * from \"./setupSpriteSheetBlock\";\r\nexport * from \"./createParticleBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./createParticleBlock\";\r\nexport * from \"./boxShapeBlock\";\r\nexport * from \"./coneShapeBlock\";\r\nexport * from \"./cylinderShapeBlock\";\r\nexport * from \"./customShapeBlock\";\r\nexport * from \"./meshShapeBlock\";\r\nexport * from \"./pointShapeBlock\";\r\nexport * from \"./setupSpriteSheetBlock\";\r\nexport * from \"./sphereShapeBlock\";\r\n"]}
@@ -99,6 +99,8 @@ export class ParticleInputBlock extends NodeParticleBlock {
99
99
  case NodeParticleContextualSources.Color:
100
100
  case NodeParticleContextualSources.InitialColor:
101
101
  case NodeParticleContextualSources.ColorDead:
102
+ case NodeParticleContextualSources.ColorStep:
103
+ case NodeParticleContextualSources.ScaledColorStep:
102
104
  this._type = NodeParticleBlockConnectionPointTypes.Color4;
103
105
  break;
104
106
  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;gB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B,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 case NodeParticleSystemSources.CameraPosition:\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 case NodeParticleContextualSources.InitialDirection:\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._storedValue = this.value;\r\n // As a function to let the user dynamically change the value at runtime\r\n this.output._storedFunction = () => {\r\n return this.value;\r\n };\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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,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 case NodeParticleSystemSources.CameraPosition:\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 case NodeParticleContextualSources.InitialDirection:\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 case NodeParticleContextualSources.ColorStep:\r\n case NodeParticleContextualSources.ScaledColorStep:\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._storedValue = this.value;\r\n // As a function to let the user dynamically change the value at runtime\r\n this.output._storedFunction = () => {\r\n return this.value;\r\n };\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"]}
@@ -27,6 +27,10 @@ export declare class SystemBlock extends NodeParticleBlock {
27
27
  * Gets or sets the target stop duration for the particle system
28
28
  */
29
29
  startDelay: number;
30
+ /**
31
+ * Gets or sets the target stop duration for the particle system
32
+ */
33
+ updateSpeed: number;
30
34
  /**
31
35
  * Gets or sets a boolean indicating if the system should not start automatically
32
36
  */
@@ -35,6 +35,10 @@ export class SystemBlock extends NodeParticleBlock {
35
35
  * Gets or sets the target stop duration for the particle system
36
36
  */
37
37
  this.startDelay = 0;
38
+ /**
39
+ * Gets or sets the target stop duration for the particle system
40
+ */
41
+ this.updateSpeed = 0.0167;
38
42
  /**
39
43
  * Gets or sets a boolean indicating if the system should not start automatically
40
44
  */
@@ -97,6 +101,7 @@ export class SystemBlock extends NodeParticleBlock {
97
101
  const particleSystem = this.particle.getConnectedValue(state);
98
102
  particleSystem.particleTexture = this.texture.getConnectedValue(state);
99
103
  particleSystem.emitRate = this.emitRate;
104
+ particleSystem.updateSpeed = this.updateSpeed;
100
105
  particleSystem.blendMode = this.blendMode;
101
106
  particleSystem.name = this.name;
102
107
  particleSystem._targetStopDuration = this.targetStopDuration;
@@ -188,6 +193,9 @@ __decorate([
188
193
  __decorate([
189
194
  editableInPropertyPage("Delay start(ms)", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
190
195
  ], SystemBlock.prototype, "startDelay", void 0);
196
+ __decorate([
197
+ editableInPropertyPage("updateSpeed", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 0.1 })
198
+ ], SystemBlock.prototype, "updateSpeed", void 0);
191
199
  __decorate([
192
200
  editableInPropertyPage("Do no start", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
193
201
  ], SystemBlock.prototype, "doNoStart", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAoD9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAtDhB;;WAEG;QAYI,cAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QAEvD;;WAEG;QAEI,aAAQ,GAAG,IAAI,CAAC;QAEvB;;WAEG;QAEI,aAAQ,GAAG,EAAE,CAAC;QAErB;;WAEG;QAEI,uBAAkB,GAAG,CAAC,CAAC;QAE9B;;WAEG;QAEI,eAAU,GAAG,CAAC,CAAC;QAEtB;;WAEG;QAEI,cAAS,GAAG,KAAK,CAAC;QAEzB,gBAAgB;QACT,gBAAW,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC;QAS1C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,aAAa,CAA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BAAsB,CAAC,WAAW,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;6CACjH;AAMd;IADN,sBAAsB,CAAC,iBAAiB,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;uDAChH;AAMvB;IADN,sBAAsB,CAAC,iBAAiB,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;+CACxH;AAMf;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;AAgK7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\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 { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { _TriggerSubEmitter } from \"./Triggers/triggerTools\";\r\n\r\n/**\r\n * Block used to get a system of particles\r\n */\r\nexport class SystemBlock extends NodeParticleBlock {\r\n private static _IdCounter = 0;\r\n\r\n /**\r\n * Gets or sets the blend mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Blend mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"MultiplyAdd\", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },\r\n ],\r\n })\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Gets or sets the epsilon value used for comparison\r\n */\r\n @editableInPropertyPage(\"Capacity\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 10000 })\r\n public capacity = 1000;\r\n\r\n /**\r\n * Gets or sets the emit rate\r\n */\r\n @editableInPropertyPage(\"Emit rate\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public emitRate = 10;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Target duration\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public targetStopDuration = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Delay start(ms)\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should not start automatically\r\n */\r\n @editableInPropertyPage(\"Do no start\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public doNoStart = false;\r\n\r\n /** @internal */\r\n public _internalId = SystemBlock._IdCounter++;\r\n\r\n /**\r\n * Create a new SystemBlock\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._isSystem = true;\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"onStart\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"onEnd\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerOutput(\"system\", NodeParticleBlockConnectionPointTypes.System);\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 \"SystemBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input 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 texture input component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the onStart input component\r\n */\r\n public get onStart(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the onEnd input component\r\n */\r\n public get onEnd(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the system output component\r\n */\r\n public get system(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Builds the block and return a functional particle system\r\n * @param state defines the building state\r\n * @returns the built particle system\r\n */\r\n public createSystem(state: NodeParticleBuildState): ParticleSystem {\r\n state.capacity = this.capacity;\r\n state.buildId = this._buildId++;\r\n\r\n this.build(state);\r\n\r\n const particleSystem = this.particle.getConnectedValue(state) as ParticleSystem;\r\n particleSystem.particleTexture = this.texture.getConnectedValue(state);\r\n particleSystem.emitRate = this.emitRate;\r\n particleSystem.blendMode = this.blendMode;\r\n particleSystem.name = this.name;\r\n particleSystem._targetStopDuration = this.targetStopDuration;\r\n particleSystem.startDelay = this.startDelay;\r\n\r\n this.system._storedValue = this;\r\n\r\n particleSystem.canStart = () => {\r\n return !this.doNoStart;\r\n };\r\n\r\n particleSystem.onStartedObservable.add((system) => {\r\n // Triggers\r\n const onStartSystem = this.onStart.getConnectedValue(state);\r\n if (onStartSystem) {\r\n system.onStartedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onStartSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n\r\n const onEndSystem = this.onEnd.getConnectedValue(state);\r\n if (onEndSystem) {\r\n system.onStoppedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onEndSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n particleSystem.dispose();\r\n });\r\n\r\n // Return\r\n return particleSystem;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.capacity = this.capacity;\r\n serializationObject.emitRate = this.emitRate;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.doNoStart = this.doNoStart;\r\n serializationObject.targetStopDuration = this.targetStopDuration;\r\n serializationObject.startDelay = this.startDelay;\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.capacity = serializationObject.capacity;\r\n this.emitRate = serializationObject.emitRate;\r\n this.doNoStart = !!serializationObject.doNoStart;\r\n\r\n if (serializationObject.blendMode !== undefined) {\r\n this.blendMode = serializationObject.blendMode;\r\n }\r\n\r\n if (serializationObject.targetStopDuration !== undefined) {\r\n this.targetStopDuration = serializationObject.targetStopDuration;\r\n }\r\n\r\n if (serializationObject.startDelay !== undefined) {\r\n this.startDelay = serializationObject.startDelay;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SystemBlock\", SystemBlock);\r\n"]}
1
+ {"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IA0D9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QA5DhB;;WAEG;QAYI,cAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QAEvD;;WAEG;QAEI,aAAQ,GAAG,IAAI,CAAC;QAEvB;;WAEG;QAEI,aAAQ,GAAG,EAAE,CAAC;QAErB;;WAEG;QAEI,uBAAkB,GAAG,CAAC,CAAC;QAE9B;;WAEG;QAEI,eAAU,GAAG,CAAC,CAAC;QAEtB;;WAEG;QAEI,gBAAW,GAAG,MAAM,CAAC;QAE5B;;WAEG;QAEI,cAAS,GAAG,KAAK,CAAC;QAEzB,gBAAgB;QACT,gBAAW,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC;QAS1C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC7E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,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;6CACjH;AAMd;IADN,sBAAsB,CAAC,iBAAiB,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;uDAChH;AAMvB;IADN,sBAAsB,CAAC,iBAAiB,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;+CACxH;AAMf;IADN,sBAAsB,CAAC,aAAa,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;gDACxH;AAMrB;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;AAiK7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\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 { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { _TriggerSubEmitter } from \"./Triggers/triggerTools\";\r\n\r\n/**\r\n * Block used to get a system of particles\r\n */\r\nexport class SystemBlock extends NodeParticleBlock {\r\n private static _IdCounter = 0;\r\n\r\n /**\r\n * Gets or sets the blend mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Blend mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"MultiplyAdd\", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },\r\n ],\r\n })\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Gets or sets the epsilon value used for comparison\r\n */\r\n @editableInPropertyPage(\"Capacity\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 10000 })\r\n public capacity = 1000;\r\n\r\n /**\r\n * Gets or sets the emit rate\r\n */\r\n @editableInPropertyPage(\"Emit rate\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public emitRate = 10;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Target duration\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public targetStopDuration = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Delay start(ms)\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"updateSpeed\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 0.1 })\r\n public updateSpeed = 0.0167;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should not start automatically\r\n */\r\n @editableInPropertyPage(\"Do no start\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public doNoStart = false;\r\n\r\n /** @internal */\r\n public _internalId = SystemBlock._IdCounter++;\r\n\r\n /**\r\n * Create a new SystemBlock\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._isSystem = true;\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"onStart\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"onEnd\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerOutput(\"system\", NodeParticleBlockConnectionPointTypes.System);\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 \"SystemBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input 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 texture input component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the onStart input component\r\n */\r\n public get onStart(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the onEnd input component\r\n */\r\n public get onEnd(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the system output component\r\n */\r\n public get system(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Builds the block and return a functional particle system\r\n * @param state defines the building state\r\n * @returns the built particle system\r\n */\r\n public createSystem(state: NodeParticleBuildState): ParticleSystem {\r\n state.capacity = this.capacity;\r\n state.buildId = this._buildId++;\r\n\r\n this.build(state);\r\n\r\n const particleSystem = this.particle.getConnectedValue(state) as ParticleSystem;\r\n particleSystem.particleTexture = this.texture.getConnectedValue(state);\r\n particleSystem.emitRate = this.emitRate;\r\n particleSystem.updateSpeed = this.updateSpeed;\r\n particleSystem.blendMode = this.blendMode;\r\n particleSystem.name = this.name;\r\n particleSystem._targetStopDuration = this.targetStopDuration;\r\n particleSystem.startDelay = this.startDelay;\r\n\r\n this.system._storedValue = this;\r\n\r\n particleSystem.canStart = () => {\r\n return !this.doNoStart;\r\n };\r\n\r\n particleSystem.onStartedObservable.add((system) => {\r\n // Triggers\r\n const onStartSystem = this.onStart.getConnectedValue(state);\r\n if (onStartSystem) {\r\n system.onStartedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onStartSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n\r\n const onEndSystem = this.onEnd.getConnectedValue(state);\r\n if (onEndSystem) {\r\n system.onStoppedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onEndSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n particleSystem.dispose();\r\n });\r\n\r\n // Return\r\n return particleSystem;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.capacity = this.capacity;\r\n serializationObject.emitRate = this.emitRate;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.doNoStart = this.doNoStart;\r\n serializationObject.targetStopDuration = this.targetStopDuration;\r\n serializationObject.startDelay = this.startDelay;\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.capacity = serializationObject.capacity;\r\n this.emitRate = serializationObject.emitRate;\r\n this.doNoStart = !!serializationObject.doNoStart;\r\n\r\n if (serializationObject.blendMode !== undefined) {\r\n this.blendMode = serializationObject.blendMode;\r\n }\r\n\r\n if (serializationObject.targetStopDuration !== undefined) {\r\n this.targetStopDuration = serializationObject.targetStopDuration;\r\n }\r\n\r\n if (serializationObject.startDelay !== undefined) {\r\n this.startDelay = serializationObject.startDelay;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SystemBlock\", SystemBlock);\r\n"]}
@@ -33,5 +33,9 @@ export declare enum NodeParticleContextualSources {
33
33
  /** Color Dead*/
34
34
  ColorDead = 20,
35
35
  /** Initial Direction */
36
- InitialDirection = 21
36
+ InitialDirection = 21,
37
+ /** Color Step */
38
+ ColorStep = 22,
39
+ /** Scaled Color Step */
40
+ ScaledColorStep = 23
37
41
  }
@@ -36,5 +36,9 @@ export var NodeParticleContextualSources;
36
36
  NodeParticleContextualSources[NodeParticleContextualSources["ColorDead"] = 20] = "ColorDead";
37
37
  /** Initial Direction */
38
38
  NodeParticleContextualSources[NodeParticleContextualSources["InitialDirection"] = 21] = "InitialDirection";
39
+ /** Color Step */
40
+ NodeParticleContextualSources[NodeParticleContextualSources["ColorStep"] = 22] = "ColorStep";
41
+ /** Scaled Color Step */
42
+ NodeParticleContextualSources[NodeParticleContextualSources["ScaledColorStep"] = 23] = "ScaledColorStep";
39
43
  })(NodeParticleContextualSources || (NodeParticleContextualSources = {}));
40
44
  //# 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,6BAiCX;AAjCD,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;IAClB,wBAAwB;IACxB,0GAAyB,CAAA;AAC7B,CAAC,EAjCW,6BAA6B,KAA7B,6BAA6B,QAiCxC","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 /** Initial Direction */\r\n InitialDirection = 0x0015,\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,6BAqCX;AArCD,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;IAClB,wBAAwB;IACxB,0GAAyB,CAAA;IACzB,iBAAiB;IACjB,4FAAkB,CAAA;IAClB,wBAAwB;IACxB,wGAAwB,CAAA;AAC5B,CAAC,EArCW,6BAA6B,KAA7B,6BAA6B,QAqCxC","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 /** Initial Direction */\r\n InitialDirection = 0x0015,\r\n /** Color Step */\r\n ColorStep = 0x0016,\r\n /** Scaled Color Step */\r\n ScaledColorStep = 0x0017,\r\n}\r\n"]}
@@ -102,6 +102,11 @@ export class NodeParticleBuildState {
102
102
  return this.systemContext.startSpriteCellID;
103
103
  case NodeParticleContextualSources.InitialDirection:
104
104
  return this.particleContext._initialDirection;
105
+ case NodeParticleContextualSources.ColorStep:
106
+ return this.particleContext.colorStep;
107
+ case NodeParticleContextualSources.ScaledColorStep:
108
+ this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);
109
+ return this.systemContext._scaledColorStep;
105
110
  }
106
111
  return null;
107
112
  }