@babylonjs/core 8.45.3 → 8.45.5

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 (106) hide show
  1. package/AudioV2/webAudio/components/webAudioParameterComponent.js +5 -1
  2. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  3. package/Cameras/touchCamera.js +1 -1
  4. package/Cameras/touchCamera.js.map +1 -1
  5. package/Engines/AbstractEngine/abstractEngine.loadFile.d.ts +11 -0
  6. package/Engines/AbstractEngine/abstractEngine.loadFile.js +12 -0
  7. package/Engines/AbstractEngine/abstractEngine.loadFile.js.map +1 -0
  8. package/Engines/AbstractEngine/abstractEngine.textureLoaders.d.ts +1 -0
  9. package/Engines/AbstractEngine/abstractEngine.textureLoaders.js +4 -0
  10. package/Engines/AbstractEngine/abstractEngine.textureLoaders.js.map +1 -0
  11. package/Engines/AbstractEngine/index.d.ts +2 -0
  12. package/Engines/AbstractEngine/index.js +2 -0
  13. package/Engines/AbstractEngine/index.js.map +1 -1
  14. package/Engines/Native/Extensions/index.d.ts +1 -0
  15. package/Engines/Native/Extensions/index.js +2 -0
  16. package/Engines/Native/Extensions/index.js.map +1 -0
  17. package/Engines/Native/Extensions/nativeEngine.cubeTexture.d.ts +27 -0
  18. package/Engines/Native/Extensions/nativeEngine.cubeTexture.js +96 -0
  19. package/Engines/Native/Extensions/nativeEngine.cubeTexture.js.map +1 -0
  20. package/Engines/Native/nativeHelpers.js +7 -0
  21. package/Engines/Native/nativeHelpers.js.map +1 -1
  22. package/Engines/Native/nativeInterfaces.d.ts +2 -0
  23. package/Engines/Native/nativeInterfaces.js.map +1 -1
  24. package/Engines/Native/nativePipelineContext.d.ts +2 -2
  25. package/Engines/Native/nativePipelineContext.js.map +1 -1
  26. package/Engines/Native/nativeRenderTargetWrapper.d.ts +3 -3
  27. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  28. package/Engines/Native/validatedNativeDataStream.js +2 -2
  29. package/Engines/Native/validatedNativeDataStream.js.map +1 -1
  30. package/Engines/abstractEngine.d.ts +9 -0
  31. package/Engines/abstractEngine.js +13 -4
  32. package/Engines/abstractEngine.js.map +1 -1
  33. package/Engines/engine.d.ts +2 -6
  34. package/Engines/engine.js +2 -13
  35. package/Engines/engine.js.map +1 -1
  36. package/Engines/index.d.ts +1 -0
  37. package/Engines/index.js +1 -0
  38. package/Engines/index.js.map +1 -1
  39. package/Engines/nativeEngine.d.ts +19 -536
  40. package/Engines/nativeEngine.js +27 -2127
  41. package/Engines/nativeEngine.js.map +1 -1
  42. package/Engines/nullEngine.d.ts +2 -0
  43. package/Engines/nullEngine.js +2 -0
  44. package/Engines/nullEngine.js.map +1 -1
  45. package/Engines/thinNativeEngine.d.ts +537 -0
  46. package/Engines/thinNativeEngine.js +2033 -0
  47. package/Engines/thinNativeEngine.js.map +1 -0
  48. package/Engines/webgpuEngine.d.ts +2 -0
  49. package/Engines/webgpuEngine.js +2 -0
  50. package/Engines/webgpuEngine.js.map +1 -1
  51. package/FrameGraph/Node/nodeRenderGraph.d.ts +0 -5
  52. package/FrameGraph/Node/nodeRenderGraph.js +0 -7
  53. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  54. package/FrameGraph/frameGraph.d.ts +0 -6
  55. package/FrameGraph/frameGraph.js +0 -23
  56. package/FrameGraph/frameGraph.js.map +1 -1
  57. package/FrameGraph/frameGraphObjectList.d.ts +0 -1
  58. package/FrameGraph/frameGraphObjectList.js +0 -1
  59. package/FrameGraph/frameGraphObjectList.js.map +1 -1
  60. package/FrameGraph/frameGraphRenderContext.d.ts +0 -1
  61. package/FrameGraph/frameGraphRenderContext.js +0 -1
  62. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  63. package/FrameGraph/frameGraphRenderTarget.d.ts +0 -1
  64. package/FrameGraph/frameGraphRenderTarget.js +0 -1
  65. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  66. package/FrameGraph/frameGraphTask.d.ts +0 -1
  67. package/FrameGraph/frameGraphTask.js +0 -1
  68. package/FrameGraph/frameGraphTask.js.map +1 -1
  69. package/FrameGraph/frameGraphTextureManager.d.ts +0 -1
  70. package/FrameGraph/frameGraphTextureManager.js +0 -1
  71. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  72. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +6 -0
  73. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +100 -41
  74. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  75. package/Misc/tools.d.ts +3 -1
  76. package/Misc/tools.js +76 -59
  77. package/Misc/tools.js.map +1 -1
  78. package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +4 -14
  79. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +9 -27
  80. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
  81. package/Particles/Node/Blocks/index.d.ts +2 -0
  82. package/Particles/Node/Blocks/index.js +2 -0
  83. package/Particles/Node/Blocks/index.js.map +1 -1
  84. package/Particles/Node/Blocks/particleClampBlock.d.ts +42 -0
  85. package/Particles/Node/Blocks/particleClampBlock.js +114 -0
  86. package/Particles/Node/Blocks/particleClampBlock.js.map +1 -0
  87. package/Particles/Node/Blocks/particleVectorMathBlock.d.ts +3 -7
  88. package/Particles/Node/Blocks/particleVectorMathBlock.js +15 -32
  89. package/Particles/Node/Blocks/particleVectorMathBlock.js.map +1 -1
  90. package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
  91. package/Particles/Node/Blocks/systemBlock.js +9 -1
  92. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  93. package/Particles/Node/nodeParticleSystemSet.helper.js +62 -4
  94. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  95. package/Particles/baseParticleSystem.d.ts +7 -0
  96. package/Particles/baseParticleSystem.js +7 -0
  97. package/Particles/baseParticleSystem.js.map +1 -1
  98. package/Particles/particleSystem.d.ts +12 -0
  99. package/Particles/particleSystem.js +12 -0
  100. package/Particles/particleSystem.js.map +1 -1
  101. package/Particles/thinParticleSystem.d.ts +10 -0
  102. package/Particles/thinParticleSystem.js +10 -1
  103. package/Particles/thinParticleSystem.js.map +1 -1
  104. package/XR/native/nativeXRFrame.js +1 -1
  105. package/XR/native/nativeXRFrame.js.map +1 -1
  106. package/package.json +1 -1
