@babylonjs/core 8.23.0 → 8.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/Bones/skeleton.d.ts +4 -0
  2. package/Bones/skeleton.js +12 -0
  3. package/Bones/skeleton.js.map +1 -1
  4. package/Buffers/storageBuffer.d.ts +6 -0
  5. package/Buffers/storageBuffer.js +8 -0
  6. package/Buffers/storageBuffer.js.map +1 -1
  7. package/Engines/Extensions/engine.multiRender.d.ts +2 -1
  8. package/Engines/Extensions/engine.multiRender.js +12 -7
  9. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  10. package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +2 -1
  11. package/Engines/WebGPU/Extensions/engine.multiRender.js +12 -7
  12. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  13. package/Engines/WebGPU/webgpuDrawContext.d.ts +6 -0
  14. package/Engines/WebGPU/webgpuDrawContext.js +9 -0
  15. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  16. package/Engines/abstractEngine.js +2 -2
  17. package/Engines/abstractEngine.js.map +1 -1
  18. package/Engines/engineCapabilities.d.ts +4 -0
  19. package/Engines/engineCapabilities.js.map +1 -1
  20. package/Engines/nativeEngine.js +2 -0
  21. package/Engines/nativeEngine.js.map +1 -1
  22. package/Engines/nullEngine.js +2 -0
  23. package/Engines/nullEngine.js.map +1 -1
  24. package/Engines/thinEngine.js +15 -0
  25. package/Engines/thinEngine.js.map +1 -1
  26. package/Engines/webgpuEngine.d.ts +7 -0
  27. package/Engines/webgpuEngine.js +12 -1
  28. package/Engines/webgpuEngine.js.map +1 -1
  29. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +12 -0
  30. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +52 -0
  31. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  32. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +0 -3
  33. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  34. package/FrameGraph/Node/nodeRenderGraph.js +7 -2
  35. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  36. package/FrameGraph/Tasks/Layers/baseLayerTask.js +1 -1
  37. package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
  38. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +11 -2
  39. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  40. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +6 -6
  41. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  42. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +27 -1
  43. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +76 -8
  44. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  45. package/FrameGraph/Tasks/Texture/clearTextureTask.js +2 -1
  46. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  47. package/FrameGraph/frameGraph.js +0 -7
  48. package/FrameGraph/frameGraph.js.map +1 -1
  49. package/FrameGraph/frameGraphRenderTarget.js +1 -1
  50. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  51. package/Lights/Clustered/clusteredLightContainer.d.ts +90 -0
  52. package/Lights/Clustered/clusteredLightContainer.js +401 -0
  53. package/Lights/Clustered/clusteredLightContainer.js.map +1 -0
  54. package/Lights/Clustered/clusteredLightingSceneComponent.d.ts +34 -0
  55. package/Lights/Clustered/clusteredLightingSceneComponent.js +47 -0
  56. package/Lights/Clustered/clusteredLightingSceneComponent.js.map +1 -0
  57. package/Lights/Clustered/index.d.ts +6 -0
  58. package/Lights/Clustered/index.js +7 -0
  59. package/Lights/Clustered/index.js.map +1 -0
  60. package/Lights/Shadows/shadowGenerator.js +9 -8
  61. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  62. package/Lights/index.d.ts +1 -0
  63. package/Lights/index.js +1 -0
  64. package/Lights/index.js.map +1 -1
  65. package/Lights/light.d.ts +2 -1
  66. package/Lights/light.js +2 -1
  67. package/Lights/light.js.map +1 -1
  68. package/Lights/lightConstants.d.ts +4 -0
  69. package/Lights/lightConstants.js +4 -0
  70. package/Lights/lightConstants.js.map +1 -1
  71. package/Lights/spotLight.d.ts +6 -3
  72. package/Lights/spotLight.js.map +1 -1
  73. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  74. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  75. package/Materials/materialHelper.functions.d.ts +2 -1
  76. package/Materials/materialHelper.functions.js +9 -3
  77. package/Materials/materialHelper.functions.js.map +1 -1
  78. package/Materials/standardMaterial.js +2 -2
  79. package/Materials/standardMaterial.js.map +1 -1
  80. package/Materials/uniformBuffer.d.ts +1 -1
  81. package/Materials/uniformBuffer.js +2 -2
  82. package/Materials/uniformBuffer.js.map +1 -1
  83. package/Meshes/abstractMesh.d.ts +4 -0
  84. package/Meshes/abstractMesh.js +4 -0
  85. package/Meshes/abstractMesh.js.map +1 -1
  86. package/Meshes/csg2.js +1 -1
  87. package/Meshes/csg2.js.map +1 -1
  88. package/Meshes/geometry.js +1 -1
  89. package/Meshes/geometry.js.map +1 -1
  90. package/Meshes/mesh.js +2 -7
  91. package/Meshes/mesh.js.map +1 -1
  92. package/Misc/dumpTools.d.ts +1 -1
  93. package/Misc/dumpTools.js +23 -14
  94. package/Misc/dumpTools.js.map +1 -1
  95. package/Misc/fileTools.js +7 -0
  96. package/Misc/fileTools.js.map +1 -1
  97. package/Misc/index.d.ts +1 -0
  98. package/Misc/index.js +1 -0
  99. package/Misc/index.js.map +1 -1
  100. package/Misc/lazy.d.ts +16 -0
  101. package/Misc/lazy.js +25 -0
  102. package/Misc/lazy.js.map +1 -0
  103. package/Morph/morphTargetManager.d.ts +4 -0
  104. package/Morph/morphTargetManager.js +12 -0
  105. package/Morph/morphTargetManager.js.map +1 -1
  106. package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +4 -0
  107. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +13 -2
  108. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
  109. package/Particles/Node/Blocks/Emitters/meshShapeBlock.d.ts +4 -0
  110. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +18 -0
  111. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  112. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.d.ts +31 -0
  113. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js +67 -0
  114. package/Particles/Node/Blocks/Update/basicColorUpdateBlock.js.map +1 -0
  115. package/Particles/Node/Blocks/index.d.ts +1 -0
  116. package/Particles/Node/Blocks/index.js +1 -0
  117. package/Particles/Node/Blocks/index.js.map +1 -1
  118. package/Particles/Node/Blocks/particleInputBlock.js +2 -0
  119. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  120. package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +2 -2
  121. package/Particles/Node/Blocks/particleSourceTextureBlock.js +3 -3
  122. package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
  123. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +5 -1
  124. package/Particles/Node/Enums/nodeParticleContextualSources.js +4 -0
  125. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  126. package/Particles/Node/nodeParticleBuildState.js +4 -0
  127. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  128. package/Particles/Node/nodeParticleSystemSet.helper.d.ts +2 -1
  129. package/Particles/Node/nodeParticleSystemSet.helper.js +88 -61
  130. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  131. package/Particles/gpuParticleSystem.d.ts +4 -0
  132. package/Particles/gpuParticleSystem.js +10 -0
  133. package/Particles/gpuParticleSystem.js.map +1 -1
  134. package/Particles/particle.d.ts +4 -0
  135. package/Particles/particle.js +5 -0
  136. package/Particles/particle.js.map +1 -1
  137. package/Particles/particleSystem.d.ts +4 -0
  138. package/Particles/particleSystem.js +10 -0
  139. package/Particles/particleSystem.js.map +1 -1
  140. package/Rendering/objectRenderer.d.ts +17 -3
  141. package/Rendering/objectRenderer.js +111 -26
  142. package/Rendering/objectRenderer.js.map +1 -1
  143. package/Shaders/ShadersInclude/clusteredLightingFunctions.d.ts +5 -0
  144. package/Shaders/ShadersInclude/clusteredLightingFunctions.js +18 -0
  145. package/Shaders/ShadersInclude/clusteredLightingFunctions.js.map +1 -0
  146. package/Shaders/ShadersInclude/helperFunctions.js +5 -1
  147. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  148. package/Shaders/ShadersInclude/lightFragment.js +33 -1
  149. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  150. package/Shaders/ShadersInclude/lightFragmentDeclaration.js +3 -0
  151. package/Shaders/ShadersInclude/lightFragmentDeclaration.js.map +1 -1
  152. package/Shaders/ShadersInclude/lightUboDeclaration.js +5 -0
  153. package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
  154. package/Shaders/ShadersInclude/lightVxUboDeclaration.js +2 -0
  155. package/Shaders/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  156. package/Shaders/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
  157. package/Shaders/ShadersInclude/lightsFragmentFunctions.js +20 -0
  158. package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  159. package/Shaders/ShadersInclude/pbrBlockPrePass.js +3 -1
  160. package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  161. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.d.ts +7 -0
  162. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +125 -0
  163. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -0
  164. package/Shaders/default.fragment.js +2 -0
  165. package/Shaders/default.fragment.js.map +1 -1
  166. package/Shaders/lightProxy.fragment.d.ts +5 -0
  167. package/Shaders/lightProxy.fragment.js +13 -0
  168. package/Shaders/lightProxy.fragment.js.map +1 -0
  169. package/Shaders/lightProxy.vertex.d.ts +8 -0
  170. package/Shaders/lightProxy.vertex.js +19 -0
  171. package/Shaders/lightProxy.vertex.js.map +1 -0
  172. package/Shaders/pbr.fragment.d.ts +1 -0
  173. package/Shaders/pbr.fragment.js +4 -0
  174. package/Shaders/pbr.fragment.js.map +1 -1
  175. package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.d.ts +5 -0
  176. package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.js +23 -0
  177. package/ShadersWGSL/ShadersInclude/clusteredLightingFunctions.js.map +1 -0
  178. package/ShadersWGSL/ShadersInclude/lightFragment.js +33 -1
  179. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  180. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +5 -0
  181. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
  182. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +2 -0
  183. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  184. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.d.ts +1 -0
  185. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +21 -1
  186. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  187. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +3 -1
  188. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  189. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.d.ts +2 -0
  190. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +114 -0
  191. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  192. package/ShadersWGSL/default.fragment.js +2 -0
  193. package/ShadersWGSL/default.fragment.js.map +1 -1
  194. package/ShadersWGSL/lightProxy.fragment.d.ts +5 -0
  195. package/ShadersWGSL/lightProxy.fragment.js +13 -0
  196. package/ShadersWGSL/lightProxy.fragment.js.map +1 -0
  197. package/ShadersWGSL/lightProxy.vertex.d.ts +7 -0
  198. package/ShadersWGSL/lightProxy.vertex.js +19 -0
  199. package/ShadersWGSL/lightProxy.vertex.js.map +1 -0
  200. package/package.json +1 -1
  201. package/scene.d.ts +1 -0
  202. package/scene.js +140 -30
  203. package/scene.js.map +1 -1
  204. package/sceneComponent.d.ts +2 -0
  205. package/sceneComponent.js +2 -0
  206. package/sceneComponent.js.map +1 -1
