@onerjs/core 8.30.8 → 8.30.9

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 (98) hide show
  1. package/Cameras/camera.js +1 -0
  2. package/Cameras/camera.js.map +1 -1
  3. package/Cameras/targetCamera.js +0 -4
  4. package/Cameras/targetCamera.js.map +1 -1
  5. package/Culling/ray.core.js +1 -1
  6. package/Culling/ray.core.js.map +1 -1
  7. package/Decorators/nodeDecorator.d.ts +9 -7
  8. package/Decorators/nodeDecorator.js +9 -7
  9. package/Decorators/nodeDecorator.js.map +1 -1
  10. package/Engines/WebGPU/webgpuTextureManager.js +2 -2
  11. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +1 -1
  15. package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
  16. package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +1 -1
  17. package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -1
  18. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +1 -1
  19. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +1 -1
  20. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +1 -1
  21. package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js +1 -1
  22. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +1 -1
  23. package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js +1 -1
  24. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js +1 -1
  25. package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js +1 -1
  26. package/FrameGraph/Node/Blocks/PostProcesses/ssao2PostProcessBlock.js.map +1 -1
  27. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js +1 -1
  28. package/FrameGraph/Node/Blocks/PostProcesses/ssrPostProcessBlock.js.map +1 -1
  29. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +6 -0
  30. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +26 -0
  31. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  32. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
  33. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +48 -22
  34. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  35. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +3 -3
  36. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  37. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +1 -1
  38. package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +1 -1
  39. package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -1
  40. package/FrameGraph/Node/nodeRenderGraph.js +2 -1
  41. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  42. package/FrameGraph/Passes/{cullPass.d.ts → objectListPass.d.ts} +8 -8
  43. package/FrameGraph/Passes/{cullPass.js → objectListPass.js} +9 -9
  44. package/FrameGraph/Passes/objectListPass.js.map +1 -0
  45. package/FrameGraph/Passes/renderPass.d.ts +6 -2
  46. package/FrameGraph/Passes/renderPass.js +14 -2
  47. package/FrameGraph/Passes/renderPass.js.map +1 -1
  48. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +2 -2
  49. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  50. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +8 -0
  51. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +10 -0
  52. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  53. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +8 -0
  54. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +13 -0
  55. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  56. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -1
  57. package/FrameGraph/Tasks/Texture/clearTextureTask.js +7 -5
  58. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  59. package/FrameGraph/frameGraph.d.ts +10 -4
  60. package/FrameGraph/frameGraph.js +22 -9
  61. package/FrameGraph/frameGraph.js.map +1 -1
  62. package/FrameGraph/frameGraphTask.js +3 -3
  63. package/FrameGraph/frameGraphTask.js.map +1 -1
  64. package/FrameGraph/index.d.ts +1 -1
  65. package/FrameGraph/index.js +1 -1
  66. package/FrameGraph/index.js.map +1 -1
  67. package/Materials/floatingOriginMatrixOverrides.js +19 -0
  68. package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
  69. package/Materials/shaderMaterial.d.ts +9 -0
  70. package/Materials/shaderMaterial.js +35 -0
  71. package/Materials/shaderMaterial.js.map +1 -1
  72. package/Particles/EmitterTypes/coneParticleEmitter.d.ts +6 -4
  73. package/Particles/EmitterTypes/coneParticleEmitter.js +18 -12
  74. package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
  75. package/Particles/EmitterTypes/customParticleEmitter.d.ts +5 -3
  76. package/Particles/EmitterTypes/customParticleEmitter.js +8 -6
  77. package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
  78. package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +15 -4
  79. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +66 -36
  80. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
  81. package/Particles/Node/Blocks/Emitters/customShapeBlock.d.ts +13 -9
  82. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +36 -23
  83. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
  84. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.d.ts +6 -0
  85. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +22 -1
  86. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
  87. package/Particles/Node/Blocks/systemBlock.d.ts +4 -4
  88. package/Particles/Node/Blocks/systemBlock.js +8 -12
  89. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  90. package/Particles/Node/nodeParticleSystemSet.helper.js +153 -19
  91. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  92. package/Particles/thinParticleSystem.js +1 -1
  93. package/Particles/thinParticleSystem.js.map +1 -1
  94. package/package.json +1 -1
  95. package/scene.d.ts +1 -3
  96. package/scene.js +8 -7
  97. package/scene.js.map +1 -1
  98. package/FrameGraph/Passes/cullPass.js.map +0 -1
@@ -1,11 +1,22 @@
1
+ import type { Nullable } from "../../../../types.js";
2
+ import type { Particle } from "../../../particle.js";
1
3
  import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
2
4
  import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
3
- import { NodeParticleBlock } from "../../nodeParticleBlock.js";
4
5
  import type { IShapeBlock } from "./IShapeBlock.js";