@@ -1,10 +1,8 @@
1
- import { __decorate } from "../../../../tslib.es6.js";
2
1
  import { RegisterClass } from "../../../../Misc/typeStore.js";
3
2
  import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
4
3
  import { NodeParticleBlock } from "../../nodeParticleBlock.js";
5
4
  import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
6
5
  import { FlowMap } from "../../../flowMap.js";
7
- import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
8
6
  /**
9
7
  * Block used to update particle position based on a flow map
10
8
  */
@@ -15,12 +13,9 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
15
13
  */
16
14
  constructor(name) {
17
15
  super(name);
18
- /**
19
- * Gets or sets the strenght of the flow map effect
20
- */
21
- this.strength = 1;
22
16
  this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
23
17
  this.registerInput("flowMap", NodeParticleBlockConnectionPointTypes.Texture);
18
+ this.registerInput("strength", NodeParticleBlockConnectionPointTypes.Float, true, 1);
24
19
  this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
25
20
  }
26
21
  /**
@@ -35,6 +30,12 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
35
30
  get flowMap() {
36
31
  return this._inputs[1];
37
32
  }
33
+ /**
34
+ * Gets the strength input component
35
+ */
36
+ get strength() {
37
+ return this._inputs[2];
38
+ }
38
39
  /**
39
40
  * Gets the output component
40
41
  */
@@ -70,7 +71,8 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
70
71
  // If the flow map is not ready, we skip processing
71
72
  return;
72
73
  }
