@babylonjs/core 8.45.2 → 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 (78) hide show
  1. package/AudioV2/webAudio/components/webAudioParameterComponent.js +1 -3
  2. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  3. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +4 -0
  4. package/Cameras/Inputs/geospatialCameraPointersInput.js +56 -3
  5. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  6. package/Cameras/geospatialCamera.d.ts +3 -2
  7. package/Cameras/geospatialCamera.js +4 -4
  8. package/Cameras/geospatialCamera.js.map +1 -1
  9. package/Cameras/touchCamera.js +1 -1
  10. package/Cameras/touchCamera.js.map +1 -1
  11. package/Engines/Native/nativeHelpers.js +7 -0
  12. package/Engines/Native/nativeHelpers.js.map +1 -1
  13. package/Engines/Native/nativeInterfaces.d.ts +2 -0
  14. package/Engines/Native/nativeInterfaces.js.map +1 -1
  15. package/Engines/abstractEngine.js +2 -2
  16. package/Engines/abstractEngine.js.map +1 -1
  17. package/FrameGraph/Node/nodeRenderGraph.d.ts +0 -5
  18. package/FrameGraph/Node/nodeRenderGraph.js +0 -7
  19. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  20. package/FrameGraph/frameGraph.d.ts +0 -6
  21. package/FrameGraph/frameGraph.js +0 -23
  22. package/FrameGraph/frameGraph.js.map +1 -1
  23. package/FrameGraph/frameGraphObjectList.d.ts +0 -1
  24. package/FrameGraph/frameGraphObjectList.js +0 -1
  25. package/FrameGraph/frameGraphObjectList.js.map +1 -1
  26. package/FrameGraph/frameGraphRenderContext.d.ts +0 -1
  27. package/FrameGraph/frameGraphRenderContext.js +0 -1
  28. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  29. package/FrameGraph/frameGraphRenderTarget.d.ts +0 -1
  30. package/FrameGraph/frameGraphRenderTarget.js +0 -1
  31. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  32. package/FrameGraph/frameGraphTask.d.ts +0 -1
  33. package/FrameGraph/frameGraphTask.js +0 -1
  34. package/FrameGraph/frameGraphTask.js.map +1 -1
  35. package/FrameGraph/frameGraphTextureManager.d.ts +0 -1
  36. package/FrameGraph/frameGraphTextureManager.js +0 -1
  37. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  38. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +6 -0
  39. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +100 -41
  40. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  41. package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +4 -14
  42. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +9 -27
  43. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
  44. package/Particles/Node/Blocks/index.d.ts +2 -1
  45. package/Particles/Node/Blocks/index.js +2 -1
  46. package/Particles/Node/Blocks/index.js.map +1 -1
  47. package/Particles/Node/Blocks/particleLocalVariableBlock.d.ts +2 -0
  48. package/Particles/Node/Blocks/particleLocalVariableBlock.js +22 -10
  49. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
  50. package/Particles/Node/Blocks/particleMathBlock.d.ts +4 -0
  51. package/Particles/Node/Blocks/particleMathBlock.js +4 -0
  52. package/Particles/Node/Blocks/particleMathBlock.js.map +1 -1
  53. package/Particles/Node/Blocks/{particleModuloBlock.d.ts → particleNumberMathBlock.d.ts} +27 -4
  54. package/Particles/Node/Blocks/particleNumberMathBlock.js +149 -0
  55. package/Particles/Node/Blocks/particleNumberMathBlock.js.map +1 -0
  56. package/Particles/Node/Blocks/particleVectorMathBlock.d.ts +54 -0
  57. package/Particles/Node/Blocks/particleVectorMathBlock.js +116 -0
  58. package/Particles/Node/Blocks/particleVectorMathBlock.js.map +1 -0
  59. package/Particles/Node/Blocks/systemBlock.d.ts +8 -0
  60. package/Particles/Node/Blocks/systemBlock.js +34 -6
  61. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  62. package/Particles/Node/nodeParticleSystemSet.helper.js +63 -4
  63. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  64. package/Particles/baseParticleSystem.d.ts +8 -1
  65. package/Particles/baseParticleSystem.js +8 -1
  66. package/Particles/baseParticleSystem.js.map +1 -1
  67. package/Particles/particle.d.ts +4 -0
  68. package/Particles/particle.js +3 -0
  69. package/Particles/particle.js.map +1 -1
  70. package/Particles/particleSystem.d.ts +12 -0
  71. package/Particles/particleSystem.js +12 -0
  72. package/Particles/particleSystem.js.map +1 -1
  73. package/Particles/thinParticleSystem.d.ts +10 -0
  74. package/Particles/thinParticleSystem.js +10 -1
  75. package/Particles/thinParticleSystem.js.map +1 -1
  76. package/package.json +1 -1
  77. package/Particles/Node/Blocks/particleModuloBlock.js +0 -98
  78. package/Particles/Node/Blocks/particleModuloBlock.js.map +0 -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,gDAAsC;AAE/F;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAMrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAVhB;;WAEG;QAEI,aAAQ,GAAG,CAAC,CAAC;QAQhB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CA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AAC;gBACX,mDAAmD;gBACnD,OAAO;YACX,CAAC;YAED,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;QAC9F,CAAC,CAAC;QAEF,MAAM,iBAAiB,GAAG;YACtB,OAAO,EAAE,cAAc;YACvB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,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;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACa,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACJ;AA3GU;IADN,sBAAsB,CAAC,UAAU,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,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/updateFlowMapBl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AAY,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"]}
