@onerjs/core 8.30.9 → 8.31.1

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 (124) hide show
  1. package/Animations/animationGroup.js +1 -4
  2. package/Animations/animationGroup.js.map +1 -1
  3. package/Behaviors/Cameras/interpolatingBehavior.d.ts +52 -0
  4. package/Behaviors/Cameras/interpolatingBehavior.js +105 -0
  5. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -0
  6. package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +5 -20
  7. package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -69
  8. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  9. package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +81 -0
  10. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +223 -0
  11. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -0
  12. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -1
  13. package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
  14. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +16 -21
  15. package/Cameras/Inputs/geospatialCameraPointersInput.js +43 -73
  16. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  17. package/Cameras/Inputs/orbitCameraPointersInput.d.ts +49 -0
  18. package/Cameras/Inputs/orbitCameraPointersInput.js +105 -0
  19. package/Cameras/Inputs/orbitCameraPointersInput.js.map +1 -0
  20. package/Cameras/Limits/geospatialLimits.d.ts +60 -0
  21. package/Cameras/Limits/geospatialLimits.js +89 -0
  22. package/Cameras/Limits/geospatialLimits.js.map +1 -0
  23. package/Cameras/cameraMovement.d.ts +150 -0
  24. package/Cameras/cameraMovement.js +190 -0
  25. package/Cameras/cameraMovement.js.map +1 -0
  26. package/Cameras/geospatialCamera.d.ts +53 -49
  27. package/Cameras/geospatialCamera.js +172 -192
  28. package/Cameras/geospatialCamera.js.map +1 -1
  29. package/Cameras/geospatialCameraInputsManager.d.ts +5 -0
  30. package/Cameras/geospatialCameraInputsManager.js +9 -0
  31. package/Cameras/geospatialCameraInputsManager.js.map +1 -1
  32. package/Cameras/geospatialCameraMovement.d.ts +66 -0
  33. package/Cameras/geospatialCameraMovement.js +199 -0
  34. package/Cameras/geospatialCameraMovement.js.map +1 -0
  35. package/Engines/Native/nativeInterfaces.d.ts +14 -6
  36. package/Engines/Native/nativeInterfaces.js +6 -1
  37. package/Engines/Native/nativeInterfaces.js.map +1 -1
  38. package/Engines/nativeEngine.js +2 -2
  39. package/Engines/nativeEngine.js.map +1 -1
  40. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +1 -1
  41. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
  42. package/FlowGraph/flowGraphMath.d.ts +25 -0
  43. package/FlowGraph/flowGraphMath.js +40 -0
  44. package/FlowGraph/flowGraphMath.js.map +1 -0
  45. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
  46. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  47. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +5 -1
  48. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  49. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -5
  50. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  51. package/Materials/shaderMaterial.js +4 -2
  52. package/Materials/shaderMaterial.js.map +1 -1
  53. package/Maths/math.vector.functions.d.ts +5 -24
  54. package/Maths/math.vector.functions.js +32 -35
  55. package/Maths/math.vector.functions.js.map +1 -1
  56. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +1 -0
  57. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +51 -16
  58. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  59. package/Meshes/csg2.js +1 -1
  60. package/Meshes/csg2.js.map +1 -1
  61. package/Meshes/thinInstanceMesh.js +15 -0
  62. package/Meshes/thinInstanceMesh.js.map +1 -1
  63. package/Misc/fileTools.js.map +1 -1
  64. package/Misc/tools.d.ts +3 -0
  65. package/Misc/tools.js +43 -4
  66. package/Misc/tools.js.map +1 -1
  67. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +1 -1
  68. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +1 -1
  69. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -1
  70. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +1 -1
  71. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +3 -3
  72. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
  73. package/Particles/Node/Blocks/Update/updateSizeBlock.d.ts +35 -0
  74. package/Particles/Node/Blocks/Update/updateSizeBlock.js +73 -0
  75. package/Particles/Node/Blocks/Update/updateSizeBlock.js.map +1 -0
  76. package/Particles/Node/Blocks/index.d.ts +1 -0
  77. package/Particles/Node/Blocks/index.js +1 -0
  78. package/Particles/Node/Blocks/index.js.map +1 -1
  79. package/Particles/Node/Blocks/particleInputBlock.js +1 -0
  80. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  81. package/Particles/Node/Blocks/particleRandomBlock.d.ts +5 -2
  82. package/Particles/Node/Blocks/particleRandomBlock.js +32 -14
  83. package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
  84. package/Particles/Node/Blocks/systemBlock.d.ts +8 -0
  85. package/Particles/Node/Blocks/systemBlock.js +8 -0
  86. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  87. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +3 -1
  88. package/Particles/Node/Enums/nodeParticleContextualSources.js +2 -0
  89. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  90. package/Particles/Node/nodeParticleBuildState.js +6 -4
  91. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  92. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +0 -2
  93. package/Particles/Node/nodeParticleSystemSet.helper.js +279 -161
  94. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  95. package/Particles/particle.d.ts +4 -0
  96. package/Particles/particle.js +2 -0
  97. package/Particles/particle.js.map +1 -1
  98. package/Particles/thinParticleSystem.d.ts +3 -7
  99. package/Particles/thinParticleSystem.function.d.ts +1 -1
  100. package/Particles/thinParticleSystem.function.js +9 -6
  101. package/Particles/thinParticleSystem.function.js.map +1 -1
  102. package/Particles/thinParticleSystem.js +4 -6
  103. package/Particles/thinParticleSystem.js.map +1 -1
  104. package/Shaders/ShadersInclude/gaussianSplatting.js +5 -1
  105. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  106. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
  107. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
  108. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
  109. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  110. package/Shaders/gaussianSplatting.vertex.js +3 -3
  111. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  112. package/Shaders/gaussianSplattingDepth.vertex.js +2 -2
  113. package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
  114. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +35 -1
  115. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  116. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +2 -1
  117. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -1
  118. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -2
  119. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  120. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  121. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  122. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
  123. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  124. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"basicPositionUpdateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/basicPositionUpdateBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AAEvE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,iBAAiB;IAC3D;;;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,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,MAAM;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,0BAA0B,CAAC;IACtC,CAAC;IAED;;;OAGG;IACa,MAAM,CAAC,KAA6B;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAuB,CAAC;QAE5E,MAAM,eAAe,GAAG,CAAC,QAAkB,EAAE,EAAE;YAC3C,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;YAC7B,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAC/E,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC1D,CAAC,CAAC;QAEF,MAAM,kBAAkB,GAAG;YACvB,OAAO,EAAE,eAAe;YACxB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,kBAAkB,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to provide the basic update functionality for particles.\r\n */\r\nexport class BasicPositionUpdateBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateScaleBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"BasicPositionUpdateBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n\r\n const processPosition = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n particle.direction.scaleToRef(system._directionScale, system._scaledDirection);\r\n particle.position.addInPlace(system._scaledDirection);\r\n };\r\n\r\n const positionProcessing = {\r\n process: processPosition,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(positionProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = positionProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BasicPositionUpdateBlock\", BasicPositionUpdateBlock);\r\n"]}
