@onerjs/core 8.36.2 → 8.36.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,3 +38,6 @@ export * from "./particleFresnelBlock.js";
38
38
  export * from "./particleNumberMathBlock.js";
39
39
  export * from "./particleVectorMathBlock.js";
40
40
  export * from "./particleClampBlock.js";
41
+ export * from "./particleNLerpBlock.js";
42
+ export * from "./particleSmoothStepBlock.js";
43
+ export * from "./particleStepBlock.js";
@@ -39,4 +39,7 @@ export * from "./particleFresnelBlock.js";
39
39
  export * from "./particleNumberMathBlock.js";
40
40
  export * from "./particleVectorMathBlock.js";
41
41
  export * from "./particleClampBlock.js";
42
+ export * from "./particleNLerpBlock.js";
43
+ export * from "./particleSmoothStepBlock.js";
44
+ export * from "./particleStepBlock.js";
42
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleFloatToIntBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateNoiseBlock\";\r\nexport * from \"./Update/updateRemapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\nexport * from \"./particleNumberMathBlock\";\r\nexport * from \"./particleVectorMathBlock\";\r\nexport * from \"./particleClampBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleFloatToIntBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateNoiseBlock\";\r\nexport * from \"./Update/updateRemapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\nexport * from \"./particleNumberMathBlock\";\r\nexport * from \"./particleVectorMathBlock\";\r\nexport * from \"./particleClampBlock\";\r\nexport * from \"./particleNLerpBlock\";\r\nexport * from \"./particleSmoothStepBlock\";\r\nexport * from \"./particleStepBlock\";\r\n"]}
@@ -0,0 +1,35 @@
1
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
2
+ import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
3
+ import type { NodeParticleBuildState } from "../nodeParticleBuildState.js";
4
+ /**
5
+ * Block used to normalize lerp between 2 values
6
+ */
7
+ export declare class ParticleNLerpBlock extends NodeParticleBlock {
8
+ /**
9
+ * Creates a new ParticleNLerpBlock
10
+ * @param name defines the block name
11
+ */
12
+ constructor(name: string);
13
+ /**
14
+ * Gets the current class name
15
+ * @returns the class name
16
+ */
17
+ getClassName(): string;
18
+ /**
19
+ * Gets the left operand input component
20
+ */
21
+ get left(): NodeParticleConnectionPoint;
22
+ /**
23
+ * Gets the right operand input component
24
+ */
25
+ get right(): NodeParticleConnectionPoint;
26
+ /**
27
+ * Gets the gradient operand input component
28
+ */
29
+ get gradient(): NodeParticleConnectionPoint;
30
+ /**
31
+ * Gets the output component
32
+ */
33
+ get output(): NodeParticleConnectionPoint;
34
+ _build(_state: NodeParticleBuildState): this | undefined;
35
+ }
@@ -0,0 +1,97 @@
1
+ import { Vector2, Vector3, 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
+ /**
6
+ * Block used to normalize lerp between 2 values
7
+ */
8
+ // eslint-disable-next-line @typescript-eslint/naming-convention
9
+ export class ParticleNLerpBlock extends NodeParticleBlock {
10
+ /**
11
+ * Creates a new ParticleNLerpBlock
12
+ * @param name defines the block name
13
+ */
14
+ constructor(name) {
15
+ super(name);
16
+ this.registerInput("left", NodeParticleBlockConnectionPointTypes.AutoDetect);
17
+ this.registerInput("right", NodeParticleBlockConnectionPointTypes.AutoDetect);
18
+ this.registerInput("gradient", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0, 1);
19
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
20
+ this._outputs[0]._typeConnectionSource = this._inputs[0];
21
+ this._linkConnectionTypes(0, 1);
22
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Matrix);
23
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);
24
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);
25
+ }
26
+ /**
27
+ * Gets the current class name
28
+ * @returns the class name
29
+ */
30
+ getClassName() {
31
+ return "ParticleNLerpBlock";
32
+ }
33
+ /**
34
+ * Gets the left operand input component
35
+ */
36
+ get left() {
37
+ return this._inputs[0];
38
+ }
39
+ /**
40
+ * Gets the right operand input component
41
+ */
42
+ get right() {
43
+ return this._inputs[1];
44
+ }
45
+ /**
46
+ * Gets the gradient operand input component
47
+ */
48
+ get gradient() {
49
+ return this._inputs[2];
50
+ }
51
+ /**
52
+ * Gets the output component
53
+ */
54
+ get output() {
55
+ return this._outputs[0];
56
+ }
57
+ _build(_state) {
58
+ if (!this.left.isConnected || !this.right.isConnected) {
59
+ this.output._storedFunction = null;
60
+ this.output._storedValue = null;
61
+ return;
62
+ }
63
+ const func = (gradient, left, right) => {
64
+ return (1 - gradient) * left + gradient * right;
65
+ };
66
+ this.output._storedFunction = (state) => {
67
+ const left = this.left.getConnectedValue(state);
68
+ const right = this.right.getConnectedValue(state);
69
+ const gradient = this.gradient.getConnectedValue(state);
70
+ switch (this.left.type) {
71
+ case NodeParticleBlockConnectionPointTypes.Int:
72
+ case NodeParticleBlockConnectionPointTypes.Float: {
73
+ return func(gradient, left, right); // NLerp is really lerp in that case
74
+ }
75
+ case NodeParticleBlockConnectionPointTypes.Vector2: {
76
+ const result = new Vector2(func(gradient, left.x, right.x), func(gradient, left.y, right.y));
77
+ result.normalize();
78
+ return result;
79
+ }
80
+ case NodeParticleBlockConnectionPointTypes.Vector3: {
81
+ const result = new Vector3(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z));
82
+ result.normalize();
83
+ return result;
84
+ }
85
+ case NodeParticleBlockConnectionPointTypes.Color4: {
86
+ const result = new Vector4(func(gradient, left.r, right.r), func(gradient, left.g, right.g), func(gradient, left.b, right.b), func(gradient, left.a, right.a));
87
+ result.normalize();
88
+ return result;
89
+ }
90
+ }
91
+ return 0;
92
+ };
93
+ return this;
94
+ }
95
+ }
96
+ RegisterClass("BABYLON.ParticleNLerpBlock", ParticleNLerpBlock);
97
+ //# sourceMappingURL=particleNLerpBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particleNLerpBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleNLerpBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAg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L,CAAC;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\n/**\r\n * Block used to normalize lerp between 2 values\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class ParticleNLerpBlock extends NodeParticleBlock {\r\n /**\r\n * Creates a new ParticleNLerpBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"left\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"gradient\", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0, 1);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleNLerpBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left operand input component\r\n */\r\n public get left(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right operand input component\r\n */\r\n public get right(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the gradient operand input component\r\n */\r\n public get gradient(): 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 public override _build(_state: NodeParticleBuildState) {\r\n if (!this.left.isConnected || !this.right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (gradient: number, left: number, right: number) => {\r\n return (1 - gradient) * left + gradient * right;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const left = this.left.getConnectedValue(state);\r\n const right = this.right.getConnectedValue(state);\r\n const gradient = this.gradient.getConnectedValue(state);\r\n switch (this.left.type) {\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n return func(gradient, left, right); // NLerp is really lerp in that case\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n const result = new Vector2(func(gradient, left.x, right.x), func(gradient, left.y, right.y));\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n const result = new Vector3(func(gradient, left.x, right.x), func(gradient, left.y, right.y), func(gradient, left.z, right.z));\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n const result = new Vector4(func(gradient, left.r, right.r), func(gradient, left.g, right.g), func(gradient, left.b, right.b), func(gradient, left.a, right.a));\r\n result.normalize();\r\n\r\n return result;\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleNLerpBlock\", ParticleNLerpBlock);\r\n"]}
@@ -0,0 +1,34 @@
1
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
2
+ import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
3
+ /**
4
+ * Block used to smooth step a value
5
+ */
6
+ export declare class ParticleSmoothStepBlock extends NodeParticleBlock {
7
+ /**
8
+ * Creates a new ParticleSmoothStepBlock
9
+ * @param name defines the block name
10
+ */
11
+ constructor(name: string);
12
+ /**
13
+ * Gets the current class name
14
+ * @returns the class name
15
+ */
16
+ getClassName(): string;
17
+ /**
18
+ * Gets the value operand input component
19
+ */
20
+ get value(): NodeParticleConnectionPoint;
21
+ /**
22
+ * Gets the first edge operand input component
23
+ */
24
+ get edge0(): NodeParticleConnectionPoint;
25
+ /**
26
+ * Gets the second edge operand input component
27
+ */
28
+ get edge1(): NodeParticleConnectionPoint;
29
+ /**
30
+ * Gets the output component
31
+ */
32
+ get output(): NodeParticleConnectionPoint;
33
+ _build(): this | undefined;
34
+ }
@@ -0,0 +1,91 @@
1
+ import { Vector2, Vector3, 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
+ /**
6
+ * Block used to smooth step a value
7
+ */
8
+ export class ParticleSmoothStepBlock extends NodeParticleBlock {
9
+ /**
10
+ * Creates a new ParticleSmoothStepBlock
11
+ * @param name defines the block name
12
+ */
13
+ constructor(name) {
14
+ super(name);
15
+ this.registerInput("value", NodeParticleBlockConnectionPointTypes.AutoDetect);
16
+ this.registerInput("edge0", NodeParticleBlockConnectionPointTypes.Float, true, 0);
17
+ this.registerInput("edge1", NodeParticleBlockConnectionPointTypes.Float, true, 1);
18
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
19
+ this._outputs[0]._typeConnectionSource = this._inputs[0];
20
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Matrix);
21
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);
22
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);
23
+ }
24
+ /**
25
+ * Gets the current class name
26
+ * @returns the class name
27
+ */
28
+ getClassName() {
29
+ return "ParticleSmoothStepBlock";
30
+ }
31
+ /**
32
+ * Gets the value operand input component
33
+ */
34
+ get value() {
35
+ return this._inputs[0];
36
+ }
37
+ /**
38
+ * Gets the first edge operand input component
39
+ */
40
+ get edge0() {
41
+ return this._inputs[1];
42
+ }
43
+ /**
44
+ * Gets the second edge operand input component
45
+ */
46
+ get edge1() {
47
+ return this._inputs[2];
48
+ }
49
+ /**
50
+ * Gets the output component
51
+ */
52
+ get output() {
53
+ return this._outputs[0];
54
+ }
55
+ _build() {
56
+ if (!this.value.isConnected) {
57
+ this.output._storedFunction = null;
58
+ this.output._storedValue = null;
59
+ return;
60
+ }
61
+ const func = (value, edge0, edge1) => {
62
+ const x = Math.max(0, Math.min((value - edge0) / (edge1 - edge0), 1));
63
+ // Smoothstep formula: 3x^2 - 2x^3
64
+ return x * x * (3 - 2 * x);
65
+ };
66
+ this.output._storedFunction = (state) => {
67
+ const source = this.value.getConnectedValue(state);
68
+ const edge0 = this.edge0.getConnectedValue(state);
69
+ const edge1 = this.edge1.getConnectedValue(state);
70
+ switch (this.value.type) {
71
+ case NodeParticleBlockConnectionPointTypes.Int:
72
+ case NodeParticleBlockConnectionPointTypes.Float: {
73
+ return func(source, edge0, edge1);
74
+ }
75
+ case NodeParticleBlockConnectionPointTypes.Vector2: {
76
+ return new Vector2(func(source.x, edge0, edge1), func(source.y, edge0, edge1));
77
+ }
78
+ case NodeParticleBlockConnectionPointTypes.Vector3: {
79
+ return new Vector3(func(source.x, edge0, edge1), func(source.y, edge0, edge1), func(source.z, edge0, edge1));
80
+ }
81
+ case NodeParticleBlockConnectionPointTypes.Color4: {
82
+ return new Vector4(func(source.r, edge0, edge1), func(source.g, edge0, edge1), func(source.b, edge0, edge1), func(source.a, edge0, edge1));
83
+ }
84
+ }
85
+ return 0;
86
+ };
87
+ return this;
88
+ }
89
+ }
90
+ RegisterClass("BABYLON.ParticleSmoothStepBlock", ParticleSmoothStepBlock);
91
+ //# sourceMappingURL=particleSmoothStepBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particleSmoothStepBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleSmoothStepBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAC1D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,YAAY,CAAC,CAAC;QAClF,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,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,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;gBAC/I,CAAC;YACL,CAAC;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\n\r\n/**\r\n * Block used to smooth step a value\r\n */\r\nexport class ParticleSmoothStepBlock extends NodeParticleBlock {\r\n /**\r\n * Creates a new ParticleSmoothStepBlock\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(\"value\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"edge0\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"edge1\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleSmoothStepBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value operand input component\r\n */\r\n public get value(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the first edge operand input component\r\n */\r\n public get edge0(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the second edge operand input component\r\n */\r\n public get edge1(): 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 public override _build() {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n const func = (value: number, edge0: number, edge1: number) => {\r\n const x = Math.max(0, Math.min((value - edge0) / (edge1 - edge0), 1));\r\n\r\n // Smoothstep formula: 3x^2 - 2x^3\r\n return x * x * (3 - 2 * x);\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const source = this.value.getConnectedValue(state);\r\n const edge0 = this.edge0.getConnectedValue(state);\r\n const edge1 = this.edge1.getConnectedValue(state);\r\n switch (this.value.type) {\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n return func(source, edge0, edge1);\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n return new Vector2(func(source.x, edge0, edge1), func(source.y, edge0, edge1));\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n return new Vector3(func(source.x, edge0, edge1), func(source.y, edge0, edge1), func(source.z, edge0, edge1));\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n return new Vector4(func(source.r, edge0, edge1), func(source.g, edge0, edge1), func(source.b, edge0, edge1), func(source.a, edge0, edge1));\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleSmoothStepBlock\", ParticleSmoothStepBlock);\r\n"]}
@@ -0,0 +1,30 @@
1
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
2
+ import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
3
+ /**
4
+ * Block used to step a value
5
+ */
6
+ export declare class ParticleStepBlock extends NodeParticleBlock {
7
+ /**
8
+ * Creates a new ParticleStepBlock
9
+ * @param name defines the block name
10
+ */
11
+ constructor(name: string);
12
+ /**
13
+ * Gets the current class name
14
+ * @returns the class name
15
+ */
16
+ getClassName(): string;
17
+ /**
18
+ * Gets the value operand input component
19
+ */
20
+ get value(): NodeParticleConnectionPoint;
21
+ /**
22
+ * Gets the edge operand input component
23
+ */
24
+ get edge(): NodeParticleConnectionPoint;
25
+ /**
26
+ * Gets the output component
27
+ */
28
+ get output(): NodeParticleConnectionPoint;
29
+ _build(): this | undefined;
30
+ }
@@ -0,0 +1,84 @@
1
+ import { Vector2, Vector3, 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
+ /**
6
+ * Block used to step a value
7
+ */
8
+ export class ParticleStepBlock extends NodeParticleBlock {
9
+ /**
10
+ * Creates a new ParticleStepBlock
11
+ * @param name defines the block name
12
+ */
13
+ constructor(name) {
14
+ super(name);
15
+ this.registerInput("value", NodeParticleBlockConnectionPointTypes.AutoDetect);
16
+ this.registerInput("edge", NodeParticleBlockConnectionPointTypes.Float, true, 0);
17
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
18
+ this._outputs[0]._typeConnectionSource = this._inputs[0];
19
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Matrix);
20
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);
21
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);
22
+ }
23
+ /**
24
+ * Gets the current class name
25
+ * @returns the class name
26
+ */
27
+ getClassName() {
28
+ return "ParticleStepBlock";
29
+ }
30
+ /**
31
+ * Gets the value operand input component
32
+ */
33
+ get value() {
34
+ return this._inputs[0];
35
+ }
36
+ /**
37
+ * Gets the edge operand input component
38
+ */
39
+ get edge() {
40
+ return this._inputs[1];
41
+ }
42
+ /**
43
+ * Gets the output component
44
+ */
45
+ get output() {
46
+ return this._outputs[0];
47
+ }
48
+ _build() {
49
+ if (!this.value.isConnected) {
50
+ this.output._storedFunction = null;
51
+ this.output._storedValue = null;
52
+ return;
53
+ }
54
+ const func = (value, edge) => {
55
+ if (value < edge) {
56
+ return 0;
57
+ }
58
+ return 1;
59
+ };
60
+ this.output._storedFunction = (state) => {
61
+ const source = this.value.getConnectedValue(state);
62
+ const edge = this.edge.getConnectedValue(state);
63
+ switch (this.value.type) {
64
+ case NodeParticleBlockConnectionPointTypes.Int:
65
+ case NodeParticleBlockConnectionPointTypes.Float: {
66
+ return func(source, edge);
67
+ }
68
+ case NodeParticleBlockConnectionPointTypes.Vector2: {
69
+ return new Vector2(func(source.x, edge), func(source.y, edge));
70
+ }
71
+ case NodeParticleBlockConnectionPointTypes.Vector3: {
72
+ return new Vector3(func(source.x, edge), func(source.y, edge), func(source.z, edge));
73
+ }
74
+ case NodeParticleBlockConnectionPointTypes.Color4: {
75
+ return new Vector4(func(source.r, edge), func(source.g, edge), func(source.b, edge), func(source.a, edge));
76
+ }
77
+ }
78
+ return 0;
79
+ };
80
+ return this;
81
+ }
82
+ }
83
+ RegisterClass("BABYLON.ParticleStepBlock", ParticleStepBlock);
84
+ //# sourceMappingURL=particleStepBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particleStepBlock.js","sourceRoot":"","sources":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CAAC;gBACnE,CAAC;gBACD,KAAK,qCAAqC,CAAC,OAAO,CAAC,CAAC,CAAC;oBACjD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;gBACzF,CAAC;gBACD,KAAK,qCAAqC,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;gBAC/G,CAAC;YACL,CAAC;YAED,OAAO,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\n\r\n/**\r\n * Block used to step a value\r\n */\r\nexport class ParticleStepBlock extends NodeParticleBlock {\r\n /**\r\n * Creates a new ParticleStepBlock\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(\"value\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"edge\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Matrix);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleStepBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value operand input component\r\n */\r\n public get value(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the edge operand input component\r\n */\r\n public get edge(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build() {\r\n if (!this.value.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n const func = (value: number, edge: number) => {\r\n if (value < edge) {\r\n return 0;\r\n }\r\n\r\n return 1;\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const source = this.value.getConnectedValue(state);\r\n const edge = this.edge.getConnectedValue(state);\r\n switch (this.value.type) {\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n return func(source, edge);\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n return new Vector2(func(source.x, edge), func(source.y, edge));\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n return new Vector3(func(source.x, edge), func(source.y, edge), func(source.z, edge));\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n return new Vector4(func(source.r, edge), func(source.g, edge), func(source.b, edge), func(source.a, edge));\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleStepBlock\", ParticleStepBlock);\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onerjs/core",
3
- "version": "8.36.2",
3
+ "version": "8.36.3",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",