@babylonjs/core 8.45.3 → 8.45.4

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 (53) hide show
  1. package/Cameras/touchCamera.js +1 -1
  2. package/Cameras/touchCamera.js.map +1 -1
  3. package/Engines/Native/nativeHelpers.js +7 -0
  4. package/Engines/Native/nativeHelpers.js.map +1 -1
  5. package/Engines/Native/nativeInterfaces.d.ts +2 -0
  6. package/Engines/Native/nativeInterfaces.js.map +1 -1
  7. package/Engines/abstractEngine.js +2 -2
  8. package/Engines/abstractEngine.js.map +1 -1
  9. package/FrameGraph/Node/nodeRenderGraph.d.ts +0 -5
  10. package/FrameGraph/Node/nodeRenderGraph.js +0 -7
  11. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  12. package/FrameGraph/frameGraph.d.ts +0 -6
  13. package/FrameGraph/frameGraph.js +0 -23
  14. package/FrameGraph/frameGraph.js.map +1 -1
  15. package/FrameGraph/frameGraphObjectList.d.ts +0 -1
  16. package/FrameGraph/frameGraphObjectList.js +0 -1
  17. package/FrameGraph/frameGraphObjectList.js.map +1 -1
  18. package/FrameGraph/frameGraphRenderContext.d.ts +0 -1
  19. package/FrameGraph/frameGraphRenderContext.js +0 -1
  20. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  21. package/FrameGraph/frameGraphRenderTarget.d.ts +0 -1
  22. package/FrameGraph/frameGraphRenderTarget.js +0 -1
  23. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  24. package/FrameGraph/frameGraphTask.d.ts +0 -1
  25. package/FrameGraph/frameGraphTask.js +0 -1
  26. package/FrameGraph/frameGraphTask.js.map +1 -1
  27. package/FrameGraph/frameGraphTextureManager.d.ts +0 -1
  28. package/FrameGraph/frameGraphTextureManager.js +0 -1
  29. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  30. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +6 -0
  31. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +100 -41
  32. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  33. package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +4 -14
  34. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +9 -27
  35. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
  36. package/Particles/Node/Blocks/particleVectorMathBlock.d.ts +3 -7
  37. package/Particles/Node/Blocks/particleVectorMathBlock.js +15 -32
  38. package/Particles/Node/Blocks/particleVectorMathBlock.js.map +1 -1
  39. package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
  40. package/Particles/Node/Blocks/systemBlock.js +9 -1
  41. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  42. package/Particles/Node/nodeParticleSystemSet.helper.js +62 -4
  43. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  44. package/Particles/baseParticleSystem.d.ts +7 -0
  45. package/Particles/baseParticleSystem.js +7 -0
  46. package/Particles/baseParticleSystem.js.map +1 -1
  47. package/Particles/particleSystem.d.ts +12 -0
  48. package/Particles/particleSystem.js +12 -0
  49. package/Particles/particleSystem.js.map +1 -1
  50. package/Particles/thinParticleSystem.d.ts +10 -0
  51. package/Particles/thinParticleSystem.js +10 -1
  52. package/Particles/thinParticleSystem.js.map +1 -1
  53. package/package.json +1 -1
@@ -5,10 +5,6 @@ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
5
5
  * Block used to update particle position based on a flow map
6
6
  */
7
7
  export declare class UpdateFlowMapBlock extends NodeParticleBlock {
8
- /**
9
- * Gets or sets the strenght of the flow map effect
10
- */
11
- strength: number;
12
8
  /**
13
9
  * Create a new UpdateFlowMapBlock
14
10
  * @param name defines the block name
@@ -22,6 +18,10 @@ export declare class UpdateFlowMapBlock extends NodeParticleBlock {
22
18
  * Gets the flowMap input component
23
19
  */
24
20
  get flowMap(): NodeParticleConnectionPoint;
21
+ /**
22
+ * Gets the strength input component
23
+ */
24
+ get strength(): NodeParticleConnectionPoint;
25
25
  /**
26
26
  * Gets the output component
27
27
  */
@@ -36,14 +36,4 @@ export declare class UpdateFlowMapBlock extends NodeParticleBlock {
36
36
  * @param state defines the current build state
37
37
  */
38
38
  _build(state: NodeParticleBuildState): void;
39
- /**
40
- * Serializes the block into a json object
41
- * @returns The serialized object
42
- */
43
- serialize(): any;
44
- /**
45
- * Deserializes the block from a json object
46
- * @param serializationObject The object to deserialize from
47
- */
48
- _deserialize(serializationObject: any): void;
49
39
  }
@@ -1,10 +1,8 @@
1
- import { __decorate } from "../../../../tslib.es6.js";
2
1
  import { RegisterClass } from "../../../../Misc/typeStore.js";
3
2
  import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
4
3
  import { NodeParticleBlock } from "../../nodeParticleBlock.js";
5
4
  import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
6
5
  import { FlowMap } from "../../../flowMap.js";
7
- import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
8
6
  /**
9
7
  * Block used to update particle position based on a flow map
10
8
  */
@@ -15,12 +13,9 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
15
13
  */
16
14
  constructor(name) {
17
15
  super(name);
18
- /**
19
- * Gets or sets the strenght of the flow map effect
20
- */
21
- this.strength = 1;
22
16
  this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
23
17
  this.registerInput("flowMap", NodeParticleBlockConnectionPointTypes.Texture);
18
+ this.registerInput("strength", NodeParticleBlockConnectionPointTypes.Float, true, 1);
24
19
  this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
25
20
  }
26
21
  /**
@@ -35,6 +30,12 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
35
30
  get flowMap() {
36
31
  return this._inputs[1];
37
32
  }
33
+ /**
34
+ * Gets the strength input component
35
+ */
36
+ get strength() {
37
+ return this._inputs[2];
38
+ }
38
39
  /**
39
40
  * Gets the output component
40
41
  */
@@ -70,7 +71,8 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
70
71
  // If the flow map is not ready, we skip processing
71
72
  return;
72
73
  }
