@babylonjs/core 8.34.0 → 8.35.0

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 (176) hide show
  1. package/Audio/audioSceneComponent.d.ts +9 -5
  2. package/Audio/audioSceneComponent.js +1 -0
  3. package/Audio/audioSceneComponent.js.map +1 -1
  4. package/AudioV2/abstractAudio/audioEngineV2.d.ts +10 -0
  5. package/AudioV2/abstractAudio/audioEngineV2.js +29 -0
  6. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  7. package/AudioV2/webAudio/webAudioEngine.d.ts +5 -0
  8. package/AudioV2/webAudio/webAudioEngine.js +8 -0
  9. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  10. package/AudioV2/webAudio/webAudioStaticSound.js +2 -2
  11. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  12. package/AudioV2/webAudio/webAudioStreamingSound.js +5 -2
  13. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  14. package/Cameras/camera.d.ts +4 -0
  15. package/Cameras/camera.js +18 -9
  16. package/Cameras/camera.js.map +1 -1
  17. package/Engines/abstractEngine.js +2 -2
  18. package/Engines/abstractEngine.js.map +1 -1
  19. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +1 -1
  20. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
  21. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +1 -1
  22. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -1
  23. package/FrameGraph/Node/Blocks/computeShaderBlock.d.ts +42 -0
  24. package/FrameGraph/Node/Blocks/computeShaderBlock.js +74 -0
  25. package/FrameGraph/Node/Blocks/computeShaderBlock.js.map +1 -0
  26. package/FrameGraph/Node/Blocks/executeBlock.d.ts +11 -1
  27. package/FrameGraph/Node/Blocks/executeBlock.js +18 -0
  28. package/FrameGraph/Node/Blocks/executeBlock.js.map +1 -1
  29. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  30. package/FrameGraph/Node/Blocks/index.js +1 -0
  31. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  32. package/FrameGraph/Node/Blocks/inputBlock.js +2 -0
  33. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  34. package/FrameGraph/Node/Blocks/outputBlock.js +1 -0
  35. package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -1
  36. package/FrameGraph/Node/nodeRenderGraph.d.ts +1 -1
  37. package/FrameGraph/Node/nodeRenderGraph.js +7 -3
  38. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  39. package/FrameGraph/Node/nodeRenderGraphBlock.js +7 -0
  40. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  41. package/FrameGraph/Passes/pass.d.ts +11 -1
  42. package/FrameGraph/Passes/pass.js +11 -1
  43. package/FrameGraph/Passes/pass.js.map +1 -1
  44. package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +115 -0
  45. package/FrameGraph/Tasks/Misc/computeShaderTask.js +174 -0
  46. package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -0
  47. package/FrameGraph/Tasks/Misc/executeTask.d.ts +5 -0
  48. package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
  49. package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
  50. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -1
  51. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
  52. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  53. package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
  54. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +7 -0
  55. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
  56. package/FrameGraph/frameGraph.d.ts +1 -1
  57. package/FrameGraph/frameGraph.js +3 -6
  58. package/FrameGraph/frameGraph.js.map +1 -1
  59. package/FrameGraph/frameGraphTask.d.ts +3 -2
  60. package/FrameGraph/frameGraphTask.js +5 -2
  61. package/FrameGraph/frameGraphTask.js.map +1 -1
  62. package/FrameGraph/frameGraphTextureManager.js +2 -2
  63. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  64. package/FrameGraph/index.d.ts +1 -0
  65. package/FrameGraph/index.js +1 -0
  66. package/FrameGraph/index.js.map +1 -1
  67. package/Lights/directionalLight.js +1 -4
  68. package/Lights/directionalLight.js.map +1 -1
  69. package/Lights/pointLight.js +2 -5
  70. package/Lights/pointLight.js.map +1 -1
  71. package/Materials/Background/backgroundMaterial.js +9 -5
  72. package/Materials/Background/backgroundMaterial.js.map +1 -1
  73. package/Materials/PBR/openpbrMaterial.d.ts +14 -0
  74. package/Materials/PBR/openpbrMaterial.js +16 -0
  75. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  76. package/Materials/clipPlaneMaterialHelper.js +11 -1
  77. package/Materials/clipPlaneMaterialHelper.js.map +1 -1
  78. package/Materials/floatingOriginMatrixOverrides.d.ts +4 -1
  79. package/Materials/floatingOriginMatrixOverrides.js +14 -2
  80. package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
  81. package/Materials/index.d.ts +1 -0
  82. package/Materials/index.js +1 -0
  83. package/Materials/index.js.map +1 -1
  84. package/Maths/math.like.d.ts +7 -2
  85. package/Maths/math.like.js.map +1 -1
  86. package/Maths/math.vector.functions.d.ts +57 -15
  87. package/Maths/math.vector.functions.js +77 -8
  88. package/Maths/math.vector.functions.js.map +1 -1
  89. package/Meshes/mesh.js +1 -1
  90. package/Meshes/mesh.js.map +1 -1
  91. package/Misc/decorators.d.ts +1 -1
  92. package/Misc/decorators.js.map +1 -1
  93. package/Misc/dumpTools.d.ts +20 -0
  94. package/Misc/dumpTools.js +60 -49
  95. package/Misc/dumpTools.js.map +1 -1
  96. package/Misc/index.d.ts +1 -2
  97. package/Misc/index.js +1 -2
  98. package/Misc/index.js.map +1 -1
  99. package/Misc/sceneSerializer.js +4 -1
  100. package/Misc/sceneSerializer.js.map +1 -1
  101. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +7 -7
  102. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  103. package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +57 -0
  104. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +163 -0
  105. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -0
  106. package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +8 -0
  107. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +25 -2
  108. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
  109. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +7 -7
  110. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
  111. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +8 -8
  112. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
  113. package/Particles/Node/Blocks/Emitters/index.d.ts +5 -4
  114. package/Particles/Node/Blocks/Emitters/index.js +5 -4
  115. package/Particles/Node/Blocks/Emitters/index.js.map +1 -1
  116. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +9 -9
  117. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  118. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +6 -6
  119. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
  120. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +7 -7
  121. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
  122. package/Particles/Node/Blocks/particleInputBlock.js +2 -0
  123. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  124. package/Particles/Node/Blocks/systemBlock.d.ts +36 -0
  125. package/Particles/Node/Blocks/systemBlock.js +84 -0
  126. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  127. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +5 -1
  128. package/Particles/Node/Enums/nodeParticleContextualSources.js +4 -0
  129. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  130. package/Particles/Node/nodeParticleBuildState.d.ts +2 -7
  131. package/Particles/Node/nodeParticleBuildState.js +12 -22
  132. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  133. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +4 -3
  134. package/Particles/Node/nodeParticleSystemSet.helper.js +285 -110
  135. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  136. package/Particles/thinParticleSystem.js +1 -0
  137. package/Particles/thinParticleSystem.js.map +1 -1
  138. package/Physics/physicsRaycastResult.d.ts +3 -0
  139. package/Physics/physicsRaycastResult.js.map +1 -1
  140. package/Physics/v2/Plugins/havokPlugin.js +1 -1
  141. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  142. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -0
  143. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +9 -1
  144. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  145. package/PostProcesses/postProcess.d.ts +4 -0
  146. package/PostProcesses/postProcess.js +4 -0
  147. package/PostProcesses/postProcess.js.map +1 -1
  148. package/PostProcesses/thinSSAO2PostProcess.d.ts +1 -0
  149. package/PostProcesses/thinSSAO2PostProcess.js +18 -6
  150. package/PostProcesses/thinSSAO2PostProcess.js.map +1 -1
  151. package/Shaders/ShadersInclude/openpbrCoatLayerData.js +4 -0
  152. package/Shaders/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
  153. package/Shaders/ShadersInclude/openpbrDirectLighting.js +5 -2
  154. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  155. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
  156. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  157. package/Shaders/ShadersInclude/openpbrFuzzLayerData.js +1 -1
  158. package/Shaders/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
  159. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
  160. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  161. package/Shaders/particles.vertex.js +1 -1
  162. package/Shaders/particles.vertex.js.map +1 -1
  163. package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js +4 -0
  164. package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
  165. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +5 -2
  166. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  167. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
  168. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  169. package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js +1 -1
  170. package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
  171. package/ShadersWGSL/particles.vertex.js +1 -1
  172. package/ShadersWGSL/particles.vertex.js.map +1 -1
  173. package/package.json +1 -1
  174. package/scene.d.ts +7 -2
  175. package/scene.js +15 -8
  176. package/scene.js.map +1 -1