73
- flowMap._processParticle(particle, this.strength * system._tempScaledUpdateSpeed, matrix);
74
+ const strength = this.strength.getConnectedValue(state);
75
+ flowMap._processParticle(particle, strength * system._tempScaledUpdateSpeed, matrix);
74
76
  };
75
77
  const flowMapProcessing = {
76
78
  process: processFlowMap,
@@ -85,26 +87,6 @@ export class UpdateFlowMapBlock extends NodeParticleBlock {
85
87
  }
86
88
  this.output._storedValue = system;
87
89
  }
88
- /**
89
- * Serializes the block into a json object
90
- * @returns The serialized object
91
- */
92
- serialize() {
93
- const serializationObject = super.serialize();
94
- serializationObject.strength = this.strength;
95
- return serializationObject;
96
- }
97
- /**
98
- * Deserializes the block from a json object
99
- * @param serializationObject The object to deserialize from
100
- */
101
- _deserialize(serializationObject) {
102
- super._deserialize(serializationObject);
103
- this.strength = serializationObject.strength;
104
- }
105
90
  }
106
- __decorate([
107
- editableInPropertyPage("strength", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
108
- ], UpdateFlowMapBlock.prototype, "strength", void 0);
109
91
  RegisterClass("BABYLON.UpdateFlowMapBlock", UpdateFlowMapBlock);
110
92
  //# sourceMappingURL=updateFlowMapBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateFlowMapBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateFlowMapBlock.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AACvE,OAAO,EAAE,OAAO,EAAE,4BAA+B;AACjD,OAAO,EAAE,sBAAsB,EAA0B,gDAAsC;AAE/F;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAMrD;;;OAGG;IACH,YAA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xB,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { INodeParticleTextureData, ParticleTextureSourceBlock } from \"../particleSourceTextureBlock\";\r\n\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\nimport { FlowMap } from \"core/Particles/flowMap\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to update particle position based on a flow map\r\n */\r\nexport class UpdateFlowMapBlock extends NodeParticleBlock {\r\n /**\r\n * Gets or sets the strenght of the flow map effect\r\n */\r\n @editableInPropertyPage(\"strength\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public strength = 1;\r\n /**\r\n * Create a new UpdateFlowMapBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"flowMap\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the flowMap input component\r\n */\r\n public get flowMap(): 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 /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateFlowMapBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n const scene = state.scene;\r\n\r\n const flowMapTexture = this.flowMap.connectedPoint?.ownerBlock as ParticleTextureSourceBlock;\r\n let flowMap: FlowMap;\r\n\r\n // eslint-disable-next-line github/no-then\r\n void flowMapTexture.extractTextureContentAsync().then((textureContent: Nullable<INodeParticleTextureData>) => {\r\n if (!textureContent) {\r\n return;\r\n }\r\n flowMap = new FlowMap(textureContent.width, textureContent.height, textureContent.data as Uint8ClampedArray);\r\n });\r\n\r\n const processFlowMap = (particle: Particle) => {\r\n const matrix = scene.getTransformMatrix();\r\n if (!flowMap) {\r\n // If the flow map is not ready, we skip processing\r\n return;\r\n }\r\n\r\n flowMap._processParticle(particle, this.strength * system._tempScaledUpdateSpeed, matrix);\r\n };\r\n\r\n const flowMapProcessing = {\r\n process: processFlowMap,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(flowMapProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = flowMapProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n\r\n /**\r\n * Serializes the block into a json object\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.strength = this.strength;\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 object to deserialize from\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.strength = serializationObject.strength;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateFlowMapBlock\", UpdateFlowMapBlock);\r\n"]}
1
+ {"version":3,"file":"updateFlowMapBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateFlowMapBlock.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AACvE,OAAO,EAAE,OAAO,EAAE,4BAA+B;AAEjD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IACrD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACrF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,qCAAqC,CAAC,QAAQ,CAAC,CAAC;IAClF,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ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iBAAiB,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport type { INodeParticleTextureData, ParticleTextureSourceBlock } from \"../particleSourceTextureBlock\";\r\n\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\nimport { FlowMap } from \"core/Particles/flowMap\";\r\n\r\n/**\r\n * Block used to update particle position based on a flow map\r\n */\r\nexport class UpdateFlowMapBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateFlowMapBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"flowMap\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"strength\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the flowMap input component\r\n */\r\n public get flowMap(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the strength input component\r\n */\r\n public get strength(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"UpdateFlowMapBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n const scene = state.scene;\r\n\r\n const flowMapTexture = this.flowMap.connectedPoint?.ownerBlock as ParticleTextureSourceBlock;\r\n let flowMap: FlowMap;\r\n\r\n // eslint-disable-next-line github/no-then\r\n void flowMapTexture.extractTextureContentAsync().then((textureContent: Nullable<INodeParticleTextureData>) => {\r\n if (!textureContent) {\r\n return;\r\n }\r\n flowMap = new FlowMap(textureContent.width, textureContent.height, textureContent.data as Uint8ClampedArray);\r\n });\r\n\r\n const processFlowMap = (particle: Particle) => {\r\n const matrix = scene.getTransformMatrix();\r\n if (!flowMap) {\r\n // If the flow map is not ready, we skip processing\r\n return;\r\n }\r\n const strength = this.strength.getConnectedValue(state) as number;\r\n flowMap._processParticle(particle, strength * system._tempScaledUpdateSpeed, matrix);\r\n };\r\n\r\n const flowMapProcessing = {\r\n process: processFlowMap,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(flowMapProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = flowMapProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateFlowMapBlock\", UpdateFlowMapBlock);\r\n"]}
@@ -17,6 +17,7 @@ export * from "./Update/basicColorUpdateBlock.js";
17
17
  export * from "./Update/updateSpriteCellIndexBlock.js";
18
18
  export * from "./Update/updateFlowMapBlock.js";
19
19
  export * from "./Update/updateNoiseBlock.js";
20
+ export * from "./Update/updateRemapBlock.js";
20
21
  export * from "./Update/updateAttractorBlock.js";
21
22
  export * from "./Update/alignAngleBlock.js";
22
23
  export * from "./Emitters/index.js";
@@ -36,3 +37,4 @@ export * from "./particleVectorLengthBlock.js";
36
37
  export * from "./particleFresnelBlock.js";
37
38
  export * from "./particleNumberMathBlock.js";
38
39
  export * from "./particleVectorMathBlock.js";
40
+ export * from "./particleClampBlock.js";
@@ -18,6 +18,7 @@ export * from "./Update/basicColorUpdateBlock.js";
18
18
  export * from "./Update/updateSpriteCellIndexBlock.js";
19
19
  export * from "./Update/updateFlowMapBlock.js";
20
20
  export * from "./Update/updateNoiseBlock.js";
21
+ export * from "./Update/updateRemapBlock.js";
21
22
  export * from "./Update/updateAttractorBlock.js";
22
23
  export * from "./Update/alignAngleBlock.js";
23
24
  export * from "./Emitters/index.js";
@@ -37,4 +38,5 @@ export * from "./particleVectorLengthBlock.js";
37
38
  export * from "./particleFresnelBlock.js";
38
39
  export * from "./particleNumberMathBlock.js";
39
40
  export * from "./particleVectorMathBlock.js";
41
+ export * from "./particleClampBlock.js";
40
42
  //# 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,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleFloatToIntBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateNoiseBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\nexport * from \"./particleNumberMathBlock\";\r\nexport * from \"./particleVectorMathBlock\";\r\n"]}
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"]}
@@ -0,0 +1,42 @@
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 clamp a float
6
+ */
7
+ export declare class ParticleClampBlock extends NodeParticleBlock {
8
+ /** Gets or sets the minimum range */
9
+ get minimum(): number;
10
+ set minimum(value: number);
11
+ /** Gets or sets the maximum range */
12
+ get maximum(): number;
13
+ set maximum(value: number);
14
+ /**
15
+ * Creates a new ParticleClampBlock
16
+ * @param name defines the block name
17
+ */
18
+ constructor(name: string);
19
+ /**
20
+ * Gets the current class name
21
+ * @returns the class name
22
+ */
23
+ getClassName(): string;
24
+ /**
25
+ * Gets the value input component
26
+ */
27
+ get value(): NodeParticleConnectionPoint;
28
+ /**
29
+ * Gets the min input component
30
+ */
31
+ get min(): NodeParticleConnectionPoint;
32
+ /**
33
+ * Gets the max input component
34
+ */
35
+ get max(): NodeParticleConnectionPoint;
36
+ /**
37
+ * Gets the output component
38
+ */
39
+ get output(): NodeParticleConnectionPoint;
40
+ _build(state: NodeParticleBuildState): this | undefined;
41
+ _deserialize(serializationObject: any): void;
42
+ }
@@ -0,0 +1,114 @@
1
+ import { RegisterClass } from "../../../Misc/typeStore.js";
2
+ import { Vector2, Vector3 } from "../../../Maths/math.vector.js";
3
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
4
+ import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
5
+ import { Color4 } from "../../../Maths/math.color.js";
6
+ /**
7
+ * Block used to clamp a float
8
+ */
9
+ export class ParticleClampBlock extends NodeParticleBlock {
10
+ /** Gets or sets the minimum range */
11
+ get minimum() {
12
+ return this.min.value;
13
+ }
14
+ set minimum(value) {
15
+ this.min.value = value;
16
+ }
17
+ /** Gets or sets the maximum range */
18
+ get maximum() {
19
+ return this.max.value;
20
+ }
21
+ set maximum(value) {
22
+ this.max.value = value;
23
+ }
24
+ /**
25
+ * Creates a new ParticleClampBlock
26
+ * @param name defines the block name
27
+ */
28
+ constructor(name) {
29
+ super(name);
30
+ this.registerInput("value", NodeParticleBlockConnectionPointTypes.AutoDetect);
31
+ this.registerInput("min", NodeParticleBlockConnectionPointTypes.Float, true, 0);
32
+ this.registerInput("max", NodeParticleBlockConnectionPointTypes.Float, true, 1);
33
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
34
+ this._outputs[0]._typeConnectionSource = this._inputs[0];
35
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Matrix);
36
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Particle);
37
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Texture);
38
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.FloatGradient);
39
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector2Gradient);
40
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3Gradient);
41
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Color4Gradient);
42
+ this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.System);
43
+ }
44
+ /**
45
+ * Gets the current class name
46
+ * @returns the class name
47
+ */
48
+ getClassName() {
49
+ return "ParticleClampBlock";
50
+ }
51
+ /**
52
+ * Gets the value input component
53
+ */
54
+ get value() {
55
+ return this._inputs[0];
56
+ }
57
+ /**
58
+ * Gets the min input component
59
+ */
60
+ get min() {
61
+ return this._inputs[1];
62
+ }
63
+ /**
64
+ * Gets the max input component
65
+ */
66
+ get max() {
67
+ return this._inputs[2];
68
+ }
69
+ /**
70
+ * Gets the output component
71
+ */
72
+ get output() {
73
+ return this._outputs[0];
74
+ }
75
+ _build(state) {
76
+ if (!this.value.isConnected) {
77
+ this.output._storedFunction = null;
78
+ this.output._storedValue = null;
79
+ return;
80
+ }
81
+ const func = (value, min, max) => {
82
+ return Math.max(min, Math.min(value, max));
83
+ };
84
+ this.output._storedFunction = (state) => {
85
+ const value = this.value.getConnectedValue(state);
86
+ const min = this.min.isConnected ? this.min.getConnectedValue(state) : this.minimum;
87
+ const max = this.max.isConnected ? this.max.getConnectedValue(state) : this.maximum;
88
+ switch (this.value.type) {
89
+ case NodeParticleBlockConnectionPointTypes.Int:
90
+ case NodeParticleBlockConnectionPointTypes.Float: {
91
+ return func(value, min, max);
92
+ }
93
+ case NodeParticleBlockConnectionPointTypes.Vector2: {
94
+ return new Vector2(func(value.x, min, max), func(value.y, min, max));
95
+ }
96
+ case NodeParticleBlockConnectionPointTypes.Vector3: {
97
+ return new Vector3(func(value.x, min, max), func(value.y, min, max), func(value.z, min, max));
98
+ }
99
+ case NodeParticleBlockConnectionPointTypes.Color4: {
100
+ return new Color4(func(value.x, min, max), func(value.y, min, max), func(value.z, min, max), func(value.w, min, max));
101
+ }
102
+ }
103
+ return 0;
104
+ };
105
+ return this;
106
+ }
107
+ _deserialize(serializationObject) {
108
+ super._deserialize(serializationObject);
109
+ this.minimum = serializationObject.minimum;
110
+ this.maximum = serializationObject.maximum;
111
+ }
112
+ }
113
+ RegisterClass("BABYLON.ParticleClampBlock", ParticleClampBlock);
114
+ //# sourceMappingURL=particleClampBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particleClampBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleClampBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IACrD,qCAAqC;IACrC,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,IAAW,OAAO,CAAC,KAAa;QAC5B,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,qCAAqC;IACrC,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,IAAW,OAAO,CAAC,KAAa;QAC5B,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;;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,KAAK,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,EA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,OAAO,IAAI,CAAC;IAChB,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC/C,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Color4 } from \"../../../Maths/math.color\";\r\n\r\n/**\r\n * Block used to clamp a float\r\n */\r\nexport class ParticleClampBlock extends NodeParticleBlock {\r\n /** Gets or sets the minimum range */\r\n public get minimum() {\r\n return this.min.value;\r\n }\r\n\r\n public set minimum(value: number) {\r\n this.min.value = value;\r\n }\r\n\r\n /** Gets or sets the maximum range */\r\n public get maximum() {\r\n return this.max.value;\r\n }\r\n\r\n public set maximum(value: number) {\r\n this.max.value = value;\r\n }\r\n\r\n /**\r\n * Creates a new ParticleClampBlock\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(\"min\", NodeParticleBlockConnectionPointTypes.Float, true, 0);\r\n this.registerInput(\"max\", NodeParticleBlockConnectionPointTypes.Float, true, 1);\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 this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.FloatGradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector2Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Color4Gradient);\r\n this._inputs[0].excludedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.System);\r\n }\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 \"ParticleClampBlock\";\r\n }\r\n\r\n /**\r\n * Gets the value 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 min input component\r\n */\r\n public get min(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): 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.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, min: number, max: number) => {\r\n return Math.max(min, Math.min(value, max));\r\n };\r\n\r\n this.output._storedFunction = (state) => {\r\n const value = this.value.getConnectedValue(state);\r\n const min = this.min.isConnected ? this.min.getConnectedValue(state) : this.minimum;\r\n const max = this.max.isConnected ? this.max.getConnectedValue(state) : this.maximum;\r\n\r\n switch (this.value.type) {\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n return func(value, min, max);\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n return new Vector2(func(value.x, min, max), func(value.y, min, max));\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n return new Vector3(func(value.x, min, max), func(value.y, min, max), func(value.z, min, max));\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n return new Color4(func(value.x, min, max), func(value.y, min, max), func(value.z, min, max), func(value.w, min, max));\r\n }\r\n }\r\n\r\n return 0;\r\n };\r\n\r\n return this;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.minimum = serializationObject.minimum;\r\n this.maximum = serializationObject.maximum;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleClampBlock\", ParticleClampBlock);\r\n"]}
@@ -6,7 +6,9 @@ import { NodeParticleBlock } from "../nodeParticleBlock.js";
6
6
  */