1
+ {"version":3,"file":"basicPositionUpdateBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/basicPositionUpdateBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK5D,OAAO,EAAE,gBAAgB,EAAE,yCAA4C;AAEvE;;GAEG;AACH,MAAM,OAAO,wBAAy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AAC,iBAAiB,GAAG,kBAAkB,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;IACtC,CAAC;CACJ;AAED,aAAa,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../../nodeParticleBuildState\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { Particle } from \"core/Particles/particle\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to provide the basic update functionality for particles.\r\n */\r\nexport class BasicPositionUpdateBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new BasicPositionUpdateBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.Particle);\r\n }\r\n\r\n /**\r\n * Gets the particle component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"BasicPositionUpdateBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n\r\n const processPosition = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n particle.direction.scaleToRef(particle._directionScale, particle._scaledDirection);\r\n particle.position.addInPlace(particle._scaledDirection);\r\n };\r\n\r\n const positionProcessing = {\r\n process: processPosition,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(positionProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = positionProcessing;\r\n }\r\n\r\n this.output._storedValue = system;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BasicPositionUpdateBlock\", BasicPositionUpdateBlock);\r\n"]}
@@ -0,0 +1,35 @@
1
+ import type { NodeParticleConnectionPoint } from "../../nodeParticleBlockConnectionPoint.js";
2
+ import type { NodeParticleBuildState } from "../../nodeParticleBuildState.js";
3
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
4
+ /**
5
+ * Block used to update the size of a particle
6
+ */
7
+ export declare class UpdateSizeBlock extends NodeParticleBlock {
8
+ /**
9
+ * Create a new UpdateSizeBlock
10
+ * @param name defines the block name
11
+ */
12
+ constructor(name: string);
13
+ /**
14
+ * Gets the particle component
15
+ */
16
+ get particle(): NodeParticleConnectionPoint;
17
+ /**
18
+ * Gets the size input component
19
+ */
20
+ get size(): NodeParticleConnectionPoint;
21
+ /**
22
+ * Gets the output component
23
+ */
24
+ get output(): NodeParticleConnectionPoint;
25
+ /**
26
+ * Gets the current class name
27
+ * @returns the class name
28
+ */
29
+ getClassName(): string;
30
+ /**
31
+ * Builds the block
32
+ * @param state defines the current build state
33
+ */
34
+ _build(state: NodeParticleBuildState): void;
35
+ }
@@ -0,0 +1,73 @@
1
+ import { RegisterClass } from "../../../../Misc/typeStore.js";
2
+ import { NodeParticleBlock } from "../../nodeParticleBlock.js";
3
+ import { NodeParticleBlockConnectionPointTypes } from "../../Enums/nodeParticleBlockConnectionPointTypes.js";
4
+ import { _ConnectAtTheEnd } from "../../../Queue/executionQueue.js";
5
+ /**
6
+ * Block used to update the size of a particle
7
+ */
8
+ export class UpdateSizeBlock extends NodeParticleBlock {
9
+ /**
10
+ * Create a new UpdateSizeBlock
11
+ * @param name defines the block name
12
+ */
13
+ constructor(name) {
14
+ super(name);
15
+ this.registerInput("particle", NodeParticleBlockConnectionPointTypes.Particle);
16
+ this.registerInput("size", NodeParticleBlockConnectionPointTypes.Float);
17
+ this.registerOutput("output", NodeParticleBlockConnectionPointTypes.Particle);
18
+ }
19
+ /**
20
+ * Gets the particle component
21
+ */
22
+ get particle() {
23
+ return this._inputs[0];
24
+ }
25
+ /**
26
+ * Gets the size input component
27
+ */
28
+ get size() {
29
+ return this._inputs[1];
30
+ }
31
+ /**
32
+ * Gets the output component
33
+ */
34
+ get output() {
35
+ return this._outputs[0];
36
+ }
37
+ /**
38
+ * Gets the current class name
39
+ * @returns the class name
40
+ */
41
+ getClassName() {
42
+ return "UpdateSizeBlock";
43
+ }
44
+ /**
45
+ * Builds the block
46
+ * @param state defines the current build state
47
+ */
48
+ _build(state) {
49
+ const system = this.particle.getConnectedValue(state);
50
+ this.output._storedValue = system;
51
+ if (!this.size.isConnected) {
52
+ return;
53
+ }
54
+ const processSize = (particle) => {
55
+ state.particleContext = particle;
56
+ state.systemContext = system;
57
+ particle.size = this.size.getConnectedValue(state);
58
+ };
59
+ const sizeProcessing = {
60
+ process: processSize,
61
+ previousItem: null,
62
+ nextItem: null,
63
+ };
64
+ if (system._updateQueueStart) {
65
+ _ConnectAtTheEnd(sizeProcessing, system._updateQueueStart);
66
+ }
67
+ else {
68
+ system._updateQueueStart = sizeProcessing;
69
+ }
70
+ }
71
+ }
72
+ RegisterClass("BABYLON.UpdateSizeBlock", UpdateSizeBlock);
73
+ //# sourceMappingURL=updateSizeBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateSizeBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Particles/Node/Blocks/Update/updateSizeBlock.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,sCAA4B;AACpD,OAAO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AQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAW,CAAC;QACjE,CAAC,CAAC;QAEF,MAAM,cAAc,GAAG;YACnB,OAAO,EAAE,WAAW;YACpB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;SACjB,CAAC;QAEF,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;YAC3B,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,iBAAiB,GAAG,cAAc,CAAC;QAC9C,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import type { Particle } from \"core/Particles/particle\";\r\nimport type { ThinParticleSystem } from \"core/Particles/thinParticleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { _ConnectAtTheEnd } from \"core/Particles/Queue/executionQueue\";\r\n\r\n/**\r\n * Block used to update the size of a particle\r\n */\r\nexport class UpdateSizeBlock extends NodeParticleBlock {\r\n /**\r\n * Create a new UpdateSizeBlock\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(\"size\", NodeParticleBlockConnectionPointTypes.Float);\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 size input component\r\n */\r\n public get size(): 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 \"UpdateSizeBlock\";\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n const system = this.particle.getConnectedValue(state) as ThinParticleSystem;\r\n\r\n this.output._storedValue = system;\r\n\r\n if (!this.size.isConnected) {\r\n return;\r\n }\r\n\r\n const processSize = (particle: Particle) => {\r\n state.particleContext = particle;\r\n state.systemContext = system;\r\n particle.size = this.size.getConnectedValue(state) as number;\r\n };\r\n\r\n const sizeProcessing = {\r\n process: processSize,\r\n previousItem: null,\r\n nextItem: null,\r\n };\r\n\r\n if (system._updateQueueStart) {\r\n _ConnectAtTheEnd(sizeProcessing, system._updateQueueStart);\r\n } else {\r\n system._updateQueueStart = sizeProcessing;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.UpdateSizeBlock\", UpdateSizeBlock);\r\n"]}
@@ -7,6 +7,7 @@ export * from "./Update/updateDirectionBlock.js";
7
7
  export * from "./Update/updatePositionBlock.js";