@@ -7,84 +7,111 @@ import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
7
7
  import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
8
8
  import { CylinderShapeBlock } from "./Blocks/Emitters/cylinderShapeBlock.js";
9
9
  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";
10
13
  function _CreateAndConnectInput(connectionPoint, name, defaultValue) {
11
14
  const input = new ParticleInputBlock(name);
12
15
  input.value = defaultValue;
13
16
  input.output.connectTo(connectionPoint);
14
17
  }
18
+ async function _ExtractDatafromParticleSystemAsync(particleSystem, target) {
19
+ // Main system
20
+ const system = new SystemBlock(particleSystem.name);
21
+ // Create particle
22
+ const createParticleBlock = new CreateParticleBlock("Create particle");
23
+ // Shape
24
+ let shapeBlock = null;
25
+ switch (particleSystem.particleEmitterType.getClassName()) {
26
+ case "BoxParticleEmitter": {
27
+ const source = particleSystem.particleEmitterType;
28
+ shapeBlock = new BoxShapeBlock("Box shape");
29
+ const target = shapeBlock;
30
+ _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
31
+ _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
32
+ _CreateAndConnectInput(target.minEmitBox, "Min Emit Box", source.minEmitBox);
33
+ _CreateAndConnectInput(target.maxEmitBox, "Max Emit Box", source.maxEmitBox);
34
+ break;
35
+ }
36
+ case "PointParticleEmitter": {
37
+ const source = particleSystem.particleEmitterType;
38
+ shapeBlock = new PointShapeBlock("Point shape");
39
+ const target = shapeBlock;
40
+ _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
41
+ _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
42
+ break;
43
+ }
44
+ case "SphereParticleEmitter": {
45
+ const source = particleSystem.particleEmitterType;
46
+ shapeBlock = new SphereShapeBlock("Sphere shape");
47
+ const target = shapeBlock;
48
+ _CreateAndConnectInput(target.radius, "Radius", source.radius);
49
+ _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
50
+ _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
51
+ break;
52
+ }
53
+ case "CylinderParticleEmitter": {
54
+ const source = particleSystem.particleEmitterType;
55
+ shapeBlock = new CylinderShapeBlock("Cylinder shape");
56
+ const target = shapeBlock;
57
+ _CreateAndConnectInput(target.height, "Height", source.height);
58
+ _CreateAndConnectInput(target.radius, "Radius", source.radius);
59
+ _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
60
+ _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
61
+ break;
62
+ }
63
+ case "MeshParticleEmitter": {
64
+ const source = particleSystem.particleEmitterType;
65
+ shapeBlock = new MeshShapeBlock("Mesh shape");
66
+ const target = shapeBlock;
67
+ _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
68
+ _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
69
+ target.mesh = source.mesh;
70
+ break;
71
+ }
72
+ }
73
+ if (!shapeBlock) {
74
+ throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);
75
+ }
76
+ createParticleBlock.particle.connectTo(shapeBlock.particle);
77
+ createParticleBlock.colorDead.value = particleSystem.colorDead;
78
+ // Texture
79
+ const textureBlock = new ParticleTextureSourceBlock("Texture");
80
+ const url = particleSystem.particleTexture.url || "";
81
+ if (url) {
82
+ textureBlock.url = url;
83
+ }
84
+ else {
85
+ textureBlock.sourceTexture = particleSystem.particleTexture;
86
+ }
87
+ textureBlock.texture.connectTo(system.texture);
88
+ // Default position update
89
+ const basicPositionUpdateBlock = new BasicPositionUpdateBlock("Position update");
90
+ shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);
91
+ // Default color update
92
+ const basicColorUpdateBlock = new BasicColorUpdateBlock("Color update");
93
+ basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);
94
+ basicColorUpdateBlock.output.connectTo(system.particle);
95
+ // Register
96
+ target.systemBlocks.push(system);
97
+ }
15
98
  /**
16
99
  * Converts a ParticleSystem to a NodeParticleSystemSet.
17
100
  * @param name The name of the node particle system set.
18
101
  * @param particleSystems The particle systems to convert.
19
102
  * @returns The converted node particle system set or null if conversion failed.
103
+ * #0K3AQ2#3625
20
104
  */
