@onerjs/core 8.34.9 → 8.35.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/AudioV2/webAudio/components/webAudioParameterComponent.js +1 -3
  2. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  3. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +4 -0
  4. package/Cameras/Inputs/geospatialCameraPointersInput.js +56 -3
  5. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  6. package/Cameras/Inputs/index.d.ts +1 -0
  7. package/Cameras/Inputs/index.js +1 -0
  8. package/Cameras/Inputs/index.js.map +1 -1
  9. package/Cameras/geospatialCamera.d.ts +3 -2
  10. package/Cameras/geospatialCamera.js +4 -4
  11. package/Cameras/geospatialCamera.js.map +1 -1
  12. package/Engines/Extensions/engine.debugging.d.ts +4 -0
  13. package/Engines/Extensions/engine.debugging.js.map +1 -1
  14. package/Engines/abstractEngine.js +2 -2
  15. package/Engines/abstractEngine.js.map +1 -1
  16. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +1 -1
  17. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -1
  18. package/FrameGraph/frameGraphContext.js +3 -3
  19. package/FrameGraph/frameGraphContext.js.map +1 -1
  20. package/FrameGraph/frameGraphTask.js +4 -4
  21. package/FrameGraph/frameGraphTask.js.map +1 -1
  22. package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
  23. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  24. package/Lights/Shadows/shadowGenerator.js +3 -3
  25. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  26. package/Lights/lightingVolume.js +6 -6
  27. package/Lights/lightingVolume.js.map +1 -1
  28. package/Materials/PBR/pbrBaseMaterial.d.ts +2 -1
  29. package/Materials/PBR/pbrBaseMaterial.js +1 -0
  30. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  31. package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +2 -0
  32. package/Materials/PBR/pbrSubSurfaceConfiguration.js +8 -4
  33. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  34. package/Materials/Textures/Procedurals/proceduralTexture.js +2 -2
  35. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  36. package/Materials/Textures/renderTargetTexture.js +2 -2
  37. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  38. package/Materials/Textures/texture.js +11 -0
  39. package/Materials/Textures/texture.js.map +1 -1
  40. package/Misc/minMaxReducer.js +2 -2
  41. package/Misc/minMaxReducer.js.map +1 -1
  42. package/Particles/Node/Blocks/Conditions/particleConditionBlock.js +2 -0
  43. package/Particles/Node/Blocks/Conditions/particleConditionBlock.js.map +1 -1
  44. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.d.ts +4 -0
  45. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js +10 -0
  46. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js.map +1 -1
  47. package/Particles/Node/Blocks/Update/updateRemapBlock.d.ts +39 -0
  48. package/Particles/Node/Blocks/Update/updateRemapBlock.js +93 -0
  49. package/Particles/Node/Blocks/Update/updateRemapBlock.js.map +1 -0
  50. package/Particles/Node/Blocks/index.d.ts +2 -1
  51. package/Particles/Node/Blocks/index.js +2 -1
  52. package/Particles/Node/Blocks/index.js.map +1 -1
  53. package/Particles/Node/Blocks/particleLocalVariableBlock.d.ts +2 -0
  54. package/Particles/Node/Blocks/particleLocalVariableBlock.js +22 -10
  55. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
  56. package/Particles/Node/Blocks/particleMathBlock.d.ts +4 -0
  57. package/Particles/Node/Blocks/particleMathBlock.js +4 -0
  58. package/Particles/Node/Blocks/particleMathBlock.js.map +1 -1
  59. package/Particles/Node/Blocks/particleNumberMathBlock.d.ts +60 -0
  60. package/Particles/Node/Blocks/particleNumberMathBlock.js +149 -0
  61. package/Particles/Node/Blocks/particleNumberMathBlock.js.map +1 -0
  62. package/Particles/Node/Blocks/{particleModuloBlock.d.ts → particleVectorMathBlock.d.ts} +25 -4
  63. package/Particles/Node/Blocks/{particleModuloBlock.js → particleVectorMathBlock.js} +59 -24
  64. package/Particles/Node/Blocks/particleVectorMathBlock.js.map +1 -0
  65. package/Particles/Node/Blocks/systemBlock.d.ts +8 -0
  66. package/Particles/Node/Blocks/systemBlock.js +57 -6
  67. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  68. package/Particles/Node/nodeParticleSystemSet.helper.js +112 -0
  69. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  70. package/Particles/baseParticleSystem.d.ts +8 -1
  71. package/Particles/baseParticleSystem.js +8 -1
  72. package/Particles/baseParticleSystem.js.map +1 -1
  73. package/Particles/particle.d.ts +4 -0
  74. package/Particles/particle.js +3 -0
  75. package/Particles/particle.js.map +1 -1
  76. package/Particles/particleSystem.d.ts +12 -0
  77. package/Particles/particleSystem.js +12 -0
  78. package/Particles/particleSystem.js.map +1 -1
  79. package/Particles/thinParticleSystem.d.ts +10 -0
  80. package/Particles/thinParticleSystem.js +20 -7
  81. package/Particles/thinParticleSystem.js.map +1 -1
  82. package/Probes/reflectionProbe.js +2 -2
  83. package/Probes/reflectionProbe.js.map +1 -1
  84. package/Rendering/depthRenderer.js +2 -2
  85. package/Rendering/depthRenderer.js.map +1 -1
  86. package/XR/features/WebXRControllerPhysics.d.ts +30 -1
  87. package/XR/features/WebXRControllerPhysics.js +269 -16
  88. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  89. package/XR/features/WebXRHandTracking.js +36 -2
  90. package/XR/features/WebXRHandTracking.js.map +1 -1
  91. package/package.json +1 -1
  92. package/Particles/Node/Blocks/particleModuloBlock.js.map +0 -1