6
+ import { Vector3 } from "../../../../Maths/math.vector.js";
7
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
8
+ /** Function that generates particle position/direction data */
9
+ type ParticleGeneratorFunction = (index: number, particle: Nullable<Particle>, outPosition: Vector3) => void;
5
10
  /**
6
11
  * Block used to provide a flow of particles emitted from a custom position.
7
12
  */
8
13
  export declare class CustomShapeBlock extends NodeParticleBlock implements IShapeBlock {
14
+ /** The particle position generator function */
15
+ particlePositionGenerator: ParticleGeneratorFunction;
16
+ /** The particle destination generator function */
17
+ particleDestinationGenerator: ParticleGeneratorFunction;
18
+ /** The particle direction generator function */
19
+ particleDirectionGenerator: ParticleGeneratorFunction;
9
20
  /**
10
21
  * Create a new CustomShapeBlock
11
22
  * @param name defines the block name
@@ -20,14 +31,6 @@ export declare class CustomShapeBlock extends NodeParticleBlock implements IShap
20
31
  * Gets the particle component
21
32
  */
22
33
  get particle(): NodeParticleConnectionPoint;
23
- /**
24
- * Gets the position input component
25
- */
26
- get position(): NodeParticleConnectionPoint;
27
- /**
28
- * Gets the direction input component
29
- */
30
- get direction(): NodeParticleConnectionPoint;
31
34
  /**
32
35
  * Gets the output component
33
36
  */
@@ -38,3 +41,4 @@ export declare class CustomShapeBlock extends NodeParticleBlock implements IShap
38
41
  */
39
42
  _build(state: NodeParticleBuildState): void;
40
43
  }
44
+ export {};
@@ -1,7 +1,9 @@
1
+ import { TmpVectors, Vector3 } from "../../../../Maths/math.vector.js";
1
2
  import { RegisterClass } from "../../../../Misc/typeStore.js";
2
- import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
3
- import { Vector3 } from "../../../../Maths/math.vector.js";
3
+ import { EmptyGeneratorFunc } from "../../../EmitterTypes/customParticleEmitter.js";
4
4
  import { NodeParticleBlock } from "../../nodeParticleBlock.js";
5
+ import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
6
+ import { _CreateLocalPositionData } from "./emitters.functions.js";
5
7
  /**
6
8
  * Block used to provide a flow of particles emitted from a custom position.
7
9
  */
@@ -12,9 +14,13 @@ export class CustomShapeBlock extends NodeParticleBlock {
12
14
  */
13
15
  constructor(name) {
14
16
  super(name);
17
+ /** The particle position generator function */
18
+ this.particlePositionGenerator = EmptyGeneratorFunc;
19
+ /** The particle destination generator function */
20
+ this.particleDestinationGenerator = EmptyGeneratorFunc;
21
+ /** The particle direction generator function */
22
+ this.particleDirectionGenerator = EmptyGeneratorFunc;
15
23
  this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
16
- this.registerInput("position", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));
17
- this.registerInput("direction", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 1.0, 0));
18
24
  this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
19
25
  }
20
26
  /**
@@ -30,18 +36,6 @@ export class CustomShapeBlock extends NodeParticleBlock {
30
36
  get particle() {
31
37
  return this._inputs[0];
32
38
  }
33
- /**
34
- * Gets the position input component
35
- */
36
- get position() {
37
- return this._inputs[1];
38
- }
39
- /**
40
- * Gets the direction input component
41
- */
42
- get direction() {
43
- return this._inputs[2];
44
- }
45
39
  /**
46
40
  * Gets the output component
47
41
  */
