@babylonjs/core 8.45.2 → 8.45.3
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.
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +1 -3
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +4 -0
- package/Cameras/Inputs/geospatialCameraPointersInput.js +56 -3
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +3 -2
- package/Cameras/geospatialCamera.js +4 -4
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Particles/Node/Blocks/index.d.ts +2 -1
- package/Particles/Node/Blocks/index.js +2 -1
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleLocalVariableBlock.d.ts +2 -0
- package/Particles/Node/Blocks/particleLocalVariableBlock.js +22 -10
- package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleMathBlock.d.ts +4 -0
- package/Particles/Node/Blocks/particleMathBlock.js +4 -0
- package/Particles/Node/Blocks/particleMathBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleNumberMathBlock.d.ts +60 -0
- package/Particles/Node/Blocks/particleNumberMathBlock.js +149 -0
- package/Particles/Node/Blocks/particleNumberMathBlock.js.map +1 -0
- package/Particles/Node/Blocks/{particleModuloBlock.d.ts → particleVectorMathBlock.d.ts} +25 -4
- package/Particles/Node/Blocks/{particleModuloBlock.js → particleVectorMathBlock.js} +59 -24
- package/Particles/Node/Blocks/particleVectorMathBlock.js.map +1 -0
- package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
- package/Particles/Node/Blocks/systemBlock.js +25 -5
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +1 -0
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +1 -1
- package/Particles/baseParticleSystem.js +1 -1
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/particle.d.ts +4 -0
- package/Particles/particle.js +3 -0
- package/Particles/particle.js.map +1 -1
- package/package.json +1 -1
- package/Particles/Node/Blocks/particleModuloBlock.js.map +0 -1
|
@@ -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 "./
|
|
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 "./
|
|
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;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D,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
|
-
|
|
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 (
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
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;
|
|
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,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AI,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;AA+G5D,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 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,yB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5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,CAAC,GAAG,EAAE;YACxD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,2BAA2B,CAAC,QAAQ,EAAE;YAClE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,2BAA2B,CAAC,QAAQ,EAAE;YAClE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,2BAA2B,CAAC,MAAM,EAAE;YAC9D,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,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;AACx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QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,CAAC,GAAG,EAAE;YACxD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,2BAA2B,CAAC,QAAQ,EAAE;YAClE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,2BAA2B,CAAC,QAAQ,EAAE;YAClE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,2BAA2B,CAAC,MAAM,EAAE;YAC9D,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,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"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
|
|
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
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Block used to apply math operations that only appply to numbers (int/float)
|
|
15
|
+
*/
|
|
16
|
+
export declare class ParticleNumberMathBlock extends NodeParticleBlock {
|
|
17
|
+
/**
|
|
18
|
+
* Gets or sets the operation applied by the block
|
|
19
|
+
*/
|
|
20
|
+
operation: ParticleNumberMathBlockOperations;
|
|
21
|
+
private readonly _connectionObservers;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new ParticleNumberMathBlock
|
|
24
|
+
* @param name defines the block name
|
|
25
|
+
*/
|
|
26
|
+
constructor(name: string);
|
|
27
|
+
/**
|
|
28
|
+
* Gets the current class name
|
|
29
|
+
* @returns the class name
|
|
30
|
+
*/
|
|
31
|
+
getClassName(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the left input component
|
|
34
|
+
*/
|
|
35
|
+
get left(): NodeParticleConnectionPoint;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the right input component
|
|
38
|
+
*/
|
|
39
|
+
get right(): NodeParticleConnectionPoint;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the geometry output component
|
|
42
|
+
*/
|
|
43
|
+
get output(): NodeParticleConnectionPoint;
|
|
44
|
+
_build(state: NodeParticleBuildState): void;
|
|
45
|
+
private _updateInputOutputTypes;
|
|
46
|
+
/**
|
|
47
|
+
* Release resources
|
|
48
|
+
*/
|
|
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;
|
|
60
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { __decorate } from "../../../tslib.es6.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeParticleBlock } from "../nodeParticleBlock.js";
|
|
4
|
+
import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
5
|
+
import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
6
|
+
/**
|
|
7
|
+
* Operations supported by the Number Math block
|
|
8
|
+
*/
|
|
9
|
+
export var ParticleNumberMathBlockOperations;
|
|
10
|
+
(function (ParticleNumberMathBlockOperations) {
|
|
11
|
+
/** Modulo */
|
|
12
|
+
ParticleNumberMathBlockOperations[ParticleNumberMathBlockOperations["Modulo"] = 0] = "Modulo";
|
|
13
|
+
/** Power */
|
|
14
|
+
ParticleNumberMathBlockOperations[ParticleNumberMathBlockOperations["Pow"] = 1] = "Pow";
|
|
15
|
+
})(ParticleNumberMathBlockOperations || (ParticleNumberMathBlockOperations = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Block used to apply math operations that only appply to numbers (int/float)
|
|
18
|
+
*/
|
|
19
|
+
export class ParticleNumberMathBlock extends NodeParticleBlock {
|
|
20
|
+
/**
|
|
21
|
+
* Create a new ParticleNumberMathBlock
|
|
22
|
+
* @param name defines the block name
|
|
23
|
+
*/
|
|
24
|
+
constructor(name) {
|
|
25
|
+
super(name);
|
|
26
|
+
/**
|
|
27
|
+
* Gets or sets the operation applied by the block
|
|
28
|
+
*/
|
|
29
|
+
this.operation = ParticleNumberMathBlockOperations.Modulo;
|
|
30
|
+
this.registerInput("left", NodeParticleBlockConnectionPointTypes.AutoDetect);
|
|
31
|
+
this.registerInput("right", NodeParticleBlockConnectionPointTypes.AutoDetect);
|
|
32
|
+
this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
|
|
33
|
+
this.output._typeConnectionSource = this.left;
|
|
34
|
+
this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);
|
|
35
|
+
this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);
|
|
36
|
+
this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);
|
|
37
|
+
this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);
|
|
38
|
+
this._linkConnectionTypes(0, 1);
|
|
39
|
+
this._connectionObservers = [
|
|
40
|
+
this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),
|
|
41
|
+
this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
|
|
42
|
+
this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),
|
|
43
|
+
this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets the current class name
|
|
48
|
+
* @returns the class name
|
|
49
|
+
*/
|
|
50
|
+
getClassName() {
|
|
51
|
+
return "ParticleNumberMathBlock";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Gets the left input component
|
|
55
|
+
*/
|
|
56
|
+
get left() {
|
|
57
|
+
return this._inputs[0];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Gets the right input component
|
|
61
|
+
*/
|
|
62
|
+
get right() {
|
|
63
|
+
return this._inputs[1];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Gets the geometry output component
|
|
67
|
+
*/
|
|
68
|
+
get output() {
|
|
69
|
+
return this._outputs[0];
|
|
70
|
+
}
|
|
71
|
+
_build(state) {
|
|
72
|
+
let func;
|
|
73
|
+
const left = this.left;
|
|
74
|
+
const right = this.right;
|
|
75
|
+
if (!left.isConnected || !right.isConnected) {
|
|
76
|
+
this.output._storedFunction = null;
|
|
77
|
+
this.output._storedValue = null;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
switch (this.operation) {
|
|
81
|
+
case ParticleNumberMathBlockOperations.Modulo: {
|
|
82
|
+
func = (state) => {
|
|
83
|
+
return left.getConnectedValue(state) % right.getConnectedValue(state);
|
|
84
|
+
};
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
case ParticleNumberMathBlockOperations.Pow: {
|
|
88
|
+
func = (state) => {
|
|
89
|
+
return Math.pow(left.getConnectedValue(state), right.getConnectedValue(state));
|
|
90
|
+
};
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
this.output._storedFunction = (state) => {
|
|
95
|
+
// We use the left type to determine if we need to cast to int
|
|
96
|
+
if (left.type === NodeParticleBlockConnectionPointTypes.Int) {
|
|
97
|
+
return func(state) | 0;
|
|
98
|
+
}
|
|
99
|
+
return func(state);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
_updateInputOutputTypes() {
|
|
103
|
+
// First update the output type with the initial assumption that we'll base it on the left input.
|
|
104
|
+
this.output._typeConnectionSource = this.left;
|
|
105
|
+
// If left is not connected, then instead use the type of right if it's connected.
|
|
106
|
+
if (!this.left.isConnected && this.right.isConnected) {
|
|
107
|
+
this.output._typeConnectionSource = this.right;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Release resources
|
|
112
|
+
*/
|
|
113
|
+
dispose() {
|
|
114
|
+
super.dispose();
|
|
115
|
+
for (const observer of this._connectionObservers) {
|
|
116
|
+
observer.remove();
|
|
117
|
+
}
|
|
118
|
+
this._connectionObservers.length = 0;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Serializes this block in a JSON representation
|
|
122
|
+
* @returns the serialized block object
|
|
123
|
+
*/
|
|
124
|
+
serialize() {
|
|
125
|
+
const serializationObject = super.serialize();
|
|
126
|
+
serializationObject.operation = this.operation;
|
|
127
|
+
return serializationObject;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Deserializes the block from a JSON object
|
|
131
|
+
* @param serializationObject the JSON object to deserialize from
|
|
132
|
+
*/
|
|
133
|
+
_deserialize(serializationObject) {
|
|
134
|
+
super._deserialize(serializationObject);
|
|
135
|
+
this.operation = serializationObject.operation;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
__decorate([
|
|
139
|
+
editableInPropertyPage("Operation", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
|
|
140
|
+
notifiers: { rebuild: true },
|
|
141
|
+
embedded: true,
|
|
142
|
+
options: [
|
|
143
|
+
{ label: "Modulo", value: ParticleNumberMathBlockOperations.Modulo },
|
|
144
|
+
{ label: "Power", value: ParticleNumberMathBlockOperations.Pow },
|
|
145
|
+
],
|
|
146
|
+
})
|
|
147
|
+
], ParticleNumberMathBlock.prototype, "operation", void 0);
|
|
148
|
+
RegisterClass("BABYLON.ParticleNumberMathBlock", ParticleNumberMathBlock);
|
|
149
|
+
//# sourceMappingURL=particleNumberMathBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"particleNumberMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleNumberMathBlock.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;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,iCAKX;AALD,WAAY,iCAAiC;IACzC,aAAa;IACb,6FAAM,CAAA;IACN,YAAY;IACZ,uFAAG,CAAA;AACP,CAAC,EALW,iCAAiC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;;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;AA3IU;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,QAAQ,EAAE,KAAK,EAAE,iCAAiC,CAAC,MAAM,EAAE;YACpE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,iCAAiC,CAAC,GAAG,EAAE;SACnE;KACJ,CAAC;0DAC0D;AA6IhE,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\n\r\n/**\r\n * Operations supported by the Number Math block\r\n */\r\nexport enum ParticleNumberMathBlockOperations {\r\n /** Modulo */\r\n Modulo,\r\n /** Power */\r\n Pow,\r\n}\r\n\r\n/**\r\n * Block used to apply math operations that only appply to numbers (int/float)\r\n */\r\nexport class ParticleNumberMathBlock 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: \"Modulo\", value: ParticleNumberMathBlockOperations.Modulo },\r\n { label: \"Power\", value: ParticleNumberMathBlockOperations.Pow },\r\n ],\r\n })\r\n public operation = ParticleNumberMathBlockOperations.Modulo;\r\n\r\n private readonly _connectionObservers: Observer<NodeParticleConnectionPoint>[];\r\n\r\n /**\r\n * Create a new ParticleNumberMathBlock\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.Int);\r\n this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);\r\n this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);\r\n this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);\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 \"ParticleNumberMathBlock\";\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 ParticleNumberMathBlockOperations.Modulo: {\r\n func = (state) => {\r\n return left.getConnectedValue(state) % right.getConnectedValue(state);\r\n };\r\n break;\r\n }\r\n case ParticleNumberMathBlockOperations.Pow: {\r\n func = (state) => {\r\n return Math.pow(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 // We use the left type to determine if we need to cast to int\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 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.ParticleNumberMathBlock\", ParticleNumberMathBlock);\r\n"]}
|
|
@@ -1,13 +1,24 @@
|
|
|
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 Vector Math block
|
|
6
|
+
*/
|
|
7
|
+
export declare enum ParticleVectorMathBlockOperations {
|
|
8
|
+
/** Dot product */
|
|
9
|
+
Dot = 0
|
|
10
|
+
}
|
|
4
11
|
/**
|
|
5
|
-
* Block used to apply
|
|
12
|
+
* Block used to apply math operations that only apply to vectors
|
|
6
13
|
*/
|
|
7
|
-
export declare class
|
|
14
|
+
export declare class ParticleVectorMathBlock extends NodeParticleBlock {
|
|
15
|
+
/**
|
|
16
|
+
* Gets or sets the operation applied by the block
|
|
17
|
+
*/
|
|
18
|
+
operation: ParticleVectorMathBlockOperations;
|
|
8
19
|
private readonly _connectionObservers;
|
|
9
20
|
/**
|
|
10
|
-
* Create a new
|
|
21
|
+
* Create a new ParticleVectorMathBlock
|
|
11
22
|
* @param name defines the block name
|
|
12
23
|
*/
|
|
13
24
|
constructor(name: string);
|
|
@@ -34,4 +45,14 @@ export declare class ParticleModuloBlock extends NodeParticleBlock {
|
|
|
34
45
|
* Release resources
|
|
35
46
|
*/
|
|
36
47
|
dispose(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Serializes this block in a JSON representation
|
|
50
|
+
* @returns the serialized block object
|
|
51
|
+
*/
|
|
52
|
+
serialize(): any;
|
|
53
|
+
/**
|
|
54
|
+
* Deserializes the block from a JSON object
|
|
55
|
+
* @param serializationObject the JSON object to deserialize from
|
|
56
|
+
*/
|
|
57
|
+
_deserialize(serializationObject: any): void;
|
|
37
58
|
}
|