@@ -0,0 +1,149 @@
1
+ import { __decorate } from "../../../tslib.es6.js";
2
+ import { RegisterClass } from "../../../Misc/typeStore.js";
3
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
4
+ import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
5
+ import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
6
+ /**
7
+ * Operations supported by the Number Math block
8
+ */
9
+ export var ParticleNumberMathBlockOperations;
10
+ (function (ParticleNumberMathBlockOperations) {
11
+ /** Modulo */
12
+ ParticleNumberMathBlockOperations[ParticleNumberMathBlockOperations["Modulo"] = 0] = "Modulo";
13
+ /** Power */
14
+ ParticleNumberMathBlockOperations[ParticleNumberMathBlockOperations["Pow"] = 1] = "Pow";
15
+ })(ParticleNumberMathBlockOperations || (ParticleNumberMathBlockOperations = {}));
16
+ /**
17
+ * Block used to apply math operations that only appply to numbers (int/float)
18
+ */
19
+ export class ParticleNumberMathBlock extends NodeParticleBlock {
20
+ /**
21
+ * Create a new ParticleNumberMathBlock
22
+ * @param name defines the block name
23
+ */
24
+ constructor(name) {
25
+ super(name);
26
+ /**
27
+ * Gets or sets the operation applied by the block
28
+ */
29
+ this.operation = ParticleNumberMathBlockOperations.Modulo;
30
+ this.registerInput("left", NodeParticleBlockConnectionPointTypes.AutoDetect);
31
+ this.registerInput("right", NodeParticleBlockConnectionPointTypes.AutoDetect);
32
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
33
+ this.output._typeConnectionSource = this.left;
34
+ this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);
35
+ this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);
36
+ this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);
37
+ this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);
38
+ this._linkConnectionTypes(0, 1);
39
+ this._connectionObservers = [
40
+ this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),
41
+ this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
42
+ this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),
43
+ this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
44
+ ];
45
+ }
46
+ /**
47
+ * Gets the current class name
48
+ * @returns the class name
49
+ */
50
+ getClassName() {
51
+ return "ParticleNumberMathBlock";
52
+ }
53
+ /**
54
+ * Gets the left input component
55
+ */
56
+ get left() {
57
+ return this._inputs[0];
58
+ }
59
+ /**
60
+ * Gets the right input component
61
+ */
62
+ get right() {
63
+ return this._inputs[1];
64
+ }
65
+ /**
66
+ * Gets the geometry output component
67
+ */
68
+ get output() {
69
+ return this._outputs[0];
70
+ }
71
+ _build(state) {
72
+ let func;
73
+ const left = this.left;
74
+ const right = this.right;
75
+ if (!left.isConnected || !right.isConnected) {
76
+ this.output._storedFunction = null;
77
+ this.output._storedValue = null;
78
+ return;
79
+ }
80
+ switch (this.operation) {
81
+ case ParticleNumberMathBlockOperations.Modulo: {
82
+ func = (state) => {
83
+ return left.getConnectedValue(state) % right.getConnectedValue(state);
84
+ };
85
+ break;
86
+ }
87
+ case ParticleNumberMathBlockOperations.Pow: {
88
+ func = (state) => {
89
+ return Math.pow(left.getConnectedValue(state), right.getConnectedValue(state));
90
+ };
91
+ break;
92
+ }
93
+ }
94
+ this.output._storedFunction = (state) => {
95
+ // We use the left type to determine if we need to cast to int
96
+ if (left.type === NodeParticleBlockConnectionPointTypes.Int) {
97
+ return func(state) | 0;
98
+ }
99
+ return func(state);
100
+ };
101
+ }
102
+ _updateInputOutputTypes() {
103
+ // First update the output type with the initial assumption that we'll base it on the left input.
104
+ this.output._typeConnectionSource = this.left;
105
+ // If left is not connected, then instead use the type of right if it's connected.
106
+ if (!this.left.isConnected && this.right.isConnected) {
107
+ this.output._typeConnectionSource = this.right;
108
+ }
109
+ }
110
+ /**
111
+ * Release resources
112
+ */
113
+ dispose() {
114
+ super.dispose();
115
+ for (const observer of this._connectionObservers) {
116
+ observer.remove();
117
+ }
118
+ this._connectionObservers.length = 0;
119
+ }
120
+ /**
121
+ * Serializes this block in a JSON representation
122
+ * @returns the serialized block object
123
+ */
124
+ serialize() {
125
+ const serializationObject = super.serialize();
126
+ serializationObject.operation = this.operation;
127
+ return serializationObject;
128
+ }
129
+ /**
130
+ * Deserializes the block from a JSON object
131
+ * @param serializationObject the JSON object to deserialize from
132
+ */
133
+ _deserialize(serializationObject) {
134
+ super._deserialize(serializationObject);
135
+ this.operation = serializationObject.operation;
136
+ }
137
+ }
138
+ __decorate([
139
+ editableInPropertyPage("Operation", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
140
+ notifiers: { rebuild: true },
141
+ embedded: true,
142
+ options: [
143
+ { label: "Modulo", value: ParticleNumberMathBlockOperations.Modulo },
144
+ { label: "Power", value: ParticleNumberMathBlockOperations.Pow },
145
+ ],
146
+ })
147
+ ], ParticleNumberMathBlock.prototype, "operation", void 0);
148
+ RegisterClass("BABYLON.ParticleNumberMathBlock", ParticleNumberMathBlock);
149
+ //# sourceMappingURL=particleNumberMathBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particleNumberMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleNumberMathBlock.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEnG;;GAEG;AACH,MAAM,CAAN,IAAY,iCAKX;AALD,WAAY,iCAAiC;IACzC,aAAa;IACb,6FAAM,CAAA;IACN,YAAY;IACZ,uFAAG,CAAA;AACP,CAAC,EALW,iCAAiC,KAAjC,iCAAiC,QAK5C;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAgB1D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IA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,CAAC;IACnD,CAAC;CACJ;AA3IU;IARN,sBAAsB,CAAC,WAAW,uCAA+B,UAAU,EAAE;QAC1E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,iCAAiC,CAAC,MAAM,EAAE;YACpE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,iCAAiC,CAAC,GAAG,EAAE;SACnE;KACJ,CAAC;0DAC0D;AA6IhE,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import type { Observer } from \"core/Misc/observable\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Operations supported by the Number Math block\r\n */\r\nexport enum ParticleNumberMathBlockOperations {\r\n /** Modulo */\r\n Modulo,\r\n /** Power */\r\n Pow,\r\n}\r\n\r\n/**\r\n * Block used to apply math operations that only appply to numbers (int/float)\r\n */\r\nexport class ParticleNumberMathBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the operation applied by the block\r\n */\r\n @editableInPropertyPage(\"Operation\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"Modulo\", value: ParticleNumberMathBlockOperations.Modulo },\r\n { label: \"Power\", value: ParticleNumberMathBlockOperations.Pow },\r\n ],\r\n })\r\n public operation = ParticleNumberMathBlockOperations.Modulo;\r\n\r\n private readonly _connectionObservers: Observer<NodeParticleConnectionPoint>[];\r\n\r\n /**\r\n * Create a new ParticleNumberMathBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"left\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.output._typeConnectionSource = this.left;\r\n\r\n this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);\r\n this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);\r\n this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);\r\n this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);\r\n\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._connectionObservers = [\r\n this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n ];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleNumberMathBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n let func: (state: NodeParticleBuildState) => any;\r\n const left = this.left;\r\n const right = this.right;\r\n\r\n if (!left.isConnected || !right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.operation) {\r\n case ParticleNumberMathBlockOperations.Modulo: {\r\n func = (state) => {\r\n return left.getConnectedValue(state) % right.getConnectedValue(state);\r\n };\r\n break;\r\n }\r\n case ParticleNumberMathBlockOperations.Pow: {\r\n func = (state) => {\r\n return Math.pow(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n // We use the left type to determine if we need to cast to int\r\n if (left.type === NodeParticleBlockConnectionPointTypes.Int) {\r\n return func(state) | 0;\r\n }\r\n return func(state);\r\n };\r\n }\r\n\r\n private _updateInputOutputTypes() {\r\n // First update the output type with the initial assumption that we'll base it on the left input.\r\n this.output._typeConnectionSource = this.left;\r\n\r\n // If left is not connected, then instead use the type of right if it's connected.\r\n if (!this.left.isConnected && this.right.isConnected) {\r\n this.output._typeConnectionSource = this.right;\r\n }\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n for (const observer of this._connectionObservers) {\r\n observer.remove();\r\n }\r\n this._connectionObservers.length = 0;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes the block from a JSON object\r\n * @param serializationObject the JSON object to deserialize from\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleNumberMathBlock\", ParticleNumberMathBlock);\r\n"]}
@@ -1,13 +1,24 @@
1
- import { NodeParticleBlock } from "../nodeParticleBlock.js";
2
1
  import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