@@ -57,26 +51,45 @@ export class CustomShapeBlock extends NodeParticleBlock {
57
51
  system._directionCreation.process = (particle) => {
58
52
  state.particleContext = particle;
59
53
  state.systemContext = system;
60
- const direction = this.direction.getConnectedValue(state);
54
+ const tmpVector = TmpVectors.Vector3[0];
55
+ if (this.particleDirectionGenerator && this.particleDirectionGenerator !== EmptyGeneratorFunc) {
56
+ this.particleDirectionGenerator(-1, particle, tmpVector);
57
+ }
58
+ else if (this.particleDestinationGenerator && this.particleDestinationGenerator !== EmptyGeneratorFunc) {
59
+ this.particleDestinationGenerator(-1, particle, tmpVector);
60
+ // Get direction
61
+ const diffVector = TmpVectors.Vector3[1];
62
+ tmpVector.subtractToRef(particle.position, diffVector);
63
+ diffVector.scaleToRef(1 / particle.lifeTime, tmpVector);
64
+ }
65
+ else {
66
+ tmpVector.set(0, 0, 0);
67
+ }
61
68
  if (system.isLocal) {
62
- particle.direction.copyFrom(direction);
69
+ particle.direction.copyFrom(tmpVector);
63
70
  }
64
71
  else {
65
- Vector3.TransformNormalToRef(direction, state.emitterWorldMatrix, particle.direction);
72
+ Vector3.TransformNormalToRef(tmpVector, state.emitterWorldMatrix, particle.direction);
66
73
  }
67
74
  particle._initialDirection = particle.direction.clone();
68
75
  };
69
76
  system._positionCreation.process = (particle) => {
70
77
  state.particleContext = particle;
71
78
  state.systemContext = system;
72
- const position = this.position.getConnectedValue(state);
79
+ const tmpVector = TmpVectors.Vector3[0];
80
+ if (this.particlePositionGenerator && this.particlePositionGenerator !== EmptyGeneratorFunc) {
81
+ this.particlePositionGenerator(-1, particle, tmpVector);
82
+ }
83
+ else {
84
+ tmpVector.set(0, 0, 0);
85
+ }
73
86
  if (system.isLocal) {
74
- particle.position.copyFrom(position);
75
- particle.position.addInPlace(state.emitterPosition);
87
+ particle.position.copyFrom(tmpVector);
76
88
  }
77
89
  else {
78
- Vector3.TransformCoordinatesToRef(position, state.emitterWorldMatrix, particle.position);
90
+ Vector3.TransformCoordinatesToRef(tmpVector, state.emitterWorldMatrix, particle.position);
79
91
  }
92
+ _CreateLocalPositionData(particle);
80
93
  };
81
94
  this.output._storedValue = system;
82
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"customShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/customShapeBlock.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;AAI5D;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IACnD;;;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,UAAU,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1G,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC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AC;QAC5D,CAAC,CAAC;QAEF,MAAM,CAAC,iBAAiB,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YACtD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;YAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAExD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACrC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,eAAgB,CAAC,CAAC;YACzD,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,yBAAyB,CAAC,QAAQ,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC9F,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,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 type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a custom position.\r\n */\r\nexport class CustomShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new CustomShapeBlock\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(\"position\", NodeParticleBlockConnectionPointTypes.Vector3, true, new Vector3(0, 0, 0));\r\n this.registerInput(\"direction\", 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 \"CustomShapeBlock\";\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 position input component\r\n */\r\n public get position(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the direction input component\r\n */\r\n public get direction(): 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 * 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 direction = this.direction.getConnectedValue(state);\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFrom(direction);\r\n } else {\r\n Vector3.TransformNormalToRef(direction, 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 const position = this.position.getConnectedValue(state);\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFrom(position);\r\n particle.position.addInPlace(state.emitterPosition!);\r\n } else {\r\n Vector3.TransformCoordinatesToRef(position, state.emitterWorldMatrix!, particle.position);\r\n }\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CustomShapeBlock\", CustomShapeBlock);\r\n"]}
1
+ {"version":3,"file":"customShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/customShapeBlock.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,yCAA+B;AAC7D,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,kBAAkB,EAAE,uDAA0D;AACvF,OAAO,EAAE,iBAAiB,EAAE,mCAA8C;AAC1E,OAAO,EAAE,qCAAqC,EAAE,6DAAwE;AACxH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAKhE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IAQnD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAZhB,+CAA+C;QACxC,8BAAyB,GAA8B,kBAAkB,CAAC;QACjF,kDAAkD;QAC3C,iCAA4B,GAA8B,kBAAkB,CAAC;QACpF,gDAAgD;QACzC,+BAA0B,GAA8B,kBAAkB,CAAC;QAS9E,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACa,MAAM,CAA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,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC3F,CAAC;YAED,QAAQ,CAAC,iBAAiB,GAAG,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QAC5D,CAAC,CAAC;QAEF,MAAM,CAAC,iBAAiB,CAAC,OAAO,GAAG,CAAC,QAAkB,EAAE,EAAE;YACtD,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;YAE7B,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAExC,IAAI,IAAI,CAAC,yBAAyB,IAAI,IAAI,CAAC,yBAAyB,KAAK,kBAAkB,EAAE,CAAC;gBAC1F,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACJ,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,CAAC;YAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,yBAAyB,CAAC,SAAS,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC/F,CAAC;YAED,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { EmptyGeneratorFunc } from \"core/Particles/EmitterTypes/customParticleEmitter\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { _CreateLocalPositionData } from \"./emitters.functions\";\r\n\r\n/** Function that generates particle position/direction data */\r\ntype ParticleGeneratorFunction = (index: number, particle: Nullable<Particle>, outPosition: Vector3) => void;\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a custom position.\r\n */\r\nexport class CustomShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /** The particle position generator function */\r\n public particlePositionGenerator: ParticleGeneratorFunction = EmptyGeneratorFunc;\r\n /** The particle destination generator function */\r\n public particleDestinationGenerator: ParticleGeneratorFunction = EmptyGeneratorFunc;\r\n /** The particle direction generator function */\r\n public particleDirectionGenerator: ParticleGeneratorFunction = EmptyGeneratorFunc;\r\n\r\n /**\r\n * Create a new CustomShapeBlock\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 current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"CustomShapeBlock\";\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 * 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 tmpVector = TmpVectors.Vector3[0];\r\n\r\n if (this.particleDirectionGenerator && this.particleDirectionGenerator !== EmptyGeneratorFunc) {\r\n this.particleDirectionGenerator(-1, particle, tmpVector);\r\n } else if (this.particleDestinationGenerator && this.particleDestinationGenerator !== EmptyGeneratorFunc) {\r\n this.particleDestinationGenerator(-1, particle, tmpVector);\r\n\r\n // Get direction\r\n const diffVector = TmpVectors.Vector3[1];\r\n tmpVector.subtractToRef(particle.position, diffVector);\r\n\r\n diffVector.scaleToRef(1 / particle.lifeTime, tmpVector);\r\n } else {\r\n tmpVector.set(0, 0, 0);\r\n }\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFrom(tmpVector);\r\n } else {\r\n Vector3.TransformNormalToRef(tmpVector, 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 const tmpVector = TmpVectors.Vector3[0];\r\n\r\n if (this.particlePositionGenerator && this.particlePositionGenerator !== EmptyGeneratorFunc) {\r\n this.particlePositionGenerator(-1, particle, tmpVector);\r\n } else {\r\n tmpVector.set(0, 0, 0);\r\n }\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFrom(tmpVector);\r\n } else {\r\n Vector3.TransformCoordinatesToRef(tmpVector, state.emitterWorldMatrix!, particle.position);\r\n }\r\n\r\n _CreateLocalPositionData(particle);\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CustomShapeBlock\", CustomShapeBlock);\r\n"]}
@@ -7,6 +7,10 @@ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
7
7
  * DirectionRandomizer will be used for the particles initial direction unless both direction1 and direction2 are connected.
