@onerjs/core 8.31.5 → 8.31.6
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/Animations/animation.d.ts +2 -1
- package/Animations/animation.js +3 -3
- package/Animations/animation.js.map +1 -1
- package/Behaviors/Cameras/interpolatingBehavior.js +10 -3
- package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js +2 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.js +3 -5
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +10 -0
- package/Cameras/geospatialCamera.js +25 -3
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +1 -0
- package/Cameras/geospatialCameraMovement.js +36 -0
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Particles/Node/Blocks/index.d.ts +1 -0
- package/Particles/Node/Blocks/index.js +1 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleFloatToIntBlock.d.ts +46 -0
- package/Particles/Node/Blocks/particleFloatToIntBlock.js +120 -0
- package/Particles/Node/Blocks/particleFloatToIntBlock.js.map +1 -0
- package/Particles/Node/Blocks/systemBlock.d.ts +4 -4
- package/Particles/Node/Blocks/systemBlock.js +22 -16
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.js +1 -1
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +61 -30
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +6 -0
- package/Particles/thinParticleSystem.js +21 -12
- package/Particles/thinParticleSystem.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-restricted-imports */
|
|
2
2
|
export * from "./systemBlock.js";
|
|
3
|
+
export * from "./particleFloatToIntBlock.js";
|
|
3
4
|
export * from "./particleInputBlock.js";
|
|
4
5
|
export * from "./particleSourceTextureBlock.js";
|
|
5
6
|
export * from "./particleMathBlock.js";
|
|
@@ -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,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+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","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\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/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\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+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","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/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\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 FloatToInt block
|
|
6
|
+
*/
|
|
7
|
+
export declare enum ParticleFloatToIntBlockOperations {
|
|
8
|
+
/** Round */
|
|
9
|
+
Round = 0,
|
|
10
|
+
/** Ceil */
|
|
11
|
+
Ceil = 1,
|
|
12
|
+
/** Floor */
|
|
13
|
+
Floor = 2,
|
|
14
|
+
/** Truncate */
|
|
15
|
+
Truncate = 3
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Block used to transform a float to an int
|
|
19
|
+
*/
|
|
20
|
+
export declare class ParticleFloatToIntBlock extends NodeParticleBlock {
|
|
21
|
+
/**
|
|
22
|
+
* Gets or sets the operation applied by the block
|
|
23
|
+
*/
|
|
24
|
+
operation: ParticleFloatToIntBlockOperations;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new ParticleFloatToIntBlock
|
|
27
|
+
* @param name defines the block name
|
|
28
|
+
*/
|
|
29
|
+
constructor(name: string);
|
|
30
|
+
/**
|
|
31
|
+
* Gets the current class name
|
|
32
|
+
* @returns the class name
|
|
33
|
+
*/
|
|
34
|
+
getClassName(): string;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the input component
|
|
37
|
+
*/
|
|
38
|
+
get input(): NodeParticleConnectionPoint;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the output component
|
|
41
|
+
*/
|
|
42
|
+
get output(): NodeParticleConnectionPoint;
|
|
43
|
+
_build(state: NodeParticleBuildState): void;
|
|
44
|
+
serialize(): any;
|
|
45
|
+
_deserialize(serializationObject: any): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { __decorate } from "../../../tslib.es6.js";
|
|
2
|
+
import { RegisterClass } from "../../../Misc/typeStore.js";
|
|
3
|
+
import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
|
|
4
|
+
import { NodeParticleBlock } from "../nodeParticleBlock.js";
|
|
5
|
+
import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
6
|
+
/**
|
|
7
|
+
* Operations supported by the FloatToInt block
|
|
8
|
+
*/
|
|
9
|
+
export var ParticleFloatToIntBlockOperations;
|
|
10
|
+
(function (ParticleFloatToIntBlockOperations) {
|
|
11
|
+
/** Round */
|
|
12
|
+
ParticleFloatToIntBlockOperations[ParticleFloatToIntBlockOperations["Round"] = 0] = "Round";
|
|
13
|
+
/** Ceil */
|
|
14
|
+
ParticleFloatToIntBlockOperations[ParticleFloatToIntBlockOperations["Ceil"] = 1] = "Ceil";
|
|
15
|
+
/** Floor */
|
|
16
|
+
ParticleFloatToIntBlockOperations[ParticleFloatToIntBlockOperations["Floor"] = 2] = "Floor";
|
|
17
|
+
/** Truncate */
|
|
18
|
+
ParticleFloatToIntBlockOperations[ParticleFloatToIntBlockOperations["Truncate"] = 3] = "Truncate";
|
|
19
|
+
})(ParticleFloatToIntBlockOperations || (ParticleFloatToIntBlockOperations = {}));
|
|
20
|
+
/**
|
|
21
|
+
* Block used to transform a float to an int
|
|
22
|
+
*/
|
|
23
|
+
export class ParticleFloatToIntBlock extends NodeParticleBlock {
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new ParticleFloatToIntBlock
|
|
26
|
+
* @param name defines the block name
|
|
27
|
+
*/
|
|
28
|
+
constructor(name) {
|
|
29
|
+
super(name);
|
|
30
|
+
/**
|
|
31
|
+
* Gets or sets the operation applied by the block
|
|
32
|
+
*/
|
|
33
|
+
this.operation = ParticleFloatToIntBlockOperations.Round;
|
|
34
|
+
this.registerInput("input", NodeParticleBlockConnectionPointTypes.AutoDetect);
|
|
35
|
+
this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Int);
|
|
36
|
+
this._outputs[0]._typeConnectionSource = this._inputs[0];
|
|
37
|
+
this._inputs[0].addExcludedConnectionPointFromAllowedTypes(NodeParticleBlockConnectionPointTypes.Float | NodeParticleBlockConnectionPointTypes.Int);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Gets the current class name
|
|
41
|
+
* @returns the class name
|
|
42
|
+
*/
|
|
43
|
+
getClassName() {
|
|
44
|
+
return "ParticleFloatToIntBlock";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets the input component
|
|
48
|
+
*/
|
|
49
|
+
get input() {
|
|
50
|
+
return this._inputs[0];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets the output component
|
|
54
|
+
*/
|
|
55
|
+
get output() {
|
|
56
|
+
return this._outputs[0];
|
|
57
|
+
}
|
|
58
|
+
_build(state) {
|
|
59
|
+
super._build(state);
|
|
60
|
+
let func = null;
|
|
61
|
+
const input = this.input;
|
|
62
|
+
switch (this.operation) {
|
|
63
|
+
case ParticleFloatToIntBlockOperations.Round: {
|
|
64
|
+
func = (state) => {
|
|
65
|
+
return Math.round(input.getConnectedValue(state));
|
|
66
|
+
};
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
case ParticleFloatToIntBlockOperations.Ceil: {
|
|
70
|
+
func = (state) => {
|
|
71
|
+
return Math.ceil(input.getConnectedValue(state));
|
|
72
|
+
};
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case ParticleFloatToIntBlockOperations.Floor: {
|
|
76
|
+
func = (state) => {
|
|
77
|
+
return Math.floor(input.getConnectedValue(state));
|
|
78
|
+
};
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case ParticleFloatToIntBlockOperations.Truncate: {
|
|
82
|
+
func = (state) => {
|
|
83
|
+
return Math.trunc(input.getConnectedValue(state));
|
|
84
|
+
};
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (!func) {
|
|
89
|
+
this.output._storedFunction = null;
|
|
90
|
+
this.output._storedValue = null;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.output._storedFunction = (state) => {
|
|
94
|
+
return func(state);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
serialize() {
|
|
98
|
+
const serializationObject = super.serialize();
|
|
99
|
+
serializationObject.operation = this.operation;
|
|
100
|
+
return serializationObject;
|
|
101
|
+
}
|
|
102
|
+
_deserialize(serializationObject) {
|
|
103
|
+
super._deserialize(serializationObject);
|
|
104
|
+
this.operation = serializationObject.operation;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
__decorate([
|
|
108
|
+
editableInPropertyPage("Operation", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
|
|
109
|
+
notifiers: { rebuild: true },
|
|
110
|
+
embedded: true,
|
|
111
|
+
options: [
|
|
112
|
+
{ label: "Round", value: ParticleFloatToIntBlockOperations.Round },
|
|
113
|
+
{ label: "Ceil", value: ParticleFloatToIntBlockOperations.Ceil },
|
|
114
|
+
{ label: "Floor", value: ParticleFloatToIntBlockOperations.Floor },
|
|
115
|
+
{ label: "Truncate", value: ParticleFloatToIntBlockOperations.Truncate },
|
|
116
|
+
],
|
|
117
|
+
})
|
|
118
|
+
], ParticleFloatToIntBlock.prototype, "operation", void 0);
|
|
119
|
+
RegisterClass("BABYLON.ParticleFloatToIntBlock", ParticleFloatToIntBlock);
|
|
120
|
+
//# sourceMappingURL=particleFloatToIntBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"particleFloatToIntBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleFloatToIntBlock.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,gCAA8C;AAC1E,OAAO,EAAE,qCAAqC,EAAE,0DAAwE;AAExH;;GAEG;AACH,MAAM,CAAN,IAAY,iCASX;AATD,WAAY,iCAAiC;IACzC,YAAY;IACZ,2FAAK,CAAA;IACL,WAAW;IACX,yFAAI,CAAA;IACJ,YAAY;IACZ,2FAAK,CAAA;IACL,eAAe;IACf,iGAAQ,CAAA;AACZ,CAAC,EATW,iCAAiC,KAAjC,iCAAiC,QAS5C;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAgB1D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApBhB;;WAEG;QAWI,cAAS,GAAG,iCAAiC,CAAC,KAAK,CAAC;QASvD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAA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E,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,iCAAiC,CAAC,KAAK,EAAE;YAClE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,iCAAiC,CAAC,IAAI,EAAE;YAChE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,iCAAiC,CAAC,KAAK,EAAE;YAClE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,iCAAiC,CAAC,QAAQ,EAAE;SAC3E;KACJ,CAAC;0DACyD;AAgG/D,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\n\r\n/**\r\n * Operations supported by the FloatToInt block\r\n */\r\nexport enum ParticleFloatToIntBlockOperations {\r\n /** Round */\r\n Round,\r\n /** Ceil */\r\n Ceil,\r\n /** Floor */\r\n Floor,\r\n /** Truncate */\r\n Truncate,\r\n}\r\n\r\n/**\r\n * Block used to transform a float to an int\r\n */\r\nexport class ParticleFloatToIntBlock 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: \"Round\", value: ParticleFloatToIntBlockOperations.Round },\r\n { label: \"Ceil\", value: ParticleFloatToIntBlockOperations.Ceil },\r\n { label: \"Floor\", value: ParticleFloatToIntBlockOperations.Floor },\r\n { label: \"Truncate\", value: ParticleFloatToIntBlockOperations.Truncate },\r\n ],\r\n })\r\n public operation = ParticleFloatToIntBlockOperations.Round;\r\n\r\n /**\r\n * Creates a new ParticleFloatToIntBlock\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(\"input\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Int);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(NodeParticleBlockConnectionPointTypes.Float | NodeParticleBlockConnectionPointTypes.Int);\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 \"ParticleFloatToIntBlock\";\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 super._build(state);\r\n let func: Nullable<(value: NodeParticleBuildState) => number> = null;\r\n const input = this.input;\r\n\r\n switch (this.operation) {\r\n case ParticleFloatToIntBlockOperations.Round: {\r\n func = (state) => {\r\n return Math.round(input.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n case ParticleFloatToIntBlockOperations.Ceil: {\r\n func = (state) => {\r\n return Math.ceil(input.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n case ParticleFloatToIntBlockOperations.Floor: {\r\n func = (state) => {\r\n return Math.floor(input.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n case ParticleFloatToIntBlockOperations.Truncate: {\r\n func = (state) => {\r\n return Math.trunc(input.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n if (!func) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n return 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.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.ParticleFloatToIntBlock\", ParticleFloatToIntBlock);\r\n"]}
|
|
@@ -15,10 +15,6 @@ export declare class SystemBlock extends NodeParticleBlock {
|
|
|
15
15
|
* Gets or sets the epsilon value used for comparison
|
|
16
16
|
*/
|
|
17
17
|
capacity: number;
|
|
18
|
-
/**
|
|
19
|
-
* Gets or sets the emit rate
|
|
20
|
-
*/
|
|
21
|
-
emitRate: number;
|
|
22
18
|
/**
|
|
23
19
|
* Gets or sets the manual emit count
|
|
24
20
|
*/
|
|
@@ -71,6 +67,10 @@ export declare class SystemBlock extends NodeParticleBlock {
|
|
|
71
67
|
* Gets the particle input component
|
|
72
68
|
*/
|
|
73
69
|
get particle(): NodeParticleConnectionPoint;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the emitRate input component
|
|
72
|
+
*/
|
|
73
|
+
get emitRate(): NodeParticleConnectionPoint;
|
|
74
74
|
/**
|
|
75
75
|
* Gets the texture input component
|
|
76
76
|
*/
|
|
@@ -25,10 +25,6 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
25
25
|
* Gets or sets the epsilon value used for comparison
|
|
26
26
|
*/
|
|
27
27
|
this.capacity = 1000;
|
|
28
|
-
/**
|
|
29
|
-
* Gets or sets the emit rate
|
|
30
|
-
*/
|
|
31
|
-
this.emitRate = 10;
|
|
32
28
|
/**
|
|
33
29
|
* Gets or sets the manual emit count
|
|
34
30
|
*/
|
|
@@ -69,6 +65,7 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
69
65
|
this._internalId = SystemBlock._IdCounter++;
|
|
70
66
|
this._isSystem = true;
|
|
71
67
|
this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
|
|
68
|
+
this.registerInput("emitRate", NodeParticleBlockConnectionPointTypes.Int, true, 10, 0);
|
|
72
69
|
this.registerInput("texture", NodeParticleBlockConnectionPointTypes.Texture);
|
|
73
70
|
this.registerInput("translationPivot", NodeParticleBlockConnectionPointTypes.Vector2, true);
|
|
74
71
|
this.registerInput("textureMask", NodeParticleBlockConnectionPointTypes.Color4, true);
|
|
@@ -90,41 +87,47 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
90
87
|
get particle() {
|
|
91
88
|
return this._inputs[0];
|
|
92
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Gets the emitRate input component
|
|
92
|
+
*/
|
|
93
|
+
get emitRate() {
|
|
94
|
+
return this._inputs[1];
|
|
95
|
+
}
|
|
93
96
|
/**
|
|
94
97
|
* Gets the texture input component
|
|
95
98
|
*/
|
|
96
99
|
get texture() {
|
|
97
|
-
return this._inputs[
|
|
100
|
+
return this._inputs[2];
|
|
98
101
|
}
|
|
99
102
|
/**
|
|
100
103
|
* Gets the translationPivot input component
|
|
101
104
|
*/
|
|
102
105
|
get translationPivot() {
|
|
103
|
-
return this._inputs[
|
|
106
|
+
return this._inputs[3];
|
|
104
107
|
}
|
|
105
108
|
/**
|
|
106
109
|
* Gets the textureMask input component
|
|
107
110
|
*/
|
|
108
111
|
get textureMask() {
|
|
109
|
-
return this._inputs[
|
|
112
|
+
return this._inputs[4];
|
|
110
113
|
}
|
|
111
114
|
/**
|
|
112
115
|
* Gets the targetStopDuration input component
|
|
113
116
|
*/
|
|
114
117
|
get targetStopDuration() {
|
|
115
|
-
return this._inputs[
|
|
118
|
+
return this._inputs[5];
|
|
116
119
|
}
|
|
117
120
|
/**
|
|
118
121
|
* Gets the onStart input component
|
|
119
122
|
*/
|
|
120
123
|
get onStart() {
|
|
121
|
-
return this._inputs[
|
|
124
|
+
return this._inputs[6];
|
|
122
125
|
}
|
|
123
126
|
/**
|
|
124
127
|
* Gets the onEnd input component
|
|
125
128
|
*/
|
|
126
129
|
get onEnd() {
|
|
127
|
-
return this._inputs[
|
|
130
|
+
return this._inputs[7];
|
|
128
131
|
}
|
|
129
132
|
/**
|
|
130
133
|
* Gets the system output component
|
|
@@ -143,7 +146,7 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
143
146
|
this.build(state);
|
|
144
147
|
const particleSystem = this.particle.getConnectedValue(state);
|
|
145
148
|
particleSystem.particleTexture = this.texture.getConnectedValue(state);
|
|
146
|
-
particleSystem.emitRate = this.emitRate;
|
|
149
|
+
particleSystem.emitRate = this.emitRate.getConnectedValue(state);
|
|
147
150
|
particleSystem.manualEmitCount = this.manualEmitCount;
|
|
148
151
|
particleSystem.updateSpeed = this.updateSpeed;
|
|
149
152
|
particleSystem.preWarmCycles = this.preWarmCycles;
|
|
@@ -157,6 +160,11 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
157
160
|
particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);
|
|
158
161
|
particleSystem.isLocal = this.isLocal;
|
|
159
162
|
particleSystem.disposeOnStop = this.disposeOnStop;
|
|
163
|
+
// The emit rate can vary if it is connected to another block like a gradient
|
|
164
|
+
particleSystem._calculateEmitRate = () => {
|
|
165
|
+
state.systemContext = particleSystem;
|
|
166
|
+
return this.emitRate.getConnectedValue(state);
|
|
167
|
+
};
|
|
160
168
|
this.system._storedValue = this;
|
|
161
169
|
particleSystem.canStart = () => {
|
|
162
170
|
return !this.doNoStart;
|
|
@@ -199,7 +207,6 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
199
207
|
serialize() {
|
|
200
208
|
const serializationObject = super.serialize();
|
|
201
209
|
serializationObject.capacity = this.capacity;
|
|
202
|
-
serializationObject.emitRate = this.emitRate;
|
|
203
210
|
serializationObject.manualEmitCount = this.manualEmitCount;
|
|
204
211
|
serializationObject.blendMode = this.blendMode;
|
|
205
212
|
serializationObject.updateSpeed = this.updateSpeed;
|
|
@@ -219,7 +226,6 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
219
226
|
_deserialize(serializationObject) {
|
|
220
227
|
super._deserialize(serializationObject);
|
|
221
228
|
this.capacity = serializationObject.capacity;
|
|
222
|
-
this.emitRate = serializationObject.emitRate;
|
|
223
229
|
this.manualEmitCount = serializationObject.manualEmitCount ?? -1;
|
|
224
230
|
this.updateSpeed = serializationObject.updateSpeed ?? 0.0167;
|
|
225
231
|
this.preWarmCycles = serializationObject.preWarmCycles ?? 0;
|
|
@@ -228,6 +234,9 @@ export class SystemBlock extends NodeParticleBlock {
|
|
|
228
234
|
this.isLocal = serializationObject.isLocal ?? false;
|
|
229
235
|
this.disposeOnStop = serializationObject.disposeOnStop ?? false;
|
|
230
236
|
this.doNoStart = !!serializationObject.doNoStart;
|
|
237
|
+
if (serializationObject.emitRate !== undefined) {
|
|
238
|
+
this.emitRate.value = serializationObject.emitRate;
|
|
239
|
+
}
|
|
231
240
|
if (serializationObject.blendMode !== undefined) {
|
|
232
241
|
this.blendMode = serializationObject.blendMode;
|
|
233
242
|
}
|
|
@@ -253,9 +262,6 @@ __decorate([
|
|
|
253
262
|
__decorate([
|
|
254
263
|
editableInPropertyPage("Capacity", 2 /* PropertyTypeForEdition.Int */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 10000 })
|
|
255
264
|
], SystemBlock.prototype, "capacity", void 0);
|
|
256
|
-
__decorate([
|
|
257
|
-
editableInPropertyPage("Emit rate", 2 /* PropertyTypeForEdition.Int */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
|
|
258
|
-
], SystemBlock.prototype, "emitRate", void 0);
|
|
259
265
|
__decorate([
|
|
260
266
|
editableInPropertyPage("Manual emit count", 2 /* PropertyTypeForEdition.Int */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: -1 })
|
|
261
267
|
], SystemBlock.prototype, "manualEmitCount", void 0);
|
|
@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AE,CAAC;8CAC3G;AAkN7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { _TriggerSubEmitter } from \"core/Particles/Node/Blocks/Triggers/triggerTools\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\n\r\n/**\r\n * Block used to get a system of particles\r\n */\r\nexport class SystemBlock extends NodeParticleBlock {\r\n private static _IdCounter = 0;\r\n\r\n /**\r\n * Gets or sets the blend mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Blend mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"MultiplyAdd\", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },\r\n ],\r\n })\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Gets or sets the epsilon value used for comparison\r\n */\r\n @editableInPropertyPage(\"Capacity\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 10000 })\r\n public capacity = 1000;\r\n\r\n /**\r\n * Gets or sets the emit rate\r\n */\r\n @editableInPropertyPage(\"Emit rate\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public emitRate = 10;\r\n\r\n /**\r\n * Gets or sets the manual emit count\r\n */\r\n @editableInPropertyPage(\"Manual emit count\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: -1 })\r\n public manualEmitCount = -1;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Delay start(ms)\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"updateSpeed\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 0.1 })\r\n public updateSpeed = 0.0167;\r\n\r\n /**\r\n * Gets or sets the number of pre-warm cycles before rendering the particle system\r\n */\r\n @editableInPropertyPage(\"Pre-warm cycles\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmCycles = 0;\r\n\r\n /**\r\n * Gets or sets the time step multiplier used for pre-warm\r\n */\r\n @editableInPropertyPage(\"Pre-warm step multiplier\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmStepOffset = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system is billboard based\r\n */\r\n @editableInPropertyPage(\"Is billboard based\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isBillboardBased = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system coordinate space is local or global\r\n */\r\n @editableInPropertyPage(\"Is local\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isLocal = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should be disposed when stopped\r\n */\r\n @editableInPropertyPage(\"Dispose on stop\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public disposeOnStop = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should not start automatically\r\n */\r\n @editableInPropertyPage(\"Do no start\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public doNoStart = false;\r\n\r\n /** @internal */\r\n public _internalId = SystemBlock._IdCounter++;\r\n\r\n /**\r\n * Create a new SystemBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this._isSystem = true;\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"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 texture input component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translationPivot input component\r\n */\r\n public get translationPivot(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\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[3];\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[4];\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[5];\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[6];\r\n }\r\n\r\n /**\r\n * Gets the system output component\r\n */\r\n public get system(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Builds the block and return a functional particle system\r\n * @param state defines the building state\r\n * @returns the built particle system\r\n */\r\n public createSystem(state: NodeParticleBuildState): ParticleSystem {\r\n state.capacity = this.capacity;\r\n state.buildId = this._buildId++;\r\n\r\n this.build(state);\r\n\r\n const particleSystem = this.particle.getConnectedValue(state) as ParticleSystem;\r\n particleSystem.particleTexture = this.texture.getConnectedValue(state);\r\n particleSystem.emitRate = this.emitRate;\r\n particleSystem.manualEmitCount = this.manualEmitCount;\r\n particleSystem.updateSpeed = this.updateSpeed;\r\n particleSystem.preWarmCycles = this.preWarmCycles;\r\n particleSystem.preWarmStepOffset = this.preWarmStepOffset;\r\n particleSystem.blendMode = this.blendMode;\r\n particleSystem.name = this.name;\r\n particleSystem._targetStopDuration = (this.targetStopDuration.getConnectedValue(state) as number) ?? 0;\r\n particleSystem.startDelay = this.startDelay;\r\n particleSystem.isBillboardBased = this.isBillboardBased;\r\n particleSystem.translationPivot = (this.translationPivot.getConnectedValue(state) as Vector2) || Vector2.Zero();\r\n particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n particleSystem.isLocal = this.isLocal;\r\n particleSystem.disposeOnStop = this.disposeOnStop;\r\n\r\n this.system._storedValue = this;\r\n\r\n particleSystem.canStart = () => {\r\n return !this.doNoStart;\r\n };\r\n\r\n particleSystem.onStartedObservable.add((system) => {\r\n // Triggers\r\n const onStartSystem = this.onStart.getConnectedValue(state);\r\n if (onStartSystem) {\r\n system.onStartedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onStartSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n\r\n const onEndSystem = this.onEnd.getConnectedValue(state);\r\n if (onEndSystem) {\r\n system.onStoppedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onEndSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n particleSystem.dispose();\r\n });\r\n\r\n // Return\r\n return particleSystem;\r\n }\r\n\r\n /**\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.emitRate = this.emitRate;\r\n serializationObject.manualEmitCount = this.manualEmitCount;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.updateSpeed = this.updateSpeed;\r\n serializationObject.preWarmCycles = this.preWarmCycles;\r\n serializationObject.preWarmStepOffset = this.preWarmStepOffset;\r\n serializationObject.isBillboardBased = this.isBillboardBased;\r\n serializationObject.isLocal = this.isLocal;\r\n serializationObject.disposeOnStop = this.disposeOnStop;\r\n serializationObject.doNoStart = this.doNoStart;\r\n serializationObject.startDelay = this.startDelay;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\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.emitRate = serializationObject.emitRate;\r\n this.manualEmitCount = serializationObject.manualEmitCount ?? -1;\r\n this.updateSpeed = serializationObject.updateSpeed ?? 0.0167;\r\n this.preWarmCycles = serializationObject.preWarmCycles ?? 0;\r\n this.preWarmStepOffset = serializationObject.preWarmStepOffset ?? 0;\r\n this.isBillboardBased = serializationObject.isBillboardBased ?? true;\r\n this.isLocal = serializationObject.isLocal ?? false;\r\n this.disposeOnStop = serializationObject.disposeOnStop ?? false;\r\n this.doNoStart = !!serializationObject.doNoStart;\r\n\r\n if (serializationObject.blendMode !== undefined) {\r\n this.blendMode = serializationObject.blendMode;\r\n }\r\n\r\n if (serializationObject.startDelay !== undefined) {\r\n this.startDelay = serializationObject.startDelay;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SystemBlock\", SystemBlock);\r\n"]}
|
|
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;Q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B,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;kDACrH;AAMlB;IADN,sBAAsB,CAAC,0BAA0B,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;sDAC1H;AAMtB;IADN,sBAAsB,CAAC,oBAAoB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;qDAC5G;AAMxB;IADN,sBAAsB,CAAC,UAAU,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4CAC1G;AAMhB;IADN,sBAAsB,CAAC,iBAAiB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC3G;AAMtB;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;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"]}
|
|
@@ -158,7 +158,7 @@ export class NodeParticleBuildState {
|
|
|
158
158
|
* @returns the value associated with the source
|
|
159
159
|
*/
|
|
160
160
|
getSystemValue(source) {
|
|
161
|
-
if (!this.
|
|
161
|
+
if (!this.systemContext) {
|
|
162
162
|
return null;
|
|
163
163
|
}
|
|
164
164
|
switch (source) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAC1D,OAAO,EAAE,qCAAqC,EAAE,yDAAwE;AACxH,OAAO,EAAE,6BAA6B,EAAE,iDAAgE;AACxG,OAAO,EAAE,yBAAyB,EAAE,6CAA4D;AAEhG;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAcI,8DAA8D;QACvD,kCAA6B,GAAkC,EAAE,CAAC;QAKzE;;WAEG;QACI,oBAAe,GAAuB,IAAI,CAAC;QAElD;;WAEG;QACI,kBAAa,GAAiC,IAAI,CAAC;QAE1D;;WAEG;QACI,kBA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OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\n\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleContextualSources } from \"core/Particles/Node/Enums/nodeParticleContextualSources\";\r\nimport { NodeParticleSystemSources } from \"core/Particles/Node/Enums/nodeParticleSystemSources\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.DirectionScale:\r\n return this.particleContext._directionScale;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.particleContext._directionScale, this.particleContext._scaledDirection);\r\n return this.particleContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.particleContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.Size:\r\n return this.particleContext.size;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n case NodeParticleContextualSources.InitialDirection:\r\n return this.particleContext._initialDirection;\r\n case NodeParticleContextualSources.ColorStep:\r\n return this.particleContext.colorStep;\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);\r\n return this.systemContext._scaledColorStep;\r\n case NodeParticleContextualSources.LocalPositionUpdated:\r\n this.particleContext.direction.scaleToRef(this.particleContext._directionScale, this.particleContext._scaledDirection);\r\n this.particleContext._localPosition!.addInPlace(this.particleContext._scaledDirection);\r\n Vector3.TransformCoordinatesToRef(this.particleContext._localPosition!, this.systemContext._emitterWorldMatrix, this.particleContext.position);\r\n return this.particleContext.position;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition(): Nullable<Vector3> {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (!this.systemContext.emitter) {\r\n return null;\r\n }\r\n\r\n if (this.systemContext.emitter instanceof Vector3) {\r\n return this.systemContext.emitter;\r\n }\r\n\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n return this.emitterPosition;\r\n case NodeParticleSystemSources.CameraPosition:\r\n return this.scene.activeCamera?.globalPosition || Vector3.Zero();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAC1D,OAAO,EAAE,qCAAqC,EAAE,yDAAwE;AACxH,OAAO,EAAE,6BAA6B,EAAE,iDAAgE;AACxG,OAAO,EAAE,yBAAyB,EAAE,6CAA4D;AAEhG;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAcI,8DAA8D;QACvD,kCAA6B,GAAkC,EAAE,CAAC;QAKzE;;WAEG;QACI,oBAAe,GAAuB,IAAI,CAAC;QAElD;;WAEG;QACI,kBAAa,GAAiC,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zC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\n\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleContextualSources } from \"core/Particles/Node/Enums/nodeParticleContextualSources\";\r\nimport { NodeParticleSystemSources } from \"core/Particles/Node/Enums/nodeParticleSystemSources\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.DirectionScale:\r\n return this.particleContext._directionScale;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.particleContext._directionScale, this.particleContext._scaledDirection);\r\n return this.particleContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.particleContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.Size:\r\n return this.particleContext.size;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n case NodeParticleContextualSources.InitialDirection:\r\n return this.particleContext._initialDirection;\r\n case NodeParticleContextualSources.ColorStep:\r\n return this.particleContext.colorStep;\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);\r\n return this.systemContext._scaledColorStep;\r\n case NodeParticleContextualSources.LocalPositionUpdated:\r\n this.particleContext.direction.scaleToRef(this.particleContext._directionScale, this.particleContext._scaledDirection);\r\n this.particleContext._localPosition!.addInPlace(this.particleContext._scaledDirection);\r\n Vector3.TransformCoordinatesToRef(this.particleContext._localPosition!, this.systemContext._emitterWorldMatrix, this.particleContext.position);\r\n return this.particleContext.position;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition(): Nullable<Vector3> {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (!this.systemContext.emitter) {\r\n return null;\r\n }\r\n\r\n if (this.systemContext.emitter instanceof Vector3) {\r\n return this.systemContext.emitter;\r\n }\r\n\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n return this.emitterPosition;\r\n case NodeParticleSystemSources.CameraPosition:\r\n return this.scene.activeCamera?.globalPosition || Vector3.Zero();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
|