3
2
  import type { NodeParticleBuildState } from "../nodeParticleBuildState.js";
3
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
4
+ /**
5
+ * Operations supported by the Vector Math block
6
+ */
7
+ export declare enum ParticleVectorMathBlockOperations {
8
+ /** Dot product */
9
+ Dot = 0
10
+ }
4
11
  /**
5
- * Block used to apply the modulo operator
12
+ * Block used to apply math operations that only apply to vectors
6
13
  */
7
- export declare class ParticleModuloBlock extends NodeParticleBlock {
14
+ export declare class ParticleVectorMathBlock extends NodeParticleBlock {
15
+ /**
16
+ * Gets or sets the operation applied by the block
17
+ */
18
+ operation: ParticleVectorMathBlockOperations;
8
19
  private readonly _connectionObservers;
9
20
  /**
10
- * Create a new ParticleModuloBlock
21
+ * Create a new ParticleVectorMathBlock
11
22
  * @param name defines the block name
12
23
  */
13
24
  constructor(name: string);
@@ -34,4 +45,14 @@ export declare class ParticleModuloBlock extends NodeParticleBlock {
34
45
  * Release resources
35
46
  */
36
47
  dispose(): void;
48
+ /**
49
+ * Serializes this block in a JSON representation
50
+ * @returns the serialized block object
51
+ */
52
+ serialize(): any;
53
+ /**
54
+ * Deserializes the block from a JSON object
55
+ * @param serializationObject the JSON object to deserialize from
56
+ */
57
+ _deserialize(serializationObject: any): void;
37
58
  }
@@ -1,24 +1,37 @@
1
+ import { __decorate } from "../../../tslib.es6.js";
1
2
  import { RegisterClass } from "../../../Misc/typeStore.js";
2
3
  import { NodeParticleBlock } from "../nodeParticleBlock.js";
3
4
  import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
5
+ import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
6
+ import { Vector3 } from "../../../Maths/math.vector.js";
4
7
  /**
5
- * Block used to apply the modulo operator
8
+ * Operations supported by the Vector Math block
6
9
  */
7
- export class ParticleModuloBlock extends NodeParticleBlock {
10
+ export var ParticleVectorMathBlockOperations;
11
+ (function (ParticleVectorMathBlockOperations) {
12
+ /** Dot product */
13
+ ParticleVectorMathBlockOperations[ParticleVectorMathBlockOperations["Dot"] = 0] = "Dot";
14
+ })(ParticleVectorMathBlockOperations || (ParticleVectorMathBlockOperations = {}));
15
+ /**
16
+ * Block used to apply math operations that only apply to vectors
17
+ */
18
+ export class ParticleVectorMathBlock extends NodeParticleBlock {
8
19
  /**
9
- * Create a new ParticleModuloBlock
20
+ * Create a new ParticleVectorMathBlock
10
21
  * @param name defines the block name
11
22
  */
12
23
  constructor(name) {
13
24
  super(name);
25
+ /**
26
+ * Gets or sets the operation applied by the block
27
+ */
28
+ this.operation = ParticleVectorMathBlockOperations.Dot;
14
29
  this.registerInput("left", NodeParticleBlockConnectionPointTypes.AutoDetect);
15
30
  this.registerInput("right", NodeParticleBlockConnectionPointTypes.AutoDetect);
16
31
  this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
17
32
  this.output._typeConnectionSource = this.left;
18
- this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);
19
- this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);
20
- this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Int);
21
- this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Float);
33
+ this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);
34
+ this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);
22
35
  this._linkConnectionTypes(0, 1);