7
7
  export declare enum ParticleVectorMathBlockOperations {
8
8
  /** Dot product */
9
- Dot = 0
9
+ Dot = 0,
10
+ /** Distance between two vectors */
11
+ Distance = 1
10
12
  }
11
13
  /**
12
14
  * Block used to apply math operations that only apply to vectors
@@ -16,7 +18,6 @@ export declare class ParticleVectorMathBlock extends NodeParticleBlock {
16
18
  * Gets or sets the operation applied by the block
17
19
  */
18
20
  operation: ParticleVectorMathBlockOperations;
19
- private readonly _connectionObservers;
20
21
  /**
21
22
  * Create a new ParticleVectorMathBlock
22
23
  * @param name defines the block name
@@ -40,11 +41,6 @@ export declare class ParticleVectorMathBlock extends NodeParticleBlock {
40
41
  */
41
42
  get output(): NodeParticleConnectionPoint;
42
43
  _build(state: NodeParticleBuildState): void;
43
- private _updateInputOutputTypes;
44
- /**
45
- * Release resources
46
- */
47
- dispose(): void;
48
44
  /**
49
45
  * Serializes this block in a JSON representation
50
46
  * @returns the serialized block object
@@ -11,6 +11,8 @@ export var ParticleVectorMathBlockOperations;
11
11
  (function (ParticleVectorMathBlockOperations) {
12
12
  /** Dot product */