73
- flowMap._processParticle(particle, this.strength * system._tempScaledUpdateSpeed, matrix);
74
+ const strength = this.strength.getConnectedValue(state);
75
+ flowMap._processParticle(particle, strength * system._tempScaledUpdateSpeed, matrix);
74
76
  };
75
77
  const flowMapProcessing = {
76
78
  process: processFlowMap,
@@ -85,26 +87,6 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
85
87
  }
86
88
  this.output._storedValue = system;
87
89
  }
88
- /**
89
- * Serializes the block into a json object
90
- * @returns The serialized object
91
- */
92
- serialize() {
93
- const serializationObject = super.serialize();
94
- serializationObject.strength = this.strength;
95
- return serializationObject;
96
- }
97
- /**
98
- * Deserializes the block from a json object
99
- * @param serializationObject The object to deserialize from
100
- */
101
- _deserialize(serializationObject) {
102
- super._deserialize(serializationObject);
103
- this.strength = serializationObject.strength;
104
- }
105
90
  }
106
- __decorate([
107
- editableInPropertyPage("strength", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
108
- ], UpdateFlowMapBlock.prototype, "strength", void 0);
109
91
  RegisterClass("BABYLON.UpdateFlowMapBlock", UpdateFlowMapBlock);
110
92
  //# sourceMappingURL=updateFlowMapBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateFlowMapBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateFlowMapBlock.ts"],"names":[],"mappings":";AAOA,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,gBAAgB,EAAE,yCAA4C;AACvE,OAAO,EAAE,OAAO,EAAE,4BAA+B;AACjD,OAAO,EAAE,sBAAsB,EAA0B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AAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;oDACnH;AA6GxB,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { INodeParticleTextureData, ParticleTextureSourceBlock } from \"../particleSourceTextureBlock\";\r\n\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\nimport { FlowMap } from \"core/Particles/flowMap\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to update particle position based on a flow map\r\n */\r\nexport class UpdateFlowMapBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the strenght of the flow map effect\r\n */\r\n @editableInPropertyPage(\"strength\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public strength = 1;\r\n /**\r\n * Create a new UpdateFlowMapBlock\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(\"flowMap\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the flowMap input component\r\n */\r\n public get flowMap(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateFlowMapBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n const scene = state.scene;\r\n\r\n const flowMapTexture = this.flowMap.connectedPoint?.ownerBlock as ParticleTextureSourceBlock;\r\n let flowMap: FlowMap;\r\n\r\n // eslint-disable-next-line github/no-then\r\n void flowMapTexture.extractTextureContentAsync().then((textureContent: Nullable<INodeParticleTextureData>) => {\r\n if (!textureContent) {\r\n return;\r\n }\r\n flowMap = new FlowMap(textureContent.width, textureContent.height, textureContent.data as Uint8ClampedArray);\r\n });\r\n\r\n const processFlowMap = (particle: Particle) => {\r\n const matrix = scene.getTransformMatrix();\r\n if (!flowMap) {\r\n // If the flow map is not ready, we skip processing\r\n return;\r\n }\r\n\r\n flowMap._processParticle(particle, this.strength * system._tempScaledUpdateSpeed, matrix);\r\n };\r\n\r\n const flowMapProcessing = {\r\n process: processFlowMap,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(flowMapProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = flowMapProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n /**\r\n * Serializes the block into a json object\r\n * @returns The serialized object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.strength = this.strength;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes the block from a json object\r\n * @param serializationObject The object to deserialize from\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.strength = serializationObject.strength;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateFlowMapBlock\", UpdateFlowMapBlock);\r\n"]}
1
+ {"version":3,"file":"updateFlowMapBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateFlowMapBlock.ts"],"names":[],"mappings":"AAOA,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,gBAAgB,EAAE,yCAA4C;AACvE,OAAO,EAAE,OAAO,EAAE,4BAA+B;AAEjD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IACrD;;;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,SAAS,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACrF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,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AAE,IAAI;SACjB,CAAC;QAEF,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { INodeParticleTextureData, ParticleTextureSourceBlock } from \"../particleSourceTextureBlock\";\r\n\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\nimport { FlowMap } from \"core/Particles/flowMap\";\r\n\r\n/**\r\n * Block used to update particle position based on a flow map\r\n */\r\nexport class UpdateFlowMapBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateFlowMapBlock\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(\"flowMap\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"strength\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the flowMap input component\r\n */\r\n public get flowMap(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the strength input component\r\n */\r\n public get strength(): 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 * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateFlowMapBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n const scene = state.scene;\r\n\r\n const flowMapTexture = this.flowMap.connectedPoint?.ownerBlock as ParticleTextureSourceBlock;\r\n let flowMap: FlowMap;\r\n\r\n // eslint-disable-next-line github/no-then\r\n void flowMapTexture.extractTextureContentAsync().then((textureContent: Nullable<INodeParticleTextureData>) => {\r\n if (!textureContent) {\r\n return;\r\n }\r\n flowMap = new FlowMap(textureContent.width, textureContent.height, textureContent.data as Uint8ClampedArray);\r\n });\r\n\r\n const processFlowMap = (particle: Particle) => {\r\n const matrix = scene.getTransformMatrix();\r\n if (!flowMap) {\r\n // If the flow map is not ready, we skip processing\r\n return;\r\n }\r\n const strength = this.strength.getConnectedValue(state) as number;\r\n flowMap._processParticle(particle, strength * system._tempScaledUpdateSpeed, matrix);\r\n };\r\n\r\n const flowMapProcessing = {\r\n process: processFlowMap,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(flowMapProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = flowMapProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateFlowMapBlock\", UpdateFlowMapBlock);\r\n"]}
@@ -6,7 +6,9 @@ import { NodeParticleBlock } from "../nodeParticleBlock.js";
6
6
  */
7
7
  export declare enum ParticleVectorMathBlockOperations {
8
8
  /** Dot product */
9
- Dot = 0
9
+ Dot = 0,
10
+ /** Distance between two vectors */
11
+ Distance = 1
10
12
  }
11
13
  /**
12
14
  * Block used to apply math operations that only apply to vectors
@@ -16,7 +18,6 @@ export declare class ParticleVectorMathBlock extends NodeParticleBlock {
16
18
  * Gets or sets the operation applied by the block
17
19
  */
18
20
  operation: ParticleVectorMathBlockOperations;
19
- private readonly _connectionObservers;
20
21
  /**
21
22
  * Create a new ParticleVectorMathBlock
22
23
  * @param name defines the block name
@@ -40,11 +41,6 @@ export declare class ParticleVectorMathBlock extends NodeParticleBlock {
40
41
  */
41
42
  get output(): NodeParticleConnectionPoint;
42
43
  _build(state: NodeParticleBuildState): void;
43
- private _updateInputOutputTypes;
44
- /**
45
- * Release resources
46
- */
47
- dispose(): void;
48
44
  /**
49
45
  * Serializes this block in a JSON representation
50
46
  * @returns the serialized block object
@@ -11,6 +11,8 @@ export var ParticleVectorMathBlockOperations;
11
11
  (function (ParticleVectorMathBlockOperations) {
12
12
  /** Dot product */
13
13
  ParticleVectorMathBlockOperations[ParticleVectorMathBlockOperations["Dot"] = 0] = "Dot";
14
+ /** Distance between two vectors */
15
+ ParticleVectorMathBlockOperations[ParticleVectorMathBlockOperations["Distance"] = 1] = "Distance";
14
16
  })(ParticleVectorMathBlockOperations || (ParticleVectorMathBlockOperations = {}));