8
8
  export * from "./Update/updateColorBlock.js";
9
9
  export * from "./Update/updateScaleBlock.js";
10
+ export * from "./Update/updateSizeBlock.js";
10
11
  export * from "./Update/updateAngleBlock.js";
11
12
  export * from "./Update/updateAgeBlock.js";
12
13
  export * from "./Update/basicPositionUpdateBlock.js";
@@ -8,6 +8,7 @@ export * from "./Update/updateDirectionBlock.js";
8
8
  export * from "./Update/updatePositionBlock.js";
9
9
  export * from "./Update/updateColorBlock.js";
10
10
  export * from "./Update/updateScaleBlock.js";
11
+ export * from "./Update/updateSizeBlock.js";
11
12
  export * from "./Update/updateAngleBlock.js";
12
13
  export * from "./Update/updateAgeBlock.js";
13
14
  export * from "./Update/basicPositionUpdateBlock.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./systemBlock\";\r\nexport * from \"./particleInputBlock\";\r\nexport * from \"./particleSourceTextureBlock\";\r\nexport * from \"./particleMathBlock\";\r\nexport * from \"./particleLerpBlock\";\r\nexport * from \"./Update/updateDirectionBlock\";\r\nexport * from \"./Update/updatePositionBlock\";\r\nexport * from \"./Update/updateColorBlock\";\r\nexport * from \"./Update/updateScaleBlock\";\r\nexport * from \"./Update/updateSizeBlock\";\r\nexport * from \"./Update/updateAngleBlock\";\r\nexport * from \"./Update/updateAgeBlock\";\r\nexport * from \"./Update/basicPositionUpdateBlock\";\r\nexport * from \"./Update/basicSpriteUpdateBlock\";\r\nexport * from \"./Update/basicColorUpdateBlock\";\r\nexport * from \"./Update/updateSpriteCellIndexBlock\";\r\nexport * from \"./Update/updateFlowMapBlock\";\r\nexport * from \"./Update/updateAttractorBlock\";\r\nexport * from \"./Update/alignAngleBlock\";\r\nexport * from \"./Emitters/index\";\r\nexport * from \"./particleGradientValueBlock\";\r\nexport * from \"./particleGradientBlock\";\r\nexport * from \"./particleConverterBlock\";\r\nexport * from \"./particleTrigonometryBlock\";\r\nexport * from \"./particleRandomBlock\";\r\nexport * from \"./particleDebugBlock\";\r\nexport * from \"./particleElbowBlock\";\r\nexport * from \"./Teleport/particleTeleportInBlock\";\r\nexport * from \"./Teleport/particleTeleportOutBlock\";\r\nexport * from \"./Conditions/particleConditionBlock\";\r\nexport * from \"./Triggers/particleTriggerBlock\";\r\nexport * from \"./particleLocalVariableBlock\";\r\nexport * from \"./particleVectorLengthBlock\";\r\nexport * from \"./particleFresnelBlock\";\r\n"]}