@@ -1,147 +1,322 @@
1
+ import { Vector2 } from "../../Maths/math.vector.js";
2
+ import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
1
3
  import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
4
+ import { NodeParticleContextualSources } from "./Enums/nodeParticleContextualSources.js";
5
+ import { ParticleConverterBlock } from "./Blocks/particleConverterBlock.js";
6
+ import { ParticleGradientBlock } from "./Blocks/particleGradientBlock.js";
7
+ import { ParticleGradientValueBlock } from "./Blocks/particleGradientValueBlock.js";
8
+ import { ParticleInputBlock } from "./Blocks/particleInputBlock.js";
9
+ import { ParticleMathBlock, ParticleMathBlockOperations } from "./Blocks/particleMathBlock.js";
10
+ import { ParticleRandomBlock, ParticleRandomBlockLocks } from "./Blocks/particleRandomBlock.js";
11
+ import { ParticleTextureSourceBlock } from "./Blocks/particleSourceTextureBlock.js";
2
12
  import { SystemBlock } from "./Blocks/systemBlock.js";
3
13
  import { CreateParticleBlock } from "./Blocks/Emitters/createParticleBlock.js";
4
14
  import { BoxShapeBlock } from "./Blocks/Emitters/boxShapeBlock.js";
5
- import { ParticleInputBlock } from "./Blocks/particleInputBlock.js";
6
- import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
7
- import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
15
+ import { ConeShapeBlock } from "./Blocks/Emitters/coneShapeBlock.js";
8
16
  import { CylinderShapeBlock } from "./Blocks/Emitters/cylinderShapeBlock.js";
9
17
  import { MeshShapeBlock } from "./Blocks/Emitters/meshShapeBlock.js";