15
17
  /**
16
18
  * Block used to apply math operations that only apply to vectors
@@ -26,19 +28,9 @@ export class ParticleVectorMathBlock extends NodeParticleBlock {
26
28
  * Gets or sets the operation applied by the block
27
29
  */
28
30
  this.operation = ParticleVectorMathBlockOperations.Dot;
29
- this.registerInput("left", NodeParticleBlockConnectionPointTypes.AutoDetect);
30
- this.registerInput("right", NodeParticleBlockConnectionPointTypes.AutoDetect);
31
- this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
32
- this.output._typeConnectionSource = this.left;
33
- this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);
34
- this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);
35
- this._linkConnectionTypes(0, 1);
36
- this._connectionObservers = [
37
- this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),
38
- this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
39
- this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),
40
- this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
41
- ];
31
+ this.registerInput("left", NodeParticleBlockConnectionPointTypes.Vector3);
32
+ this.registerInput("right", NodeParticleBlockConnectionPointTypes.Vector3);
33
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Float);
42
34
  }
43
35
  /**
44
36
  * Gets the current class name
@@ -81,29 +73,17 @@ export class ParticleVectorMathBlock extends NodeParticleBlock {
81
73
  };
82
74
  break;
83
75
  }
76
+ case ParticleVectorMathBlockOperations.Distance: {
77
+ func = (state) => {
78
+ return Vector3.Distance(left.getConnectedValue(state), right.getConnectedValue(state));
79
+ };
80
+ break;
81
+ }
84
82
  }
85
83
  this.output._storedFunction = (state) => {
86
84
  return func(state);
87
85
  };
88
86
  }
89
- _updateInputOutputTypes() {
90
- // First update the output type with the initial assumption that we'll base it on the left input.
91
- this.output._typeConnectionSource = this.left;
92
- // If left is not connected, then instead use the type of right if it's connected.
93
- if (!this.left.isConnected && this.right.isConnected) {
94
- this.output._typeConnectionSource = this.right;
95
- }
96
- }
97
- /**
98
- * Release resources
99
- */
100
- dispose() {
101
- super.dispose();
102
- for (const observer of this._connectionObservers) {
103
- observer.remove();
104
- }
105
- this._connectionObservers.length = 0;
106
- }
107
87
  /**
108
88
  * Serializes this block in a JSON representation
109
89
  * @returns the serialized block object
@@ -126,7 +106,10 @@ __decorate([
126
106
  editableInPropertyPage("Operation", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
127
107
  notifiers: { rebuild: true },
128
108
  embedded: true,
129
- options: [{ label: "Dot", value: ParticleVectorMathBlockOperations.Dot }],
109
+ options: [
110
+ { label: "Dot", value: ParticleVectorMathBlockOperations.Dot },
111
+ { label: "Distance", value: ParticleVectorMathBlockOperations.Distance },
112
+ ],
130
113
  })
131
114
  ], ParticleVectorMathBlock.prototype, "operation", void 0);
132
115
  RegisterClass("BABYLON.ParticleVectorMathBlock", ParticleVectorMathBlock);
@@ -1 +1 @@
1
- {"version":3,"file":"particleVectorMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleVectorMathBlock.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD;;GAEG;AACH,MAAM,CAAN,IAAY,iCAGX;AAHD,WAAY,iCAAiC;IACzC,kBAAkB;IAClB,uFAAG,CAAA;AACP,CAAC,EAHW,iCAAiC,KAAjC,iCAAiC,QAG5C;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAY1D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAhBhB;;WAEG;QAMI,cAAS,GAAG,iCAAiC,CAAC,GAAG,CAAC;QAUrD,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAE9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAA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QACtB,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAE/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACa,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IACnD,CAAC;CACJ;AA9HU;IALN,sBAAsB,CAAC,WAAW,uCAA+B,UAAU,EAAE;QAC1E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iCAAiC,CAAC,GAAG,EAAE,CAAC;KAC5E,CAAC;0DACuD;AAgI7D,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import type { Observer } from \"core/Misc/observable\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { Vector3 } from \"../../../Maths/math.vector\";\r\n\r\n/**\r\n * Operations supported by the Vector Math block\r\n */\r\nexport enum ParticleVectorMathBlockOperations {\r\n /** Dot product */\r\n Dot,\r\n}\r\n\r\n/**\r\n * Block used to apply math operations that only apply to vectors\r\n */\r\nexport class ParticleVectorMathBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [{ label: \"Dot\", value: ParticleVectorMathBlockOperations.Dot }],\r\n })\r\n public operation = ParticleVectorMathBlockOperations.Dot;\r\n private readonly _connectionObservers: Observer<NodeParticleConnectionPoint>[];\r\n\r\n /**\r\n * Create a new ParticleVectorMathBlock\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(\"left\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.output._typeConnectionSource = this.left;\r\n\r\n this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);\r\n this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);\r\n\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._connectionObservers = [\r\n this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n ];\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 \"ParticleVectorMathBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n let func: (state: NodeParticleBuildState) => any;\r\n const left = this.left;\r\n const right = this.right;\r\n\r\n if (!left.isConnected || !right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.operation) {\r\n case ParticleVectorMathBlockOperations.Dot: {\r\n func = (state) => {\r\n return Vector3.Dot(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n }\r\n\r\n private _updateInputOutputTypes() {\r\n // First update the output type with the initial assumption that we'll base it on the left input.\r\n this.output._typeConnectionSource = this.left;\r\n\r\n // If left is not connected, then instead use the type of right if it's connected.\r\n if (!this.left.isConnected && this.right.isConnected) {\r\n this.output._typeConnectionSource = this.right;\r\n }\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n for (const observer of this._connectionObservers) {\r\n observer.remove();\r\n }\r\n this._connectionObservers.length = 0;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes the block from a JSON object\r\n * @param serializationObject the JSON object to deserialize from\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleVectorMathBlock\", ParticleVectorMathBlock);\r\n"]}
1
+ {"version":3,"file":"particleVectorMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleVectorMathBlock.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,C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AAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IACnD,CAAC;CACJ;AA/FU;IARN,sBAAsB,CAAC,WAAW,uCAA+B,UAAU,EAAE;QAC1E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iCAAiC,CAAC,GAAG,EAAE;YAC9D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,iCAAiC,CAAC,QAAQ,EAAE;SAC3E;KACJ,CAAC;0DACuD;AAiG7D,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { Vector3 } from \"../../../Maths/math.vector\";\r\n\r\n/**\r\n * Operations supported by the Vector Math block\r\n */\r\nexport enum ParticleVectorMathBlockOperations {\r\n /** Dot product */\r\n Dot,\r\n /** Distance between two vectors */\r\n Distance,\r\n}\r\n\r\n/**\r\n * Block used to apply math operations that only apply to vectors\r\n */\r\nexport class ParticleVectorMathBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Dot\", value: ParticleVectorMathBlockOperations.Dot },\r\n { label: \"Distance\", value: ParticleVectorMathBlockOperations.Distance },\r\n ],\r\n })\r\n public operation = ParticleVectorMathBlockOperations.Dot;\r\n\r\n /**\r\n * Create a new ParticleVectorMathBlock\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(\"left\", NodeParticleBlockConnectionPointTypes.Vector3);\r\n this.registerInput(\"right\", NodeParticleBlockConnectionPointTypes.Vector3);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Float);\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 \"ParticleVectorMathBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n let func: (state: NodeParticleBuildState) => any;\r\n const left = this.left;\r\n const right = this.right;\r\n\r\n if (!left.isConnected || !right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.operation) {\r\n case ParticleVectorMathBlockOperations.Dot: {\r\n func = (state) => {\r\n return Vector3.Dot(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n case ParticleVectorMathBlockOperations.Distance: {\r\n func = (state) => {\r\n return Vector3.Distance(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes the block from a JSON object\r\n * @param serializationObject the JSON object to deserialize from\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleVectorMathBlock\", ParticleVectorMathBlock);\r\n"]}
@@ -103,6 +103,10 @@ export declare class SystemBlock extends NodeParticleBlock {
103
103
  * Gets the rampGradient input component
104
104
  */
105
105
  get rampGradient(): NodeParticleConnectionPoint;
106
+ /**
107
+ * Gets the emitterPosition input component
108
+ */
109
+ get emitterPosition(): NodeParticleConnectionPoint;
106
110
  /**
107
111
  * Gets the system output component
108
112
  */
@@ -2,7 +2,7 @@ import { __decorate } from "../../../tslib.es6.js";
2
2
 
3
3
  import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
4
4
  import { RegisterClass } from "../../../Misc/typeStore.js";
5
- import { Vector2 } from "../../../Maths/math.vector.js";
5
+ import { Vector2, Vector3 } from "../../../Maths/math.vector.js";
6
6
  import { Color3, Color4 } from "../../../Maths/math.color.js";
7
7
  import { BaseParticleSystem } from "../../baseParticleSystem.js";
8
8
  import { NodeParticleBlock } from "../nodeParticleBlock.js";
@@ -79,6 +79,7 @@ export class SystemBlock extends NodeParticleBlock {
79
79
  this.registerInput("onStart", NodeParticleBlockConnectionPointTypes.System, true);
80
80
  this.registerInput("onEnd", NodeParticleBlockConnectionPointTypes.System, true);
81
81
  this.registerInput("rampGradient", NodeParticleBlockConnectionPointTypes.Color4, true);
82
+ this.registerInput("emitterPosition", NodeParticleBlockConnectionPointTypes.Vector3, true, Vector3.Zero());
82
83
  this.registerOutput("system", NodeParticleBlockConnectionPointTypes.System);
83
84
  }
84
85
  /**
@@ -142,6 +143,12 @@ export class SystemBlock extends NodeParticleBlock {
142
143
  get rampGradient() {
143
144
  return this._inputs[8];
144
145
  }
146
+ /**
147
+ * Gets the emitterPosition input component
148
+ */
149
+ get emitterPosition() {
150
+ return this._inputs[9];
151
+ }
145
152
  /**
146
153
  * Gets the system output component
147
154
  */
@@ -174,6 +181,7 @@ export class SystemBlock extends NodeParticleBlock {
174
181
  particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);
175
182
  particleSystem.isLocal = this.isLocal;
176
183
  particleSystem.disposeOnStop = this.disposeOnStop;
184
+ particleSystem.emitter = this.emitterPosition.getConnectedValue(state) ?? Vector3.Zero();
177
185
  // The emit rate can vary if it is connected to another block like a gradient
178
186
  particleSystem._calculateEmitRate = () => {
179
187
  state.systemContext = particleSystem;
@@ -1 +1 @@
1
- {"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,qCAA8B;AACvD,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,iBAAiB,EAAE,gCAA8C;AAC1E,OAAO,EAAE,kBAAkB,EAAE,mCAAyD;AACtF,OAAO,EAAE,qCAAqC,EAAE,0DAAwE;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAiG9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAnGhB;;WAEG;QAYI,cAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QAEvD;;WAEG;QAEI,aAAQ,GAAG,IAAI,CAAC;QAEvB;;WAEG;QAEI,oBAAe,GAAG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AAE;SACxG;KACJ,CAAC;kDAC2D;AAMtD;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;AAqQ7B,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\nimport type { ParticleGradientValueBlock } from \"./particleGradientValueBlock\";\r\n\r\nimport { Constants } from \"../../../Engines/constants\";\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 { Color3, 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\nimport { ParticleGradientBlock } from \"./particleGradientBlock\";\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: \"Blend Mode OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Blend Mode Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Blend Mode Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Blend Mode Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"Blend Mode 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 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 the billboard mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Billboard mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Billboard Mode All\", value: Constants.PARTICLES_BILLBOARDMODE_ALL },\r\n { label: \"Billboard Mode Y\", value: Constants.PARTICLES_BILLBOARDMODE_Y },\r\n { label: \"Billboard Mode Stretched\", value: Constants.PARTICLES_BILLBOARDMODE_STRETCHED },\r\n { label: \"Billboard Mode Stretched Local\", value: Constants.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL },\r\n ],\r\n })\r\n public billBoardMode = Constants.PARTICLES_BILLBOARDMODE_ALL;\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(\"emitRate\", NodeParticleBlockConnectionPointTypes.Int, true, 10, 0);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\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.registerInput(\"onStart\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"onEnd\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"rampGradient\", 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 emitRate input component\r\n */\r\n public get emitRate(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\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[2];\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[3];\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[4];\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[5];\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[6];\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[7];\r\n }\r\n\r\n /**\r\n * Gets the rampGradient input component\r\n */\r\n public get rampGradient(): NodeParticleConnectionPoint {\r\n return this._inputs[8];\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.getConnectedValue(state) as number;\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.billboardMode = this.billBoardMode;\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 // The emit rate can vary if it is connected to another block like a gradient\r\n particleSystem._calculateEmitRate = () => {\r\n state.systemContext = particleSystem;\r\n return this.emitRate.getConnectedValue(state) as number;\r\n };\r\n\r\n // Get the ramp gradients\r\n particleSystem.useRampGradients = false;\r\n if (this.rampGradient.isConnected) {\r\n if (this.rampGradient.connectedPoint?.ownerBlock instanceof ParticleGradientBlock) {\r\n // We have a possible gradient, loop through its entries\r\n const gradientInputs = this.rampGradient.connectedPoint?.ownerBlock.inputs;\r\n\r\n // Skip the first input which is the gradient selector, and we only care about the gradient values\r\n for (let i = 1; i < gradientInputs.length; i++) {\r\n if (gradientInputs[i].isConnected) {\r\n const rampEntry = gradientInputs[i].connectedPoint?.ownerBlock as ParticleGradientValueBlock;\r\n const color = rampEntry._inputs[0].getConnectedValue(state) as Color4;\r\n particleSystem.addRampGradient(rampEntry.reference, new Color3(color.r, color.g, color.b));\r\n particleSystem.useRampGradients = true;\r\n }\r\n }\r\n } else {\r\n // We have a single value, add it as ramp gradient\r\n const color = this.rampGradient.getConnectedValue(state) as Color4;\r\n particleSystem.addRampGradient(0, new Color3(color.r, color.g, color.b));\r\n particleSystem.useRampGradients = true;\r\n }\r\n }\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 /**\r\n * Serializes the system block\r\n * @returns The serialized object\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.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.billBoardMode = this.billBoardMode;\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 /**\r\n * Deserializes the system block\r\n * @param serializationObject The serialized system\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.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.billBoardMode = serializationObject.billBoardMode ?? Constants.PARTICLES_BILLBOARDMODE_ALL;\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.emitRate !== undefined) {\r\n this.emitRate.value = serializationObject.emitRate;\r\n }\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"]}
1
+ {"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,qCAA8B;AACvD,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,iBAAiB,EAAE,gCAA8C;AAC1E,OAAO,EAAE,kBAAkB,EAAE,mCAAyD;AACtF,OAAO,EAAE,qCAAqC,EAAE,0DAAwE;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAiG9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAnGhB;;WAEG;QAYI,cAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QAEvD;;WAEG;QAEI,aAAQ,GAAG,IAAI,CAAC;QAEvB;;WAEG;QAEI,oBAAe,GAAG,CAAC,CAAC,CAAC;QAE5B;;WAEG;QAEI,eAAU,GAAG,CAAC,CAAC;QAEtB;;WAEG;QAEI,gBAAW,GAAG,MAAM,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E;YAC7E,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,CAAC,yBAAyB,EAAE;YACzE,EAAE,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,SAAS,CAAC,iCAAiC,EAAE;YACzF,EAAE,KAAK,EAAE,gCAAgC,EAAE,KAAK,EAAE,SAAS,CAAC,uCAAuC,EAAE;SACxG;KACJ,CAAC;kDAC2D;AAMtD;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;AA8Q7B,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\nimport type { ParticleGradientValueBlock } from \"./particleGradientValueBlock\";\r\n\r\nimport { Constants } from \"../../../Engines/constants\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3, 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\nimport { ParticleGradientBlock } from \"./particleGradientBlock\";\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: \"Blend Mode OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Blend Mode Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Blend Mode Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Blend Mode Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"Blend Mode 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 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 the billboard mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Billboard mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Billboard Mode All\", value: Constants.PARTICLES_BILLBOARDMODE_ALL },\r\n { label: \"Billboard Mode Y\", value: Constants.PARTICLES_BILLBOARDMODE_Y },\r\n { label: \"Billboard Mode Stretched\", value: Constants.PARTICLES_BILLBOARDMODE_STRETCHED },\r\n { label: \"Billboard Mode Stretched Local\", value: Constants.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL },\r\n ],\r\n })\r\n public billBoardMode = Constants.PARTICLES_BILLBOARDMODE_ALL;\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(\"emitRate\", NodeParticleBlockConnectionPointTypes.Int, true, 10, 0);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\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.registerInput(\"onStart\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"onEnd\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"rampGradient\", NodeParticleBlockConnectionPointTypes.Color4, true);\r\n this.registerInput(\"emitterPosition\", NodeParticleBlockConnectionPointTypes.Vector3, true, Vector3.Zero());\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 emitRate input component\r\n */\r\n public get emitRate(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\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[2];\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[3];\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[4];\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[5];\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[6];\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[7];\r\n }\r\n\r\n /**\r\n * Gets the rampGradient input component\r\n */\r\n public get rampGradient(): NodeParticleConnectionPoint {\r\n return this._inputs[8];\r\n }\r\n\r\n /**\r\n * Gets the emitterPosition input component\r\n */\r\n public get emitterPosition(): NodeParticleConnectionPoint {\r\n return this._inputs[9];\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.getConnectedValue(state) as number;\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.billboardMode = this.billBoardMode;\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 particleSystem.emitter = (this.emitterPosition.getConnectedValue(state) as Vector3) ?? Vector3.Zero();\r\n\r\n // The emit rate can vary if it is connected to another block like a gradient\r\n particleSystem._calculateEmitRate = () => {\r\n state.systemContext = particleSystem;\r\n return this.emitRate.getConnectedValue(state) as number;\r\n };\r\n\r\n // Get the ramp gradients\r\n particleSystem.useRampGradients = false;\r\n if (this.rampGradient.isConnected) {\r\n if (this.rampGradient.connectedPoint?.ownerBlock instanceof ParticleGradientBlock) {\r\n // We have a possible gradient, loop through its entries\r\n const gradientInputs = this.rampGradient.connectedPoint?.ownerBlock.inputs;\r\n\r\n // Skip the first input which is the gradient selector, and we only care about the gradient values\r\n for (let i = 1; i < gradientInputs.length; i++) {\r\n if (gradientInputs[i].isConnected) {\r\n const rampEntry = gradientInputs[i].connectedPoint?.ownerBlock as ParticleGradientValueBlock;\r\n const color = rampEntry._inputs[0].getConnectedValue(state) as Color4;\r\n particleSystem.addRampGradient(rampEntry.reference, new Color3(color.r, color.g, color.b));\r\n particleSystem.useRampGradients = true;\r\n }\r\n }\r\n } else {\r\n // We have a single value, add it as ramp gradient\r\n const color = this.rampGradient.getConnectedValue(state) as Color4;\r\n particleSystem.addRampGradient(0, new Color3(color.r, color.g, color.b));\r\n particleSystem.useRampGradients = true;\r\n }\r\n }\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 /**\r\n * Serializes the system block\r\n * @returns The serialized object\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.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.billBoardMode = this.billBoardMode;\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 /**\r\n * Deserializes the system block\r\n * @param serializationObject The serialized system\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.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.billBoardMode = serializationObject.billBoardMode ?? Constants.PARTICLES_BILLBOARDMODE_ALL;\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.emitRate !== undefined) {\r\n this.emitRate.value = serializationObject.emitRate;\r\n }\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"]}
@@ -1,5 +1,6 @@
1
1
  import { Color4 } from "../../Maths/math.color.js";