@@ -108,6 +108,7 @@ export class ParticleInputBlock extends NodeParticleBlock {
108
108
  case NodeParticleContextualSources.Lifetime:
109
109
  case NodeParticleContextualSources.Angle:
110
110
  case NodeParticleContextualSources.AgeGradient:
111
+ case NodeParticleContextualSources.Size:
111
112
  this._type = NodeParticleBlockConnectionPointTypes.Float;
112
113
  break;
113
114
  case NodeParticleContextualSources.SpriteCellEnd:
@@ -1 +1 @@
1
- {"version":3,"file":"particleInputBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleInputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CA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KAAK,CAAC;QAClD,CAAC;aAAM,CAAC;YACJ,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAE1D,IAAI,SAAS,EAAE,CAAC;gBACZ,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACvE,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Observable } from \"../../../Misc/observable\";\r\nimport { GetClass, RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Matrix, Vector2, Vector3 } from \"../../../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 \"core/Maths/math.color\";\r\nimport { NodeParticleContextualSources } from \"../Enums/nodeParticleContextualSources\";\r\nimport { NodeParticleSystemSources } from \"../Enums/nodeParticleSystemSources\";\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nexport class ParticleInputBlock extends NodeParticleBlock {\r\n private _storedValue: any;\r\n private _valueCallback: () => any;\r\n private _type: NodeParticleBlockConnectionPointTypes = NodeParticleBlockConnectionPointTypes.Undefined;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public min: number = 0;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public max: number = 0;\r\n\r\n /** Gets or sets the group to use to display this block in the Inspector */\r\n public groupInInspector = \"\";\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this input is displayed in the Inspector\r\n */\r\n public displayInInspector = true;\r\n\r\n /** Gets an observable raised when the value is changed */\r\n public onValueChangedObservable = new Observable<ParticleInputBlock>();\r\n\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n public get type(): NodeParticleBlockConnectionPointTypes {\r\n if (this._type === NodeParticleBlockConnectionPointTypes.AutoDetect) {\r\n if (this.value != null) {\r\n if (!isNaN(this.value)) {\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n return this._type;\r\n }\r\n\r\n switch (this.value.getClassName()) {\r\n case \"Vector2\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector2;\r\n return this._type;\r\n case \"Vector3\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n return this._type;\r\n case \"Color4\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Color4;\r\n return this._type;\r\n case \"Matrix\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Matrix;\r\n return this._type;\r\n }\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n /** @internal */\r\n private _systemSource: NodeParticleSystemSources = NodeParticleSystemSources.None;\r\n\r\n /**\r\n * Gets a boolean indicating that the current connection point is a system source\r\n */\r\n public get isSystemSource(): boolean {\r\n return this._contextualSource === NodeParticleContextualSources.None && this._systemSource !== NodeParticleSystemSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the system source used by this input block\r\n */\r\n public get systemSource(): NodeParticleSystemSources {\r\n return this._systemSource;\r\n }\r\n\r\n public set systemSource(value: NodeParticleSystemSources) {\r\n this._systemSource = value;\r\n\r\n if (value !== NodeParticleSystemSources.None) {\r\n this._contextualSource = NodeParticleContextualSources.None;\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n\r\n switch (value) {\r\n case NodeParticleSystemSources.Time:\r\n case NodeParticleSystemSources.Delta:\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n break;\r\n case NodeParticleSystemSources.Emitter:\r\n case NodeParticleSystemSources.CameraPosition:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n break;\r\n }\r\n\r\n if (this.output) {\r\n this.output.type = this._type;\r\n }\r\n }\r\n }\r\n\r\n private _contextualSource = NodeParticleContextualSources.None;\r\n /**\r\n * Gets a boolean indicating that the current connection point is a contextual value\r\n */\r\n public get isContextual(): boolean {\r\n return this._contextualSource !== NodeParticleContextualSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the current contextual value\r\n */\r\n public get contextualValue(): NodeParticleContextualSources {\r\n return this._contextualSource;\r\n }\r\n\r\n public set contextualValue(value: NodeParticleContextualSources) {\r\n this._contextualSource = value;\r\n\r\n if (value !== NodeParticleContextualSources.None) {\r\n this._systemSource = NodeParticleSystemSources.None;\r\n\r\n switch (value) {\r\n case NodeParticleContextualSources.Scale:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector2;\r\n break;\r\n case NodeParticleContextualSources.Position:\r\n case NodeParticleContextualSources.Direction:\r\n case NodeParticleContextualSources.ScaledDirection:\r\n case NodeParticleContextualSources.InitialDirection:\r\n case NodeParticleContextualSources.LocalPositionUpdated:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n break;\r\n case NodeParticleContextualSources.Color:\r\n case NodeParticleContextualSources.InitialColor:\r\n case NodeParticleContextualSources.ColorDead:\r\n case NodeParticleContextualSources.ColorStep:\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this._type = NodeParticleBlockConnectionPointTypes.Color4;\r\n break;\r\n case NodeParticleContextualSources.Age:\r\n case NodeParticleContextualSources.Lifetime:\r\n case NodeParticleContextualSources.Angle:\r\n case NodeParticleContextualSources.AgeGradient:\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n break;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n this._type = NodeParticleBlockConnectionPointTypes.Int;\r\n break;\r\n }\r\n\r\n if (this.output) {\r\n this.output.type = this._type;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new InputBlock\r\n * @param name defines the block name\r\n * @param type defines the type of the input (can be set to NodeParticleBlockConnectionPointTypes.AutoDetect)\r\n */\r\n public constructor(name: string, type: NodeParticleBlockConnectionPointTypes = NodeParticleBlockConnectionPointTypes.AutoDetect) {\r\n super(name);\r\n\r\n this._type = type;\r\n this._isInput = true;\r\n this._storedValue = null;\r\n\r\n this.setDefaultValue();\r\n\r\n this.registerOutput(\"output\", type);\r\n }\r\n\r\n /**\r\n * Gets or sets the value of that point.\r\n * Please note that this value will be ignored if valueCallback is defined\r\n */\r\n public get value(): any {\r\n return this._storedValue;\r\n }\r\n\r\n public set value(value: any) {\r\n if (this.type === NodeParticleBlockConnectionPointTypes.Float) {\r\n if (this.min !== this.max) {\r\n value = Math.max(this.min, value);\r\n value = Math.min(this.max, value);\r\n }\r\n }\r\n\r\n this._storedValue = value;\r\n\r\n this.onValueChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets a callback used to get the value of that point.\r\n * Please note that setting this value will force the connection point to ignore the value property\r\n */\r\n public get valueCallback(): () => any {\r\n return this._valueCallback;\r\n }\r\n\r\n public set valueCallback(value: () => any) {\r\n this._valueCallback = value;\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 \"ParticleInputBlock\";\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 * Set the input block to its default value (based on its type)\r\n */\r\n public setDefaultValue() {\r\n switch (this.type) {\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float:\r\n this.value = 0;\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n this.value = Vector2.Zero();\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n this.value = Vector3.Zero();\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n this.value = new Color4(1, 1, 1, 1);\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Matrix:\r\n this.value = Matrix.Identity();\r\n break;\r\n }\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n super._build(state);\r\n\r\n if (this.isSystemSource) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getSystemValue(this._systemSource);\r\n };\r\n } else if (this.isContextual) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getContextualValue(this._contextualSource);\r\n };\r\n } else {\r\n this.output._storedValue = this.value;\r\n // As a function to let the user dynamically change the value at runtime\r\n this.output._storedFunction = () => {\r\n return this.value;\r\n };\r\n }\r\n }\r\n\r\n public override dispose() {\r\n this.onValueChangedObservable.clear();\r\n\r\n super.dispose();\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.type = this.type;\r\n serializationObject.contextualValue = this.contextualValue;\r\n serializationObject.systemSource = this.systemSource;\r\n serializationObject.min = this.min;\r\n serializationObject.max = this.max;\r\n serializationObject.groupInInspector = this.groupInInspector;\r\n serializationObject.displayInInspector = this.displayInInspector;\r\n\r\n if (this._storedValue !== null && !this.isContextual && !this.isSystemSource) {\r\n if (this._storedValue.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this._storedValue.getClassName();\r\n serializationObject.value = this._storedValue.asArray();\r\n } else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this._storedValue;\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this._type = serializationObject.type;\r\n this.contextualValue = serializationObject.contextualValue;\r\n this.systemSource = serializationObject.systemSource || NodeParticleSystemSources.None;\r\n\r\n this.min = serializationObject.min || 0;\r\n this.max = serializationObject.max || 0;\r\n this.groupInInspector = serializationObject.groupInInspector || \"\";\r\n if (serializationObject.displayInInspector !== undefined) {\r\n this.displayInInspector = serializationObject.displayInInspector;\r\n }\r\n\r\n if (!serializationObject.valueType) {\r\n return;\r\n }\r\n\r\n if (serializationObject.valueType === \"number\") {\r\n this._storedValue = serializationObject.value;\r\n } else {\r\n const valueType = GetClass(serializationObject.valueType);\r\n\r\n if (valueType) {\r\n this._storedValue = valueType.FromArray(serializationObject.value);\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleInputBlock\", ParticleInputBlock);\r\n"]}
1
+ {"version":3,"file":"particleInputBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleInputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAsBrD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,qCAAqC,CAAC,UAAU,EAAE,CAAC;YAClE,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;gBACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBACrB,IAAI,CAAC,KAAK,GAAG,qCAAqC,CAAC,KAAK,CAAC;oBACzD,OAAO,IAAI,CAAC,KAAK,CAAC;gBACtB,CAAC;gBAED,QAAQ,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,CAAC;oB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BAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,mBAAmB,CAAC,eAAe,CAAC;QAC3D,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,YAAY,IAAI,yBAAyB,CAAC,IAAI,CAAC;QAEvF,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,IAAI,EAAE,CAAC;QACnE,IAAI,mBAAmB,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACvD,IAAI,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,kBAAkB,CAAC;QACrE,CAAC;QAED,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC;YACjC,OAAO;QACX,CAAC;QAED,IAAI,mBAAmB,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC7C,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,KAAK,CAAC;QAClD,CAAC;aAAM,CAAC;YACJ,MAAM,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAE1D,IAAI,SAAS,EAAE,CAAC;gBACZ,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACvE,CAAC;QACL,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { Observable } from \"../../../Misc/observable\";\r\nimport { GetClass, RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Matrix, Vector2, Vector3 } from \"../../../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 \"core/Maths/math.color\";\r\nimport { NodeParticleContextualSources } from \"../Enums/nodeParticleContextualSources\";\r\nimport { NodeParticleSystemSources } from \"../Enums/nodeParticleSystemSources\";\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nexport class ParticleInputBlock extends NodeParticleBlock {\r\n private _storedValue: any;\r\n private _valueCallback: () => any;\r\n private _type: NodeParticleBlockConnectionPointTypes = NodeParticleBlockConnectionPointTypes.Undefined;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public min: number = 0;\r\n\r\n /** Gets or set a value used to limit the range of float values */\r\n public max: number = 0;\r\n\r\n /** Gets or sets the group to use to display this block in the Inspector */\r\n public groupInInspector = \"\";\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this input is displayed in the Inspector\r\n */\r\n public displayInInspector = true;\r\n\r\n /** Gets an observable raised when the value is changed */\r\n public onValueChangedObservable = new Observable<ParticleInputBlock>();\r\n\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n public get type(): NodeParticleBlockConnectionPointTypes {\r\n if (this._type === NodeParticleBlockConnectionPointTypes.AutoDetect) {\r\n if (this.value != null) {\r\n if (!isNaN(this.value)) {\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n return this._type;\r\n }\r\n\r\n switch (this.value.getClassName()) {\r\n case \"Vector2\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector2;\r\n return this._type;\r\n case \"Vector3\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n return this._type;\r\n case \"Color4\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Color4;\r\n return this._type;\r\n case \"Matrix\":\r\n this._type = NodeParticleBlockConnectionPointTypes.Matrix;\r\n return this._type;\r\n }\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n /** @internal */\r\n private _systemSource: NodeParticleSystemSources = NodeParticleSystemSources.None;\r\n\r\n /**\r\n * Gets a boolean indicating that the current connection point is a system source\r\n */\r\n public get isSystemSource(): boolean {\r\n return this._contextualSource === NodeParticleContextualSources.None && this._systemSource !== NodeParticleSystemSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the system source used by this input block\r\n */\r\n public get systemSource(): NodeParticleSystemSources {\r\n return this._systemSource;\r\n }\r\n\r\n public set systemSource(value: NodeParticleSystemSources) {\r\n this._systemSource = value;\r\n\r\n if (value !== NodeParticleSystemSources.None) {\r\n this._contextualSource = NodeParticleContextualSources.None;\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n\r\n switch (value) {\r\n case NodeParticleSystemSources.Time:\r\n case NodeParticleSystemSources.Delta:\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n break;\r\n case NodeParticleSystemSources.Emitter:\r\n case NodeParticleSystemSources.CameraPosition:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n break;\r\n }\r\n\r\n if (this.output) {\r\n this.output.type = this._type;\r\n }\r\n }\r\n }\r\n\r\n private _contextualSource = NodeParticleContextualSources.None;\r\n /**\r\n * Gets a boolean indicating that the current connection point is a contextual value\r\n */\r\n public get isContextual(): boolean {\r\n return this._contextualSource !== NodeParticleContextualSources.None;\r\n }\r\n\r\n /**\r\n * Gets or sets the current contextual value\r\n */\r\n public get contextualValue(): NodeParticleContextualSources {\r\n return this._contextualSource;\r\n }\r\n\r\n public set contextualValue(value: NodeParticleContextualSources) {\r\n this._contextualSource = value;\r\n\r\n if (value !== NodeParticleContextualSources.None) {\r\n this._systemSource = NodeParticleSystemSources.None;\r\n\r\n switch (value) {\r\n case NodeParticleContextualSources.Scale:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector2;\r\n break;\r\n case NodeParticleContextualSources.Position:\r\n case NodeParticleContextualSources.Direction:\r\n case NodeParticleContextualSources.ScaledDirection:\r\n case NodeParticleContextualSources.InitialDirection:\r\n case NodeParticleContextualSources.LocalPositionUpdated:\r\n this._type = NodeParticleBlockConnectionPointTypes.Vector3;\r\n break;\r\n case NodeParticleContextualSources.Color:\r\n case NodeParticleContextualSources.InitialColor:\r\n case NodeParticleContextualSources.ColorDead:\r\n case NodeParticleContextualSources.ColorStep:\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this._type = NodeParticleBlockConnectionPointTypes.Color4;\r\n break;\r\n case NodeParticleContextualSources.Age:\r\n case NodeParticleContextualSources.Lifetime:\r\n case NodeParticleContextualSources.Angle:\r\n case NodeParticleContextualSources.AgeGradient:\r\n case NodeParticleContextualSources.Size:\r\n this._type = NodeParticleBlockConnectionPointTypes.Float;\r\n break;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n this._type = NodeParticleBlockConnectionPointTypes.Int;\r\n break;\r\n }\r\n\r\n if (this.output) {\r\n this.output.type = this._type;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new InputBlock\r\n * @param name defines the block name\r\n * @param type defines the type of the input (can be set to NodeParticleBlockConnectionPointTypes.AutoDetect)\r\n */\r\n public constructor(name: string, type: NodeParticleBlockConnectionPointTypes = NodeParticleBlockConnectionPointTypes.AutoDetect) {\r\n super(name);\r\n\r\n this._type = type;\r\n this._isInput = true;\r\n this._storedValue = null;\r\n\r\n this.setDefaultValue();\r\n\r\n this.registerOutput(\"output\", type);\r\n }\r\n\r\n /**\r\n * Gets or sets the value of that point.\r\n * Please note that this value will be ignored if valueCallback is defined\r\n */\r\n public get value(): any {\r\n return this._storedValue;\r\n }\r\n\r\n public set value(value: any) {\r\n if (this.type === NodeParticleBlockConnectionPointTypes.Float) {\r\n if (this.min !== this.max) {\r\n value = Math.max(this.min, value);\r\n value = Math.min(this.max, value);\r\n }\r\n }\r\n\r\n this._storedValue = value;\r\n\r\n this.onValueChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets or sets a callback used to get the value of that point.\r\n * Please note that setting this value will force the connection point to ignore the value property\r\n */\r\n public get valueCallback(): () => any {\r\n return this._valueCallback;\r\n }\r\n\r\n public set valueCallback(value: () => any) {\r\n this._valueCallback = value;\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 \"ParticleInputBlock\";\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 * Set the input block to its default value (based on its type)\r\n */\r\n public setDefaultValue() {\r\n switch (this.type) {\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float:\r\n this.value = 0;\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n this.value = Vector2.Zero();\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n this.value = Vector3.Zero();\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n this.value = new Color4(1, 1, 1, 1);\r\n break;\r\n case NodeParticleBlockConnectionPointTypes.Matrix:\r\n this.value = Matrix.Identity();\r\n break;\r\n }\r\n }\r\n\r\n public override _build(state: NodeParticleBuildState) {\r\n super._build(state);\r\n\r\n if (this.isSystemSource) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getSystemValue(this._systemSource);\r\n };\r\n } else if (this.isContextual) {\r\n this.output._storedValue = null;\r\n this.output._storedFunction = (state) => {\r\n return state.getContextualValue(this._contextualSource);\r\n };\r\n } else {\r\n this.output._storedValue = this.value;\r\n // As a function to let the user dynamically change the value at runtime\r\n this.output._storedFunction = () => {\r\n return this.value;\r\n };\r\n }\r\n }\r\n\r\n public override dispose() {\r\n this.onValueChangedObservable.clear();\r\n\r\n super.dispose();\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.type = this.type;\r\n serializationObject.contextualValue = this.contextualValue;\r\n serializationObject.systemSource = this.systemSource;\r\n serializationObject.min = this.min;\r\n serializationObject.max = this.max;\r\n serializationObject.groupInInspector = this.groupInInspector;\r\n serializationObject.displayInInspector = this.displayInInspector;\r\n\r\n if (this._storedValue !== null && !this.isContextual && !this.isSystemSource) {\r\n if (this._storedValue.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this._storedValue.getClassName();\r\n serializationObject.value = this._storedValue.asArray();\r\n } else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this._storedValue;\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this._type = serializationObject.type;\r\n this.contextualValue = serializationObject.contextualValue;\r\n this.systemSource = serializationObject.systemSource || NodeParticleSystemSources.None;\r\n\r\n this.min = serializationObject.min || 0;\r\n this.max = serializationObject.max || 0;\r\n this.groupInInspector = serializationObject.groupInInspector || \"\";\r\n if (serializationObject.displayInInspector !== undefined) {\r\n this.displayInInspector = serializationObject.displayInInspector;\r\n }\r\n\r\n if (!serializationObject.valueType) {\r\n return;\r\n }\r\n\r\n if (serializationObject.valueType === \"number\") {\r\n this._storedValue = serializationObject.value;\r\n } else {\r\n const valueType = GetClass(serializationObject.valueType);\r\n\r\n if (valueType) {\r\n this._storedValue = valueType.FromArray(serializationObject.value);\r\n }\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleInputBlock\", ParticleInputBlock);\r\n"]}
@@ -1,5 +1,5 @@
1
- import { NodeParticleBlock } from "../nodeParticleBlock.js";
2
1
  import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