13
13
  ParticleVectorMathBlockOperations[ParticleVectorMathBlockOperations["Dot"] = 0] = "Dot";
14
+ /** Distance between two vectors */
15
+ ParticleVectorMathBlockOperations[ParticleVectorMathBlockOperations["Distance"] = 1] = "Distance";
14
16
  })(ParticleVectorMathBlockOperations || (ParticleVectorMathBlockOperations = {}));
15
17
  /**
16
18
  * Block used to apply math operations that only apply to vectors
@@ -26,19 +28,9 @@ export class ParticleVectorMathBlock extends NodeParticleBlock {
26
28
  * Gets or sets the operation applied by the block
27
29
  */
28
30
  this.operation = ParticleVectorMathBlockOperations.Dot;
29
- this.registerInput("left", NodeParticleBlockConnectionPointTypes.AutoDetect);
30
- this.registerInput("right", NodeParticleBlockConnectionPointTypes.AutoDetect);
31
- this.registerOutput("output", NodeParticleBlockConnectionPointTypes.BasedOnInput);
32
- this.output._typeConnectionSource = this.left;
33
- this.left.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);
34
- this.right.acceptedConnectionPointTypes.push(NodeParticleBlockConnectionPointTypes.Vector3);
35
- this._linkConnectionTypes(0, 1);
36
- this._connectionObservers = [
37
- this.left.onConnectionObservable.add(() => this._updateInputOutputTypes()),
38
- this.left.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
39
- this.right.onConnectionObservable.add(() => this._updateInputOutputTypes()),
40
- this.right.onDisconnectionObservable.add(() => this._updateInputOutputTypes()),
41
- ];
31
+ this.registerInput("left", NodeParticleBlockConnectionPointTypes.Vector3);
32
+ this.registerInput("right", NodeParticleBlockConnectionPointTypes.Vector3);
33
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Float);
42
34
  }