23
36
  this._connectionObservers = [
24
37
  this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),
@@ -32,7 +45,7 @@ export class ParticleModuloBlock extends NodeParticleBlock {
32
45
  * @returns the class name
33
46
  */
34
47
  getClassName() {
35
- return "ParticleModuloBlock";
48
+ return "ParticleVectorMathBlock";
36
49
  }
37
50
  /**
38
51
  * Gets the left input component
@@ -53,6 +66,7 @@ export class ParticleModuloBlock extends NodeParticleBlock {
53
66
  return this._outputs[0];
54
67
  }
55
68
  _build(state) {
69
+ let func;
56
70
  const left = this.left;
57
71
  const right = this.right;
58
72
  if (!left.isConnected || !right.isConnected) {
@@ -60,27 +74,24 @@ export class ParticleModuloBlock extends NodeParticleBlock {
60
74
  this.output._storedValue = null;
61
75
  return;
62
76
  }
63
- const func = (state) => {
64
- return left.getConnectedValue(state) % right.getConnectedValue(state);
65
- };
66
- this.output._storedFunction = (state) => {
67
- if (left.type === NodeParticleBlockConnectionPointTypes.Int) {
68
- return func(state) | 0;
77
+ switch (this.operation) {
78
+ case ParticleVectorMathBlockOperations.Dot: {
79
+ func = (state) => {
80
+ return Vector3.Dot(left.getConnectedValue(state), right.getConnectedValue(state));
81
+ };
82
+ break;
69
83
  }
84
+ }
85
+ this.output._storedFunction = (state) => {
70
86
  return func(state);
71
87
  };
72
88
  }
73
89
  _updateInputOutputTypes() {
74
90
  // First update the output type with the initial assumption that we'll base it on the left input.
75
91
  this.output._typeConnectionSource = this.left;
76
- if (this.left.isConnected && this.right.isConnected) {
77
- if (this.right.type === NodeParticleBlockConnectionPointTypes.Float) {
78
- this.output._typeConnectionSource = this.right;
79
- }
80
- }
81
- else if (this.left.isConnected !== this.right.isConnected) {
82
- // Only one input is connected, so we need to determine the output type based on the connected input.
83
- this.output._typeConnectionSource = this.left.isConnected ? this.left : this.right;
92
+ // If left is not connected, then instead use the type of right if it's connected.
93
+ if (!this.left.isConnected && this.right.isConnected) {
94
+ this.output._typeConnectionSource = this.right;
84
95
  }
85
96
  }
86
97
  /**
@@ -93,6 +104,30 @@ export class ParticleModuloBlock extends NodeParticleBlock {
93
104
  }
94
105
  this._connectionObservers.length = 0;
95
106
  }
107
+ /**
108
+ * Serializes this block in a JSON representation
109
+ * @returns the serialized block object
110
+ */
111
+ serialize() {
112
+ const serializationObject = super.serialize();
113
+ serializationObject.operation = this.operation;
114
+ return serializationObject;
115
+ }
116
+ /**
117
+ * Deserializes the block from a JSON object
118
+ * @param serializationObject the JSON object to deserialize from
119
+ */
120
+ _deserialize(serializationObject) {
121
+ super._deserialize(serializationObject);
122
+ this.operation = serializationObject.operation;
123
+ }
96
124
  }