10
- import { ParticleTextureSourceBlock } from "./Blocks/particleSourceTextureBlock.js";
11
- import { BasicPositionUpdateBlock } from "./Blocks/Update/basicPositionUpdateBlock.js";
12
- import { BasicColorUpdateBlock } from "./Blocks/Update/basicColorUpdateBlock.js";
13
- import { ParticleRandomBlock } from "./Blocks/particleRandomBlock.js";
14
- function _CreateAndConnectInput(connectionPoint, name, defaultValue) {
15
- const input = new ParticleInputBlock(name);
16
- input.value = defaultValue;
17
- input.output.connectTo(connectionPoint);
18
+ import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
19
+ import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
20
+ import { UpdateColorBlock } from "./Blocks/Update/updateColorBlock.js";
21
+ import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
22
+ /**
23
+ * Converts a ParticleSystem to a NodeParticleSystemSet.
24
+ * @param name The name of the node particle system set.
25
+ * @param particleSystemsList The particle systems to convert.
26
+ * @returns The converted node particle system set or null if conversion failed.
27
+ * #0K3AQ2#3672
28
+ * #7J0NXA#4
29
+ */
30
+ export async function ConvertToNodeParticleSystemSetAsync(name, particleSystemsList) {
31
+ if (!particleSystemsList || !particleSystemsList.length) {
32
+ return null;
33
+ }
34
+ const nodeParticleSystemSet = new NodeParticleSystemSet(name);
35
+ const promises = [];
36
+ for (const particleSystem of particleSystemsList) {
37
+ promises.push(_ExtractDatafromParticleSystemAsync(nodeParticleSystemSet, particleSystem));
38
+ }
39
+ await Promise.all(promises);
40
+ return nodeParticleSystemSet;
41
+ }
42
+ async function _ExtractDatafromParticleSystemAsync(newSet, oldSystem) {
43
+ // CreateParticle block
44
+ const createParticleBlock = _CreateCreateParticleBlock(oldSystem);
45
+ // Emitter Shape block
46
+ const shapeBlock = _CreateEmitterShapeBlock(oldSystem);
47
+ createParticleBlock.particle.connectTo(shapeBlock.particle);
48
+ // Position update
49
+ const positionUpdateBlock = _CreatePositionUpdateBlock();
50
+ shapeBlock.output.connectTo(positionUpdateBlock.particle);
51
+ // Color update
52
+ const colorUpdateBlock = _CreateColorUpdateBlock(oldSystem, createParticleBlock);
53
+ positionUpdateBlock.output.connectTo(colorUpdateBlock.particle);
54
+ // System block
55
+ const newSystem = _CreateSystemBlock(oldSystem);
56
+ colorUpdateBlock.output.connectTo(newSystem.particle);
57
+ // Register
58
+ newSet.systemBlocks.push(newSystem);
18
59
  }
19
- async function _ExtractDatafromParticleSystemAsync(particleSystem, target) {
20
- // Main system
21
- const system = new SystemBlock(particleSystem.name);
22
- system.capacity = particleSystem.getCapacity();
23
- system.emitRate = particleSystem.emitRate;
60
+ function _CreateSystemBlock(oldSystem) {
61
+ const newSystem = new SystemBlock(oldSystem.name);
62
+ // Translation pivot
63
+ _CreateAndConnectInput("Translation pivot", oldSystem.translationPivot, newSystem.translationPivot);
64
+ // Gravity
65
+ _CreateAndConnectInput("Gravity", oldSystem.gravity, newSystem.gravity);
66
+ newSystem.emitRate = oldSystem.emitRate;
67
+ newSystem.manualEmitCount = oldSystem.manualEmitCount;
68
+ newSystem.blendMode = oldSystem.blendMode;
69
+ newSystem.capacity = oldSystem.getCapacity();
70
+ newSystem.targetStopDuration = oldSystem.targetStopDuration;
71
+ newSystem.startDelay = oldSystem.startDelay;
72
+ newSystem.targetStopDuration = oldSystem.targetStopDuration;
73
+ newSystem.updateSpeed = oldSystem.updateSpeed;
74
+ newSystem.preWarmCycles = oldSystem.preWarmCycles;
75
+ newSystem.preWarmStepOffset = oldSystem.preWarmStepOffset;
76
+ newSystem.isBillboardBased = oldSystem.isBillboardBased;
77
+ newSystem.isLocal = oldSystem.isLocal;
78
+ newSystem.disposeOnStop = oldSystem.disposeOnStop;
79
+ // Texture
80
+ const textureBlock = new ParticleTextureSourceBlock("Texture");
81
+ const url = oldSystem.particleTexture.url || "";
82
+ if (url) {
83
+ textureBlock.url = url;
84
+ }
85
+ else {
86
+ textureBlock.sourceTexture = oldSystem.particleTexture;
87
+ }
88
+ textureBlock.texture.connectTo(newSystem.texture);
89
+ return newSystem;
90
+ }
91
+ function _CreateCreateParticleBlock(oldSystem) {
24
92
  // Create particle
25
- const createParticleBlock = new CreateParticleBlock("Create particle");
26
- // Shape
93
+ const createParticleBlock = new CreateParticleBlock("Create Particle");
94
+ // Size
95
+ const randomSizeBlock = new ParticleRandomBlock("Random size");
96
+ _CreateAndConnectInput("Min size", oldSystem.minSize, randomSizeBlock.min);
97
+ _CreateAndConnectInput("Max size", oldSystem.maxSize, randomSizeBlock.max);
98
+ randomSizeBlock.output.connectTo(createParticleBlock.size);
99
+ // Scale
100
+ const randomScaleBlock = new ParticleRandomBlock("Random Scale");
101
+ _CreateAndConnectInput("Min Scale", new Vector2(oldSystem.minScaleX, oldSystem.minScaleY), randomScaleBlock.min);
102
+ _CreateAndConnectInput("Max Scale", new Vector2(oldSystem.maxScaleX, oldSystem.maxScaleY), randomScaleBlock.max);
103
+ randomScaleBlock.output.connectTo(createParticleBlock.scale);
104
+ // Color is handled when we do the color update block to manage gradients
105
+ // Dead color
106
+ _CreateAndConnectInput("Dead Color", oldSystem.colorDead, createParticleBlock.colorDead);
107
+ // Emit power (Speed)
108
+ const randomEmitPowerBlock = new ParticleRandomBlock("Random Emit Power");
109
+ _CreateAndConnectInput("Min Emit Power", oldSystem.minEmitPower, randomEmitPowerBlock.min);
110
+ _CreateAndConnectInput("Max Emit Power", oldSystem.maxEmitPower, randomEmitPowerBlock.max);
111
+ randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);
112
+ // Angular speed
113
+ const randomAngularSpeedBlock = new ParticleRandomBlock("Random Angular Speed");
114
+ _CreateAndConnectInput("Min Angular Speed", oldSystem.minAngularSpeed, randomAngularSpeedBlock.min);
115
+ _CreateAndConnectInput("Max Angular Speed", oldSystem.maxAngularSpeed, randomAngularSpeedBlock.max);
116
+ randomAngularSpeedBlock.output.connectTo(createParticleBlock.angularSpeed);
117
+ // Angle (rotation)
118
+ const randomRotationBlock = new ParticleRandomBlock("Random Rotation");
119
+ _CreateAndConnectInput("Min Rotation", oldSystem.minInitialRotation, randomRotationBlock.min);
120
+ _CreateAndConnectInput("Max Rotation", oldSystem.maxInitialRotation, randomRotationBlock.max);
121
+ randomRotationBlock.output.connectTo(createParticleBlock.angle);
122
+ // Lifetime
123
+ const randomLifetimeBlock = new ParticleRandomBlock("Random Lifetime");
124
+ _CreateAndConnectInput("Min Lifetime", oldSystem.minLifeTime, randomLifetimeBlock.min);
125
+ _CreateAndConnectInput("Max Lifetime", oldSystem.maxLifeTime, randomLifetimeBlock.max);
126
+ randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);
127
+ return createParticleBlock;
128
+ }
129
+ function _CreateEmitterShapeBlock(oldSystem) {
130
+ const emitter = oldSystem.particleEmitterType;
131
+ if (!emitter) {
132
+ throw new Error("Particle system has no emitter type.");
133
+ }
27
134
  let shapeBlock = null;
28
- switch (particleSystem.particleEmitterType.getClassName()) {
135
+ switch (emitter.getClassName()) {
29
136
  case "BoxParticleEmitter": {
30
- const source = particleSystem.particleEmitterType;
31
- shapeBlock = new BoxShapeBlock("Box shape");
137
+ const source = emitter;
138
+ shapeBlock = new BoxShapeBlock("Box Shape");
32
139
  const target = shapeBlock;
33
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
34
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
35
- _CreateAndConnectInput(target.minEmitBox, "Min Emit Box", source.minEmitBox);
36
- _CreateAndConnectInput(target.maxEmitBox, "Max Emit Box", source.maxEmitBox);
140
+ _CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
141
+ _CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
142
+ _CreateAndConnectInput("Min Emit Box", source.minEmitBox, target.minEmitBox);
143
+ _CreateAndConnectInput("Max Emit Box", source.maxEmitBox, target.maxEmitBox);
37
144
  break;
38
145
  }
39
- case "PointParticleEmitter": {
40
- const source = particleSystem.particleEmitterType;
41
- shapeBlock = new PointShapeBlock("Point shape");
146
+ case "ConeParticleEmitter": {
147
+ const source = emitter;
148
+ shapeBlock = new ConeShapeBlock("Cone Shape");
42
149
  const target = shapeBlock;
43
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
44
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
150
+ _CreateAndConnectInput("Radius", source.radius, target.radius);
151
+ _CreateAndConnectInput("Angle", source.angle, target.angle);
152
+ _CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
153
+ _CreateAndConnectInput("Height Range", source.heightRange, target.heightRange);
154
+ _CreateAndConnectInput("Emit From Spawn Point Only", source.emitFromSpawnPointOnly ? 1 : 0, target.emitFromSpawnPointOnly, NodeParticleBlockConnectionPointTypes.Int);
155
+ _CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
45
156
  break;
46
157
  }
47
- case "SphereParticleEmitter": {
48
- const source = particleSystem.particleEmitterType;
49
- shapeBlock = new SphereShapeBlock("Sphere shape");
50
- const target = shapeBlock;
51
- _CreateAndConnectInput(target.radius, "Radius", source.radius);
52
- _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
53
- _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
54
- break;
158
+ case "CustomParticleEmitter": {
159
+ // Custom emitter is not supported in nodes yet
160
+ throw new Error("CustomParticleEmitter is not supported in Node Particle System.");
55
161
  }
56
162
  case "CylinderParticleEmitter": {
57
- const source = particleSystem.particleEmitterType;
58
- shapeBlock = new CylinderShapeBlock("Cylinder shape");
163
+ const source = emitter;
164
+ shapeBlock = new CylinderShapeBlock("Cylinder Shape");
59
165
  const target = shapeBlock;
60
- _CreateAndConnectInput(target.height, "Height", source.height);
61
- _CreateAndConnectInput(target.radius, "Radius", source.radius);
62
- _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
63
- _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
166
+ _CreateAndConnectInput("Height", source.height, target.height);
167
+ _CreateAndConnectInput("Radius", source.radius, target.radius);
168
+ _CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
169
+ _CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
64
170
  break;
65
171
  }
172
+ case "HemisphericParticleEmitter": {
173
+ // Hemispheric emitter is not supported in nodes yet
174
+ throw new Error("HemisphericParticleEmitter is not supported in Node Particle System.");
175
+ }
66
176
  case "MeshParticleEmitter": {
67
- const source = particleSystem.particleEmitterType;
68
- shapeBlock = new MeshShapeBlock("Mesh shape");
177
+ const source = emitter;
178
+ shapeBlock = new MeshShapeBlock("Mesh Shape");
69
179
  const target = shapeBlock;
70
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
71
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
180
+ _CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
181
+ _CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
72
182
  target.mesh = source.mesh;
73
183
  break;
74
184
  }
185
+ case "PointParticleEmitter": {
186
+ const source = emitter;
187
+ shapeBlock = new PointShapeBlock("Point Shape");
188
+ const target = shapeBlock;
189
+ _CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
190
+ _CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
191
+ break;
192
+ }
193
+ case "SphereParticleEmitter": {
194
+ const source = emitter;
195
+ shapeBlock = new SphereShapeBlock("Sphere Shape");
196
+ const target = shapeBlock;
197
+ _CreateAndConnectInput("Radius", source.radius, target.radius);
198
+ _CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
199
+ _CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
200
+ break;
201
+ }
75
202
  }
76
203
  if (!shapeBlock) {
77
- throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);
204
+ throw new Error(`Unsupported particle emitter type: ${emitter.getClassName()}`);
78
205
  }
79
- createParticleBlock.particle.connectTo(shapeBlock.particle);
80
- createParticleBlock.colorDead.value = particleSystem.colorDead;
81
- // Color
82
- const color0Block = new ParticleInputBlock("Color0");
83
- color0Block.value = particleSystem.color1;
84
- const color1Block = new ParticleInputBlock("Color1");
85
- color1Block.value = particleSystem.color2;
86
- const randomColorBlock = new ParticleRandomBlock("Random Color");
87
- color0Block.output.connectTo(randomColorBlock.min);
88
- color1Block.output.connectTo(randomColorBlock.max);
89
- randomColorBlock.output.connectTo(createParticleBlock.color);
90
- // Emit power
91
- const minEmitPowerBlock = new ParticleInputBlock("Min Emit Power");
92
- minEmitPowerBlock.value = particleSystem.minEmitPower;
93
- const maxEmitPowerBlock = new ParticleInputBlock("Max Emit Power");
94
- maxEmitPowerBlock.value = particleSystem.maxEmitPower;
95
- const randomEmitPowerBlock = new ParticleRandomBlock("Random Emit Power");
96
- minEmitPowerBlock.output.connectTo(randomEmitPowerBlock.min);
97
- maxEmitPowerBlock.output.connectTo(randomEmitPowerBlock.max);
98
- randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);
99
- // Lifetime
100
- const minLifetimeBlock = new ParticleInputBlock("Min Lifetime");
101
- minLifetimeBlock.value = particleSystem.minLifeTime;
102
- const maxLifetimeBlock = new ParticleInputBlock("Max Lifetime");
103
- maxLifetimeBlock.value = particleSystem.maxLifeTime;
104
- const randomLifetimeBlock = new ParticleRandomBlock("Random Lifetime");
105
- minLifetimeBlock.output.connectTo(randomLifetimeBlock.min);
106
- maxLifetimeBlock.output.connectTo(randomLifetimeBlock.max);
107
- randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);
108
- // Texture
109
- const textureBlock = new ParticleTextureSourceBlock("Texture");
110
- const url = particleSystem.particleTexture.url || "";
111
- if (url) {
112
- textureBlock.url = url;
206
+ return shapeBlock;
207
+ }
208
+ function _CreatePositionUpdateBlock() {
209
+ // Default position update
210
+ const positionUpdateBlock = new UpdatePositionBlock("Position update");
211
+ const addPositionBlock = new ParticleMathBlock("Add Position");
212
+ addPositionBlock.operation = ParticleMathBlockOperations.Add;
213
+ _CreateAndConnectContextual("Position", NodeParticleContextualSources.Position, addPositionBlock.left);
214
+ _CreateAndConnectContextual("Scaled Direction", NodeParticleContextualSources.ScaledDirection, addPositionBlock.right);
215
+ addPositionBlock.output.connectTo(positionUpdateBlock.position);
216
+ return positionUpdateBlock;
217
+ }
218
+ function _CreateColorUpdateBlock(oldSystem, createParticleBlock) {
219
+ if (!oldSystem) {
220
+ throw new Error("Invalid particle system");
221
+ }
222
+ // Calculate the color
223
+ const colorGradients = oldSystem.getColorGradients();
224
+ let colorBlock = null;
225
+ if (colorGradients && colorGradients.length > 0) {
226
+ colorBlock = _CreateGradientColorUpdate(oldSystem, colorGradients, createParticleBlock);
113
227
  }
114
228
  else {
115
- textureBlock.sourceTexture = particleSystem.particleTexture;
229
+ colorBlock = _CreateBasicColorUpdate();
116
230
  }
117
- textureBlock.texture.connectTo(system.texture);
118
- // Default position update
119
- const basicPositionUpdateBlock = new BasicPositionUpdateBlock("Position update");
120
- shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);
121
- // Default color update
122
- const basicColorUpdateBlock = new BasicColorUpdateBlock("Color update");
123
- basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);
124
- basicColorUpdateBlock.output.connectTo(system.particle);
125
- // Register
126
- target.systemBlocks.push(system);
231
+ // Clamp alpha >= 0
232
+ const clampedColor = _ClampUpdateColorAlpha(colorBlock);
233
+ // Create the color update block
234
+ const colorUpdateBlock = new UpdateColorBlock("Color update");
235
+ clampedColor.colorOut.connectTo(colorUpdateBlock.color);
236
+ return colorUpdateBlock;
127
237
  }