2
2
  import { Vector2, Vector3 } from "../../Maths/math.vector.js";
3
+ import { AbstractMesh } from "../../Meshes/abstractMesh.js";
3
4
  import { FactorGradient } from "../../Misc/gradients.js";
4
5
  import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
5
6
  import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
@@ -27,12 +28,15 @@ import { SetupSpriteSheetBlock } from "./Blocks/Emitters/setupSpriteSheetBlock.j
27
28
  import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
28
29
  import { UpdateAngleBlock } from "./Blocks/Update/updateAngleBlock.js";
29
30
  import { BasicSpriteUpdateBlock } from "./Blocks/Update/basicSpriteUpdateBlock.js";
31
+ import { UpdateAttractorBlock } from "./Blocks/Update/updateAttractorBlock.js";
30
32
  import { UpdateColorBlock } from "./Blocks/Update/updateColorBlock.js";
31
33
  import { UpdateDirectionBlock } from "./Blocks/Update/updateDirectionBlock.js";
34
+ import { UpdateFlowMapBlock } from "./Blocks/Update/updateFlowMapBlock.js";
32
35
  import { UpdateNoiseBlock } from "./Blocks/Update/updateNoiseBlock.js";
33
36
  import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
34
37
  import { UpdateSizeBlock } from "./Blocks/Update/updateSizeBlock.js";