21
- export function ConvertToNodeParticleSystemSet(name, particleSystems) {
105
+ export async function ConvertToNodeParticleSystemSetAsync(name, particleSystems) {
22
106
  if (!particleSystems || !particleSystems.length) {
23
107
  return null;
24
108
  }
25
109
  const nodeParticleSystemSet = new NodeParticleSystemSet(name);
110
+ const promises = [];
26
111
  for (const particleSystem of particleSystems) {
27
- // Main system
28
- const system = new SystemBlock(particleSystem.name);
29
- // Create particle
30
- const createParticleBlock = new CreateParticleBlock("Create particle");
31
- // Shape
32
- let shapeBlock = null;
33
- switch (particleSystem.particleEmitterType.getClassName()) {
34
- case "BoxParticleEmitter": {
35
- const source = particleSystem.particleEmitterType;
36
- shapeBlock = new BoxShapeBlock("Box shape");
37
- const target = shapeBlock;
38
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
39
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
40
- _CreateAndConnectInput(target.minEmitBox, "Min Emit Box", source.minEmitBox);
41
- _CreateAndConnectInput(target.maxEmitBox, "Max Emit Box", source.maxEmitBox);
42
- break;
43
- }
44
- case "PointParticleEmitter": {
45
- const source = particleSystem.particleEmitterType;
46
- shapeBlock = new PointShapeBlock("Point shape");
47
- const target = shapeBlock;
48
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
49
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
50
- break;
51
- }
52
- case "SphereParticleEmitter": {
53
- const source = particleSystem.particleEmitterType;
54
- shapeBlock = new SphereShapeBlock("Sphere shape");
55
- const target = shapeBlock;
56
- _CreateAndConnectInput(target.radius, "Radius", source.radius);
57
- _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
58
- _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
59
- break;
60
- }
61
- case "CylinderParticleEmitter": {
62
- const source = particleSystem.particleEmitterType;
63
- shapeBlock = new CylinderShapeBlock("Cylinder shape");
64
- const target = shapeBlock;
65
- _CreateAndConnectInput(target.height, "Height", source.height);
66
- _CreateAndConnectInput(target.radius, "Radius", source.radius);
67
- _CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
68
- _CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
69
- break;
70
- }
71
- case "MeshParticleEmitter": {
72
- const source = particleSystem.particleEmitterType;
73
- shapeBlock = new MeshShapeBlock("Mesh shape");
74
- const target = shapeBlock;
75
- _CreateAndConnectInput(target.direction1, "Direction 1", source.direction1);
76
- _CreateAndConnectInput(target.direction2, "Direction 2", source.direction2);
77
- target.mesh = source.mesh;
78
- break;
79
- }
80
- }
81
- if (!shapeBlock) {
82
- throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);
83
- }
84
- createParticleBlock.particle.connectTo(shapeBlock.particle);
85
- shapeBlock.output.connectTo(system.particle);
86
- nodeParticleSystemSet.systemBlocks.push(system);
112
+ promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));
87
113
  }