97
- RegisterClass("BABYLON.ParticleModuloBlock", ParticleModuloBlock);
98
- //# sourceMappingURL=particleModuloBlock.js.map
125
+ __decorate([
126
+ editableInPropertyPage("Operation", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
127
+ notifiers: { rebuild: true },
128
+ embedded: true,
129
+ options: [{ label: "Dot", value: ParticleVectorMathBlockOperations.Dot }],
130
+ })
131
+ ], ParticleVectorMathBlock.prototype, "operation", void 0);
132
+ RegisterClass("BABYLON.ParticleVectorMathBlock", ParticleVectorMathBlock);
133
+ //# sourceMappingURL=particleVectorMathBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particleVectorMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleVectorMathBlock.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAA0B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD;;GAEG;AACH,MAAM,CAAN,IAAY,iCAGX;AAHD,WAAY,iCAAiC;IACzC,kBAAkB;IAClB,uFAAG,CAAA;AACP,CAAC,EAHW,iCAAiC,KAAjC,iCAAiC,QAG5C;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAY1D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAhBhB;;WAEG;QAMI,cAAS,GAAG,iCAAiC,CAAC,GAAG,CAAC;QAUrD,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,UAAU,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,OA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QAAQ,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC/C,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAE/C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACa,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IACnD,CAAC;CACJ;AA9HU;IALN,sBAAsB,CAAC,WAAW,uCAA+B,UAAU,EAAE;QAC1E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iCAAiC,CAAC,GAAG,EAAE,CAAC;KAC5E,CAAC;0DACuD;AAgI7D,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import type { Observer } from \"core/Misc/observable\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\n\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"../../../Decorators/nodeDecorator\";\r\nimport { Vector3 } from \"../../../Maths/math.vector\";\r\n\r\n/**\r\n * Operations supported by the Vector Math block\r\n */\r\nexport enum ParticleVectorMathBlockOperations {\r\n /** Dot product */\r\n Dot,\r\n}\r\n\r\n/**\r\n * Block used to apply math operations that only apply to vectors\r\n */\r\nexport class ParticleVectorMathBlock 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: [{ label: \"Dot\", value: ParticleVectorMathBlockOperations.Dot }],\r\n })\r\n public operation = ParticleVectorMathBlockOperations.Dot;\r\n private readonly _connectionObservers: Observer<NodeParticleConnectionPoint>[];\r\n\r\n /**\r\n * Create a new ParticleVectorMathBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"left\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"right\", NodeParticleBlockConnectionPointTypes.AutoDetect);\r\n\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.output._typeConnectionSource = this.left;\r\n\r\n this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);\r\n this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);\r\n\r\n this._linkConnectionTypes(0, 1);\r\n\r\n this._connectionObservers = [\r\n this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),\r\n this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),\r\n ];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleVectorMathBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left input component\r\n */\r\n public get left(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the right input component\r\n */\r\n public get right(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n let func: (state: NodeParticleBuildState) => any;\r\n const left = this.left;\r\n const right = this.right;\r\n\r\n if (!left.isConnected || !right.isConnected) {\r\n this.output._storedFunction = null;\r\n this.output._storedValue = null;\r\n return;\r\n }\r\n\r\n switch (this.operation) {\r\n case ParticleVectorMathBlockOperations.Dot: {\r\n func = (state) => {\r\n return Vector3.Dot(left.getConnectedValue(state), right.getConnectedValue(state));\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n return func(state);\r\n };\r\n }\r\n\r\n private _updateInputOutputTypes() {\r\n // First update the output type with the initial assumption that we'll base it on the left input.\r\n this.output._typeConnectionSource = this.left;\r\n\r\n // If left is not connected, then instead use the type of right if it's connected.\r\n if (!this.left.isConnected && this.right.isConnected) {\r\n this.output._typeConnectionSource = this.right;\r\n }\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n for (const observer of this._connectionObservers) {\r\n observer.remove();\r\n }\r\n this._connectionObservers.length = 0;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.operation = this.operation;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes the block from a JSON object\r\n * @param serializationObject the JSON object to deserialize from\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.operation = serializationObject.operation;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleVectorMathBlock\", ParticleVectorMathBlock);\r\n"]}
@@ -39,6 +39,10 @@ export declare class SystemBlock extends NodeParticleBlock {
39
39
  * Gets or sets a boolean indicating if the system is billboard based
40
40
  */
41
41
  isBillboardBased: boolean;
42
+ /**
43
+ * Gets or sets the billboard mode for the particle system
44
+ */
45
+ billBoardMode: number;
42
46
  /**
43
47
  * Gets or sets a boolean indicating if the system coordinate space is local or global
44
48
  */
@@ -95,6 +99,10 @@ export declare class SystemBlock extends NodeParticleBlock {
95
99
  * Gets the onEnd input component
96
100
  */
97
101
  get onEnd(): NodeParticleConnectionPoint;
102
+ /**
103
+ * Gets the rampGradient input component
104
+ */
105
+ get rampGradient(): NodeParticleConnectionPoint;
98
106
  /**
99
107
  * Gets the system output component
100
108
  */
@@ -1,12 +1,14 @@
1
1
  import { __decorate } from "../../../tslib.es6.js";
2
+
2
3
  import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
3
4
  import { RegisterClass } from "../../../Misc/typeStore.js";
4
5
  import { Vector2 } from "../../../Maths/math.vector.js";
5
- import { Color4 } from "../../../Maths/math.color.js";
6
+ import { Color3, Color4 } from "../../../Maths/math.color.js";
6
7
  import { BaseParticleSystem } from "../../baseParticleSystem.js";
7
8
  import { NodeParticleBlock } from "../nodeParticleBlock.js";
8
9
  import { _TriggerSubEmitter } from "./Triggers/triggerTools.js";
9
10
  import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
11
+ import { ParticleGradientBlock } from "./particleGradientBlock.js";
10
12
  /**
11
13
  * Block used to get a system of particles
12
14
  */
@@ -49,6 +51,10 @@ export class SystemBlock extends NodeParticleBlock {
49
51
  * Gets or sets a boolean indicating if the system is billboard based
50
52
  */
51
53
  this.isBillboardBased = true;
54
+ /**
55
+ * Gets or sets the billboard mode for the particle system
56
+ */
57
+ this.billBoardMode = 7;
52
58
  /**
53
59
  * Gets or sets a boolean indicating if the system coordinate space is local or global
54
60
  */
@@ -72,6 +78,7 @@ export class SystemBlock extends NodeParticleBlock {
72
78
  this.registerInput("targetStopDuration", NodeParticleBlockConnectionPointTypes.Float, true, 0, 0);
73
79
  this.registerInput("onStart", NodeParticleBlockConnectionPointTypes.System, true);
74
80
  this.registerInput("onEnd", NodeParticleBlockConnectionPointTypes.System, true);
81
+ this.registerInput("rampGradient", NodeParticleBlockConnectionPointTypes.Color4, true);
75
82
  this.registerOutput("system", NodeParticleBlockConnectionPointTypes.System);
76
83
  }
77
84
  /**
@@ -129,6 +136,12 @@ export class SystemBlock extends NodeParticleBlock {
129
136
  get onEnd() {
130
137
  return this._inputs[7];
131
138
  }
139
+ /**
140
+ * Gets the rampGradient input component
141
+ */
142
+ get rampGradient() {
143
+ return this._inputs[8];
144
+ }
132
145
  /**
133
146
  * Gets the system output component
134
147
  */
@@ -156,6 +169,7 @@ export class SystemBlock extends NodeParticleBlock {
156
169
  particleSystem._targetStopDuration = this.targetStopDuration.getConnectedValue(state) ?? 0;
157
170
  particleSystem.startDelay = this.startDelay;
158
171
  particleSystem.isBillboardBased = this.isBillboardBased;
172
+ particleSystem.billboardMode = this.billBoardMode;
159
173
  particleSystem.translationPivot = this.translationPivot.getConnectedValue(state) || Vector2.Zero();
160
174
  particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);
161
175
  particleSystem.isLocal = this.isLocal;
@@ -165,6 +179,29 @@ export class SystemBlock extends NodeParticleBlock {
165
179
  state.systemContext = particleSystem;
166
180
  return this.emitRate.getConnectedValue(state);
167
181
  };
182
+ // Get the ramp gradients
183
+ particleSystem.useRampGradients = false;
184
+ if (this.rampGradient.isConnected) {
185
+ if (this.rampGradient.connectedPoint?.ownerBlock instanceof ParticleGradientBlock) {
186
+ // We have a possible gradient, loop through its entries
187
+ const gradientInputs = this.rampGradient.connectedPoint?.ownerBlock.inputs;
188
+ // Skip the first input which is the gradient selector, and we only care about the gradient values
189
+ for (let i = 1; i < gradientInputs.length; i++) {
190
+ if (gradientInputs[i].isConnected) {
191
+ const rampEntry = gradientInputs[i].connectedPoint?.ownerBlock;
192
+ const color = rampEntry._inputs[0].getConnectedValue(state);
193
+ particleSystem.addRampGradient(rampEntry.reference, new Color3(color.r, color.g, color.b));
194
+ particleSystem.useRampGradients = true;
195
+ }
196
+ }
197
+ }
198
+ else {
199
+ // We have a single value, add it as ramp gradient
200
+ const color = this.rampGradient.getConnectedValue(state);
201
+ particleSystem.addRampGradient(0, new Color3(color.r, color.g, color.b));
202
+ particleSystem.useRampGradients = true;
203
+ }
204
+ }
168
205
  this.system._storedValue = this;
169
206
  particleSystem.canStart = () => {
170
207
  return !this.doNoStart;
@@ -213,6 +250,7 @@ export class SystemBlock extends NodeParticleBlock {
213
250
  serializationObject.preWarmCycles = this.preWarmCycles;
214
251
  serializationObject.preWarmStepOffset = this.preWarmStepOffset;
215
252
  serializationObject.isBillboardBased = this.isBillboardBased;
253
+ serializationObject.billBoardMode = this.billBoardMode;
216
254
  serializationObject.isLocal = this.isLocal;
217
255
  serializationObject.disposeOnStop = this.disposeOnStop;
218
256
  serializationObject.doNoStart = this.doNoStart;
@@ -231,6 +269,7 @@ export class SystemBlock extends NodeParticleBlock {
231
269
  this.preWarmCycles = serializationObject.preWarmCycles ?? 0;
232
270
  this.preWarmStepOffset = serializationObject.preWarmStepOffset ?? 0;
233
271
  this.isBillboardBased = serializationObject.isBillboardBased ?? true;
272
+ this.billBoardMode = serializationObject.billBoardMode ?? 7;
234
273
  this.isLocal = serializationObject.isLocal ?? false;
235
274
  this.disposeOnStop = serializationObject.disposeOnStop ?? false;
236
275
  this.doNoStart = !!serializationObject.doNoStart;
@@ -251,11 +290,11 @@ __decorate([
251
290
  notifiers: { rebuild: true },
252
291
  embedded: true,
253
292
  options: [
254
- { label: "OneOne", value: BaseParticleSystem.BLENDMODE_ONEONE },
255
- { label: "Standard", value: BaseParticleSystem.BLENDMODE_STANDARD },
256
- { label: "Add", value: BaseParticleSystem.BLENDMODE_ADD },
257
- { label: "Multiply", value: BaseParticleSystem.BLENDMODE_MULTIPLY },
258
- { label: "MultiplyAdd", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },
293
+ { label: "Blend Mode OneOne", value: BaseParticleSystem.BLENDMODE_ONEONE },
294
+ { label: "Blend Mode Standard", value: BaseParticleSystem.BLENDMODE_STANDARD },
295
+ { label: "Blend Mode Add", value: BaseParticleSystem.BLENDMODE_ADD },
296
+ { label: "Blend Mode Multiply", value: BaseParticleSystem.BLENDMODE_MULTIPLY },
297
+ { label: "Blend Mode MultiplyAdd", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },
259
298
  ],
260
299
  })
261
300
  ], SystemBlock.prototype, "blendMode", void 0);
@@ -280,6 +319,18 @@ __decorate([
280
319
  __decorate([
281
320
  editableInPropertyPage("Is billboard based", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
282
321
  ], SystemBlock.prototype, "isBillboardBased", void 0);
322
+ __decorate([
323
+ editableInPropertyPage("Billboard mode", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
324
+ notifiers: { rebuild: true },
325
+ embedded: true,
326
+ options: [
327
+ { label: "Billboard Mode All", value: 7 },
328
+ { label: "Billboard Mode Y", value: 2 },
329
+ { label: "Billboard Mode Stretched", value: 8 },
330
+ { label: "Billboard Mode Stretched Local", value: 9 },
331
+ ],
332
+ })
333
+ ], SystemBlock.prototype, "billBoardMode", void 0);
283
334
  __decorate([
284
335
  editableInPropertyPage("Is local", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
285
336
  ], SystemBlock.prototype, "isLocal", void 0);