35
38
  import { UpdateRemapBlock } from "./Blocks/Update/updateRemapBlock.js";
39
+ import { GenerateBase64StringFromPixelData } from "../../Misc/copyTools.js";
36
40
  /**
37
41
  * Converts a ParticleSystem to a NodeParticleSystemSet.
38
42
  * @param name The name of the node particle system set.
@@ -368,6 +372,12 @@ function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
368
372
  context.scaledDirection = _UpdateParticleDragGradientBlockGroup(oldSystem._dragGradients, context);
369
373
  }
370
374
  updatedParticle = _UpdateParticlePositionBlockGroup(updatedParticle, oldSystem.isLocal, context);
375
+ if (oldSystem.attractors && oldSystem.attractors.length > 0) {
376
+ updatedParticle = _UpdateParticleAttractorBlockGroup(updatedParticle, oldSystem.attractors);
377
+ }
378
+ if (oldSystem.flowMap) {
379
+ updatedParticle = _UpdateParticleFlowMapBlockGroup(updatedParticle, oldSystem.flowMap, oldSystem.flowMapStrength);
380
+ }
371
381
  if (oldSystem._limitVelocityGradients && oldSystem._limitVelocityGradients.length > 0 && oldSystem.limitVelocityDamping !== 0) {
372
382
  updatedParticle = _UpdateParticleVelocityLimitGradientBlockGroup(updatedParticle, oldSystem._limitVelocityGradients, oldSystem.limitVelocityDamping, context);
373
383
  }
@@ -582,6 +592,46 @@ function _UpdateParticlePositionBlockGroup(inputParticle, isLocal, context) {
582
592
  }
583
593
  return updatePosition.output;
584
594
  }
595
+ /**
596
+ * Creates the group of blocks that represent the particle attractor update
597
+ * @param inputParticle The input particle to update
598
+ * @param attractors The attractors (if any)
599
+ * @returns The output of the group of blocks that represent the particle attractor update
600
+ */
601
+ function _UpdateParticleAttractorBlockGroup(inputParticle, attractors) {
602
+ let outputParticle = inputParticle;
603
+ // Chain update attractor blocks for each attractor
604
+ for (let i = 0; i < attractors.length; i++) {
605
+ const attractor = attractors[i];
606
+ const attractorBlock = new UpdateAttractorBlock(`Attractor Block ${i}`);
607
+ outputParticle.connectTo(attractorBlock.particle);
608
+ _CreateAndConnectInput("Attractor Position", attractor.position.clone(), attractorBlock.attractor);
609
+ _CreateAndConnectInput("Attractor Strength", attractor.strength, attractorBlock.strength);
610
+ outputParticle = attractorBlock.output;
611
+ }
612
+ return outputParticle;
613
+ }
614
+ /**
615
+ * Creates the group of blocks that represent the particle flow map update
616
+ * @param inputParticle The input particle to update
617
+ * @param flowMap The flow map data
618
+ * @param flowMapStrength The strength of the flow map
619
+ * @returns The output of the group of blocks that represent the particle flow map update
620
+ */
621
+ function _UpdateParticleFlowMapBlockGroup(inputParticle, flowMap, flowMapStrength) {
622
+ // Create the flow map update block
623
+ const updateFlowMapBlock = new UpdateFlowMapBlock("Flow Map Update");
624
+ inputParticle.connectTo(updateFlowMapBlock.particle);
625
+ // Create a texture block from the flow map data
626
+ // The FlowMap only stores raw pixel data, so we need to convert it to a base64 data URL
627
+ // Y has to be flipped as the texture data is flipped between CPU (canvas, Y=0 at top) and GPU (texture, Y=0 at bottom)
628
+ const flowMapTextureBlock = new ParticleTextureSourceBlock("Flow Map Texture");
629
+ flowMapTextureBlock.serializedCachedData = true;
630
+ flowMapTextureBlock.textureDataUrl = GenerateBase64StringFromPixelData(flowMap.data, { width: flowMap.width, height: flowMap.height }, true) ?? "";
631
+ flowMapTextureBlock.texture.connectTo(updateFlowMapBlock.flowMap);
632
+ _CreateAndConnectInput("Flow Map Strength", flowMapStrength, updateFlowMapBlock.strength);
633
+ return updateFlowMapBlock.output;
634
+ }
585
635
  /**
586
636
  * Creates the group of blocks that represent the particle size update
587
637
  * @param inputParticle The input particle to update
@@ -751,19 +801,27 @@ function _SystemBlockGroup(updateParticleOutput, oldSystem, context) {
751
801
  newSystem.billBoardMode = oldSystem.billboardMode;
752
802
  newSystem.isLocal = oldSystem.isLocal;
753
803
  newSystem.disposeOnStop = oldSystem.disposeOnStop;
754
- _SystemEmitRateValue(oldSystem.getEmitRateGradients(), oldSystem.targetStopDuration, oldSystem.emitRate, newSystem, context);
755
- const texture = oldSystem.particleTexture;
756
- if (texture) {
757
- _CreateTextureBlock(texture).connectTo(newSystem.texture);
804
+ if (oldSystem.emitter) {
805
+ _SystemEmitterPosition(oldSystem.emitter, newSystem);
758
806
  }
807
+ _SystemEmitRateValue(oldSystem.getEmitRateGradients(), oldSystem.targetStopDuration, oldSystem.emitRate, newSystem, context);
759
808
  _SystemTargetStopDuration(oldSystem.targetStopDuration, newSystem, context);
760
809
  const rampGradients = oldSystem.getRampGradients();
761
810
  if (rampGradients && rampGradients.length > 0) {
762
811
  _SystemRampGradientsBlockGroup(rampGradients, newSystem);
763
812
  }
813
+ const texture = oldSystem.particleTexture;
814
+ if (texture) {
815
+ _CreateTextureBlock(texture).connectTo(newSystem.texture);
816
+ }
764
817
  updateParticleOutput.connectTo(newSystem.particle);
765
818
  return newSystem;
766
819
  }
820
+ function _SystemEmitterPosition(emitter, newSystem) {
821
+ if (emitter) {
822
+ _CreateAndConnectInput("Emitter Position", emitter instanceof AbstractMesh ? emitter.position.clone() : emitter.clone(), newSystem.emitterPosition, NodeParticleBlockConnectionPointTypes.Vector3);
823
+ }
824
+ }
767
825
  function _SystemEmitRateValue(emitGradients, targetStopDuration, emitRate, newSystem, context) {
768
826
  if (emitGradients && emitGradients.length > 0 && targetStopDuration > 0) {
769
827
  // Create the emit gradients