8
8
  */
9
9
  export declare class SphereShapeBlock extends NodeParticleBlock implements IShapeBlock {
10
+ /**
11
+ * Gets or sets a boolean indicating whether to emit in a hemispheric mode (top half of the sphere) or not
12
+ */
13
+ isHemispheric: boolean;
10
14
  /**
11
15
  * Create a new SphereShapeBlock
12
16
  * @param name defines the block name
@@ -50,4 +54,6 @@ export declare class SphereShapeBlock extends NodeParticleBlock implements IShap
50
54
  * @param state defines the build state
51
55
  */
52
56
  _build(state: NodeParticleBuildState): void;
57
+ serialize(): any;
58
+ _deserialize(serializationObject: any): void;
53
59
  }
@@ -1,9 +1,11 @@
1
+ import { __decorate } from "../../../../tslib.es6.js";
1
2
  import { RegisterClass } from "../../../../Misc/typeStore.js";
2
3
  import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
3
4
  import { NodeParticleBlock } from "../../nodeParticleBlock.js";
4
5
  import { Vector3 } from "../../../../Maths/math.vector.js";
5
6
  import { RandomRange } from "../../../../Maths/math.scalar.functions.js";
6
7
  import { _CreateLocalPositionData } from "./emitters.functions.js";
8
+ import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
7
9
  /**
8
10
  * Block used to provide a flow of particles emitted from a sphere shape.
9
11
  * DirectionRandomizer will be used for the particles initial direction unless both direction1 and direction2 are connected.
@@ -15,6 +17,10 @@ export class SphereShapeBlock extends NodeParticleBlock {
15
17
  */
16
18
  constructor(name) {
17
19
  super(name);
20
+ /**
21
+ * Gets or sets a boolean indicating whether to emit in a hemispheric mode (top half of the sphere) or not
22
+ */
23
+ this.isHemispheric = false;
18
24
  this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
19
25
  this.registerInput("radius", NodeParticleBlockConnectionPointTypes.Float, true, 1);
20
26
  this.registerInput("radiusRange", NodeParticleBlockConnectionPointTypes.Float, true, 1, 0, 1);
@@ -124,8 +130,11 @@ export class SphereShapeBlock extends NodeParticleBlock {
124
130
  const phi = RandomRange(0, 2 * Math.PI);
125
131
  const theta = Math.acos(2 * v - 1);
126
132
  const randX = randRadius * Math.cos(phi) * Math.sin(theta);
127
- const randY = randRadius * Math.cos(theta);
133
+ let randY = randRadius * Math.cos(theta);
128
134
  const randZ = randRadius * Math.sin(phi) * Math.sin(theta);
135
+ if (this.isHemispheric) {
136
+ randY = Math.abs(randY);
137
+ }
129
138
  if (system.isLocal) {
130
139
  particle.position.copyFromFloats(randX, randY, randZ);
131
140
  }
@@ -136,6 +145,18 @@ export class SphereShapeBlock extends NodeParticleBlock {
136
145
  };
137
146
  this.output._storedValue = system;
138
147
  }
148
+ serialize() {
149
+ const serializationObject = super.serialize();
150
+ serializationObject.isHemispheric = this.isHemispheric;
151
+ return serializationObject;
152
+ }
153
+ _deserialize(serializationObject) {
154
+ super._deserialize(serializationObject);
155
+ this.isHemispheric = serializationObject.isHemispheric;
156
+ }
139
157
  }
