@babylonjs/core 8.45.0 → 8.45.2
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/Cameras/Inputs/index.d.ts +1 -0
- package/Cameras/Inputs/index.js +1 -0
- package/Cameras/Inputs/index.js.map +1 -1
- package/Engines/Extensions/engine.debugging.d.ts +4 -0
- package/Engines/Extensions/engine.debugging.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -1
- package/FrameGraph/frameGraphContext.js +3 -3
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.js +4 -4
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +3 -3
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/lightingVolume.js +6 -6
- package/Lights/lightingVolume.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +17 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +2 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +2 -0
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +8 -4
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +2 -2
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Misc/minMaxReducer.js +2 -2
- package/Misc/minMaxReducer.js.map +1 -1
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.js +2 -0
- package/Particles/Node/Blocks/Conditions/particleConditionBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.d.ts +4 -0
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js +10 -0
- package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateRemapBlock.d.ts +39 -0
- package/Particles/Node/Blocks/Update/updateRemapBlock.js +93 -0
- package/Particles/Node/Blocks/Update/updateRemapBlock.js.map +1 -0
- package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
- package/Particles/Node/Blocks/systemBlock.js +32 -1
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +88 -0
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/thinParticleSystem.js +10 -6
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Probes/reflectionProbe.js +2 -2
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/depthRenderer.js +2 -2
- package/Rendering/depthRenderer.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.d.ts +30 -1
- package/XR/features/WebXRControllerPhysics.js +269 -16
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +36 -2
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,10 @@ export class SetupSpriteSheetBlock extends NodeParticleBlock {
|
|
|
29
29
|
* Gets or sets the height of the sprite sheet
|
|
30
30
|
*/
|
|
31
31
|
this.height = 64;
|
|
32
|
+
/**
|
|
33
|
+
* Gets or sets the speed of the cell change
|
|
34
|
+
*/
|
|
35
|
+
this.spriteCellChangeSpeed = 1;
|
|
32
36
|
/**
|
|
33
37
|
* Gets or sets a boolean indicating if the sprite sheet should loop
|
|
34
38
|
*/
|
|
@@ -70,6 +74,7 @@ export class SetupSpriteSheetBlock extends NodeParticleBlock {
|
|
|
70
74
|
system.endSpriteCellID = this.end;
|
|
71
75
|
system.spriteCellLoop = this.loop;
|
|
72
76
|
system.spriteRandomStartCell = this.randomStartCell;
|
|
77
|
+
system.spriteCellChangeSpeed = this.spriteCellChangeSpeed;
|
|
73
78
|
this.output._storedValue = system;
|
|
74
79
|
}
|
|
75
80
|
serialize() {
|
|
@@ -78,6 +83,7 @@ export class SetupSpriteSheetBlock extends NodeParticleBlock {
|
|
|
78
83
|
serializationObject.height = this.height;
|
|
79
84
|
serializationObject.start = this.start;
|
|
80
85
|
serializationObject.end = this.end;
|
|
86
|
+
serializationObject.spriteCellChangeSpeed = this.spriteCellChangeSpeed;
|
|
81
87
|
serializationObject.loop = this.loop;
|
|
82
88
|
serializationObject.randomStartCell = this.randomStartCell;
|
|
83
89
|
return serializationObject;
|
|
@@ -88,6 +94,7 @@ export class SetupSpriteSheetBlock extends NodeParticleBlock {
|
|
|
88
94
|
this.height = serializationObject.height;
|
|
89
95
|
this.start = serializationObject.start;
|
|
90
96
|
this.end = serializationObject.end;
|
|
97
|
+
this.spriteCellChangeSpeed = serializationObject.spriteCellChangeSpeed;
|
|
91
98
|
this.loop = serializationObject.loop;
|
|
92
99
|
this.randomStartCell = serializationObject.randomStartCell;
|
|
93
100
|
}
|
|
@@ -104,6 +111,9 @@ __decorate([
|
|
|
104
111
|
__decorate([
|
|
105
112
|
editableInPropertyPage("Height", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
|
|
106
113
|
], SetupSpriteSheetBlock.prototype, "height", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
editableInPropertyPage("Sprite Cell Change Speed", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
|
|
116
|
+
], SetupSpriteSheetBlock.prototype, "spriteCellChangeSpeed", void 0);
|
|
107
117
|
__decorate([
|
|
108
118
|
editableInPropertyPage("Loop", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
|
|
109
119
|
], SetupSpriteSheetBlock.prototype, "loop", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupSpriteSheetBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAA0B,gDAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"file":"setupSpriteSheetBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAA0B,gDAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IA2CxD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QA/ChB;;WAEG;QAEI,UAAK,GAAG,CAAC,CAAC;QAEjB;;WAEG;QAEI,QAAG,GAAG,CAAC,CAAC;QAEf;;WAEG;QAEI,UAAK,GAAG,EAAE,CAAC;QAElB;;WAEG;QAEI,WAAM,GAAG,EAAE,CAAC;QAEnB;;WAEG;QAEI,0BAAqB,GAAG,CAAC,CAAC;Q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IADN,sBAAsB,CAAC,KAAK,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;kDACjH;AAMR;IADN,sBAAsB,CAAC,OAAO,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;oDAClH;AAMX;IADN,sBAAsB,CAAC,QAAQ,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;qDAClH;AAMZ;IADN,sBAAsB,CAAC,0BAA0B,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;oEACtH;AAM1B;IADN,sBAAsB,CAAC,MAAM,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;mDACzG;AAMb;IADN,sBAAsB,CAAC,mBAAmB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8DAC3G;AA+EnC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,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\nimport type { ParticleSystem } from \"core/Particles\";\r\n/**\r\n * Block used as configure the sprite sheet for particles\r\n */\r\nexport class SetupSpriteSheetBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the start cell of the sprite sheet\r\n */\r\n @editableInPropertyPage(\"Start\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public start = 0;\r\n\r\n /**\r\n * Gets or sets the end cell of the sprite sheet\r\n */\r\n @editableInPropertyPage(\"End\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public end = 8;\r\n\r\n /**\r\n * Gets or sets the width of the sprite sheet\r\n */\r\n @editableInPropertyPage(\"Width\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public width = 64;\r\n\r\n /**\r\n * Gets or sets the height of the sprite sheet\r\n */\r\n @editableInPropertyPage(\"Height\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public height = 64;\r\n\r\n /**\r\n * Gets or sets the speed of the cell change\r\n */\r\n @editableInPropertyPage(\"Sprite Cell Change Speed\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public spriteCellChangeSpeed = 1;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the sprite sheet should loop\r\n */\r\n @editableInPropertyPage(\"Loop\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public loop = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the sprite sheet should start at a random cell\r\n */\r\n @editableInPropertyPage(\"Random start cell\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public randomStartCell = false;\r\n\r\n /**\r\n * Creates a new SetupSpriteSheetBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[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 \"SetupSpriteSheetBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n super._build(state);\r\n\r\n const system = this.particle.getConnectedValue(state) as ParticleSystem;\r\n\r\n system._isAnimationSheetEnabled = true;\r\n system.spriteCellWidth = this.width;\r\n system.spriteCellHeight = this.height;\r\n system.startSpriteCellID = this.start;\r\n system.endSpriteCellID = this.end;\r\n system.spriteCellLoop = this.loop;\r\n system.spriteRandomStartCell = this.randomStartCell;\r\n system.spriteCellChangeSpeed = this.spriteCellChangeSpeed;\r\n this.output._storedValue = system;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.width = this.width;\r\n serializationObject.height = this.height;\r\n serializationObject.start = this.start;\r\n serializationObject.end = this.end;\r\n serializationObject.spriteCellChangeSpeed = this.spriteCellChangeSpeed;\r\n serializationObject.loop = this.loop;\r\n serializationObject.randomStartCell = this.randomStartCell;\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.width = serializationObject.width;\r\n this.height = serializationObject.height;\r\n this.start = serializationObject.start;\r\n this.end = serializationObject.end;\r\n this.spriteCellChangeSpeed = serializationObject.spriteCellChangeSpeed;\r\n this.loop = serializationObject.loop;\r\n this.randomStartCell = serializationObject.randomStartCell;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SetupSpriteSheetBlock\", SetupSpriteSheetBlock);\r\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
|
|
2
|
+
import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
|
|
3
|
+
import { NodeParticleBlock } from "../../nodeParticleBlock.js";
|
|
4
|
+
/**
|
|
5
|
+
* Block used to update the remap value of a particle
|
|
6
|
+
*/
|
|
7
|
+
export declare class UpdateRemapBlock extends NodeParticleBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Create a new UpdateRemapBlock
|
|
10
|
+
* @param name defines the block name
|
|
11
|
+
*/
|
|
12
|
+
constructor(name: string);
|
|
13
|
+
/**
|
|
14
|
+
* Gets the particle component
|
|
15
|
+
*/
|
|
16
|
+
get particle(): NodeParticleConnectionPoint;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the remapColor input component
|
|
19
|
+
*/
|
|
20
|
+
get remapColor(): NodeParticleConnectionPoint;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the remapAlpha input component
|
|
23
|
+
*/
|
|
24
|
+
get remapAlpha(): NodeParticleConnectionPoint;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the output component
|
|
27
|
+
*/
|
|
28
|
+
get output(): NodeParticleConnectionPoint;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the current class name
|
|
31
|
+
* @returns the class name
|
|
32
|
+
*/
|
|
33
|
+
getClassName(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Builds the block
|
|
36
|
+
* @param state defines the current build state
|
|
37
|
+
*/
|
|
38
|
+
_build(state: NodeParticleBuildState): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Vector2, Vector4 } from "../../../../Maths/math.vector.js";
|
|
2
|
+
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
3
|
+
import { NodeParticleBlock } from "../../nodeParticleBlock.js";
|
|
4
|
+
import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
5
|
+
import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
|
|
6
|
+
/**
|
|
7
|
+
* Block used to update the remap value of a particle
|
|
8
|
+
*/
|
|
9
|
+
export class UpdateRemapBlock extends NodeParticleBlock {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new UpdateRemapBlock
|
|
12
|
+
* @param name defines the block name
|
|
13
|
+
*/
|
|
14
|
+
constructor(name) {
|
|
15
|
+
super(name);
|
|
16
|
+
this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
|
|
17
|
+
this.registerInput("remapColor", NodeParticleBlockConnectionPointTypes.Vector2, true);
|
|
18
|
+
this.registerInput("remapAlpha", NodeParticleBlockConnectionPointTypes.Vector2, true);
|
|
19
|
+
this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets the particle component
|
|
23
|
+
*/
|
|
24
|
+
get particle() {
|
|
25
|
+
return this._inputs[0];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the remapColor input component
|
|
29
|
+
*/
|
|
30
|
+
get remapColor() {
|
|
31
|
+
return this._inputs[1];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Gets the remapAlpha input component
|
|
35
|
+
*/
|
|
36
|
+
get remapAlpha() {
|
|
37
|
+
return this._inputs[2];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Gets the output component
|
|
41
|
+
*/
|
|
42
|
+
get output() {
|
|
43
|
+
return this._outputs[0];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the current class name
|
|
47
|
+
* @returns the class name
|
|
48
|
+
*/
|
|
49
|
+
getClassName() {
|
|
50
|
+
return "UpdateRemapBlock";
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Builds the block
|
|
54
|
+
* @param state defines the current build state
|
|
55
|
+
*/
|
|
56
|
+
_build(state) {
|
|
57
|
+
const system = this.particle.getConnectedValue(state);
|
|
58
|
+
this.output._storedValue = system;
|
|
59
|
+
if (!this.remapColor.isConnected && !this.remapAlpha.isConnected) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const processRemap = (particle) => {
|
|
63
|
+
state.particleContext = particle;
|
|
64
|
+
state.systemContext = system;
|
|
65
|
+
const colorRemap = this.remapColor.isConnected ? this.remapColor.getConnectedValue(state) : new Vector2(0, 1);
|
|
66
|
+
const alphaRemap = this.remapAlpha.isConnected ? this.remapAlpha.getConnectedValue(state) : new Vector2(0, 1);
|
|
67
|
+
if (!particle.remapData) {
|
|
68
|
+
particle.remapData = new Vector4(0, 1, 0, 1);
|
|
69
|
+
}
|
|
70
|
+
if (colorRemap) {
|
|
71
|
+
particle.remapData.x = colorRemap.x;
|
|
72
|
+
particle.remapData.y = colorRemap.y;
|
|
73
|
+
}
|
|
74
|
+
if (alphaRemap) {
|
|
75
|
+
particle.remapData.z = alphaRemap.x;
|
|
76
|
+
particle.remapData.w = alphaRemap.y;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const remapProcessing = {
|
|
80
|
+
process: processRemap,
|
|
81
|
+
previousItem: null,
|
|
82
|
+
nextItem: null,
|
|
83
|
+
};
|
|
84
|
+
if (system._updateQueueStart) {
|
|
85
|
+
_ConnectAtTheEnd(remapProcessing, system._updateQueueStart);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
system._updateQueueStart = remapProcessing;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
RegisterClass("BABYLON.UpdateRemapBlock", UpdateRemapBlock);
|
|
93
|
+
//# sourceMappingURL=updateRemapBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateRemapBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateRemapBlock.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO,EAAE,iBAAiB,EAAE,mCAA8C;AAC1E,OAAO,EAAE,qCAAqC,EAAE,6DAAwE;AACxH,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AAEvE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IACnD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,qCAAqC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACa,YAA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BACb,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;gBACpC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;YACxC,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,eAAe,GAAG;YACpB,OAAO,EAAE,YAAY;YACrB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,eAAe,CAAC;QAC/C,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { Vector2, Vector4 } from \"../../../../Maths/math.vector\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to update the remap value of a particle\r\n */\r\nexport class UpdateRemapBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateRemapBlock\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(\"remapColor\", NodeParticleBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"remapAlpha\", NodeParticleBlockConnectionPointTypes.Vector2, true);\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 remapColor input component\r\n */\r\n public get remapColor(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the remapAlpha input component\r\n */\r\n public get remapAlpha(): 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 \"UpdateRemapBlock\";\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\r\n this.output._storedValue = system;\r\n\r\n if (!this.remapColor.isConnected && !this.remapAlpha.isConnected) {\r\n return;\r\n }\r\n\r\n const processRemap = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n\r\n const colorRemap = this.remapColor.isConnected ? (this.remapColor.getConnectedValue(state) as Vector2) : new Vector2(0, 1);\r\n const alphaRemap = this.remapAlpha.isConnected ? (this.remapAlpha.getConnectedValue(state) as Vector2) : new Vector2(0, 1);\r\n\r\n if (!particle.remapData) {\r\n particle.remapData = new Vector4(0, 1, 0, 1);\r\n }\r\n\r\n if (colorRemap) {\r\n particle.remapData.x = colorRemap.x;\r\n particle.remapData.y = colorRemap.y;\r\n }\r\n\r\n if (alphaRemap) {\r\n particle.remapData.z = alphaRemap.x;\r\n particle.remapData.w = alphaRemap.y;\r\n }\r\n };\r\n\r\n const remapProcessing = {\r\n process: processRemap,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(remapProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = remapProcessing;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateRemapBlock\", UpdateRemapBlock);\r\n"]}
|
|
@@ -95,6 +95,10 @@ export declare class SystemBlock extends NodeParticleBlock {
|
|
|
95
95
|
* Gets the onEnd input component
|
|
96
96
|
*/
|
|
97
97
|
get onEnd(): NodeParticleConnectionPoint;
|
|
98
|
+
/**
|
|
99
|
+
* Gets the rampGradient input component
|
|
100
|
+
*/
|
|
101
|
+
get rampGradient(): NodeParticleConnectionPoint;
|
|
98
102
|
/**
|
|
99
103
|
* Gets the system output component
|
|
100
104
|
*/
|
|
@@ -2,11 +2,12 @@ import { __decorate } from "../../../tslib.es6.js";
|
|
|
2
2
|
import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
3
3
|
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
4
4
|
import { Vector2 } from "../../../Maths/math.vector.js";
|
|
5
|
-
import { Color4 } from "../../../Maths/math.color.js";
|
|
5
|
+
import { Color3, Color4 } from "../../../Maths/math.color.js";
|
|
6
6
|
import { BaseParticleSystem } from "../../baseParticleSystem.js";
|
|
7
7
|
import { NodeParticleBlock } from "../nodeParticleBlock.js";
|
|
8
8
|
import { _TriggerSubEmitter } from "./Triggers/triggerTools.js";
|
|
9
9
|
import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
10
|
+
import { ParticleGradientBlock } from "./particleGradientBlock.js";
|
|
10
11
|
/**
|
|
11
12
|
* Block used to get a system of particles
|
|
12
13
|
*/
|
|
@@ -72,6 +73,7 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
72
73
|
this.registerInput("targetStopDuration", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0);
|
|
73
74
|
this.registerInput("onStart", NodeParticleBlockConnectionPointTypes.System, true);
|
|
74
75
|
this.registerInput("onEnd", NodeParticleBlockConnectionPointTypes.System, true);
|
|
76
|
+
this.registerInput("rampGradient", NodeParticleBlockConnectionPointTypes.Color4, true);
|
|
75
77
|
this.registerOutput("system", NodeParticleBlockConnectionPointTypes.System);
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
@@ -129,6 +131,12 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
129
131
|
get onEnd() {
|
|
130
132
|
return this._inputs[7];
|
|
131
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Gets the rampGradient input component
|
|
136
|
+
*/
|
|
137
|
+
get rampGradient() {
|
|
138
|
+
return this._inputs[8];
|
|
139
|
+
}
|
|
132
140
|
/**
|
|
133
141
|
* Gets the system output component
|
|
134
142
|
*/
|
|
@@ -165,6 +173,29 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
165
173
|
state.systemContext = particleSystem;
|
|
166
174
|
return this.emitRate.getConnectedValue(state);
|
|
167
175
|
};
|
|
176
|
+
// Get the ramp gradients
|
|
177
|
+
particleSystem.useRampGradients = false;
|
|
178
|
+
if (this.rampGradient.isConnected) {
|
|
179
|
+
if (this.rampGradient.connectedPoint?.ownerBlock instanceof ParticleGradientBlock) {
|
|
180
|
+
// We have a possible gradient, loop through its entries
|
|
181
|
+
const gradientInputs = this.rampGradient.connectedPoint?.ownerBlock.inputs;
|
|
182
|
+
// Skip the first input which is the gradient selector, and we only care about the gradient values
|
|
183
|
+
for (let i = 1; i < gradientInputs.length; i++) {
|
|
184
|
+
if (gradientInputs[i].isConnected) {
|
|
185
|
+
const rampEntry = gradientInputs[i].connectedPoint?.ownerBlock;
|
|
186
|
+
const color = rampEntry._inputs[0].getConnectedValue(state);
|
|
187
|
+
particleSystem.addRampGradient(rampEntry.reference, new Color3(color.r, color.g, color.b));
|
|
188
|
+
particleSystem.useRampGradients = true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
// We have a single value, add it as ramp gradient
|
|
194
|
+
const color = this.rampGradient.getConnectedValue(state);
|
|
195
|
+
particleSystem.addRampGradient(0, new Color3(color.r, color.g, color.b));
|
|
196
|
+
particleSystem.useRampGradients = true;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
168
199
|
this.system._storedValue = this;
|
|
169
200
|
particleSystem.canStart = () => {
|
|
170
201
|
return !this.doNoStart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,iBAAiB,EAAE,gCAA8C;AAC1E,OAAO,EAAE,kBAAkB,EAAE,mCAAyD;AACtF,OAAO,EAAE,qCAAqC,EAAE,0DAAwE;AAExH;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAkF9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApFhB;;WAEG;QAYI,cAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QAEvD;;WAEG;QAEI,aAAQ,GAAG,IAAI,CAAC;QAEvB;;WAEG;QAEI,oBAAe,GAAG,CAAC,CAAC,CAAC;QAE5B;;WAEG;QAEI,eAAU,GAAG,CAAC,CAAC;QAEtB;;WAEG;QAEI,gBAAW,GAAG,MAAM,CAAC;QAE5B;;WAEG;QAEI,kBAAa,GAAG,CAAC,CAAC;QAEzB;;WAEG;QAEI,sBAAiB,GAAG,CAAC,CAAC;QAE7B;;WAEG;QAEI,qBAAgB,GAAG,IAAI,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,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;qDAC5G;AAMxB;IADN,sBAAsB,CAAC,UAAU,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4CAC1G;AAMhB;IADN,sBAAsB,CAAC,iBAAiB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC3G;AAMtB;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;AAkO7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { _TriggerSubEmitter } from \"core/Particles/Node/Blocks/Triggers/triggerTools\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\n\r\n/**\r\n * Block used to get a system of particles\r\n */\r\nexport class SystemBlock extends NodeParticleBlock {\r\n private static _IdCounter = 0;\r\n\r\n /**\r\n * Gets or sets the blend mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Blend mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"MultiplyAdd\", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },\r\n ],\r\n })\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Gets or sets the epsilon value used for comparison\r\n */\r\n @editableInPropertyPage(\"Capacity\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 10000 })\r\n public capacity = 1000;\r\n\r\n /**\r\n * Gets or sets the manual emit count\r\n */\r\n @editableInPropertyPage(\"Manual emit count\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: -1 })\r\n public manualEmitCount = -1;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Delay start(ms)\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"updateSpeed\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 0.1 })\r\n public updateSpeed = 0.0167;\r\n\r\n /**\r\n * Gets or sets the number of pre-warm cycles before rendering the particle system\r\n */\r\n @editableInPropertyPage(\"Pre-warm cycles\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmCycles = 0;\r\n\r\n /**\r\n * Gets or sets the time step multiplier used for pre-warm\r\n */\r\n @editableInPropertyPage(\"Pre-warm step multiplier\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmStepOffset = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system is billboard based\r\n */\r\n @editableInPropertyPage(\"Is billboard based\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isBillboardBased = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system coordinate space is local or global\r\n */\r\n @editableInPropertyPage(\"Is local\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isLocal = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should be disposed when stopped\r\n */\r\n @editableInPropertyPage(\"Dispose on stop\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public disposeOnStop = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should not start automatically\r\n */\r\n @editableInPropertyPage(\"Do no start\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public doNoStart = false;\r\n\r\n /** @internal */\r\n public _internalId = SystemBlock._IdCounter++;\r\n\r\n /**\r\n * Create a new SystemBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this._isSystem = true;\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"emitRate\", NodeParticleBlockConnectionPointTypes.Int, true, 10, 0);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"translationPivot\", NodeParticleBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"textureMask\", NodeParticleBlockConnectionPointTypes.Color4, true);\r\n this.registerInput(\"targetStopDuration\", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0);\r\n this.registerInput(\"onStart\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"onEnd\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerOutput(\"system\", NodeParticleBlockConnectionPointTypes.System);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"SystemBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the emitRate input component\r\n */\r\n public get emitRate(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the texture input component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the translationPivot input component\r\n */\r\n public get translationPivot(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the textureMask input component\r\n */\r\n public get textureMask(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the targetStopDuration input component\r\n */\r\n public get targetStopDuration(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the onStart input component\r\n */\r\n public get onStart(): NodeParticleConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the onEnd input component\r\n */\r\n public get onEnd(): NodeParticleConnectionPoint {\r\n return this._inputs[7];\r\n }\r\n\r\n /**\r\n * Gets the system output component\r\n */\r\n public get system(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Builds the block and return a functional particle system\r\n * @param state defines the building state\r\n * @returns the built particle system\r\n */\r\n public createSystem(state: NodeParticleBuildState): ParticleSystem {\r\n state.capacity = this.capacity;\r\n state.buildId = this._buildId++;\r\n\r\n this.build(state);\r\n\r\n const particleSystem = this.particle.getConnectedValue(state) as ParticleSystem;\r\n particleSystem.particleTexture = this.texture.getConnectedValue(state);\r\n particleSystem.emitRate = this.emitRate.getConnectedValue(state) as number;\r\n particleSystem.manualEmitCount = this.manualEmitCount;\r\n particleSystem.updateSpeed = this.updateSpeed;\r\n particleSystem.preWarmCycles = this.preWarmCycles;\r\n particleSystem.preWarmStepOffset = this.preWarmStepOffset;\r\n particleSystem.blendMode = this.blendMode;\r\n particleSystem.name = this.name;\r\n particleSystem._targetStopDuration = (this.targetStopDuration.getConnectedValue(state) as number) ?? 0;\r\n particleSystem.startDelay = this.startDelay;\r\n particleSystem.isBillboardBased = this.isBillboardBased;\r\n particleSystem.translationPivot = (this.translationPivot.getConnectedValue(state) as Vector2) || Vector2.Zero();\r\n particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n particleSystem.isLocal = this.isLocal;\r\n particleSystem.disposeOnStop = this.disposeOnStop;\r\n\r\n // The emit rate can vary if it is connected to another block like a gradient\r\n particleSystem._calculateEmitRate = () => {\r\n state.systemContext = particleSystem;\r\n return this.emitRate.getConnectedValue(state) as number;\r\n };\r\n\r\n this.system._storedValue = this;\r\n\r\n particleSystem.canStart = () => {\r\n return !this.doNoStart;\r\n };\r\n\r\n particleSystem.onStartedObservable.add((system) => {\r\n // Triggers\r\n const onStartSystem = this.onStart.getConnectedValue(state);\r\n if (onStartSystem) {\r\n system.onStartedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onStartSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n\r\n const onEndSystem = this.onEnd.getConnectedValue(state);\r\n if (onEndSystem) {\r\n system.onStoppedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onEndSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n particleSystem.dispose();\r\n });\r\n\r\n // Return\r\n return particleSystem;\r\n }\r\n\r\n /**\r\n * Serializes the system block\r\n * @returns The serialized object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.capacity = this.capacity;\r\n serializationObject.manualEmitCount = this.manualEmitCount;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.updateSpeed = this.updateSpeed;\r\n serializationObject.preWarmCycles = this.preWarmCycles;\r\n serializationObject.preWarmStepOffset = this.preWarmStepOffset;\r\n serializationObject.isBillboardBased = this.isBillboardBased;\r\n serializationObject.isLocal = this.isLocal;\r\n serializationObject.disposeOnStop = this.disposeOnStop;\r\n serializationObject.doNoStart = this.doNoStart;\r\n serializationObject.startDelay = this.startDelay;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes the system block\r\n * @param serializationObject The serialized system\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.capacity = serializationObject.capacity;\r\n this.manualEmitCount = serializationObject.manualEmitCount ?? -1;\r\n this.updateSpeed = serializationObject.updateSpeed ?? 0.0167;\r\n this.preWarmCycles = serializationObject.preWarmCycles ?? 0;\r\n this.preWarmStepOffset = serializationObject.preWarmStepOffset ?? 0;\r\n this.isBillboardBased = serializationObject.isBillboardBased ?? true;\r\n this.isLocal = serializationObject.isLocal ?? false;\r\n this.disposeOnStop = serializationObject.disposeOnStop ?? false;\r\n this.doNoStart = !!serializationObject.doNoStart;\r\n\r\n if (serializationObject.emitRate !== undefined) {\r\n this.emitRate.value = serializationObject.emitRate;\r\n }\r\n\r\n if (serializationObject.blendMode !== undefined) {\r\n this.blendMode = serializationObject.blendMode;\r\n }\r\n\r\n if (serializationObject.startDelay !== undefined) {\r\n this.startDelay = serializationObject.startDelay;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SystemBlock\", SystemBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,qCAA8B;AACvD,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,iBAAiB,EAAE,gCAA8C;AAC1E,OAAO,EAAE,kBAAkB,EAAE,mCAAyD;AACtF,OAAO,EAAE,qCAAqC,EAAE,0DAAwE;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAkF9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApFhB;;WAEG;QAYI,cAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QAEvD;;WAEG;QAEI,aAAQ,GAAG,IAAI,CAAC;QAEvB;;WAEG;QAEI,oBAAe,GAAG,CAAC,CAAC,CAAC;QAE5B;;WAEG;QAEI,eAAU,GAAG,CAAC,CAAC;QAEtB;;WAEG;QAEI,gBAAW,GAAG,MAAM,CAAC;QAE5B;;WAEG;QAEI,kBAAa,GAAG,CAAC,CAAC;QAEzB;;WAEG;QAEI,sBAAiB,GAAG,CAAC,CAAC;QAE7B;;WAEG;QAEI,qBAAgB,GAAG,IAAI,CAAC;QAE/B;;WAEG;QAEI,YAAO,GAAG,KAAK,CAAC;QAEvB;;WAEG;QAEI,kBAAa,GAAG,KAAK,CAAC;QAE7B;;WAEG;QAEI,cAAS,GAAG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B;IADN,sBAAsB,CAAC,oBAAoB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;qDAC5G;AAMxB;IADN,sBAAsB,CAAC,UAAU,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4CAC1G;AAMhB;IADN,sBAAsB,CAAC,iBAAiB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC3G;AAMtB;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;AAkQ7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\nimport type { ParticleGradientValueBlock } from \"./particleGradientValueBlock\";\r\n\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { _TriggerSubEmitter } from \"core/Particles/Node/Blocks/Triggers/triggerTools\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { ParticleGradientBlock } from \"./particleGradientBlock\";\r\n\r\n/**\r\n * Block used to get a system of particles\r\n */\r\nexport class SystemBlock extends NodeParticleBlock {\r\n private static _IdCounter = 0;\r\n\r\n /**\r\n * Gets or sets the blend mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Blend mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"MultiplyAdd\", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },\r\n ],\r\n })\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Gets or sets the epsilon value used for comparison\r\n */\r\n @editableInPropertyPage(\"Capacity\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 10000 })\r\n public capacity = 1000;\r\n\r\n /**\r\n * Gets or sets the manual emit count\r\n */\r\n @editableInPropertyPage(\"Manual emit count\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: -1 })\r\n public manualEmitCount = -1;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Delay start(ms)\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"updateSpeed\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 0.1 })\r\n public updateSpeed = 0.0167;\r\n\r\n /**\r\n * Gets or sets the number of pre-warm cycles before rendering the particle system\r\n */\r\n @editableInPropertyPage(\"Pre-warm cycles\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmCycles = 0;\r\n\r\n /**\r\n * Gets or sets the time step multiplier used for pre-warm\r\n */\r\n @editableInPropertyPage(\"Pre-warm step multiplier\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmStepOffset = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system is billboard based\r\n */\r\n @editableInPropertyPage(\"Is billboard based\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isBillboardBased = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system coordinate space is local or global\r\n */\r\n @editableInPropertyPage(\"Is local\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isLocal = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should be disposed when stopped\r\n */\r\n @editableInPropertyPage(\"Dispose on stop\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public disposeOnStop = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should not start automatically\r\n */\r\n @editableInPropertyPage(\"Do no start\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public doNoStart = false;\r\n\r\n /** @internal */\r\n public _internalId = SystemBlock._IdCounter++;\r\n\r\n /**\r\n * Create a new SystemBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this._isSystem = true;\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"emitRate\", NodeParticleBlockConnectionPointTypes.Int, true, 10, 0);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"translationPivot\", NodeParticleBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"textureMask\", NodeParticleBlockConnectionPointTypes.Color4, true);\r\n this.registerInput(\"targetStopDuration\", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0);\r\n this.registerInput(\"onStart\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"onEnd\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"rampGradient\", NodeParticleBlockConnectionPointTypes.Color4, true);\r\n this.registerOutput(\"system\", NodeParticleBlockConnectionPointTypes.System);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"SystemBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the emitRate input component\r\n */\r\n public get emitRate(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the texture input component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the translationPivot input component\r\n */\r\n public get translationPivot(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the textureMask input component\r\n */\r\n public get textureMask(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the targetStopDuration input component\r\n */\r\n public get targetStopDuration(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the onStart input component\r\n */\r\n public get onStart(): NodeParticleConnectionPoint {\r\n return this._inputs[6];\r\n }\r\n\r\n /**\r\n * Gets the onEnd input component\r\n */\r\n public get onEnd(): NodeParticleConnectionPoint {\r\n return this._inputs[7];\r\n }\r\n\r\n /**\r\n * Gets the rampGradient input component\r\n */\r\n public get rampGradient(): NodeParticleConnectionPoint {\r\n return this._inputs[8];\r\n }\r\n\r\n /**\r\n * Gets the system output component\r\n */\r\n public get system(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Builds the block and return a functional particle system\r\n * @param state defines the building state\r\n * @returns the built particle system\r\n */\r\n public createSystem(state: NodeParticleBuildState): ParticleSystem {\r\n state.capacity = this.capacity;\r\n state.buildId = this._buildId++;\r\n\r\n this.build(state);\r\n\r\n const particleSystem = this.particle.getConnectedValue(state) as ParticleSystem;\r\n particleSystem.particleTexture = this.texture.getConnectedValue(state);\r\n particleSystem.emitRate = this.emitRate.getConnectedValue(state) as number;\r\n particleSystem.manualEmitCount = this.manualEmitCount;\r\n particleSystem.updateSpeed = this.updateSpeed;\r\n particleSystem.preWarmCycles = this.preWarmCycles;\r\n particleSystem.preWarmStepOffset = this.preWarmStepOffset;\r\n particleSystem.blendMode = this.blendMode;\r\n particleSystem.name = this.name;\r\n particleSystem._targetStopDuration = (this.targetStopDuration.getConnectedValue(state) as number) ?? 0;\r\n particleSystem.startDelay = this.startDelay;\r\n particleSystem.isBillboardBased = this.isBillboardBased;\r\n particleSystem.translationPivot = (this.translationPivot.getConnectedValue(state) as Vector2) || Vector2.Zero();\r\n particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n particleSystem.isLocal = this.isLocal;\r\n particleSystem.disposeOnStop = this.disposeOnStop;\r\n\r\n // The emit rate can vary if it is connected to another block like a gradient\r\n particleSystem._calculateEmitRate = () => {\r\n state.systemContext = particleSystem;\r\n return this.emitRate.getConnectedValue(state) as number;\r\n };\r\n\r\n // Get the ramp gradients\r\n particleSystem.useRampGradients = false;\r\n if (this.rampGradient.isConnected) {\r\n if (this.rampGradient.connectedPoint?.ownerBlock instanceof ParticleGradientBlock) {\r\n // We have a possible gradient, loop through its entries\r\n const gradientInputs = this.rampGradient.connectedPoint?.ownerBlock.inputs;\r\n\r\n // Skip the first input which is the gradient selector, and we only care about the gradient values\r\n for (let i = 1; i < gradientInputs.length; i++) {\r\n if (gradientInputs[i].isConnected) {\r\n const rampEntry = gradientInputs[i].connectedPoint?.ownerBlock as ParticleGradientValueBlock;\r\n const color = rampEntry._inputs[0].getConnectedValue(state) as Color4;\r\n particleSystem.addRampGradient(rampEntry.reference, new Color3(color.r, color.g, color.b));\r\n particleSystem.useRampGradients = true;\r\n }\r\n }\r\n } else {\r\n // We have a single value, add it as ramp gradient\r\n const color = this.rampGradient.getConnectedValue(state) as Color4;\r\n particleSystem.addRampGradient(0, new Color3(color.r, color.g, color.b));\r\n particleSystem.useRampGradients = true;\r\n }\r\n }\r\n\r\n this.system._storedValue = this;\r\n\r\n particleSystem.canStart = () => {\r\n return !this.doNoStart;\r\n };\r\n\r\n particleSystem.onStartedObservable.add((system) => {\r\n // Triggers\r\n const onStartSystem = this.onStart.getConnectedValue(state);\r\n if (onStartSystem) {\r\n system.onStartedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onStartSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n\r\n const onEndSystem = this.onEnd.getConnectedValue(state);\r\n if (onEndSystem) {\r\n system.onStoppedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onEndSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n particleSystem.dispose();\r\n });\r\n\r\n // Return\r\n return particleSystem;\r\n }\r\n\r\n /**\r\n * Serializes the system block\r\n * @returns The serialized object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.capacity = this.capacity;\r\n serializationObject.manualEmitCount = this.manualEmitCount;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.updateSpeed = this.updateSpeed;\r\n serializationObject.preWarmCycles = this.preWarmCycles;\r\n serializationObject.preWarmStepOffset = this.preWarmStepOffset;\r\n serializationObject.isBillboardBased = this.isBillboardBased;\r\n serializationObject.isLocal = this.isLocal;\r\n serializationObject.disposeOnStop = this.disposeOnStop;\r\n serializationObject.doNoStart = this.doNoStart;\r\n serializationObject.startDelay = this.startDelay;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes the system block\r\n * @param serializationObject The serialized system\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.capacity = serializationObject.capacity;\r\n this.manualEmitCount = serializationObject.manualEmitCount ?? -1;\r\n this.updateSpeed = serializationObject.updateSpeed ?? 0.0167;\r\n this.preWarmCycles = serializationObject.preWarmCycles ?? 0;\r\n this.preWarmStepOffset = serializationObject.preWarmStepOffset ?? 0;\r\n this.isBillboardBased = serializationObject.isBillboardBased ?? true;\r\n this.isLocal = serializationObject.isLocal ?? false;\r\n this.disposeOnStop = serializationObject.disposeOnStop ?? false;\r\n this.doNoStart = !!serializationObject.doNoStart;\r\n\r\n if (serializationObject.emitRate !== undefined) {\r\n this.emitRate.value = serializationObject.emitRate;\r\n }\r\n\r\n if (serializationObject.blendMode !== undefined) {\r\n this.blendMode = serializationObject.blendMode;\r\n }\r\n\r\n if (serializationObject.startDelay !== undefined) {\r\n this.startDelay = serializationObject.startDelay;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SystemBlock\", SystemBlock);\r\n"]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Color4 } from "../../Maths/math.color.js";
|
|
1
2
|
import { Vector2, Vector3 } from "../../Maths/math.vector.js";
|
|
3
|
+
import { FactorGradient } from "../../Misc/gradients.js";
|
|
4
|
+
import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
2
5
|
import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
|
|
3
6
|
import { NodeParticleContextualSources } from "./Enums/nodeParticleContextualSources.js";
|
|
4
7
|
import { NodeParticleSystemSources } from "./Enums/nodeParticleSystemSources.js";
|
|
@@ -29,6 +32,7 @@ import { UpdateDirectionBlock } from "./Blocks/Update/updateDirectionBlock.js";
|
|
|
29
32
|
import { UpdateNoiseBlock } from "./Blocks/Update/updateNoiseBlock.js";
|
|
30
33
|
import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
|
|
31
34
|
import { UpdateSizeBlock } from "./Blocks/Update/updateSizeBlock.js";
|
|
35
|
+
import { UpdateRemapBlock } from "./Blocks/Update/updateRemapBlock.js";
|
|
32
36
|
/**
|
|
33
37
|
* Converts a ParticleSystem to a NodeParticleSystemSet.
|
|
34
38
|
* @param name The name of the node particle system set.
|
|
@@ -338,6 +342,7 @@ function _SpriteSheetBlock(particle, oldSystem) {
|
|
|
338
342
|
spriteSheetBlock.end = oldSystem.endSpriteCellID;
|
|
339
343
|
spriteSheetBlock.width = oldSystem.spriteCellWidth;
|
|
340
344
|
spriteSheetBlock.height = oldSystem.spriteCellHeight;
|
|
345
|
+
spriteSheetBlock.spriteCellChangeSpeed = oldSystem.spriteCellChangeSpeed;
|
|
341
346
|
spriteSheetBlock.loop = oldSystem.spriteCellLoop;
|
|
342
347
|
spriteSheetBlock.randomStartCell = oldSystem.spriteRandomStartCell;
|
|
343
348
|
return spriteSheetBlock.output;
|
|
@@ -375,6 +380,9 @@ function _UpdateParticleBlockGroup(inputParticle, oldSystem, context) {
|
|
|
375
380
|
if (oldSystem.gravity.equalsToFloats(0, 0, 0) === false) {
|
|
376
381
|
updatedParticle = _UpdateParticleGravityBlockGroup(updatedParticle, oldSystem.gravity);
|
|
377
382
|
}
|
|
383
|
+
if (oldSystem.useRampGradients) {
|
|
384
|
+
updatedParticle = _UpdateParticleRemapGradientBlockGroup(updatedParticle, oldSystem.getColorRemapGradients(), oldSystem.getAlphaRemapGradients(), context);
|
|
385
|
+
}
|
|
378
386
|
if (oldSystem.isAnimationSheetEnabled) {
|
|
379
387
|
updatedParticle = _UpdateParticleSpriteCellBlockGroup(updatedParticle);
|
|
380
388
|
}
|
|
@@ -616,6 +624,71 @@ function _UpdateParticleGravityBlockGroup(inputParticle, gravity) {
|
|
|
616
624
|
addDirectionBlock.output.connectTo(updateDirection.direction);
|
|
617
625
|
return updateDirection.output;
|
|
618
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* Creates the group of blocks that represent the color and alpha remap update
|
|
629
|
+
* @param inputParticle The input particle to update
|
|
630
|
+
* @param colorRemapGradients The color remap gradients
|
|
631
|
+
* @param alphaRemapGradients The alpha remap gradients
|
|
632
|
+
* @param context The context of the current conversion
|
|
633
|
+
* @returns The ouput of the group of blocks that represent the particle remap update
|
|
634
|
+
*/
|
|
635
|
+
function _UpdateParticleRemapGradientBlockGroup(inputParticle, colorRemapGradients, alphaRemapGradients, context) {
|
|
636
|
+
let hasUpdate = false;
|
|
637
|
+
const remapUpdateBlock = new UpdateRemapBlock("Remap Update");
|
|
638
|
+
if (colorRemapGradients && colorRemapGradients.length > 0) {
|
|
639
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
640
|
+
// Split the color gradient into factor1 and factor2 gradients
|
|
641
|
+
const colorFactor1Gradients = [];
|
|
642
|
+
const colorFactor2Gradients = [];
|
|
643
|
+
for (let i = 0; i < colorRemapGradients.length; i++) {
|
|
644
|
+
const gradientValue = colorRemapGradients[i];
|
|
645
|
+
colorFactor1Gradients.push(new FactorGradient(gradientValue.gradient, gradientValue.factor1));
|
|
646
|
+
colorFactor2Gradients.push(new FactorGradient(gradientValue.gradient, gradientValue.factor2));
|
|
647
|
+
}
|
|
648
|
+
// Generate the gradient
|
|
649
|
+
const colorFactor1BlockGroup = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, colorFactor1Gradients, ParticleRandomBlockLocks.OncePerParticle, "Color Min");
|
|
650
|
+
// Generate the gradient
|
|
651
|
+
const colorFactor2BlockGroup = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, colorFactor2Gradients, ParticleRandomBlockLocks.OncePerParticle, "Color Max");
|
|
652
|
+
const substractBlock = new ParticleMathBlock("Color Max - Min");
|
|
653
|
+
substractBlock.operation = ParticleMathBlockOperations.Subtract;
|
|
654
|
+
colorFactor2BlockGroup.connectTo(substractBlock.left);
|
|
655
|
+
colorFactor1BlockGroup.connectTo(substractBlock.right);
|
|
656
|
+
const colorConverterBlock = new ParticleConverterBlock("Color Remap Converter");
|
|
657
|
+
colorFactor1BlockGroup.connectTo(colorConverterBlock.xIn);
|
|
658
|
+
substractBlock.output.connectTo(colorConverterBlock.yIn);
|
|
659
|
+
colorConverterBlock.xyOut.connectTo(remapUpdateBlock.remapColor);
|
|
660
|
+
hasUpdate = true;
|
|
661
|
+
}
|
|
662
|
+
if (alphaRemapGradients && alphaRemapGradients.length > 0) {
|
|
663
|
+
context.ageToLifeTimeRatioBlockGroupOutput = _CreateAgeToLifeTimeRatioBlockGroup(context);
|
|
664
|
+
// Split the color gradient into factor1 and factor2 gradients
|
|
665
|
+
const alphaFactor1Gradients = [];
|
|
666
|
+
const alphaFactor2Gradients = [];
|
|
667
|
+
for (let i = 0; i < alphaRemapGradients.length; i++) {
|
|
668
|
+
const gradientValue = alphaRemapGradients[i];
|
|
669
|
+
alphaFactor1Gradients.push(new FactorGradient(gradientValue.gradient, gradientValue.factor1));
|
|
670
|
+
alphaFactor2Gradients.push(new FactorGradient(gradientValue.gradient, gradientValue.factor2));
|
|
671
|
+
}
|
|
672
|
+
// Generate the gradient
|
|
673
|
+
const alphaFactor1BlockGroup = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, alphaFactor1Gradients, ParticleRandomBlockLocks.OncePerParticle, "Alpha Min");
|
|
674
|
+
// Generate the gradient
|
|
675
|
+
const alphaFactor2BlockGroup = _CreateGradientBlockGroup(context.ageToLifeTimeRatioBlockGroupOutput, alphaFactor2Gradients, ParticleRandomBlockLocks.OncePerParticle, "Alpha Max");
|
|
676
|
+
const substractBlock = new ParticleMathBlock("Alpha Max - Min");
|
|
677
|
+
substractBlock.operation = ParticleMathBlockOperations.Subtract;
|
|
678
|
+
alphaFactor2BlockGroup.connectTo(substractBlock.left);
|
|
679
|
+
alphaFactor1BlockGroup.connectTo(substractBlock.right);
|
|
680
|
+
const alphaConverterBlock = new ParticleConverterBlock("Alpha Remap Converter");
|
|
681
|
+
alphaFactor1BlockGroup.connectTo(alphaConverterBlock.xIn);
|
|
682
|
+
substractBlock.output.connectTo(alphaConverterBlock.yIn);
|
|
683
|
+
alphaConverterBlock.xyOut.connectTo(remapUpdateBlock.remapAlpha);
|
|
684
|
+
hasUpdate = true;
|
|
685
|
+
}
|
|
686
|
+
if (hasUpdate) {
|
|
687
|
+
inputParticle.connectTo(remapUpdateBlock.particle);
|
|
688
|
+
return remapUpdateBlock.output;
|
|
689
|
+
}
|
|
690
|
+
return inputParticle;
|
|
691
|
+
}
|
|
619
692
|
/**
|
|
620
693
|
* Creates the group of blocks that represent the particle sprite cell update
|
|
621
694
|
* @param inputParticle The input particle to update
|
|
@@ -683,6 +756,10 @@ function _SystemBlockGroup(updateParticleOutput, oldSystem, context) {
|
|
|
683
756
|
_CreateTextureBlock(texture).connectTo(newSystem.texture);
|
|
684
757
|
}
|
|
685
758
|
_SystemTargetStopDuration(oldSystem.targetStopDuration, newSystem, context);
|
|
759
|
+
const rampGradients = oldSystem.getRampGradients();
|
|
760
|
+
if (rampGradients && rampGradients.length > 0) {
|
|
761
|
+
_SystemRampGradientsBlockGroup(rampGradients, newSystem);
|
|
762
|
+
}
|
|
686
763
|
updateParticleOutput.connectTo(newSystem.particle);
|
|
687
764
|
return newSystem;
|
|
688
765
|
}
|
|
@@ -712,6 +789,17 @@ function _SystemTargetStopDuration(targetStopDuration, newSystem, context) {
|
|
|
712
789
|
newSystem.targetStopDuration.value = targetStopDuration;
|
|
713
790
|
}
|
|
714
791
|
}
|
|
792
|
+
function _SystemRampGradientsBlockGroup(rampGradients, newSystem) {
|
|
793
|
+
const gradientBlock = new ParticleGradientBlock("Ramp Gradient Block");
|
|
794
|
+
for (let i = 0; i < rampGradients.length; i++) {
|
|
795
|
+
const rampGradient = rampGradients[i];
|
|
796
|
+
const gradientValueBlock = new ParticleGradientValueBlock(`Ramp Gradient ${i}`);
|
|
797
|
+
gradientValueBlock.reference = rampGradient.gradient;
|
|
798
|
+
_CreateAndConnectInput(`Color ${i}`, new Color4(rampGradient.color.r, rampGradient.color.g, rampGradient.color.b), gradientValueBlock.value, NodeParticleBlockConnectionPointTypes.Color4);
|
|
799
|
+
gradientValueBlock.output.connectTo(gradientBlock.inputs[i + 1]);
|
|
800
|
+
}
|
|
801
|
+
gradientBlock.output.connectTo(newSystem.rampGradient);
|
|
802
|
+
}
|
|
715
803
|
// ------------- UTILITY FUNCTIONS -------------
|
|
716
804
|
function _CreateDeltaModifiedInput(name, value) {
|
|
717
805
|
const multiplyBlock = new ParticleMathBlock("Multiply by Delta");
|