43
35
  /**
44
36
  * Gets the current class name
@@ -81,29 +73,17 @@ export class ParticleVectorMathBlock extends NodeParticleBlock {
81
73
  };
82
74
  break;
83
75
  }
76
+ case ParticleVectorMathBlockOperations.Distance: {
77
+ func = (state) => {
78
+ return Vector3.Distance(left.getConnectedValue(state), right.getConnectedValue(state));
79
+ };
80
+ break;
81
+ }
84
82
  }
85
83
  this.output._storedFunction = (state) => {
86
84
  return func(state);
87
85
  };
88
86
  }
89
- _updateInputOutputTypes() {
90
- // First update the output type with the initial assumption that we'll base it on the left input.
91
- this.output._typeConnectionSource = this.left;
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;
95
- }
96
- }
97
- /**
98
- * Release resources
99
- */
100
- dispose() {
101
- super.dispose();
102
- for (const observer of this._connectionObservers) {
103
- observer.remove();
104
- }
105
- this._connectionObservers.length = 0;
106
- }
107
87
  /**
108
88
  * Serializes this block in a JSON representation
109
89
  * @returns the serialized block object
@@ -126,7 +106,10 @@ __decorate([
126
106
  editableInPropertyPage("Operation", 5 /* PropertyTypeForEdition.List */, "ADVANCED", {
127
107
  notifiers: { rebuild: true },
128
108
  embedded: true,
129
- options: [{ label: "Dot", value: ParticleVectorMathBlockOperations.Dot }],
109
+ options: [
110
+ { label: "Dot", value: ParticleVectorMathBlockOperations.Dot },
111
+ { label: "Distance", value: ParticleVectorMathBlockOperations.Distance },
112
+ ],
130
113
  })