2
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
3
3
  /**
4
4
  * Locks supported by the random block
5
5
  */
@@ -9,13 +9,16 @@ export declare enum ParticleRandomBlockLocks {
9
9
  /** PerParticle */
10
10
  PerParticle = 1,
11
11
  /** PerSystem */
12
- PerSystem = 2
12
+ PerSystem = 2,
13
+ /** OncePerParticle */
14
+ OncePerParticle = 3
13
15
  }
14
16
  /**
15
17
  * Block used to get a random number
16
18
  */
17
19
  export declare class ParticleRandomBlock extends NodeParticleBlock {
18
20
  private _currentLockId;
21
+ private _oncePerParticleMap;
19
22
  /**
20
23
  * Gets or sets a value indicating if that block will lock its value for a specific event
21
24
  */
@@ -1,10 +1,10 @@
1
1
  import { __decorate } from "../../../tslib.es6.js";
2
+ import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
2
3
  import { RegisterClass } from "../../../Misc/typeStore.js";
4
+ import { Color4 } from "../../../Maths/math.color.js";
3
5
  import { Vector2, Vector3 } from "../../../Maths/math.vector.js";
4
- import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
5
6
  import { NodeParticleBlock } from "../nodeParticleBlock.js";
6
7
  import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
7
- import { Color4 } from "../../../Maths/math.color.js";
8
8
  /**
9
9
  * Locks supported by the random block
10
10
  */
@@ -16,6 +16,8 @@ export var ParticleRandomBlockLocks;
16
16
  ParticleRandomBlockLocks[ParticleRandomBlockLocks["PerParticle"] = 1] = "PerParticle";
17
17
  /** PerSystem */
18
18
  ParticleRandomBlockLocks[ParticleRandomBlockLocks["PerSystem"] = 2] = "PerSystem";
19
+ /** OncePerParticle */
20
+ ParticleRandomBlockLocks[ParticleRandomBlockLocks["OncePerParticle"] = 3] = "OncePerParticle";
19
21
  })(ParticleRandomBlockLocks || (ParticleRandomBlockLocks = {}));