114
+ await Promise.all(promises);
88
115
  return nodeParticleSystemSet;
89
116
  }
90
117
  //# 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,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,SAAS,sBAAsB,CAAC,eAA4C,EAAE,IAAY,EAAE,YAA8B;IACtH,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC3C,KAAK,CAAC,KAAK,GAAG,YAAY,CAAC;IAC3B,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,IAAY,EAAE,eAAiC;IAC1F,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;IAE9D,KAAK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CAAC,YAAY,CAAC,CAAC;gBAE9C,MAAM,MAAM,GAAG,UAA4B,CAAC;gBAC5C,sBAAsB,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC5E,sBAAsB,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;gBAE5E,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAY,CAAC;gBAClC,MAAM;YACV,CAAC;QACL,CAAC;QAED,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,sCAAsC,cAAc,CAAC,mBAAmB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAC/G,CAAC;QAED,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5D,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE7C,qBAAqB,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED,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\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\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 */\r\nexport function ConvertToNodeParticleSystemSet(name: string, particleSystems: ParticleSystem[]): 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\r\n for (const particleSystem of particleSystems) {\r\n // Main system\r\n const system = new SystemBlock(particleSystem.name);\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 shapeBlock.output.connectTo(system.particle);\r\n\r\n nodeParticleSystemSet.systemBlocks.push(system);\r\n }\r\n\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":"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,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,SAAS,sBAAsB,CAAC,eAA4C,EAAE,IAAY,EAAE,YAA8B;IACtH,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC3C,KAAK,CAAC,KAAK,GAAG,YAAY,CAAC;IAC3B,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;AAC5C,C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B,CAAC,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC1E,qBAAqB,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAExD,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\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\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 // 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#3625\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"]}