131
114
  ], ParticleVectorMathBlock.prototype, "operation", void 0);
132
115
  RegisterClass("BABYLON.ParticleVectorMathBlock", ParticleVectorMathBlock);
@@ -1 +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,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iC,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"]}
1
+ {"version":3,"file":"particleVectorMathBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleVectorMathBlock.ts"],"names":[],"mappings":";AAGA,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,iCAKX;AALD,WAAY,iCAAiC;IACzC,kBAAkB;IAClB,uFAAG,CAAA;IACH,mCAAmC;IACnC,iGAAQ,CAAA;AACZ,CAAC,EALW,iCAAiC,KAAjC,iCAAiC,QAK5C;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAc1D;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAlBhB;;WAEG;QASI,cAAS,GAAG,iCAAiC,CAAC,GAAG,CAAC;QASrD,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,OAAO,CAAC,CAAC;QAC1E,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,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AE;oBACb,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC3F,CAAC,CAAC;gBACF,MAAM;YACV,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC;IACN,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;AA/FU;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,KAAK,EAAE,KAAK,EAAE,iCAAiC,CAAC,GAAG,EAAE;YAC9D,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,iCAAiC,CAAC,QAAQ,EAAE;SAC3E;KACJ,CAAC;0DACuD;AAiG7D,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import 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 /** Distance between two vectors */\r\n Distance,\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: [\r\n { label: \"Dot\", value: ParticleVectorMathBlockOperations.Dot },\r\n { label: \"Distance\", value: ParticleVectorMathBlockOperations.Distance },\r\n ],\r\n })\r\n public operation = ParticleVectorMathBlockOperations.Dot;\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.Vector3);\r\n this.registerInput(\"right\", NodeParticleBlockConnectionPointTypes.Vector3);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Float);\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 case ParticleVectorMathBlockOperations.Distance: {\r\n func = (state) => {\r\n return Vector3.Distance(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 /**\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"]}
@@ -103,6 +103,10 @@ export declare class SystemBlock extends NodeParticleBlock {
103
103
  * Gets the rampGradient input component
104
104
  */
105
105
  get rampGradient(): NodeParticleConnectionPoint;
106
+ /**
107
+ * Gets the emitterPosition input component
108
+ */
109
+ get emitterPosition(): NodeParticleConnectionPoint;
106
110
  /**
107
111
  * Gets the system output component
108
112
  */
@@ -2,7 +2,7 @@ import { __decorate } from "../../../tslib.es6.js";
2
2
 
3
3
  import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
4
4
  import { RegisterClass } from "../../../Misc/typeStore.js";
5
- import { Vector2 } from "../../../Maths/math.vector.js";
5
+ import { Vector2, Vector3 } from "../../../Maths/math.vector.js";
6
6
  import { Color3, Color4 } from "../../../Maths/math.color.js";
7
7
  import { BaseParticleSystem } from "../../baseParticleSystem.js";
8
8
  import { NodeParticleBlock } from "../nodeParticleBlock.js";
@@ -79,6 +79,7 @@ export class SystemBlock extends NodeParticleBlock {
79
79
  this.registerInput("onStart", NodeParticleBlockConnectionPointTypes.System, true);
80
80
  this.registerInput("onEnd", NodeParticleBlockConnectionPointTypes.System, true);
81
81
  this.registerInput("rampGradient", NodeParticleBlockConnectionPointTypes.Color4, true);
82
+ this.registerInput("emitterPosition", NodeParticleBlockConnectionPointTypes.Vector3, true, Vector3.Zero());
82
83
  this.registerOutput("system", NodeParticleBlockConnectionPointTypes.System);
83
84
  }
84
85
  /**
@@ -142,6 +143,12 @@ export class SystemBlock extends NodeParticleBlock {
142
143
  get rampGradient() {
143
144
  return this._inputs[8];
144
145
  }
146
+ /**
147
+ * Gets the emitterPosition input component
148
+ */
149
+ get emitterPosition() {
150
+ return this._inputs[9];
151
+ }
145
152
  /**
146
153
  * Gets the system output component
147
154
  */
@@ -174,6 +181,7 @@ export class SystemBlock extends NodeParticleBlock {
174
181
  particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);
175
182
  particleSystem.isLocal = this.isLocal;
176
183
  particleSystem.disposeOnStop = this.disposeOnStop;
184
+ particleSystem.emitter = this.emitterPosition.getConnectedValue(state) ?? Vector3.Zero();
177
185
  // The emit rate can vary if it is connected to another block like a gradient
178
186
  particleSystem._calculateEmitRate = () => {
179
187
  state.systemContext = particleSystem;