20
22
  /**
21
23
  * Block used to get a random number
@@ -28,6 +30,7 @@ export class ParticleRandomBlock extends NodeParticleBlock {
28
30
  constructor(name) {
29
31
  super(name);
30
32
  this._currentLockId = -2;
33
+ this._oncePerParticleMap = new Map();
31
34
  /**
32
35
  * Gets or sets a value indicating if that block will lock its value for a specific event
33
36
  */
@@ -77,6 +80,7 @@ export class ParticleRandomBlock extends NodeParticleBlock {
77
80
  _build() {
78
81
  let func = null;
79
82
  this._currentLockId = -2;
83
+ this._oncePerParticleMap.clear();
80
84
  switch (this.min.type) {
81
85
  case NodeParticleBlockConnectionPointTypes.AutoDetect:
82
86
  case NodeParticleBlockConnectionPointTypes.Int:
@@ -114,20 +118,33 @@ export class ParticleRandomBlock extends NodeParticleBlock {
114
118
  }
115
119
  }
116
120
  this.output._storedFunction = (state) => {
117
- let lockId = 0;
118
- switch (this.lockMode) {
119
- case ParticleRandomBlockLocks.PerParticle:
120
- lockId = state.particleContext?.id ?? -1;
121
- break;
122
- case ParticleRandomBlockLocks.PerSystem:
123
- lockId = state.buildId ?? 0;
124
- break;
121
+ if (this.lockMode === ParticleRandomBlockLocks.OncePerParticle) {
122
+ const particleId = state.particleContext?.id ?? -1;
123
+ let cachedValue = this._oncePerParticleMap.get(particleId);
124
+ if (!cachedValue) {
125
+ cachedValue = func(state);
126
+ this._oncePerParticleMap.set(particleId, cachedValue);
127
+ }
128
+ this.output._storedValue = cachedValue;
125
129
  }
126
- if (this._currentLockId !== lockId) {
127
- if (this.lockMode !== ParticleRandomBlockLocks.None) {
128
- this._currentLockId = lockId;
130
+ else {
131
+ let lockId = -2;
132
+ switch (this.lockMode) {
133
+ case ParticleRandomBlockLocks.PerParticle:
134
+ lockId = state.particleContext?.id ?? -1;
135
+ break;
136
+ case ParticleRandomBlockLocks.PerSystem:
137
+ lockId = state.buildId ?? 0;
138
+ break;
139
+ default:
140
+ break;
141
+ }
142
+ if (this.lockMode === ParticleRandomBlockLocks.None || this._currentLockId !== lockId) {
143
+ if (this.lockMode !== ParticleRandomBlockLocks.None) {
144
+ this._currentLockId = lockId;
145
+ }
146
+ this.output._storedValue = func(state);
129
147
  }
130
- this.output._storedValue = func(state);
131
148
  }
132
149
  return this.output._storedValue;
133
150
  };
@@ -154,6 +171,7 @@ __decorate([
154
171
  { label: "None", value: ParticleRandomBlockLocks.None },
155
172
  { label: "Per particle", value: ParticleRandomBlockLocks.PerParticle },
156
173
  { label: "Per system", value: ParticleRandomBlockLocks.PerSystem },
174
+ { label: "Once per particle", value: ParticleRandomBlockLocks.OncePerParticle },
157
175
  ],
158
176
  })
159
177
  ], ParticleRandomBlock.prototype, "lockMode", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"particleRandomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleRandomBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAE/C;;GAEG;AACH,MAAM,CAAN,IAAY,wBAOX;AAPD,WAAY,wBAAwB;IAChC,WAAW;IACX,uEAAQ,CAAA;IACR,kBAAkB;IAClB,qFAAe,CAAA;IACf,gBAAgB;IAChB,iFAAa,CAAA;AACjB,CAAC,EAPW,wBAAwB,KAAxB,wBAAwB,QAOnC;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAgBtD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApBR,mBAAc,GAAG,CAAC,CAAC,CAAC;QAC5B;;WAEG;QAUI,aAAQ,GAAG,wBAAwB,CAAC,WAAW,CAAC;QASnD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,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B,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACJ;AApJU;IATN,sBAAsB,CAAC,UAAU,uCAA+B,UAAU,EAAE;QACzE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE;YACvD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,wBAAwB,CAAC,WAAW,EAAE;YACtE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,wBAAwB,CAAC,SAAS,EAAE;SACrE;KACJ,CAAC;qDACqD;AAsJ3D,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\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 \"core/Maths/math.color\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum ParticleRandomBlockLocks {\r\n /** None */\r\n None = 0,\r\n /** PerParticle */\r\n PerParticle = 1,\r\n /** PerSystem */\r\n PerSystem = 2,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class ParticleRandomBlock extends NodeParticleBlock {\r\n private _currentLockId = -2;\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific event\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"None\", value: ParticleRandomBlockLocks.None },\r\n { label: \"Per particle\", value: ParticleRandomBlockLocks.PerParticle },\r\n { label: \"Per system\", value: ParticleRandomBlockLocks.PerSystem },\r\n ],\r\n })\r\n public lockMode = ParticleRandomBlockLocks.PerParticle;\r\n\r\n /**\r\n * Create a new ParticleRandomBlock\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(\"min\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 0);\r\n this.registerInput(\"max\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 1);\r\n\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._outputs[0]._defaultConnectionPointType = NodeParticleBlockConnectionPointTypes.Float;\r\n this._linkConnectionTypes(0, 1);\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 \"ParticleRandomBlock\";\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[0];\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[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() {\r\n let func: Nullable<(state: NodeParticleBuildState) => any> = null;\r\n this._currentLockId = -2;\r\n\r\n switch (this.min.type) {\r\n case NodeParticleBlockConnectionPointTypes.AutoDetect:\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? 0;\r\n const max = this.max.getConnectedValue(state) ?? 1;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) ?? Vector2.One();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) ?? Vector3.One();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? new Color4(0, 0, 0, 0);\r\n const max = this.max.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n return new Color4(\r\n min.r + Math.random() * (max.r - min.r),\r\n min.g + Math.random() * (max.g - min.g),\r\n min.b + Math.random() * (max.b - min.b),\r\n min.a + Math.random() * (max.a - min.a)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n let lockId = 0;\r\n\r\n switch (this.lockMode) {\r\n case ParticleRandomBlockLocks.PerParticle:\r\n lockId = state.particleContext?.id ?? -1;\r\n break;\r\n case ParticleRandomBlockLocks.PerSystem:\r\n lockId = state.buildId ?? 0;\r\n break;\r\n }\r\n\r\n if (this._currentLockId !== lockId) {\r\n if (this.lockMode !== ParticleRandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n }\r\n this.output._storedValue = func!(state);\r\n }\r\n return this.output._storedValue;\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.lockMode = this.lockMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleRandomBlock\", ParticleRandomBlock);\r\n"]}
1
+ {"version":3,"file":"particleRandomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleRandomBlock.ts"],"names":[],"mappings":";AAIA,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,sCAA+B;AAC1D,OAAO,EAAE,iBAAiB,EAAE,gCAA8C;AAC1E,OAAO,EAAE,qCAAqC,EAAE,0DAAwE;AAExH;;GAEG;AACH,MAAM,CAAN,I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AAE,CAAC;QAE9C,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACJ;AArKU;IAVN,sBAAsB,CAAC,UAAU,uCAA+B,UAAU,EAAE;QACzE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE;YACvD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,wBAAwB,CAAC,WAAW,EAAE;YACtE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,wBAAwB,CAAC,SAAS,EAAE;YAClE,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,wBAAwB,CAAC,eAAe,EAAE;SAClF;KACJ,CAAC;qDACqD;AAuK3D,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum ParticleRandomBlockLocks {\r\n /** None */\r\n None = 0,\r\n /** PerParticle */\r\n PerParticle = 1,\r\n /** PerSystem */\r\n PerSystem = 2,\r\n /** OncePerParticle */\r\n OncePerParticle = 3,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class ParticleRandomBlock extends NodeParticleBlock {\r\n private _currentLockId = -2;\r\n private _oncePerParticleMap: Map<number, any> = new Map();\r\n\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific event\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"None\", value: ParticleRandomBlockLocks.None },\r\n { label: \"Per particle\", value: ParticleRandomBlockLocks.PerParticle },\r\n { label: \"Per system\", value: ParticleRandomBlockLocks.PerSystem },\r\n { label: \"Once per particle\", value: ParticleRandomBlockLocks.OncePerParticle },\r\n ],\r\n })\r\n public lockMode = ParticleRandomBlockLocks.PerParticle;\r\n\r\n /**\r\n * Create a new ParticleRandomBlock\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(\"min\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 0);\r\n this.registerInput(\"max\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 1);\r\n\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._outputs[0]._defaultConnectionPointType = NodeParticleBlockConnectionPointTypes.Float;\r\n this._linkConnectionTypes(0, 1);\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 \"ParticleRandomBlock\";\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[0];\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[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() {\r\n let func: Nullable<(state: NodeParticleBuildState) => any> = null;\r\n this._currentLockId = -2;\r\n this._oncePerParticleMap.clear();\r\n\r\n switch (this.min.type) {\r\n case NodeParticleBlockConnectionPointTypes.AutoDetect:\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? 0;\r\n const max = this.max.getConnectedValue(state) ?? 1;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) ?? Vector2.One();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) ?? Vector3.One();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? new Color4(0, 0, 0, 0);\r\n const max = this.max.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n return new Color4(\r\n min.r + Math.random() * (max.r - min.r),\r\n min.g + Math.random() * (max.g - min.g),\r\n min.b + Math.random() * (max.b - min.b),\r\n min.a + Math.random() * (max.a - min.a)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n if (this.lockMode === ParticleRandomBlockLocks.OncePerParticle) {\r\n const particleId = state.particleContext?.id ?? -1;\r\n let cachedValue = this._oncePerParticleMap.get(particleId);\r\n\r\n if (!cachedValue) {\r\n cachedValue = func!(state);\r\n this._oncePerParticleMap.set(particleId, cachedValue);\r\n }\r\n\r\n this.output._storedValue = cachedValue;\r\n } else {\r\n let lockId = -2;\r\n\r\n switch (this.lockMode) {\r\n case ParticleRandomBlockLocks.PerParticle:\r\n lockId = state.particleContext?.id ?? -1;\r\n break;\r\n case ParticleRandomBlockLocks.PerSystem:\r\n lockId = state.buildId ?? 0;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n if (this.lockMode === ParticleRandomBlockLocks.None || this._currentLockId !== lockId) {\r\n if (this.lockMode !== ParticleRandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n }\r\n\r\n this.output._storedValue = func!(state);\r\n }\r\n }\r\n\r\n return this.output._storedValue;\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.lockMode = this.lockMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleRandomBlock\", ParticleRandomBlock);\r\n"]}
@@ -105,6 +105,14 @@ export declare class SystemBlock extends NodeParticleBlock {
105
105
  * @returns the built particle system
106
106
  */
107
107
  createSystem(state: NodeParticleBuildState): ParticleSystem;
108
+ /**
109
+ * Serializes the system block
110
+ * @returns The serialized object
111
+ */
108
112
  serialize(): any;
113
+ /**
114
+ * Deserializes the system block
115
+ * @param serializationObject The serialized system
116
+ */
109
117
  _deserialize(serializationObject: any): void;
110
118
  }
@@ -192,6 +192,10 @@ export class SystemBlock extends NodeParticleBlock {
192
192
  // Return
193
193
  return particleSystem;
194
194
  }
195
+ /**
196
+ * Serializes the system block
197
+ * @returns The serialized object
198
+ */
195
199
  serialize() {
196
200
  const serializationObject = super.serialize();
197
201
  serializationObject.capacity = this.capacity;
@@ -208,6 +212,10 @@ export class SystemBlock extends NodeParticleBlock {
208
212
  serializationObject.startDelay = this.startDelay;
209
213
  return serializationObject;
210
214
  }
215
+ /**
216
+ * Deserializes the system block
217
+ * @param serializationObject The serialized system
218
+ */
211
219
  _deserialize(serializationObject) {
212
220
  super._deserialize(serializationObject);
213
221
  this.capacity = serializationObject.capacity;