128
- /**
129
- * Converts a ParticleSystem to a NodeParticleSystemSet.
130
- * @param name The name of the node particle system set.
131
- * @param particleSystems The particle systems to convert.
132
- * @returns The converted node particle system set or null if conversion failed.
133
- * #0K3AQ2#3627
134
- */
135
- export async function ConvertToNodeParticleSystemSetAsync(name, particleSystems) {
136
- if (!particleSystems || !particleSystems.length) {
137
- return null;
238
+ function _CreateGradientColorUpdate(oldSystem, gradient, createParticleBlock) {
239
+ const colorGradientBlock = new ParticleGradientBlock("Color Gradient");
240
+ _CreateAndConnectContextual("gradient", NodeParticleContextualSources.Age, colorGradientBlock.gradient);
241
+ let tempColor = null;
242
+ let colorStart = null;
243
+ let colorEnd = null;
244
+ for (let i = 0; i < gradient.length; i++) {
245
+ const gradientStep = gradient[i];
246
+ const gradientValueBlock = new ParticleGradientValueBlock("Color Gradient Value " + i);
247
+ gradientValueBlock.reference = gradientStep.gradient;
248
+ if (gradientStep.color2) {
249
+ // Create a random between color1 and color2
250
+ const randomColorBlock = new ParticleRandomBlock("Random Color for Gradient " + i);
251
+ randomColorBlock.lockMode = ParticleRandomBlockLocks.PerSystem;
252
+ _CreateAndConnectInput("Color 1", gradientStep.color1, randomColorBlock.min);
253
+ _CreateAndConnectInput("Color 2", gradientStep.color2, randomColorBlock.max);
254
+ randomColorBlock.output.connectTo(gradientValueBlock.value);
255
+ tempColor = randomColorBlock;
256
+ }
257
+ else {
258
+ // Single color
259
+ const input = new ParticleInputBlock("Color " + i);
260
+ input.value = gradientStep.color1;
261
+ input.output.connectTo(gradientValueBlock.value);
262
+ tempColor = input;
263
+ }
264
+ if (gradientStep.gradient === 0) {
265
+ colorStart = tempColor;
266
+ }
267
+ else if (gradientStep.gradient === 1) {
268
+ colorEnd = tempColor;
269
+ }
270
+ gradientValueBlock.output.connectTo(colorGradientBlock.inputs[i + 1]);
138
271
  }
139
- const nodeParticleSystemSet = new NodeParticleSystemSet(name);
140
- const promises = [];
141
- for (const particleSystem of particleSystems) {
142
- promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));
272
+ _UpdateCreateParticleColor(oldSystem, colorStart, colorEnd, createParticleBlock);
273
+ return colorGradientBlock;
274
+ }
275
+ function _CreateBasicColorUpdate() {
276
+ const addColorBlock = new ParticleMathBlock("Add Color");
277
+ addColorBlock.operation = ParticleMathBlockOperations.Add;
278
+ _CreateAndConnectContextual("Color", NodeParticleContextualSources.Color, addColorBlock.left);
279
+ _CreateAndConnectContextual("Scaled Color Step", NodeParticleContextualSources.ScaledColorStep, addColorBlock.right);
280
+ return addColorBlock;
281
+ }
282
+ function _UpdateCreateParticleColor(oldSystem, colorStart, colorEnd, createParticleBlock) {
283
+ if (colorStart === null) {
284
+ colorStart = new ParticleInputBlock("Color Start");
285
+ colorStart.value = oldSystem.color1;
143
286
  }
144
- await Promise.all(promises);
145
- return nodeParticleSystemSet;
287
+ if (colorEnd === null) {
288
+ colorEnd = new ParticleInputBlock("Color End");
289
+ colorEnd.value = oldSystem.color2;
290
+ }
291
+ const randomColorBlock = new ParticleRandomBlock("Random color");
292
+ randomColorBlock.lockMode = ParticleRandomBlockLocks.PerSystem;
293
+ colorStart.output.connectTo(randomColorBlock.min);
294
+ colorEnd.output.connectTo(randomColorBlock.max);
295
+ randomColorBlock.output.connectTo(createParticleBlock.color);
296
+ }
297
+ function _ClampUpdateColorAlpha(colorBlock) {
298
+ // Decompose color to clamp alpha
299
+ const decomposeColorBlock = new ParticleConverterBlock("Decompose Color");
300
+ colorBlock.outputs[0].connectTo(decomposeColorBlock.colorIn);
301
+ // Clamp alpha to be >= 0
302
+ const maxAlphaBlock = new ParticleMathBlock("Alpha >= 0");
303
+ maxAlphaBlock.operation = ParticleMathBlockOperations.Max;
304
+ decomposeColorBlock.wOut.connectTo(maxAlphaBlock.left);
305
+ _CreateAndConnectInput("Zero", 0, maxAlphaBlock.right);
306
+ // Recompose color
307
+ const composeColorBlock = new ParticleConverterBlock("Compose Color");
308
+ decomposeColorBlock.xyzOut.connectTo(composeColorBlock.xyzIn);
309
+ maxAlphaBlock.output.connectTo(composeColorBlock.wIn);
310
+ return composeColorBlock;
311
+ }
312
+ function _CreateAndConnectInput(inputBlockName, value, targetToConnectTo, inputType) {
313
+ const input = new ParticleInputBlock(inputBlockName, inputType);
314
+ input.value = value;
315
+ input.output.connectTo(targetToConnectTo);
316
+ }
317
+ function _CreateAndConnectContextual(contextualBlockName, contextValue, targetToConnectTo) {
318
+ const input = new ParticleInputBlock(contextualBlockName);
319
+ input.contextualValue = contextValue;
320
+ input.output.connectTo(targetToConnectTo);
146
321
  }
147
322
  //# sourceMappingURL=nodeParticleSystemSet.helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParticleSystemSet.helper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAShE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,kBAAk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,WAAW;IACX,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CAAC,IAAY,EAAE,eAAiC;IACrG,IAAI,CAAC,eAAe,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC3C,QAAQ,CAAC,IAAI,CAAC,mCAAmC,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,qBAAqB,CAAC;AACjC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ParticleSystem } from \"../particleSystem\";\r\nimport { NodeParticleSystemSet } from \"./nodeParticleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport type { IShapeBlock } from \"./Blocks/Emitters/IShapeBlock\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport type { BoxParticleEmitter } from \"../EmitterTypes/boxParticleEmitter\";\r\nimport type { PointParticleEmitter } from \"../EmitterTypes/pointParticleEmitter\";\r\nimport type { SphereParticleEmitter } from \"../EmitterTypes/sphereParticleEmitter\";\r\nimport type { CylinderParticleEmitter, MeshParticleEmitter } from \"../EmitterTypes\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { PointShapeBlock } from \"./Blocks/Emitters/pointShapeBlock\";\r\nimport { SphereShapeBlock } from \"./Blocks/Emitters/sphereShapeBlock\";\r\nimport { CylinderShapeBlock } from \"./Blocks/Emitters/cylinderShapeBlock\";\r\nimport { MeshShapeBlock } from \"./Blocks/Emitters/meshShapeBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport type { Texture } from \"../../Materials/Textures/texture\";\r\nimport { BasicPositionUpdateBlock } from \"./Blocks/Update/basicPositionUpdateBlock\";\r\nimport { BasicColorUpdateBlock } from \"./Blocks/Update/basicColorUpdateBlock\";\r\nimport { ParticleRandomBlock } from \"./Blocks/particleRandomBlock\";\r\n\r\nfunction _CreateAndConnectInput(connectionPoint: NodeParticleConnectionPoint, name: string, defaultValue: Vector3 | number) {\r\n const input = new ParticleInputBlock(name);\r\n input.value = defaultValue;\r\n input.output.connectTo(connectionPoint);\r\n}\r\n\r\nasync function _ExtractDatafromParticleSystemAsync(particleSystem: ParticleSystem, target: NodeParticleSystemSet) {\r\n // Main system\r\n const system = new SystemBlock(particleSystem.name);\r\n system.capacity = particleSystem.getCapacity();\r\n system.emitRate = particleSystem.emitRate;\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n let shapeBlock: Nullable<IShapeBlock> = null;\r\n switch (particleSystem.particleEmitterType.getClassName()) {\r\n case \"BoxParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as BoxParticleEmitter;\r\n shapeBlock = new BoxShapeBlock(\"Box shape\");\r\n\r\n const target = shapeBlock as BoxShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n _CreateAndConnectInput(target.minEmitBox, \"Min Emit Box\", source.minEmitBox);\r\n _CreateAndConnectInput(target.maxEmitBox, \"Max Emit Box\", source.maxEmitBox);\r\n break;\r\n }\r\n case \"PointParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as PointParticleEmitter;\r\n shapeBlock = new PointShapeBlock(\"Point shape\");\r\n\r\n const target = shapeBlock as PointShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n break;\r\n }\r\n case \"SphereParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as SphereParticleEmitter;\r\n shapeBlock = new SphereShapeBlock(\"Sphere shape\");\r\n\r\n const target = shapeBlock as SphereShapeBlock;\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"CylinderParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as CylinderParticleEmitter;\r\n shapeBlock = new CylinderShapeBlock(\"Cylinder shape\");\r\n\r\n const target = shapeBlock as CylinderShapeBlock;\r\n _CreateAndConnectInput(target.height, \"Height\", source.height);\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"MeshParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as MeshParticleEmitter;\r\n shapeBlock = new MeshShapeBlock(\"Mesh shape\");\r\n\r\n const target = shapeBlock as MeshShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n\r\n target.mesh = source.mesh as Mesh;\r\n break;\r\n }\r\n }\r\n\r\n if (!shapeBlock) {\r\n throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);\r\n }\r\n\r\n createParticleBlock.particle.connectTo(shapeBlock.particle);\r\n createParticleBlock.colorDead.value = particleSystem.colorDead;\r\n\r\n // Color\r\n const color0Block = new ParticleInputBlock(\"Color0\");\r\n color0Block.value = particleSystem.color1;\r\n\r\n const color1Block = new ParticleInputBlock(\"Color1\");\r\n color1Block.value = particleSystem.color2;\r\n\r\n const randomColorBlock = new ParticleRandomBlock(\"Random Color\");\r\n color0Block.output.connectTo(randomColorBlock.min);\r\n color1Block.output.connectTo(randomColorBlock.max);\r\n\r\n randomColorBlock.output.connectTo(createParticleBlock.color);\r\n\r\n // Emit power\r\n const minEmitPowerBlock = new ParticleInputBlock(\"Min Emit Power\");\r\n minEmitPowerBlock.value = particleSystem.minEmitPower;\r\n\r\n const maxEmitPowerBlock = new ParticleInputBlock(\"Max Emit Power\");\r\n maxEmitPowerBlock.value = particleSystem.maxEmitPower;\r\n\r\n const randomEmitPowerBlock = new ParticleRandomBlock(\"Random Emit Power\");\r\n minEmitPowerBlock.output.connectTo(randomEmitPowerBlock.min);\r\n maxEmitPowerBlock.output.connectTo(randomEmitPowerBlock.max);\r\n\r\n randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);\r\n\r\n // Lifetime\r\n const minLifetimeBlock = new ParticleInputBlock(\"Min Lifetime\");\r\n minLifetimeBlock.value = particleSystem.minLifeTime;\r\n\r\n const maxLifetimeBlock = new ParticleInputBlock(\"Max Lifetime\");\r\n maxLifetimeBlock.value = particleSystem.maxLifeTime;\r\n\r\n const randomLifetimeBlock = new ParticleRandomBlock(\"Random Lifetime\");\r\n minLifetimeBlock.output.connectTo(randomLifetimeBlock.min);\r\n maxLifetimeBlock.output.connectTo(randomLifetimeBlock.max);\r\n\r\n randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n const url = (particleSystem.particleTexture as Texture).url || \"\";\r\n if (url) {\r\n textureBlock.url = url;\r\n } else {\r\n textureBlock.sourceTexture = particleSystem.particleTexture;\r\n }\r\n textureBlock.texture.connectTo(system.texture);\r\n\r\n // Default position update\r\n const basicPositionUpdateBlock = new BasicPositionUpdateBlock(\"Position update\");\r\n shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);\r\n\r\n // Default color update\r\n const basicColorUpdateBlock = new BasicColorUpdateBlock(\"Color update\");\r\n basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);\r\n basicColorUpdateBlock.output.connectTo(system.particle);\r\n\r\n // Register\r\n target.systemBlocks.push(system);\r\n}\r\n\r\n/**\r\n * Converts a ParticleSystem to a NodeParticleSystemSet.\r\n * @param name The name of the node particle system set.\r\n * @param particleSystems The particle systems to convert.\r\n * @returns The converted node particle system set or null if conversion failed.\r\n * #0K3AQ2#3627\r\n */\r\nexport async function ConvertToNodeParticleSystemSetAsync(name: string, particleSystems: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>> {\r\n if (!particleSystems || !particleSystems.length) {\r\n return null;\r\n }\r\n\r\n const nodeParticleSystemSet = new NodeParticleSystemSet(name);\r\n const promises: Promise<void>[] = [];\r\n\r\n for (const particleSystem of particleSystems) {\r\n promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));\r\n }\r\n\r\n await Promise.all(promises);\r\n return nodeParticleSystemSet;\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeParticleSystemSet.helper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.helper.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,mCAA+B;AACjD,OAAO,EAAE,qCAAqC,EAAE,yDAAwE;AACxH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,qBAAq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CAAC,CAAC;IAC9D,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAEtD,OAAO,iBAAiB,CAAC;AAC7B,CAAC;AAED,SAAS,sBAAsB,CAC3B,cAAsB,EACtB,KAA0C,EAC1C,iBAA8C,EAC9C,SAAiD;IAEjD,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAChE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,2BAA2B,CAAC,mBAA2B,EAAE,YAA2C,EAAE,iBAA8C;IACzJ,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAC1D,KAAK,CAAC,eAAe,GAAG,YAAY,CAAC;IACrC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Color4 } from \"core/Maths/math.color\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { ColorGradient } from \"core/Misc\";\r\nimport type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { IParticleSystem } from \"core/Particles/IParticleSystem\";\r\nimport type { BoxParticleEmitter } from \"core/Particles/EmitterTypes/boxParticleEmitter\";\r\nimport type { ConeParticleEmitter } from \"core/Particles/EmitterTypes/coneParticleEmitter\";\r\nimport type { CylinderParticleEmitter } from \"core/Particles/EmitterTypes/cylinderParticleEmitter\";\r\nimport type { MeshParticleEmitter } from \"core/Particles/EmitterTypes/meshParticleEmitter\";\r\nimport type { PointParticleEmitter } from \"core/Particles/EmitterTypes/pointParticleEmitter\";\r\nimport type { SphereParticleEmitter } from \"core/Particles/EmitterTypes/sphereParticleEmitter\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { IShapeBlock } from \"core/Particles/Node/Blocks/Emitters/IShapeBlock\";\r\n\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleSystemSet } from \"./nodeParticleSystemSet\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport { ParticleConverterBlock } from \"./Blocks/particleConverterBlock\";\r\nimport { ParticleGradientBlock } from \"./Blocks/particleGradientBlock\";\r\nimport { ParticleGradientValueBlock } from \"./Blocks/particleGradientValueBlock\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { ParticleMathBlock, ParticleMathBlockOperations } from \"./Blocks/particleMathBlock\";\r\nimport { ParticleRandomBlock, ParticleRandomBlockLocks } from \"./Blocks/particleRandomBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport { ConeShapeBlock } from \"./Blocks/Emitters/coneShapeBlock\";\r\nimport { CylinderShapeBlock } from \"./Blocks/Emitters/cylinderShapeBlock\";\r\nimport { MeshShapeBlock } from \"./Blocks/Emitters/meshShapeBlock\";\r\nimport { PointShapeBlock } from \"./Blocks/Emitters/pointShapeBlock\";\r\nimport { SphereShapeBlock } from \"./Blocks/Emitters/sphereShapeBlock\";\r\nimport { UpdateColorBlock } from \"./Blocks/Update/updateColorBlock\";\r\nimport { UpdatePositionBlock } from \"./Blocks/Update/updatePositionBlock\";\r\n\r\n/**\r\n * Converts a ParticleSystem to a NodeParticleSystemSet.\r\n * @param name The name of the node particle system set.\r\n * @param particleSystemsList The particle systems to convert.\r\n * @returns The converted node particle system set or null if conversion failed.\r\n * #0K3AQ2#3672\r\n * #7J0NXA#4\r\n */\r\nexport async function ConvertToNodeParticleSystemSetAsync(name: string, particleSystemsList: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>> {\r\n if (!particleSystemsList || !particleSystemsList.length) {\r\n return null;\r\n }\r\n\r\n const nodeParticleSystemSet = new NodeParticleSystemSet(name);\r\n const promises: Promise<void>[] = [];\r\n\r\n for (const particleSystem of particleSystemsList) {\r\n promises.push(_ExtractDatafromParticleSystemAsync(nodeParticleSystemSet, particleSystem));\r\n }\r\n\r\n await Promise.all(promises);\r\n return nodeParticleSystemSet;\r\n}\r\n\r\nasync function _ExtractDatafromParticleSystemAsync(newSet: NodeParticleSystemSet, oldSystem: ParticleSystem): Promise<void> {\r\n // CreateParticle block\r\n const createParticleBlock = _CreateCreateParticleBlock(oldSystem);\r\n\r\n // Emitter Shape block\r\n const shapeBlock = _CreateEmitterShapeBlock(oldSystem);\r\n createParticleBlock.particle.connectTo(shapeBlock.particle);\r\n\r\n // Position update\r\n const positionUpdateBlock = _CreatePositionUpdateBlock();\r\n shapeBlock.output.connectTo(positionUpdateBlock.particle);\r\n\r\n // Color update\r\n const colorUpdateBlock = _CreateColorUpdateBlock(oldSystem, createParticleBlock);\r\n positionUpdateBlock.output.connectTo(colorUpdateBlock.particle);\r\n\r\n // System block\r\n const newSystem = _CreateSystemBlock(oldSystem);\r\n colorUpdateBlock.output.connectTo(newSystem.particle);\r\n\r\n // Register\r\n newSet.systemBlocks.push(newSystem);\r\n}\r\n\r\nfunction _CreateSystemBlock(oldSystem: IParticleSystem): SystemBlock {\r\n const newSystem = new SystemBlock(oldSystem.name);\r\n\r\n // Translation pivot\r\n _CreateAndConnectInput(\"Translation pivot\", oldSystem.translationPivot, newSystem.translationPivot);\r\n\r\n // Gravity\r\n _CreateAndConnectInput(\"Gravity\", oldSystem.gravity, newSystem.gravity);\r\n\r\n newSystem.emitRate = oldSystem.emitRate;\r\n newSystem.manualEmitCount = oldSystem.manualEmitCount;\r\n\r\n newSystem.blendMode = oldSystem.blendMode;\r\n newSystem.capacity = oldSystem.getCapacity();\r\n newSystem.targetStopDuration = oldSystem.targetStopDuration;\r\n newSystem.startDelay = oldSystem.startDelay;\r\n newSystem.targetStopDuration = oldSystem.targetStopDuration;\r\n newSystem.updateSpeed = oldSystem.updateSpeed;\r\n newSystem.preWarmCycles = oldSystem.preWarmCycles;\r\n newSystem.preWarmStepOffset = oldSystem.preWarmStepOffset;\r\n newSystem.isBillboardBased = oldSystem.isBillboardBased;\r\n newSystem.isLocal = oldSystem.isLocal;\r\n newSystem.disposeOnStop = oldSystem.disposeOnStop;\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n const url = (oldSystem.particleTexture as Texture).url || \"\";\r\n if (url) {\r\n textureBlock.url = url;\r\n } else {\r\n textureBlock.sourceTexture = oldSystem.particleTexture;\r\n }\r\n textureBlock.texture.connectTo(newSystem.texture);\r\n\r\n return newSystem;\r\n}\r\n\r\nfunction _CreateCreateParticleBlock(oldSystem: ParticleSystem): CreateParticleBlock {\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create Particle\");\r\n\r\n // Size\r\n const randomSizeBlock = new ParticleRandomBlock(\"Random size\");\r\n _CreateAndConnectInput(\"Min size\", oldSystem.minSize, randomSizeBlock.min);\r\n _CreateAndConnectInput(\"Max size\", oldSystem.maxSize, randomSizeBlock.max);\r\n randomSizeBlock.output.connectTo(createParticleBlock.size);\r\n\r\n // Scale\r\n const randomScaleBlock = new ParticleRandomBlock(\"Random Scale\");\r\n _CreateAndConnectInput(\"Min Scale\", new Vector2(oldSystem.minScaleX, oldSystem.minScaleY), randomScaleBlock.min);\r\n _CreateAndConnectInput(\"Max Scale\", new Vector2(oldSystem.maxScaleX, oldSystem.maxScaleY), randomScaleBlock.max);\r\n randomScaleBlock.output.connectTo(createParticleBlock.scale);\r\n\r\n // Color is handled when we do the color update block to manage gradients\r\n\r\n // Dead color\r\n _CreateAndConnectInput(\"Dead Color\", oldSystem.colorDead, createParticleBlock.colorDead);\r\n\r\n // Emit power (Speed)\r\n const randomEmitPowerBlock = new ParticleRandomBlock(\"Random Emit Power\");\r\n _CreateAndConnectInput(\"Min Emit Power\", oldSystem.minEmitPower, randomEmitPowerBlock.min);\r\n _CreateAndConnectInput(\"Max Emit Power\", oldSystem.maxEmitPower, randomEmitPowerBlock.max);\r\n randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);\r\n\r\n // Angular speed\r\n const randomAngularSpeedBlock = new ParticleRandomBlock(\"Random Angular Speed\");\r\n _CreateAndConnectInput(\"Min Angular Speed\", oldSystem.minAngularSpeed, randomAngularSpeedBlock.min);\r\n _CreateAndConnectInput(\"Max Angular Speed\", oldSystem.maxAngularSpeed, randomAngularSpeedBlock.max);\r\n randomAngularSpeedBlock.output.connectTo(createParticleBlock.angularSpeed);\r\n\r\n // Angle (rotation)\r\n const randomRotationBlock = new ParticleRandomBlock(\"Random Rotation\");\r\n _CreateAndConnectInput(\"Min Rotation\", oldSystem.minInitialRotation, randomRotationBlock.min);\r\n _CreateAndConnectInput(\"Max Rotation\", oldSystem.maxInitialRotation, randomRotationBlock.max);\r\n randomRotationBlock.output.connectTo(createParticleBlock.angle);\r\n\r\n // Lifetime\r\n const randomLifetimeBlock = new ParticleRandomBlock(\"Random Lifetime\");\r\n _CreateAndConnectInput(\"Min Lifetime\", oldSystem.minLifeTime, randomLifetimeBlock.min);\r\n _CreateAndConnectInput(\"Max Lifetime\", oldSystem.maxLifeTime, randomLifetimeBlock.max);\r\n randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);\r\n\r\n return createParticleBlock;\r\n}\r\n\r\nfunction _CreateEmitterShapeBlock(oldSystem: IParticleSystem): IShapeBlock {\r\n const emitter = oldSystem.particleEmitterType;\r\n if (!emitter) {\r\n throw new Error(\"Particle system has no emitter type.\");\r\n }\r\n\r\n let shapeBlock: Nullable<IShapeBlock> = null;\r\n switch (emitter.getClassName()) {\r\n case \"BoxParticleEmitter\": {\r\n const source = emitter as BoxParticleEmitter;\r\n shapeBlock = new BoxShapeBlock(\"Box Shape\");\r\n\r\n const target = shapeBlock as BoxShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n _CreateAndConnectInput(\"Min Emit Box\", source.minEmitBox, target.minEmitBox);\r\n _CreateAndConnectInput(\"Max Emit Box\", source.maxEmitBox, target.maxEmitBox);\r\n break;\r\n }\r\n case \"ConeParticleEmitter\": {\r\n const source = emitter as ConeParticleEmitter;\r\n shapeBlock = new ConeShapeBlock(\"Cone Shape\");\r\n\r\n const target = shapeBlock as ConeShapeBlock;\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Angle\", source.angle, target.angle);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Height Range\", source.heightRange, target.heightRange);\r\n _CreateAndConnectInput(\"Emit From Spawn Point Only\", source.emitFromSpawnPointOnly ? 1 : 0, target.emitFromSpawnPointOnly, NodeParticleBlockConnectionPointTypes.Int);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n case \"CustomParticleEmitter\": {\r\n // Custom emitter is not supported in nodes yet\r\n throw new Error(\"CustomParticleEmitter is not supported in Node Particle System.\");\r\n }\r\n case \"CylinderParticleEmitter\": {\r\n const source = emitter as CylinderParticleEmitter;\r\n shapeBlock = new CylinderShapeBlock(\"Cylinder Shape\");\r\n\r\n const target = shapeBlock as CylinderShapeBlock;\r\n _CreateAndConnectInput(\"Height\", source.height, target.height);\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n case \"HemisphericParticleEmitter\": {\r\n // Hemispheric emitter is not supported in nodes yet\r\n throw new Error(\"HemisphericParticleEmitter is not supported in Node Particle System.\");\r\n }\r\n case \"MeshParticleEmitter\": {\r\n const source = emitter as MeshParticleEmitter;\r\n shapeBlock = new MeshShapeBlock(\"Mesh Shape\");\r\n\r\n const target = shapeBlock as MeshShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n\r\n target.mesh = source.mesh as Mesh;\r\n break;\r\n }\r\n case \"PointParticleEmitter\": {\r\n const source = emitter as PointParticleEmitter;\r\n shapeBlock = new PointShapeBlock(\"Point Shape\");\r\n\r\n const target = shapeBlock as PointShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n break;\r\n }\r\n case \"SphereParticleEmitter\": {\r\n const source = emitter as SphereParticleEmitter;\r\n shapeBlock = new SphereShapeBlock(\"Sphere Shape\");\r\n\r\n const target = shapeBlock as SphereShapeBlock;\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n }\r\n\r\n if (!shapeBlock) {\r\n throw new Error(`Unsupported particle emitter type: ${emitter.getClassName()}`);\r\n }\r\n\r\n return shapeBlock;\r\n}\r\n\r\nfunction _CreatePositionUpdateBlock(): UpdatePositionBlock {\r\n // Default position update\r\n const positionUpdateBlock = new UpdatePositionBlock(\"Position update\");\r\n\r\n const addPositionBlock = new ParticleMathBlock(\"Add Position\");\r\n addPositionBlock.operation = ParticleMathBlockOperations.Add;\r\n _CreateAndConnectContextual(\"Position\", NodeParticleContextualSources.Position, addPositionBlock.left);\r\n _CreateAndConnectContextual(\"Scaled Direction\", NodeParticleContextualSources.ScaledDirection, addPositionBlock.right);\r\n addPositionBlock.output.connectTo(positionUpdateBlock.position);\r\n\r\n return positionUpdateBlock;\r\n}\r\n\r\nfunction _CreateColorUpdateBlock(oldSystem: IParticleSystem, createParticleBlock: CreateParticleBlock): UpdateColorBlock {\r\n if (!oldSystem) {\r\n throw new Error(\"Invalid particle system\");\r\n }\r\n\r\n // Calculate the color\r\n const colorGradients = oldSystem.getColorGradients();\r\n let colorBlock: Nullable<ParticleGradientBlock | ParticleMathBlock> = null;\r\n if (colorGradients && colorGradients.length > 0) {\r\n colorBlock = _CreateGradientColorUpdate(oldSystem, colorGradients, createParticleBlock);\r\n } else {\r\n colorBlock = _CreateBasicColorUpdate();\r\n }\r\n\r\n // Clamp alpha >= 0\r\n const clampedColor = _ClampUpdateColorAlpha(colorBlock);\r\n\r\n // Create the color update block\r\n const colorUpdateBlock = new UpdateColorBlock(\"Color update\");\r\n clampedColor.colorOut.connectTo(colorUpdateBlock.color);\r\n\r\n return colorUpdateBlock;\r\n}\r\n\r\nfunction _CreateGradientColorUpdate(oldSystem: IParticleSystem, gradient: Array<ColorGradient>, createParticleBlock: CreateParticleBlock): ParticleGradientBlock {\r\n const colorGradientBlock = new ParticleGradientBlock(\"Color Gradient\");\r\n _CreateAndConnectContextual(\"gradient\", NodeParticleContextualSources.Age, colorGradientBlock.gradient);\r\n\r\n let tempColor: Nullable<ParticleInputBlock | ParticleRandomBlock> = null;\r\n let colorStart: Nullable<ParticleInputBlock | ParticleRandomBlock> = null;\r\n let colorEnd: Nullable<ParticleInputBlock | ParticleRandomBlock> = null;\r\n for (let i = 0; i < gradient.length; i++) {\r\n const gradientStep = gradient[i];\r\n const gradientValueBlock = new ParticleGradientValueBlock(\"Color Gradient Value \" + i);\r\n gradientValueBlock.reference = gradientStep.gradient;\r\n\r\n if (gradientStep.color2) {\r\n // Create a random between color1 and color2\r\n const randomColorBlock = new ParticleRandomBlock(\"Random Color for Gradient \" + i);\r\n randomColorBlock.lockMode = ParticleRandomBlockLocks.PerSystem;\r\n _CreateAndConnectInput(\"Color 1\", gradientStep.color1, randomColorBlock.min);\r\n _CreateAndConnectInput(\"Color 2\", gradientStep.color2, randomColorBlock.max);\r\n randomColorBlock.output.connectTo(gradientValueBlock.value);\r\n tempColor = randomColorBlock;\r\n } else {\r\n // Single color\r\n const input = new ParticleInputBlock(\"Color \" + i);\r\n input.value = gradientStep.color1;\r\n input.output.connectTo(gradientValueBlock.value);\r\n tempColor = input;\r\n }\r\n\r\n if (gradientStep.gradient === 0) {\r\n colorStart = tempColor;\r\n } else if (gradientStep.gradient === 1) {\r\n colorEnd = tempColor;\r\n }\r\n\r\n gradientValueBlock.output.connectTo(colorGradientBlock.inputs[i + 1]);\r\n }\r\n\r\n _UpdateCreateParticleColor(oldSystem, colorStart, colorEnd, createParticleBlock);\r\n\r\n return colorGradientBlock;\r\n}\r\n\r\nfunction _CreateBasicColorUpdate(): ParticleMathBlock {\r\n const addColorBlock = new ParticleMathBlock(\"Add Color\");\r\n addColorBlock.operation = ParticleMathBlockOperations.Add;\r\n _CreateAndConnectContextual(\"Color\", NodeParticleContextualSources.Color, addColorBlock.left);\r\n _CreateAndConnectContextual(\"Scaled Color Step\", NodeParticleContextualSources.ScaledColorStep, addColorBlock.right);\r\n\r\n return addColorBlock;\r\n}\r\n\r\nfunction _UpdateCreateParticleColor(\r\n oldSystem: IParticleSystem,\r\n colorStart: Nullable<ParticleInputBlock | ParticleRandomBlock>,\r\n colorEnd: Nullable<ParticleInputBlock | ParticleRandomBlock>,\r\n createParticleBlock: CreateParticleBlock\r\n): void {\r\n if (colorStart === null) {\r\n colorStart = new ParticleInputBlock(\"Color Start\");\r\n colorStart.value = oldSystem.color1;\r\n }\r\n\r\n if (colorEnd === null) {\r\n colorEnd = new ParticleInputBlock(\"Color End\");\r\n colorEnd.value = oldSystem.color2;\r\n }\r\n\r\n const randomColorBlock = new ParticleRandomBlock(\"Random color\");\r\n randomColorBlock.lockMode = ParticleRandomBlockLocks.PerSystem;\r\n colorStart.output.connectTo(randomColorBlock.min);\r\n colorEnd.output.connectTo(randomColorBlock.max);\r\n randomColorBlock.output.connectTo(createParticleBlock.color);\r\n}\r\n\r\nfunction _ClampUpdateColorAlpha(colorBlock: ParticleMathBlock | ParticleGradientBlock): ParticleConverterBlock {\r\n // Decompose color to clamp alpha\r\n const decomposeColorBlock = new ParticleConverterBlock(\"Decompose Color\");\r\n colorBlock.outputs[0].connectTo(decomposeColorBlock.colorIn);\r\n\r\n // Clamp alpha to be >= 0\r\n const maxAlphaBlock = new ParticleMathBlock(\"Alpha >= 0\");\r\n maxAlphaBlock.operation = ParticleMathBlockOperations.Max;\r\n decomposeColorBlock.wOut.connectTo(maxAlphaBlock.left);\r\n _CreateAndConnectInput(\"Zero\", 0, maxAlphaBlock.right);\r\n\r\n // Recompose color\r\n const composeColorBlock = new ParticleConverterBlock(\"Compose Color\");\r\n decomposeColorBlock.xyzOut.connectTo(composeColorBlock.xyzIn);\r\n maxAlphaBlock.output.connectTo(composeColorBlock.wIn);\r\n\r\n return composeColorBlock;\r\n}\r\n\r\nfunction _CreateAndConnectInput(\r\n inputBlockName: string,\r\n value: number | Vector2 | Vector3 | Color4,\r\n targetToConnectTo: NodeParticleConnectionPoint,\r\n inputType?: NodeParticleBlockConnectionPointTypes\r\n): void {\r\n const input = new ParticleInputBlock(inputBlockName, inputType);\r\n input.value = value;\r\n input.output.connectTo(targetToConnectTo);\r\n}\r\n\r\nfunction _CreateAndConnectContextual(contextualBlockName: string, contextValue: NodeParticleContextualSources, targetToConnectTo: NodeParticleConnectionPoint): void {\r\n const input = new ParticleInputBlock(contextualBlockName);\r\n input.contextualValue = contextValue;\r\n input.output.connectTo(targetToConnectTo);\r\n}\r\n"]}
@@ -1217,6 +1217,7 @@ export class ThinParticleSystem extends BaseParticleSystem {
1217
1217
  throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";
1218
1218
  }
1219
1219
  if (delay) {
1220
+ this.startDelay = delay;
1220
1221
  setTimeout(() => {
1221
1222
  this.start(0);
1222
1223
  }, delay);