@@ -34,4 +34,5 @@ export * from "./Triggers/particleTriggerBlock.js";
34
34
  export * from "./particleLocalVariableBlock.js";
35
35
  export * from "./particleVectorLengthBlock.js";
36
36
  export * from "./particleFresnelBlock.js";
37
- export * from "./particleModuloBlock.js";
37
+ export * from "./particleNumberMathBlock.js";
38
+ export * from "./particleVectorMathBlock.js";
@@ -35,5 +35,6 @@ export * from "./Triggers/particleTriggerBlock.js";
35
35
  export * from "./particleLocalVariableBlock.js";
36
36
  export * from "./particleVectorLengthBlock.js";
37
37
  export * from "./particleFresnelBlock.js";
38
- export * from "./particleModuloBlock.js";
38
+ export * from "./particleNumberMathBlock.js";
39
+ export * from "./particleVectorMathBlock.js";
39
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleFloatToIntBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateNoiseBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\nexport * from \"./particleModuloBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleFloatToIntBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateNoiseBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\nexport * from \"./particleNumberMathBlock\";\r\nexport * from \"./particleVectorMathBlock\";\r\n"]}
@@ -14,6 +14,7 @@ export declare class ParticleLocalVariableBlock extends NodeParticleBlock {
14
14
  * Gets or sets the scope used by the block
15
15
  */
16
16
  scope: ParticleLocalVariableBlockScope;
17
+ private _storage;
17
18
  /**
18
19
  * Create a new ParticleLocalVariableBlock
19
20
  * @param name defines the block name
@@ -35,4 +36,5 @@ export declare class ParticleLocalVariableBlock extends NodeParticleBlock {
35
36
  _build(state: NodeParticleBuildState): void;
36
37
  serialize(): any;
37
38
  _deserialize(serializationObject: any): void;
39
+ dispose(): void;
38
40
  }
@@ -23,6 +23,7 @@ export class ParticleLocalVariableBlock extends NodeParticleBlock {
23
23
  * Gets or sets the scope used by the block
24
24
  */
25
25
  this.scope = ParticleLocalVariableBlockScope.Particle;
26
+ this._storage = new Map();
26
27
  this._isDebug = true;
27
28
  this.registerInput("input", NodeParticleBlockConnectionPointTypes.AutoDetect);
28
29
  this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
@@ -60,22 +61,29 @@ export class ParticleLocalVariableBlock extends NodeParticleBlock {
60
61
  this.output._storedValue = null;
61
62
  return;
62
63
  }
63
- let storedValue = null;
64
- let localId = -1;
65
64
  const func = (state) => {
66
65
  if (!state.particleContext && !state.systemContext) {
67
- storedValue = null;
66
+ this._storage.clear();
68
67
  return null;
69
68
  }
70
69
  const id = (this.scope === ParticleLocalVariableBlockScope.Particle ? state.particleContext?.id : state.systemContext?.getScene().getFrameId()) || -1;
71
- if (localId !== id) {
72
- localId = id;
73
- storedValue = null;
70
+ if (!this._storage.has(id)) {
71
+ let value = this.input.getConnectedValue(state);
72
+ if (value.clone) {
73
+ value = value.clone(); // We clone to snapshot the value at this moment
74
+ }
75
+ this._storage.set(id, value);
76
+ if (this.scope === ParticleLocalVariableBlockScope.Particle) {
77
+ state.particleContext.onReset = () => {
78
+ this._storage.delete(id);
79
+ state.particleContext.onReset = null;
80
+ };
81
+ }
82
+ state.systemContext.onDisposeObservable.addOnce(() => {
83
+ this._storage.clear();
84
+ });
74
85
  }
75
- if (storedValue === null) {
76
- storedValue = this.input.getConnectedValue(state);
77
- }
78
- return storedValue;
86
+ return this._storage.get(id);
79
87
  };
80
88
  if (this.output.isConnected) {
81
89
  this.output._storedFunction = func;
@@ -93,6 +101,10 @@ export class ParticleLocalVariableBlock extends NodeParticleBlock {
93
101
  super._deserialize(serializationObject);
94
102
  this.scope = serializationObject.scope;
95
103
  }
104
+ dispose() {
105
+ this._storage.clear();
106
+ super.dispose();
107
+ }
96
108
  }
97
109
  __decorate([
98
110
  editableInPropertyPage("Scope", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
@@ -1 +1 @@
1
- {"version":3,"file":"particleLocalVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleLocalVariableBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,MAAM,CAAN,IAAY,+BAGX;AAHD,WAAY,+BAA+B;IACvC,6FAAY,CAAA;IACZ,qFAAQ,CAAA;AACZ,CAAC,EAHW,+BAA+B,KAA/B,+BAA+B,QAG1C;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAc7D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAlBhB;;WAEG;QASI,UAAK,GAAG,+BAA+B,CAAC,QAAQ,CAAC;QASpD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAElF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,qCAAqC,CAAC,aA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C;IAC3C,CAAC;CACJ;AAhGU;IARN,sBAAsB,CAAC,OAAO,uCAA+B,UAAU,EAAE;QACtE,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,+BAA+B,CAAC,QAAQ,EAAE;YACtE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,+BAA+B,CAAC,IAAI,EAAE;SACjE;KACJ,CAAC;yDACsD;AAkG5D,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\nexport enum ParticleLocalVariableBlockScope {\r\n Particle = 0,\r\n Loop = 1,\r\n}\r\n\r\n/**\r\n * Defines a block used to store local values\r\n * #A1OS53#5\r\n */\r\nexport class ParticleLocalVariableBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the scope used by the block\r\n */\r\n @editableInPropertyPage(\"Scope\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n embedded: true,\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Particle\", value: ParticleLocalVariableBlockScope.Particle },\r\n { label: \"Loop\", value: ParticleLocalVariableBlockScope.Loop },\r\n ],\r\n })\r\n public scope = ParticleLocalVariableBlockScope.Particle;\r\n\r\n /**\r\n * Create a new ParticleLocalVariableBlock\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._isDebug = true;\r\n\r\n this.registerInput(\"input\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.FloatGradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector2Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Color4Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.System);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleLocalVariableBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): 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 public override _build(state: NodeParticleBuildState) {\r\n if (!this.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n let storedValue: any = null;\r\n let localId = -1;\r\n\r\n const func = (state: NodeParticleBuildState) => {\r\n if (!state.particleContext && !state.systemContext) {\r\n storedValue = null;\r\n return null;\r\n }\r\n\r\n const id = (this.scope === ParticleLocalVariableBlockScope.Particle ? state.particleContext?.id : state.systemContext?.getScene()!.getFrameId()) || -1;\r\n\r\n if (localId !== id) {\r\n localId = id;\r\n storedValue = null;\r\n }\r\n\r\n if (storedValue === null) {\r\n storedValue = this.input.getConnectedValue(state);\r\n }\r\n\r\n return storedValue;\r\n };\r\n\r\n if (this.output.isConnected) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.scope = this.scope;\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.scope = serializationObject.scope;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleLocalVariableBlock\", ParticleLocalVariableBlock);\r\n"]}
1
+ {"version":3,"file":"particleLocalVariableBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleLocalVariableBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,MAAM,CAAN,IAAY,+BAGX;AAHD,WAAY,+BAA+B;IACvC,6FAAY,CAAA;IACZ,qFAAQ,CAAA;AACZ,CAAC,EAHW,+BAA+B,KAA/B,+BAA+B,QAG1C;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAe7D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAnBhB;;WAEG;QASI,UAAK,GAAG,+BAA+B,CAAC,QAAQ,CAAC;QAChD,aAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;QAStC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qC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AoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\nexport enum ParticleLocalVariableBlockScope {\r\n Particle = 0,\r\n Loop = 1,\r\n}\r\n\r\n/**\r\n * Defines a block used to store local values\r\n * #A1OS53#5\r\n */\r\nexport class ParticleLocalVariableBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the scope used by the block\r\n */\r\n @editableInPropertyPage(\"Scope\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n embedded: true,\r\n notifiers: { rebuild: true },\r\n options: [\r\n { label: \"Particle\", value: ParticleLocalVariableBlockScope.Particle },\r\n { label: \"Loop\", value: ParticleLocalVariableBlockScope.Loop },\r\n ],\r\n })\r\n public scope = ParticleLocalVariableBlockScope.Particle;\r\n private _storage = new Map<number, any>();\r\n\r\n /**\r\n * Create a new ParticleLocalVariableBlock\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._isDebug = true;\r\n\r\n this.registerInput(\"input\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.FloatGradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector2Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Color4Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.System);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleLocalVariableBlock\";\r\n }\r\n\r\n /**\r\n * Gets the input component\r\n */\r\n public get input(): 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 public override _build(state: NodeParticleBuildState) {\r\n if (!this.input.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (state: NodeParticleBuildState) => {\r\n if (!state.particleContext && !state.systemContext) {\r\n this._storage.clear();\r\n return null;\r\n }\r\n\r\n const id = (this.scope === ParticleLocalVariableBlockScope.Particle ? state.particleContext?.id : state.systemContext?.getScene()!.getFrameId()) || -1;\r\n\r\n if (!this._storage.has(id)) {\r\n let value = this.input.getConnectedValue(state);\r\n\r\n if (value.clone) {\r\n value = value.clone(); // We clone to snapshot the value at this moment\r\n }\r\n this._storage.set(id, value);\r\n\r\n if (this.scope === ParticleLocalVariableBlockScope.Particle) {\r\n state.particleContext!.onReset = () => {\r\n this._storage.delete(id);\r\n state.particleContext!.onReset = null;\r\n };\r\n }\r\n state.systemContext!.onDisposeObservable.addOnce(() => {\r\n this._storage.clear();\r\n });\r\n }\r\n\r\n return this._storage.get(id);\r\n };\r\n\r\n if (this.output.isConnected) {\r\n this.output._storedFunction = func;\r\n } else {\r\n this.output._storedValue = func(state);\r\n }\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.scope = this.scope;\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.scope = serializationObject.scope;\r\n }\r\n\r\n public override dispose() {\r\n this._storage.clear();\r\n super.dispose();\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleLocalVariableBlock\", ParticleLocalVariableBlock);\r\n"]}
@@ -60,5 +60,9 @@ export declare class ParticleMathBlock extends NodeParticleBlock {
60
60
  * @returns the serialized block object
61
61
  */
62
62
  serialize(): any;
63
+ /**
64
+ * Deserializes the block from a JSON object
65
+ * @param serializationObject the JSON object to deserialize from
66
+ */
63
67
  _deserialize(serializationObject: any): void;
64
68
  }
@@ -298,6 +298,10 @@ export class ParticleMathBlock extends NodeParticleBlock {
298
298
  serializationObject.operation = this.operation;
299
299
  return serializationObject;
300
300
  }
301
+ /**
302
+ * Deserializes the block from a JSON object
303
+ * @param serializationObject the JSON object to deserialize from
304
+ */
301
305
  _deserialize(serializationObject) {
302
306
  super._deserialize(serializationObject);
303
307
  this.operation = serializationObject.operation;
@@ -1 +1 @@
1
- {"version":3,"file":"particleMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleMathBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AAC1D,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAEvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAE/C;;GAEG;AACH,MAAM,CAAN,IAAY,2BAaX;AAbD,WAAY,2BAA2B;IACnC,UAAU;IACV,2EAAG,CAAA;IACH,eAAe;IACf,qFAAQ,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AAE,2BAA2B,CAAC,GAAG,EAAE;YACxD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,CAAC,GAAG,EAAE;SAC3D;KACJ,CAAC;oDACiD;AAgTvD,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Operations supported by the Math block\r\n */\r\nexport enum ParticleMathBlockOperations {\r\n /** Add */\r\n Add,\r\n /** Subtract */\r\n Subtract,\r\n /** Multiply */\r\n Multiply,\r\n /** Divide */\r\n Divide,\r\n /** Max */\r\n Max,\r\n /** Min */\r\n Min,\r\n}\r\n\r\n/**\r\n * Block used to apply math functions\r\n */\r\nexport class ParticleMathBlock 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: \"Add\", value: ParticleMathBlockOperations.Add },\r\n { label: \"Subtract\", value: ParticleMathBlockOperations.Subtract },\r\n { label: \"Multiply\", value: ParticleMathBlockOperations.Multiply },\r\n { label: \"Divide\", value: ParticleMathBlockOperations.Divide },\r\n { label: \"Max\", value: ParticleMathBlockOperations.Max },\r\n { label: \"Min\", value: ParticleMathBlockOperations.Min },\r\n ],\r\n })\r\n public operation = ParticleMathBlockOperations.Add;\r\n\r\n private readonly _connectionObservers: Observer<NodeParticleConnectionPoint>[];\r\n\r\n /**\r\n * Create a new ParticleMathBlock\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 const excludedConnectionPointTypes = [\r\n NodeParticleBlockConnectionPointTypes.Matrix,\r\n NodeParticleBlockConnectionPointTypes.Particle,\r\n NodeParticleBlockConnectionPointTypes.Texture,\r\n NodeParticleBlockConnectionPointTypes.System,\r\n NodeParticleBlockConnectionPointTypes.FloatGradient,\r\n NodeParticleBlockConnectionPointTypes.Color4Gradient,\r\n NodeParticleBlockConnectionPointTypes.Vector2Gradient,\r\n NodeParticleBlockConnectionPointTypes.Vector3Gradient,\r\n ] as const;\r\n\r\n this.left.excludedConnectionPointTypes.push(...excludedConnectionPointTypes);\r\n this.right.excludedConnectionPointTypes.push(...excludedConnectionPointTypes);\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 \"ParticleMathBlock\";\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 const leftIsScalar = left.type === NodeParticleBlockConnectionPointTypes.Float || left.type === NodeParticleBlockConnectionPointTypes.Int;\r\n const rightIsScalar = right.type === NodeParticleBlockConnectionPointTypes.Float || right.type === NodeParticleBlockConnectionPointTypes.Int;\r\n\r\n // If both input types are scalars, then this is a scalar operation.\r\n const isScalar = leftIsScalar && rightIsScalar;\r\n\r\n switch (this.operation) {\r\n case ParticleMathBlockOperations.Add: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) + right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).add(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).add(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Subtract: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) - right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).subtract(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).subtract(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Multiply: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) * right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).multiply(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).multiply(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Divide: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) / right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).divide(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).divide(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Min: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return Math.min(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n const [vector, scalar] = leftIsScalar ? [right, left] : [left, right];\r\n\r\n switch (vector.type) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const other = vector.getConnectedValue(state);\r\n const { r, g, b, a } = state.adapt(scalar, vector.type);\r\n\r\n return new Color4(Math.min(other.r, r), Math.min(other.g, g), Math.min(other.b, b), Math.min(other.a, a));\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Max: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return Math.max(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n const [vector, scalar] = leftIsScalar ? [right, left] : [left, right];\r\n\r\n switch (vector.type) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const other = vector.getConnectedValue(state);\r\n const { r, g, b, a } = state.adapt(scalar, vector.type);\r\n\r\n return new Color4(Math.max(other.r, r), Math.min(other.g, g), Math.min(other.b, b), Math.min(other.a, a));\r\n };\r\n break;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n if (left.type === NodeParticleBlockConnectionPointTypes.Int) {\r\n return func(state) | 0;\r\n }\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 (this.left.isConnected && this.right.isConnected) {\r\n // Both inputs are connected, so we need to determine the output type based on the input types.\r\n if (\r\n this.left.type === NodeParticleBlockConnectionPointTypes.Int ||\r\n (this.left.type === NodeParticleBlockConnectionPointTypes.Float && this.right.type !== NodeParticleBlockConnectionPointTypes.Int)\r\n ) {\r\n this.output._typeConnectionSource = this.right;\r\n }\r\n } else if (this.left.isConnected !== this.right.isConnected) {\r\n // Only one input is connected, so we need to determine the output type based on the connected input.\r\n this.output._typeConnectionSource = this.left.isConnected ? this.left : this.right;\r\n }\r\n\r\n // Next update the accepted connection point types for the inputs based on the current input connection state.\r\n if (this.left.isConnected || this.right.isConnected) {\r\n for (const [first, second] of [\r\n [this.left, this.right],\r\n [this.right, this.left],\r\n ]) {\r\n // Always allow Ints and Floats.\r\n first.acceptedConnectionPointTypes = [NodeParticleBlockConnectionPointTypes.Int, NodeParticleBlockConnectionPointTypes.Float];\r\n\r\n if (second.isConnected) {\r\n // The same types as the connected input are always allowed.\r\n first.acceptedConnectionPointTypes.push(second.type);\r\n\r\n // If the other input is a scalar, then we also allow Vector types.\r\n if (second.type === NodeParticleBlockConnectionPointTypes.Int || second.type === NodeParticleBlockConnectionPointTypes.Float) {\r\n first.acceptedConnectionPointTypes.push(\r\n NodeParticleBlockConnectionPointTypes.Vector2,\r\n NodeParticleBlockConnectionPointTypes.Vector3,\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n }\r\n }\r\n }\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 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.ParticleMathBlock\", ParticleMathBlock);\r\n"]}
1
+ {"version":3,"file":"particleMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleMathBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AAC1D,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAEvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAE/C;;GAEG;AACH,MAAM,CAAN,IAAY,2BAaX;AAbD,WAAY,2BAA2B;IACnC,UAAU;IACV,2EAAG,CAAA;IACH,eAAe;IACf,qFAAQ,CAAA;IACR,eAAe;IACf,q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B,CAAC,GAAG,EAAE;YACxD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,CAAC,GAAG,EAAE;SAC3D;KACJ,CAAC;oDACiD;AAoTvD,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Operations supported by the Math block\r\n */\r\nexport enum ParticleMathBlockOperations {\r\n /** Add */\r\n Add,\r\n /** Subtract */\r\n Subtract,\r\n /** Multiply */\r\n Multiply,\r\n /** Divide */\r\n Divide,\r\n /** Max */\r\n Max,\r\n /** Min */\r\n Min,\r\n}\r\n\r\n/**\r\n * Block used to apply math functions\r\n */\r\nexport class ParticleMathBlock 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: \"Add\", value: ParticleMathBlockOperations.Add },\r\n { label: \"Subtract\", value: ParticleMathBlockOperations.Subtract },\r\n { label: \"Multiply\", value: ParticleMathBlockOperations.Multiply },\r\n { label: \"Divide\", value: ParticleMathBlockOperations.Divide },\r\n { label: \"Max\", value: ParticleMathBlockOperations.Max },\r\n { label: \"Min\", value: ParticleMathBlockOperations.Min },\r\n ],\r\n })\r\n public operation = ParticleMathBlockOperations.Add;\r\n\r\n private readonly _connectionObservers: Observer<NodeParticleConnectionPoint>[];\r\n\r\n /**\r\n * Create a new ParticleMathBlock\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 const excludedConnectionPointTypes = [\r\n NodeParticleBlockConnectionPointTypes.Matrix,\r\n NodeParticleBlockConnectionPointTypes.Particle,\r\n NodeParticleBlockConnectionPointTypes.Texture,\r\n NodeParticleBlockConnectionPointTypes.System,\r\n NodeParticleBlockConnectionPointTypes.FloatGradient,\r\n NodeParticleBlockConnectionPointTypes.Color4Gradient,\r\n NodeParticleBlockConnectionPointTypes.Vector2Gradient,\r\n NodeParticleBlockConnectionPointTypes.Vector3Gradient,\r\n ] as const;\r\n\r\n this.left.excludedConnectionPointTypes.push(...excludedConnectionPointTypes);\r\n this.right.excludedConnectionPointTypes.push(...excludedConnectionPointTypes);\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 \"ParticleMathBlock\";\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 const leftIsScalar = left.type === NodeParticleBlockConnectionPointTypes.Float || left.type === NodeParticleBlockConnectionPointTypes.Int;\r\n const rightIsScalar = right.type === NodeParticleBlockConnectionPointTypes.Float || right.type === NodeParticleBlockConnectionPointTypes.Int;\r\n\r\n // If both input types are scalars, then this is a scalar operation.\r\n const isScalar = leftIsScalar && rightIsScalar;\r\n\r\n switch (this.operation) {\r\n case ParticleMathBlockOperations.Add: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) + right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).add(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).add(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Subtract: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) - right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).subtract(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).subtract(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Multiply: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) * right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).multiply(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).multiply(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Divide: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return left.getConnectedValue(state) / right.getConnectedValue(state);\r\n };\r\n } else if (leftIsScalar) {\r\n func = (state) => {\r\n return state.adapt(left, right.type).divide(right.getConnectedValue(state));\r\n };\r\n } else {\r\n func = (state) => {\r\n return left.getConnectedValue(state).divide(state.adapt(right, left.type));\r\n };\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Min: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return Math.min(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n const [vector, scalar] = leftIsScalar ? [right, left] : [left, right];\r\n\r\n switch (vector.type) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Minimize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const other = vector.getConnectedValue(state);\r\n const { r, g, b, a } = state.adapt(scalar, vector.type);\r\n\r\n return new Color4(Math.min(other.r, r), Math.min(other.g, g), Math.min(other.b, b), Math.min(other.a, a));\r\n };\r\n break;\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n case ParticleMathBlockOperations.Max: {\r\n if (isScalar) {\r\n func = (state) => {\r\n return Math.max(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n } else {\r\n const [vector, scalar] = leftIsScalar ? [right, left] : [left, right];\r\n\r\n switch (vector.type) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n return Vector2.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n return Vector3.Maximize(vector.getConnectedValue(state), state.adapt(scalar, vector.type));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const other = vector.getConnectedValue(state);\r\n const { r, g, b, a } = state.adapt(scalar, vector.type);\r\n\r\n return new Color4(Math.max(other.r, r), Math.min(other.g, g), Math.min(other.b, b), Math.min(other.a, a));\r\n };\r\n break;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n if (left.type === NodeParticleBlockConnectionPointTypes.Int) {\r\n return func(state) | 0;\r\n }\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 (this.left.isConnected && this.right.isConnected) {\r\n // Both inputs are connected, so we need to determine the output type based on the input types.\r\n if (\r\n this.left.type === NodeParticleBlockConnectionPointTypes.Int ||\r\n (this.left.type === NodeParticleBlockConnectionPointTypes.Float && this.right.type !== NodeParticleBlockConnectionPointTypes.Int)\r\n ) {\r\n this.output._typeConnectionSource = this.right;\r\n }\r\n } else if (this.left.isConnected !== this.right.isConnected) {\r\n // Only one input is connected, so we need to determine the output type based on the connected input.\r\n this.output._typeConnectionSource = this.left.isConnected ? this.left : this.right;\r\n }\r\n\r\n // Next update the accepted connection point types for the inputs based on the current input connection state.\r\n if (this.left.isConnected || this.right.isConnected) {\r\n for (const [first, second] of [\r\n [this.left, this.right],\r\n [this.right, this.left],\r\n ]) {\r\n // Always allow Ints and Floats.\r\n first.acceptedConnectionPointTypes = [NodeParticleBlockConnectionPointTypes.Int, NodeParticleBlockConnectionPointTypes.Float];\r\n\r\n if (second.isConnected) {\r\n // The same types as the connected input are always allowed.\r\n first.acceptedConnectionPointTypes.push(second.type);\r\n\r\n // If the other input is a scalar, then we also allow Vector types.\r\n if (second.type === NodeParticleBlockConnectionPointTypes.Int || second.type === NodeParticleBlockConnectionPointTypes.Float) {\r\n first.acceptedConnectionPointTypes.push(\r\n NodeParticleBlockConnectionPointTypes.Vector2,\r\n NodeParticleBlockConnectionPointTypes.Vector3,\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n }\r\n }\r\n }\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.ParticleMathBlock\", ParticleMathBlock);\r\n"]}
@@ -1,13 +1,26 @@
1
- import { NodeParticleBlock } from "../nodeParticleBlock.js";
2
1
  import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
3
2
  import type { NodeParticleBuildState } from "../nodeParticleBuildState.js";
3
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
4
+ /**
5
+ * Operations supported by the Number Math block
6
+ */
7
+ export declare enum ParticleNumberMathBlockOperations {
8
+ /** Modulo */
9
+ Modulo = 0,
10
+ /** Power */
11
+ Pow = 1
12
+ }
4
13
  /**
5
- * Block used to apply the modulo operator
14
+ * Block used to apply math operations that only appply to numbers (int/float)
6
15
  */
7
- export declare class ParticleModuloBlock extends NodeParticleBlock {
16
+ export declare class ParticleNumberMathBlock extends NodeParticleBlock {
17
+ /**
18
+ * Gets or sets the operation applied by the block
19
+ */
20
+ operation: ParticleNumberMathBlockOperations;
8
21
  private readonly _connectionObservers;
9
22
  /**
10
- * Create a new ParticleModuloBlock
23
+ * Create a new ParticleNumberMathBlock
11
24
  * @param name defines the block name
12
25
  */
13
26
  constructor(name: string);
@@ -34,4 +47,14 @@ export declare class ParticleModuloBlock extends NodeParticleBlock {
34
47
  * Release resources
35
48
  */
36
49
  dispose(): void;
50
+ /**
51
+ * Serializes this block in a JSON representation
52
+ * @returns the serialized block object
53
+ */
54
+ serialize(): any;
55
+ /**
56
+ * Deserializes the block from a JSON object
57
+ * @param serializationObject the JSON object to deserialize from
58
+ */
59
+ _deserialize(serializationObject: any): void;
37
60
  }