@@ -115,6 +115,10 @@ export declare class GPUParticleSystem extends BaseParticleSystem implements IDi
115
115
  readonly isGPU = true;
116
116
  /** Gets or sets a matrix to use to compute projection */
117
117
  defaultProjectionMatrix: Matrix;
118
+ /**
119
+ * Gets or sets an object used to store user defined information for the particle system
120
+ */
121
+ metadata: any;
118
122
  /**
119
123
  * Creates a Point Emitter for the particle system (emits directly from the emitter position)
120
124
  * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
@@ -732,6 +732,10 @@ export class GPUParticleSystem extends BaseParticleSystem {
732
732
  this.isLocal = false;
733
733
  /** Indicates that the particle system is GPU based */
734
734
  this.isGPU = true;
735
+ /**
736
+ * Gets or sets an object used to store user defined information for the particle system
737
+ */
738
+ this.metadata = null;
735
739
  /** Flow map */
736
740
  /** @internal */
737
741
  this._flowMap = null;
@@ -1664,6 +1668,9 @@ export class GPUParticleSystem extends BaseParticleSystem {
1664
1668
  serializationObject.customShader = this.customShader;
1665
1669
  serializationObject.preventAutoStart = this.preventAutoStart;
1666
1670
  serializationObject.worldOffset = this.worldOffset.asArray();
1671
+ if (this.metadata) {
1672
+ serializationObject.metadata = this.metadata;
1673
+ }
1667
1674
  return serializationObject;
1668
1675
  }
1669
1676
  /**
@@ -1709,6 +1716,9 @@ export class GPUParticleSystem extends BaseParticleSystem {
1709
1716
  if (parsedParticleSystem.preventAutoStart) {
1710
1717
  particleSystem.preventAutoStart = parsedParticleSystem.preventAutoStart;
1711
1718
  }
1719
+ if (parsedParticleSystem.metadata) {
1720
+ particleSystem.metadata = parsedParticleSystem.metadata;
1721
+ }
1712
1722
  if (!doNotStart && !particleSystem.preventAutoStart) {
1713
1723
  particleSystem.start();
1714
1724
  }