158
+ __decorate([
159
+ editableInPropertyPage("Is hemispheric", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
160
+ ], SphereShapeBlock.prototype, "isHemispheric", void 0);
140
161
  RegisterClass("BABYLON.SphereShapeBlock", SphereShapeBlock);
141
162
  //# sourceMappingURL=sphereShapeBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sphereShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/sphereShapeBlock.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,yCAA+B;AACjD,OAAO,EAAE,WAAW,EAAE,mDAAyC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SA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E,KAAK,EAAE,KAAK,CAAC,kBAAmB,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnH,CAAC;YAED,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport { _CreateLocalPositionData } from \"./emitters.functions\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a sphere shape.\r\n * DirectionRandomizer will be used for the particles initial direction unless both direction1 and direction2 are connected.\r\n */\r\nexport class SphereShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Create a new SphereShapeBlock\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(\"radiusRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1, 0, 1);\r\n this.registerInput(\"directionRandomizer\", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0, 1);\r\n this.registerInput(\"direction1\", NodeParticleBlockConnectionPointTypes.Vector3, true);\r\n this.registerInput(\"direction2\", NodeParticleBlockConnectionPointTypes.Vector3, true);\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 \"SphereShapeBlock\";\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 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 radiusRange input component\r\n */\r\n public get radiusRange(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\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[3];\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[4];\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[5];\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 // We always use directionRandomizer unless both directions are connected\r\n if (this.direction1.isConnected === false || this.direction2.isConnected === false) {\r\n const directionRandomizer = this.directionRandomizer.getConnectedValue(state) as number;\r\n\r\n const direction = particle.position.subtract(state.emitterPosition!).normalize();\r\n const randX = RandomRange(0, directionRandomizer);\r\n const randY = RandomRange(0, directionRandomizer);\r\n const randZ = RandomRange(0, directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFromFloats(direction.x, direction.y, direction.z);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, state.emitterWorldMatrix!, particle.direction);\r\n }\r\n } else {\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 (system.isLocal) {\r\n particle.direction.copyFromFloats(randX, randY, randZ);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.direction);\r\n }\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 radius = this.radius.getConnectedValue(state) as number;\r\n const radiusRange = this.radiusRange.getConnectedValue(state) as number;\r\n\r\n const randRadius = radius - RandomRange(0, radius * radiusRange);\r\n const v = RandomRange(0, 1.0);\r\n const phi = RandomRange(0, 2 * Math.PI);\r\n const theta = Math.acos(2 * v - 1);\r\n const randX = randRadius * Math.cos(phi) * Math.sin(theta);\r\n const randY = randRadius * Math.cos(theta);\r\n const randZ = randRadius * Math.sin(phi) * Math.sin(theta);\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n } else {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n }\r\n\r\n _CreateLocalPositionData(particle);\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SphereShapeBlock\", SphereShapeBlock);\r\n"]}
1
+ {"version":3,"file":"sphereShapeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node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AAE,EAAE,CAAC;uDAC1G;AAwKjC,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { IShapeBlock } from \"./IShapeBlock\";\r\n\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { RandomRange } from \"core/Maths/math.scalar.functions\";\r\nimport { _CreateLocalPositionData } from \"./emitters.functions\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to provide a flow of particles emitted from a sphere shape.\r\n * DirectionRandomizer will be used for the particles initial direction unless both direction1 and direction2 are connected.\r\n */\r\nexport class SphereShapeBlock extends NodeParticleBlock implements IShapeBlock {\r\n /**\r\n * Gets or sets a boolean indicating whether to emit in a hemispheric mode (top half of the sphere) or not\r\n */\r\n @editableInPropertyPage(\"Is hemispheric\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isHemispheric = false;\r\n\r\n /**\r\n * Create a new SphereShapeBlock\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(\"radiusRange\", NodeParticleBlockConnectionPointTypes.Float, true, 1, 0, 1);\r\n this.registerInput(\"directionRandomizer\", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0, 1);\r\n this.registerInput(\"direction1\", NodeParticleBlockConnectionPointTypes.Vector3, true);\r\n this.registerInput(\"direction2\", NodeParticleBlockConnectionPointTypes.Vector3, true);\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 \"SphereShapeBlock\";\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 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 radiusRange input component\r\n */\r\n public get radiusRange(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\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[3];\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[4];\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[5];\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 // We always use directionRandomizer unless both directions are connected\r\n if (this.direction1.isConnected === false || this.direction2.isConnected === false) {\r\n const directionRandomizer = this.directionRandomizer.getConnectedValue(state) as number;\r\n\r\n const direction = particle.position.subtract(state.emitterPosition!).normalize();\r\n const randX = RandomRange(0, directionRandomizer);\r\n const randY = RandomRange(0, directionRandomizer);\r\n const randZ = RandomRange(0, directionRandomizer);\r\n direction.x += randX;\r\n direction.y += randY;\r\n direction.z += randZ;\r\n direction.normalize();\r\n\r\n if (system.isLocal) {\r\n particle.direction.copyFromFloats(direction.x, direction.y, direction.z);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(direction.x, direction.y, direction.z, state.emitterWorldMatrix!, particle.direction);\r\n }\r\n } else {\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 (system.isLocal) {\r\n particle.direction.copyFromFloats(randX, randY, randZ);\r\n } else {\r\n Vector3.TransformNormalFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.direction);\r\n }\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 radius = this.radius.getConnectedValue(state) as number;\r\n const radiusRange = this.radiusRange.getConnectedValue(state) as number;\r\n\r\n const randRadius = radius - RandomRange(0, radius * radiusRange);\r\n const v = RandomRange(0, 1.0);\r\n const phi = RandomRange(0, 2 * Math.PI);\r\n const theta = Math.acos(2 * v - 1);\r\n const randX = randRadius * Math.cos(phi) * Math.sin(theta);\r\n let randY = randRadius * Math.cos(theta);\r\n const randZ = randRadius * Math.sin(phi) * Math.sin(theta);\r\n\r\n if (this.isHemispheric) {\r\n randY = Math.abs(randY);\r\n }\r\n\r\n if (system.isLocal) {\r\n particle.position.copyFromFloats(randX, randY, randZ);\r\n } else {\r\n Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, state.emitterWorldMatrix!, particle.position);\r\n }\r\n\r\n _CreateLocalPositionData(particle);\r\n };\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.isHemispheric = this.isHemispheric;\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.isHemispheric = serializationObject.isHemispheric;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SphereShapeBlock\", SphereShapeBlock);\r\n"]}
@@ -23,10 +23,6 @@ export declare class SystemBlock extends NodeParticleBlock {
23
23
  * Gets or sets the manual emit count
24
24
  */
25
25
  manualEmitCount: number;
26
- /**
27
- * Gets or sets the target stop duration for the particle system
28
- */
29
- targetStopDuration: number;
30
26
  /**
31
27
  * Gets or sets the target stop duration for the particle system
32
28
  */
@@ -95,6 +91,10 @@ export declare class SystemBlock extends NodeParticleBlock {
95
91
  * Gets the textureMask input component
96
92
  */
97
93
  get textureMask(): NodeParticleConnectionPoint;
94
+ /**
95
+ * Gets the targetStopDuration input component
96
+ */
97
+ get targetStopDuration(): NodeParticleConnectionPoint;
98
98
  /**
99
99
  * Gets the system output component
100
100
  */
@@ -33,10 +33,6 @@ export class SystemBlock extends NodeParticleBlock {
33
33
  * Gets or sets the manual emit count
34
34
  */
35
35
  this.manualEmitCount = -1;
36
- /**
37
- * Gets or sets the target stop duration for the particle system
38
- */
39
- this.targetStopDuration = 0;
40
36
  /**
41
37
  * Gets or sets the target stop duration for the particle system
42
38
  */
@@ -78,6 +74,7 @@ export class SystemBlock extends NodeParticleBlock {
78
74
  this.registerInput("onEnd", NodeParticleBlockConnectionPointTypes.System, true);
79
75
  this.registerInput("translationPivot", NodeParticleBlockConnectionPointTypes.Vector2, true);
80
76
  this.registerInput("textureMask", NodeParticleBlockConnectionPointTypes.Color4, true);
77
+ this.registerInput("targetStopDuration", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0);
81
78
  this.registerOutput("system", NodeParticleBlockConnectionPointTypes.System);
82
79
  }
83
80
  /**
@@ -123,6 +120,12 @@ export class SystemBlock extends NodeParticleBlock {
123
120
  get textureMask() {
124
121
  return this._inputs[5];
125
122
  }
123
+ /**
124
+ * Gets the targetStopDuration input component
125
+ */
126
+ get targetStopDuration() {
127
+ return this._inputs[6];
128
+ }
126
129
  /**
127
130
  * Gets the system output component
128
131
  */
@@ -147,7 +150,7 @@ export class SystemBlock extends NodeParticleBlock {
147
150
  particleSystem.preWarmStepOffset = this.preWarmStepOffset;
148
151
  particleSystem.blendMode = this.blendMode;
149
152
  particleSystem.name = this.name;
150
- particleSystem._targetStopDuration = this.targetStopDuration;
153
+ particleSystem._targetStopDuration = this.targetStopDuration.getConnectedValue(state) ?? 0;
151
154
  particleSystem.startDelay = this.startDelay;
152
155
  particleSystem.isBillboardBased = this.isBillboardBased;
153
156
  particleSystem.translationPivot = this.translationPivot.getConnectedValue(state) || Vector2.Zero();
@@ -202,7 +205,6 @@ export class SystemBlock extends NodeParticleBlock {
202
205
  serializationObject.isLocal = this.isLocal;
203
206
  serializationObject.disposeOnStop = this.disposeOnStop;
204
207
  serializationObject.doNoStart = this.doNoStart;
205
- serializationObject.targetStopDuration = this.targetStopDuration;
206
208
  serializationObject.startDelay = this.startDelay;
207
209
  return serializationObject;
208
210
  }
@@ -221,9 +223,6 @@ export class SystemBlock extends NodeParticleBlock {
221
223
  if (serializationObject.blendMode !== undefined) {
222
224
  this.blendMode = serializationObject.blendMode;
223
225
  }
224
- if (serializationObject.targetStopDuration !== undefined) {
225
- this.targetStopDuration = serializationObject.targetStopDuration;
226
- }
227
226
  if (serializationObject.startDelay !== undefined) {
228
227
  this.startDelay = serializationObject.startDelay;
229
228
  }
@@ -252,9 +251,6 @@ __decorate([
252
251
  __decorate([
253
252
  editableInPropertyPage("Manual emit count", 2 /* PropertyTypeForEdition.Int */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: -1 })
254
253
  ], SystemBlock.prototype, "manualEmitCount", void 0);
255
- __decorate([
256
- editableInPropertyPage("Target duration", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
257
- ], SystemBlock.prototype, "targetStopDuration", void 0);
258
254
  __decorate([
259
255
  editableInPropertyPage("Delay start(ms)", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
260
256
  ], SystemBlock.prototype, "startDelay", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,iBAAiB,EAAE,gCAA8C;AAC1E,OAAO,EAAE,kBAAkB,EAAE,mCAAyD;AACtF,OAAO,EAAE,qCAAqC,EAAE,0DAAwE;AAExH;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IA8F9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAhGhB;;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,oBAAe,GAAG,CAAC,CAAC,CAAC;QAE5B;;WAEG;QAEI,uBAAkB,GAAG,CAAC,CAAC;QAE9B;;WAEG;QAEI,eAAU,GAAG,CAAC,CAAC;QAEtB;;WAEG;QAEI,gBAAW,GAAG,MAAM,CAAC;QAE5B;;WAEG;QAEI,kBAAa,GAAG,CAAC,CAAC;QAEzB;;WAEG;QAEI,sBAAiB,GAAG,CAAC,CAAC;QAE7B;;WAEG;QAEI,qBAAgB,GAAG,IAAI,CAAC;QAE/B;;W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,EAAE,EAAE,CAAC;4CAC1G;AAMhB;IADN,sBAAsB,CAAC,iBAAiB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC3G;AAMtB;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;AAuM7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { _TriggerSubEmitter } from \"core/Particles/Node/Blocks/Triggers/triggerTools\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\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 manual emit count\r\n */\r\n @editableInPropertyPage(\"Manual emit count\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: -1 })\r\n public manualEmitCount = -1;\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 the number of pre-warm cycles before rendering the particle system\r\n */\r\n @editableInPropertyPage(\"Pre-warm cycles\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmCycles = 0;\r\n\r\n /**\r\n * Gets or sets the time step multiplier used for pre-warm\r\n */\r\n @editableInPropertyPage(\"Pre-warm step multiplier\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmStepOffset = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system is billboard based\r\n */\r\n @editableInPropertyPage(\"Is billboard based\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isBillboardBased = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system coordinate space is local or global\r\n */\r\n @editableInPropertyPage(\"Is local\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isLocal = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should be disposed when stopped\r\n */\r\n @editableInPropertyPage(\"Dispose on stop\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public disposeOnStop = false;\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.registerInput(\"translationPivot\", NodeParticleBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"textureMask\", NodeParticleBlockConnectionPointTypes.Color4, 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 translationPivot input component\r\n */\r\n public get translationPivot(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the textureMask input component\r\n */\r\n public get textureMask(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\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.manualEmitCount = this.manualEmitCount;\r\n particleSystem.updateSpeed = this.updateSpeed;\r\n particleSystem.preWarmCycles = this.preWarmCycles;\r\n particleSystem.preWarmStepOffset = this.preWarmStepOffset;\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 particleSystem.isBillboardBased = this.isBillboardBased;\r\n particleSystem.translationPivot = (this.translationPivot.getConnectedValue(state) as Vector2) || Vector2.Zero();\r\n particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n particleSystem.isLocal = this.isLocal;\r\n particleSystem.disposeOnStop = this.disposeOnStop;\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.manualEmitCount = this.manualEmitCount;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.updateSpeed = this.updateSpeed;\r\n serializationObject.preWarmCycles = this.preWarmCycles;\r\n serializationObject.preWarmStepOffset = this.preWarmStepOffset;\r\n serializationObject.isBillboardBased = this.isBillboardBased;\r\n serializationObject.isLocal = this.isLocal;\r\n serializationObject.disposeOnStop = this.disposeOnStop;\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.manualEmitCount = serializationObject.manualEmitCount ?? -1;\r\n this.updateSpeed = serializationObject.updateSpeed ?? 0.0167;\r\n this.preWarmCycles = serializationObject.preWarmCycles ?? 0;\r\n this.preWarmStepOffset = serializationObject.preWarmStepOffset ?? 0;\r\n this.isBillboardBased = serializationObject.isBillboardBased ?? true;\r\n this.isLocal = serializationObject.isLocal ?? false;\r\n this.disposeOnStop = serializationObject.disposeOnStop ?? false;\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":";AAIA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,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N,sBAAsB,CAAC,iBAAiB,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;kDACrH;AAMlB;IADN,sBAAsB,CAAC,0BAA0B,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;sDAC1H;AAMtB;IADN,sBAAsB,CAAC,oBAAoB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;qDAC5G;AAMxB;IADN,sBAAsB,CAAC,UAAU,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4CAC1G;AAMhB;IADN,sBAAsB,CAAC,iBAAiB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC3G;AAMtB;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;AA0M7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { _TriggerSubEmitter } from \"core/Particles/Node/Blocks/Triggers/triggerTools\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\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 manual emit count\r\n */\r\n @editableInPropertyPage(\"Manual emit count\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: -1 })\r\n public manualEmitCount = -1;\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 the number of pre-warm cycles before rendering the particle system\r\n */\r\n @editableInPropertyPage(\"Pre-warm cycles\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmCycles = 0;\r\n\r\n /**\r\n * Gets or sets the time step multiplier used for pre-warm\r\n */\r\n @editableInPropertyPage(\"Pre-warm step multiplier\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmStepOffset = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system is billboard based\r\n */\r\n @editableInPropertyPage(\"Is billboard based\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isBillboardBased = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system coordinate space is local or global\r\n */\r\n @editableInPropertyPage(\"Is local\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isLocal = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should be disposed when stopped\r\n */\r\n @editableInPropertyPage(\"Dispose on stop\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public disposeOnStop = false;\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.registerInput(\"translationPivot\", NodeParticleBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"textureMask\", NodeParticleBlockConnectionPointTypes.Color4, true);\r\n this.registerInput(\"targetStopDuration\", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0);\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 translationPivot input component\r\n */\r\n public get translationPivot(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the textureMask input component\r\n */\r\n public get textureMask(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the targetStopDuration input component\r\n */\r\n public get targetStopDuration(): NodeParticleConnectionPoint {\r\n return this._inputs[6];\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.manualEmitCount = this.manualEmitCount;\r\n particleSystem.updateSpeed = this.updateSpeed;\r\n particleSystem.preWarmCycles = this.preWarmCycles;\r\n particleSystem.preWarmStepOffset = this.preWarmStepOffset;\r\n particleSystem.blendMode = this.blendMode;\r\n particleSystem.name = this.name;\r\n particleSystem._targetStopDuration = (this.targetStopDuration.getConnectedValue(state) as number) ?? 0;\r\n particleSystem.startDelay = this.startDelay;\r\n particleSystem.isBillboardBased = this.isBillboardBased;\r\n particleSystem.translationPivot = (this.translationPivot.getConnectedValue(state) as Vector2) || Vector2.Zero();\r\n particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n particleSystem.isLocal = this.isLocal;\r\n particleSystem.disposeOnStop = this.disposeOnStop;\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.manualEmitCount = this.manualEmitCount;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.updateSpeed = this.updateSpeed;\r\n serializationObject.preWarmCycles = this.preWarmCycles;\r\n serializationObject.preWarmStepOffset = this.preWarmStepOffset;\r\n serializationObject.isBillboardBased = this.isBillboardBased;\r\n serializationObject.isLocal = this.isLocal;\r\n serializationObject.disposeOnStop = this.disposeOnStop;\r\n serializationObject.doNoStart = this.doNoStart;\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.manualEmitCount = serializationObject.manualEmitCount ?? -1;\r\n this.updateSpeed = serializationObject.updateSpeed ?? 0.0167;\r\n this.preWarmCycles = serializationObject.preWarmCycles ?? 0;\r\n this.preWarmStepOffset = serializationObject.preWarmStepOffset ?? 0;\r\n this.isBillboardBased = serializationObject.isBillboardBased ?? true;\r\n this.isLocal = serializationObject.isLocal ?? false;\r\n this.disposeOnStop = serializationObject.disposeOnStop ?? false;\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.startDelay !== undefined) {\r\n this.startDelay = serializationObject.startDelay;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SystemBlock\", SystemBlock);\r\n"]}