@onerjs/core 8.30.5 → 8.30.7

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 (219) hide show
  1. package/Actions/action.d.ts +5 -0
  2. package/Actions/action.js.map +1 -1
  3. package/Actions/actionManager.js +6 -2
  4. package/Actions/actionManager.js.map +1 -1
  5. package/Animations/runtimeAnimation.d.ts +0 -2
  6. package/Animations/runtimeAnimation.js +3 -5
  7. package/Animations/runtimeAnimation.js.map +1 -1
  8. package/AudioV2/abstractAudio/abstractSound.js +1 -0
  9. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  10. package/AudioV2/abstractAudio/audioEngineV2.d.ts +2 -0
  11. package/AudioV2/abstractAudio/audioEngineV2.js +18 -8
  12. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  13. package/AudioV2/webAudio/webAudioStaticSound.js +8 -3
  14. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  15. package/Collisions/gpuPicker.js +0 -1
  16. package/Collisions/gpuPicker.js.map +1 -1
  17. package/Debug/debugLayer.d.ts +1 -1
  18. package/Debug/debugLayer.js.map +1 -1
  19. package/Decorators/nodeDecorator.d.ts +3 -1
  20. package/Decorators/nodeDecorator.js +2 -0
  21. package/Decorators/nodeDecorator.js.map +1 -1
  22. package/Engines/Native/nativeInterfaces.d.ts +1 -1
  23. package/Engines/Native/nativeInterfaces.js.map +1 -1
  24. package/Engines/WebGPU/webgpuCacheSampler.js +4 -0
  25. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  26. package/Engines/abstractEngine.js +2 -2
  27. package/Engines/abstractEngine.js.map +1 -1
  28. package/Engines/nativeEngine.js +12 -13
  29. package/Engines/nativeEngine.js.map +1 -1
  30. package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.d.ts +2 -2
  31. package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.js +2 -2
  32. package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.js.map +1 -1
  33. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +1 -1
  34. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +2 -2
  35. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
  36. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.d.ts +44 -0
  37. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +152 -0
  38. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -0
  39. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.d.ts +2 -2
  40. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js +2 -2
  41. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js.map +1 -1
  42. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.d.ts +2 -2
  43. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js +2 -2
  44. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js.map +1 -1
  45. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.d.ts +2 -2
  46. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +2 -2
  47. package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -1
  48. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.d.ts +2 -2
  49. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +2 -2
  50. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js.map +1 -1
  51. package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.d.ts +2 -2
  52. package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js +2 -2
  53. package/FrameGraph/Node/Blocks/PostProcesses/colorCorrectionPostProcessBlock.js.map +1 -1
  54. package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.d.ts +2 -2
  55. package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js +2 -2
  56. package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js.map +1 -1
  57. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.d.ts +2 -2
  58. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js +2 -2
  59. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js.map +1 -1
  60. package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.d.ts +2 -2
  61. package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js +2 -2
  62. package/FrameGraph/Node/Blocks/PostProcesses/filterPostProcessBlock.js.map +1 -1
  63. package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.d.ts +2 -2
  64. package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.js +2 -2
  65. package/FrameGraph/Node/Blocks/PostProcesses/fxaaPostProcessBlock.js.map +1 -1
  66. package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.d.ts +2 -2
  67. package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.js +2 -2
  68. package/FrameGraph/Node/Blocks/PostProcesses/grainPostProcessBlock.js.map +1 -1
  69. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.d.ts +2 -2
  70. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js +3 -3
  71. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js.map +1 -1
  72. package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.d.ts +2 -2
  73. package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.js +2 -2
  74. package/FrameGraph/Node/Blocks/PostProcesses/motionBlurPostProcessBlock.js.map +1 -1
  75. package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.d.ts +3 -3
  76. package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.js +3 -3
  77. package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.js.map +1 -1
  78. package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.d.ts +2 -2
  79. package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.js +2 -2
  80. package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.js.map +1 -1
  81. package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.d.ts +2 -2
  82. package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.js +4 -4
  83. package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.js.map +1 -1
  84. package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.d.ts +2 -2
  85. package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.js +2 -2
  86. package/FrameGraph/Node/Blocks/PostProcesses/taaPostProcessBlock.js.map +1 -1
  87. package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.d.ts +2 -2
  88. package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.js +2 -2
  89. package/FrameGraph/Node/Blocks/PostProcesses/tonemapPostProcessBlock.js.map +1 -1
  90. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +1 -1
  91. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js.map +1 -1
  92. package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js +1 -1
  93. package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js.map +1 -1
  94. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +20 -1
  95. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +83 -0
  96. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
  97. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  98. package/FrameGraph/Node/Blocks/index.js +1 -0
  99. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  100. package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +7 -1
  101. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +8 -2
  102. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  103. package/FrameGraph/Tasks/PostProcesses/taaTask.d.ts +1 -1
  104. package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
  105. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +4 -4
  106. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -4
  107. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
  108. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -4
  109. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -3
  110. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  111. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +2 -3
  112. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +1 -2
  113. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
  114. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +3 -1
  115. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +11 -1
  116. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
  117. package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +11 -1
  118. package/FrameGraph/Tasks/Texture/copyToTextureTask.js +10 -1
  119. package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
  120. package/FrameGraph/frameGraphContext.d.ts +8 -1
  121. package/FrameGraph/frameGraphContext.js +9 -0
  122. package/FrameGraph/frameGraphContext.js.map +1 -1
  123. package/FrameGraph/frameGraphRenderContext.d.ts +5 -2
  124. package/FrameGraph/frameGraphRenderContext.js +32 -7
  125. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  126. package/FrameGraph/frameGraphTask.d.ts +8 -0
  127. package/FrameGraph/frameGraphTask.js +12 -0
  128. package/FrameGraph/frameGraphTask.js.map +1 -1
  129. package/Materials/PBR/openpbrMaterial.js +2 -1
  130. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  131. package/Materials/Textures/mirrorTexture.js +4 -1
  132. package/Materials/Textures/mirrorTexture.js.map +1 -1
  133. package/Materials/clipPlaneMaterialHelper.js +11 -1
  134. package/Materials/clipPlaneMaterialHelper.js.map +1 -1
  135. package/Materials/floatingOriginMatrixOverrides.d.ts +4 -1
  136. package/Materials/floatingOriginMatrixOverrides.js +14 -2
  137. package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
  138. package/Materials/index.d.ts +1 -0
  139. package/Materials/index.js +1 -0
  140. package/Materials/index.js.map +1 -1
  141. package/Materials/shaderMaterial.js +1 -1
  142. package/Materials/shaderMaterial.js.map +1 -1
  143. package/Maths/math.vector.functions.d.ts +31 -5
  144. package/Maths/math.vector.functions.js +41 -4
  145. package/Maths/math.vector.functions.js.map +1 -1
  146. package/Meshes/Node/Blocks/randomBlock.js +11 -11
  147. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  148. package/Misc/copyTextureToTexture.d.ts +18 -1
  149. package/Misc/copyTextureToTexture.js +31 -2
  150. package/Misc/copyTextureToTexture.js.map +1 -1
  151. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +7 -7
  152. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  153. package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +4 -0
  154. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +18 -2
  155. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
  156. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +7 -7
  157. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
  158. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +8 -8
  159. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
  160. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +9 -9
  161. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  162. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +6 -6
  163. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
  164. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +7 -7
  165. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
  166. package/Particles/Node/Blocks/particleRandomBlock.js +10 -10
  167. package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
  168. package/Particles/Node/Blocks/systemBlock.d.ts +33 -1
  169. package/Particles/Node/Blocks/systemBlock.js +83 -3
  170. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  171. package/Particles/Node/nodeParticleBuildState.d.ts +2 -7
  172. package/Particles/Node/nodeParticleBuildState.js +7 -22
  173. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  174. package/Particles/Node/nodeParticleSystemSet.helper.js +224 -58
  175. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  176. package/Particles/Node/nodeParticleSystemSet.js +1 -1
  177. package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
  178. package/Particles/thinParticleSystem.js +1 -0
  179. package/Particles/thinParticleSystem.js.map +1 -1
  180. package/Physics/v2/IPhysicsEnginePlugin.d.ts +1 -1
  181. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  182. package/Physics/v2/Plugins/havokPlugin.d.ts +27 -4
  183. package/Physics/v2/Plugins/havokPlugin.js +72 -8
  184. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  185. package/Physics/v2/physicsEngine.d.ts +12 -2
  186. package/Physics/v2/physicsEngine.js +15 -1
  187. package/Physics/v2/physicsEngine.js.map +1 -1
  188. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -1
  189. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  190. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +3 -0
  191. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  192. package/Shaders/copyTextureToTexture.fragment.js +2 -2
  193. package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
  194. package/Shaders/picking.fragment.js +1 -1
  195. package/Shaders/picking.fragment.js.map +1 -1
  196. package/Shaders/picking.vertex.js +1 -1
  197. package/Shaders/picking.vertex.js.map +1 -1
  198. package/ShadersWGSL/copyTextureToTexture.fragment.js +3 -3
  199. package/ShadersWGSL/copyTextureToTexture.fragment.js.map +1 -1
  200. package/ShadersWGSL/iblVoxelGrid.vertex.js +1 -1
  201. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  202. package/ShadersWGSL/picking.fragment.js +1 -1
  203. package/ShadersWGSL/picking.fragment.js.map +1 -1
  204. package/ShadersWGSL/picking.vertex.js +1 -1
  205. package/ShadersWGSL/picking.vertex.js.map +1 -1
  206. package/Sprites/spriteRenderer.js +10 -8
  207. package/Sprites/spriteRenderer.js.map +1 -1
  208. package/XR/features/WebXRLightEstimation.d.ts +8 -0
  209. package/XR/features/WebXRLightEstimation.js +6 -1
  210. package/XR/features/WebXRLightEstimation.js.map +1 -1
  211. package/XR/webXRSessionManager.js +4 -0
  212. package/XR/webXRSessionManager.js.map +1 -1
  213. package/assetContainer.d.ts +1 -1
  214. package/assetContainer.js +1 -1
  215. package/assetContainer.js.map +1 -1
  216. package/package.json +1 -1
  217. package/scene.d.ts +5 -2
  218. package/scene.js +9 -14
  219. package/scene.js.map +1 -1
@@ -82,32 +82,32 @@ export class ParticleRandomBlock extends NodeParticleBlock {
82
82
  case NodeParticleBlockConnectionPointTypes.Int:
83
83
  case NodeParticleBlockConnectionPointTypes.Float: {
84
84
  func = (state) => {
85
- const min = this.min.getConnectedValue(state) || 0;
86
- const max = this.max.getConnectedValue(state) || 1;
85
+ const min = this.min.getConnectedValue(state) ?? 0;
86
+ const max = this.max.getConnectedValue(state) ?? 1;
87
87
  return min + Math.random() * (max - min);
88
88
  };
89
89
  break;
90
90
  }
91
91
  case NodeParticleBlockConnectionPointTypes.Vector2: {
92
92
  func = (state) => {
93
- const min = this.min.getConnectedValue(state) || Vector2.Zero();
94
- const max = this.max.getConnectedValue(state) || Vector2.One();
93
+ const min = this.min.getConnectedValue(state) ?? Vector2.Zero();
94
+ const max = this.max.getConnectedValue(state) ?? Vector2.One();
95
95
  return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));
96
96
  };
97
97
  break;
98
98
  }
99
99
  case NodeParticleBlockConnectionPointTypes.Vector3: {
100
100
  func = (state) => {
101
- const min = this.min.getConnectedValue(state) || Vector3.Zero();
102
- const max = this.max.getConnectedValue(state) || Vector3.One();
101
+ const min = this.min.getConnectedValue(state) ?? Vector3.Zero();
102
+ const max = this.max.getConnectedValue(state) ?? Vector3.One();
103
103
  return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));
104
104
  };
105
105
  break;
106
106
  }
107
107
  case NodeParticleBlockConnectionPointTypes.Color4: {
108
108
  func = (state) => {
109
- const min = this.min.getConnectedValue(state) || new Color4(0, 0, 0, 0);
110
- const max = this.max.getConnectedValue(state) || new Color4(1, 1, 1, 1);
109
+ const min = this.min.getConnectedValue(state) ?? new Color4(0, 0, 0, 0);
110
+ const max = this.max.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);
111
111
  return new Color4(min.r + Math.random() * (max.r - min.r), min.g + Math.random() * (max.g - min.g), min.b + Math.random() * (max.b - min.b), min.a + Math.random() * (max.a - min.a));
112
112
  };
113
113
  break;
@@ -117,10 +117,10 @@ export class ParticleRandomBlock extends NodeParticleBlock {
117
117
  let lockId = 0;
118
118
  switch (this.lockMode) {
119
119
  case ParticleRandomBlockLocks.PerParticle:
120
- lockId = state.particleContext?.id || -1;
120
+ lockId = state.particleContext?.id ?? -1;
121
121
  break;
122
122
  case ParticleRandomBlockLocks.PerSystem:
123
- lockId = state.buildId || 0;
123
+ lockId = state.buildId ?? 0;
124
124
  break;
125
125
  }
126
126
  if (this._currentLockId !== lockId) {
@@ -1 +1 @@
1
- {"version":3,"file":"particleRandomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleRandomBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAE/C;;GAEG;AACH,MAAM,CAAN,IAAY,wBAOX;AAPD,WAAY,wBAAwB;IAChC,WAAW;IACX,uEAAQ,CAAA;IACR,kBAAkB;IAClB,qFAAe,CAAA;IACf,gBAAgB;IAChB,iFAAa,CAAA;AACjB,CAAC,EAPW,wBAAwB,KAAxB,wBAAwB,QAOnC;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAgBtD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QApBR,mBAAc,GAAG,CAAC,CAAC,CAAC;QAC5B;;WAEG;QAUI,aAAQ,GAAG,wBAAwB,CAAC,WAAW,CAAC;QASnD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,UA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AGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IACjD,CAAC;CACJ;AApJU;IATN,sBAAsB,CAAC,UAAU,uCAA+B,UAAU,EAAE;QACzE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE;YACvD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,wBAAwB,CAAC,WAAW,EAAE;YACtE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,wBAAwB,CAAC,SAAS,EAAE;SACrE;KACJ,CAAC;qDACqD;AAsJ3D,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum ParticleRandomBlockLocks {\r\n /** None */\r\n None = 0,\r\n /** PerParticle */\r\n PerParticle = 1,\r\n /** PerSystem */\r\n PerSystem = 2,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class ParticleRandomBlock extends NodeParticleBlock {\r\n private _currentLockId = -2;\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific event\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"None\", value: ParticleRandomBlockLocks.None },\r\n { label: \"Per particle\", value: ParticleRandomBlockLocks.PerParticle },\r\n { label: \"Per system\", value: ParticleRandomBlockLocks.PerSystem },\r\n ],\r\n })\r\n public lockMode = ParticleRandomBlockLocks.PerParticle;\r\n\r\n /**\r\n * Create a new ParticleRandomBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"min\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 0);\r\n this.registerInput(\"max\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 1);\r\n\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._outputs[0]._defaultConnectionPointType = NodeParticleBlockConnectionPointTypes.Float;\r\n this._linkConnectionTypes(0, 1);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleRandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build() {\r\n let func: Nullable<(state: NodeParticleBuildState) => any> = null;\r\n this._currentLockId = -2;\r\n\r\n switch (this.min.type) {\r\n case NodeParticleBlockConnectionPointTypes.AutoDetect:\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || 0;\r\n const max = this.max.getConnectedValue(state) || 1;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector2.One();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) || Vector3.One();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) || new Color4(0, 0, 0, 0);\r\n const max = this.max.getConnectedValue(state) || new Color4(1, 1, 1, 1);\r\n return new Color4(\r\n min.r + Math.random() * (max.r - min.r),\r\n min.g + Math.random() * (max.g - min.g),\r\n min.b + Math.random() * (max.b - min.b),\r\n min.a + Math.random() * (max.a - min.a)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n let lockId = 0;\r\n\r\n switch (this.lockMode) {\r\n case ParticleRandomBlockLocks.PerParticle:\r\n lockId = state.particleContext?.id || -1;\r\n break;\r\n case ParticleRandomBlockLocks.PerSystem:\r\n lockId = state.buildId || 0;\r\n break;\r\n }\r\n\r\n if (this._currentLockId !== lockId) {\r\n if (this.lockMode !== ParticleRandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n }\r\n this.output._storedValue = func!(state);\r\n }\r\n return this.output._storedValue;\r\n };\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.lockMode = this.lockMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleRandomBlock\", ParticleRandomBlock);\r\n"]}
1
+ {"version":3,"file":"particleRandomBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleRandomBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAA0B,sBAAsB,EAAE,6CAAsC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,OAAO,E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qD;AAsJ3D,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { Vector2, Vector3 } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { PropertyTypeForEdition, editableInPropertyPage } from \"core/Decorators/nodeDecorator\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\n\r\n/**\r\n * Locks supported by the random block\r\n */\r\nexport enum ParticleRandomBlockLocks {\r\n /** None */\r\n None = 0,\r\n /** PerParticle */\r\n PerParticle = 1,\r\n /** PerSystem */\r\n PerSystem = 2,\r\n}\r\n\r\n/**\r\n * Block used to get a random number\r\n */\r\nexport class ParticleRandomBlock extends NodeParticleBlock {\r\n private _currentLockId = -2;\r\n /**\r\n * Gets or sets a value indicating if that block will lock its value for a specific event\r\n */\r\n @editableInPropertyPage(\"LockMode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"None\", value: ParticleRandomBlockLocks.None },\r\n { label: \"Per particle\", value: ParticleRandomBlockLocks.PerParticle },\r\n { label: \"Per system\", value: ParticleRandomBlockLocks.PerSystem },\r\n ],\r\n })\r\n public lockMode = ParticleRandomBlockLocks.PerParticle;\r\n\r\n /**\r\n * Create a new ParticleRandomBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerInput(\"min\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 0);\r\n this.registerInput(\"max\", NodeParticleBlockConnectionPointTypes.AutoDetect, true, 1);\r\n\r\n this.registerOutput(\"output\", NodeParticleBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(\r\n NodeParticleBlockConnectionPointTypes.Float |\r\n NodeParticleBlockConnectionPointTypes.Int |\r\n NodeParticleBlockConnectionPointTypes.Vector2 |\r\n NodeParticleBlockConnectionPointTypes.Vector3 |\r\n NodeParticleBlockConnectionPointTypes.Color4\r\n );\r\n\r\n this._outputs[0]._typeConnectionSource = this._inputs[0];\r\n this._outputs[0]._defaultConnectionPointType = NodeParticleBlockConnectionPointTypes.Float;\r\n this._linkConnectionTypes(0, 1);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleRandomBlock\";\r\n }\r\n\r\n /**\r\n * Gets the min input component\r\n */\r\n public get min(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the max input component\r\n */\r\n public get max(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the geometry output component\r\n */\r\n public get output(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override _build() {\r\n let func: Nullable<(state: NodeParticleBuildState) => any> = null;\r\n this._currentLockId = -2;\r\n\r\n switch (this.min.type) {\r\n case NodeParticleBlockConnectionPointTypes.AutoDetect:\r\n case NodeParticleBlockConnectionPointTypes.Int:\r\n case NodeParticleBlockConnectionPointTypes.Float: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? 0;\r\n const max = this.max.getConnectedValue(state) ?? 1;\r\n return min + Math.random() * (max - min);\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector2: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? Vector2.Zero();\r\n const max = this.max.getConnectedValue(state) ?? Vector2.One();\r\n return new Vector2(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Vector3: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? Vector3.Zero();\r\n const max = this.max.getConnectedValue(state) ?? Vector3.One();\r\n return new Vector3(min.x + Math.random() * (max.x - min.x), min.y + Math.random() * (max.y - min.y), min.z + Math.random() * (max.z - min.z));\r\n };\r\n break;\r\n }\r\n case NodeParticleBlockConnectionPointTypes.Color4: {\r\n func = (state) => {\r\n const min = this.min.getConnectedValue(state) ?? new Color4(0, 0, 0, 0);\r\n const max = this.max.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n return new Color4(\r\n min.r + Math.random() * (max.r - min.r),\r\n min.g + Math.random() * (max.g - min.g),\r\n min.b + Math.random() * (max.b - min.b),\r\n min.a + Math.random() * (max.a - min.a)\r\n );\r\n };\r\n break;\r\n }\r\n }\r\n\r\n this.output._storedFunction = (state) => {\r\n let lockId = 0;\r\n\r\n switch (this.lockMode) {\r\n case ParticleRandomBlockLocks.PerParticle:\r\n lockId = state.particleContext?.id ?? -1;\r\n break;\r\n case ParticleRandomBlockLocks.PerSystem:\r\n lockId = state.buildId ?? 0;\r\n break;\r\n }\r\n\r\n if (this._currentLockId !== lockId) {\r\n if (this.lockMode !== ParticleRandomBlockLocks.None) {\r\n this._currentLockId = lockId;\r\n }\r\n this.output._storedValue = func!(state);\r\n }\r\n return this.output._storedValue;\r\n };\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.lockMode = this.lockMode;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.lockMode = serializationObject.lockMode;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleRandomBlock\", ParticleRandomBlock);\r\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { ParticleSystem } from "../../particleSystem.js";
2
- import { NodeParticleBlock } from "../nodeParticleBlock.js";
3
2
  import type { NodeParticleConnectionPoint } from "../nodeParticleBlockConnectionPoint.js";
4
3
  import type { NodeParticleBuildState } from "../nodeParticleBuildState.js";
4
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
5
5
  /**
6
6
  * Block used to get a system of particles
7
7
  */
@@ -19,6 +19,10 @@ export declare class SystemBlock extends NodeParticleBlock {
19
19
  * Gets or sets the emit rate
20
20
  */
21
21
  emitRate: number;
22
+ /**
23
+ * Gets or sets the manual emit count
24
+ */
25
+ manualEmitCount: number;
22
26
  /**
23
27
  * Gets or sets the target stop duration for the particle system
24
28
  */
@@ -31,6 +35,26 @@ export declare class SystemBlock extends NodeParticleBlock {
31
35
  * Gets or sets the target stop duration for the particle system
32
36
  */
33
37
  updateSpeed: number;
38
+ /**
39
+ * Gets or sets the number of pre-warm cycles before rendering the particle system
40
+ */
41
+ preWarmCycles: number;
42
+ /**
43
+ * Gets or sets the time step multiplier used for pre-warm
44
+ */
45
+ preWarmStepOffset: number;
46
+ /**
47
+ * Gets or sets a boolean indicating if the system is billboard based
48
+ */
49
+ isBillboardBased: boolean;
50
+ /**
51
+ * Gets or sets a boolean indicating if the system coordinate space is local or global
52
+ */
53
+ isLocal: boolean;
54
+ /**
55
+ * Gets or sets a boolean indicating if the system should be disposed when stopped
56
+ */
57
+ disposeOnStop: boolean;
34
58
  /**
35
59
  * Gets or sets a boolean indicating if the system should not start automatically
36
60
  */
@@ -63,6 +87,14 @@ export declare class SystemBlock extends NodeParticleBlock {
63
87
  * Gets the onEnd input component
64
88
  */
65
89
  get onEnd(): NodeParticleConnectionPoint;
90
+ /**
91
+ * Gets the translationPivot input component
92
+ */
93
+ get translationPivot(): NodeParticleConnectionPoint;
94
+ /**
95
+ * Gets the textureMask input component
96
+ */
97
+ get textureMask(): NodeParticleConnectionPoint;
66
98
  /**
67
99
  * Gets the system output component
68
100
  */
@@ -1,10 +1,12 @@
1
1
  import { __decorate } from "../../../tslib.es6.js";
2
- import { RegisterClass } from "../../../Misc/typeStore.js";
3
- import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
4
- import { NodeParticleBlock } from "../nodeParticleBlock.js";
5
2
  import { editableInPropertyPage } from "../../../Decorators/nodeDecorator.js";
3
+ import { RegisterClass } from "../../../Misc/typeStore.js";
4
+ import { Vector2 } from "../../../Maths/math.vector.js";
5
+ import { Color4 } from "../../../Maths/math.color.js";
6
6
  import { BaseParticleSystem } from "../../baseParticleSystem.js";
7
+ import { NodeParticleBlock } from "../nodeParticleBlock.js";
7
8
  import { _TriggerSubEmitter } from "./Triggers/triggerTools.js";
9
+ import { NodeParticleBlockConnectionPointTypes } from "../Enums/nodeParticleBlockConnectionPointTypes.js";
8
10
  /**
9
11
  * Block used to get a system of particles
10
12
  */
@@ -27,6 +29,10 @@ export class SystemBlock extends NodeParticleBlock {
27
29
  * Gets or sets the emit rate
28
30
  */
29
31
  this.emitRate = 10;
32
+ /**
33
+ * Gets or sets the manual emit count
34
+ */
35
+ this.manualEmitCount = -1;
30
36
  /**
31
37
  * Gets or sets the target stop duration for the particle system
32
38
  */
@@ -39,6 +45,26 @@ export class SystemBlock extends NodeParticleBlock {
39
45
  * Gets or sets the target stop duration for the particle system
40
46
  */
41
47
  this.updateSpeed = 0.0167;
48
+ /**
49
+ * Gets or sets the number of pre-warm cycles before rendering the particle system
50
+ */
51
+ this.preWarmCycles = 0;
52
+ /**
53
+ * Gets or sets the time step multiplier used for pre-warm
54
+ */
55
+ this.preWarmStepOffset = 0;
56
+ /**
57
+ * Gets or sets a boolean indicating if the system is billboard based
58
+ */
59
+ this.isBillboardBased = true;
60
+ /**
61
+ * Gets or sets a boolean indicating if the system coordinate space is local or global
62
+ */
63
+ this.isLocal = false;
64
+ /**
65
+ * Gets or sets a boolean indicating if the system should be disposed when stopped
66
+ */
67
+ this.disposeOnStop = false;
42
68
  /**
43
69
  * Gets or sets a boolean indicating if the system should not start automatically
44
70
  */
@@ -50,6 +76,8 @@ export class SystemBlock extends NodeParticleBlock {
50
76
  this.registerInput("texture", NodeParticleBlockConnectionPointTypes.Texture);
51
77
  this.registerInput("onStart", NodeParticleBlockConnectionPointTypes.System, true);
52
78
  this.registerInput("onEnd", NodeParticleBlockConnectionPointTypes.System, true);
79
+ this.registerInput("translationPivot", NodeParticleBlockConnectionPointTypes.Vector2, true);
80
+ this.registerInput("textureMask", NodeParticleBlockConnectionPointTypes.Color4, true);
53
81
  this.registerOutput("system", NodeParticleBlockConnectionPointTypes.System);
54
82
  }
55
83
  /**
@@ -83,6 +111,18 @@ export class SystemBlock extends NodeParticleBlock {
83
111
  get onEnd() {
84
112
  return this._inputs[3];
85
113
  }
114
+ /**
115
+ * Gets the translationPivot input component
116
+ */
117
+ get translationPivot() {
118
+ return this._inputs[4];
119
+ }
120
+ /**
121
+ * Gets the textureMask input component
122
+ */
123
+ get textureMask() {
124
+ return this._inputs[5];
125
+ }
86
126
  /**
87
127
  * Gets the system output component
88
128
  */
@@ -101,11 +141,19 @@ export class SystemBlock extends NodeParticleBlock {
101
141
  const particleSystem = this.particle.getConnectedValue(state);
102
142
  particleSystem.particleTexture = this.texture.getConnectedValue(state);
103
143
  particleSystem.emitRate = this.emitRate;
144
+ particleSystem.manualEmitCount = this.manualEmitCount;
104
145
  particleSystem.updateSpeed = this.updateSpeed;
146
+ particleSystem.preWarmCycles = this.preWarmCycles;
147
+ particleSystem.preWarmStepOffset = this.preWarmStepOffset;
105
148
  particleSystem.blendMode = this.blendMode;
106
149
  particleSystem.name = this.name;
107
150
  particleSystem._targetStopDuration = this.targetStopDuration;
108
151
  particleSystem.startDelay = this.startDelay;
152
+ particleSystem.isBillboardBased = this.isBillboardBased;
153
+ particleSystem.translationPivot = this.translationPivot.getConnectedValue(state) || Vector2.Zero();
154
+ particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);
155
+ particleSystem.isLocal = this.isLocal;
156
+ particleSystem.disposeOnStop = this.disposeOnStop;
109
157
  this.system._storedValue = this;
110
158
  particleSystem.canStart = () => {
111
159
  return !this.doNoStart;
@@ -145,7 +193,14 @@ export class SystemBlock extends NodeParticleBlock {
145
193
  const serializationObject = super.serialize();
146
194
  serializationObject.capacity = this.capacity;
147
195
  serializationObject.emitRate = this.emitRate;
196
+ serializationObject.manualEmitCount = this.manualEmitCount;
148
197
  serializationObject.blendMode = this.blendMode;
198
+ serializationObject.updateSpeed = this.updateSpeed;
199
+ serializationObject.preWarmCycles = this.preWarmCycles;
200
+ serializationObject.preWarmStepOffset = this.preWarmStepOffset;
201
+ serializationObject.isBillboardBased = this.isBillboardBased;
202
+ serializationObject.isLocal = this.isLocal;
203
+ serializationObject.disposeOnStop = this.disposeOnStop;
149
204
  serializationObject.doNoStart = this.doNoStart;
150
205
  serializationObject.targetStopDuration = this.targetStopDuration;
151
206
  serializationObject.startDelay = this.startDelay;
@@ -155,6 +210,13 @@ export class SystemBlock extends NodeParticleBlock {
155
210
  super._deserialize(serializationObject);
156
211
  this.capacity = serializationObject.capacity;
157
212
  this.emitRate = serializationObject.emitRate;
213
+ this.manualEmitCount = serializationObject.manualEmitCount ?? -1;
214
+ this.updateSpeed = serializationObject.updateSpeed ?? 0.0167;
215
+ this.preWarmCycles = serializationObject.preWarmCycles ?? 0;
216
+ this.preWarmStepOffset = serializationObject.preWarmStepOffset ?? 0;
217
+ this.isBillboardBased = serializationObject.isBillboardBased ?? true;
218
+ this.isLocal = serializationObject.isLocal ?? false;
219
+ this.disposeOnStop = serializationObject.disposeOnStop ?? false;
158
220
  this.doNoStart = !!serializationObject.doNoStart;
159
221
  if (serializationObject.blendMode !== undefined) {
160
222
  this.blendMode = serializationObject.blendMode;
@@ -187,6 +249,9 @@ __decorate([
187
249
  __decorate([
188
250
  editableInPropertyPage("Emit rate", 2 /* PropertyTypeForEdition.Int */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
189
251
  ], SystemBlock.prototype, "emitRate", void 0);
252
+ __decorate([
253
+ editableInPropertyPage("Manual emit count", 2 /* PropertyTypeForEdition.Int */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: -1 })
254
+ ], SystemBlock.prototype, "manualEmitCount", void 0);
190
255
  __decorate([
191
256
  editableInPropertyPage("Target duration", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
192
257
  ], SystemBlock.prototype, "targetStopDuration", void 0);
@@ -196,6 +261,21 @@ __decorate([
196
261
  __decorate([
197
262
  editableInPropertyPage("updateSpeed", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 0.1 })
198
263
  ], SystemBlock.prototype, "updateSpeed", void 0);
264
+ __decorate([
265
+ editableInPropertyPage("Pre-warm cycles", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
266
+ ], SystemBlock.prototype, "preWarmCycles", void 0);
267
+ __decorate([
268
+ editableInPropertyPage("Pre-warm step multiplier", 1 /* PropertyTypeForEdition.Float */, "ADVANCED", { embedded: true, notifiers: { rebuild: true }, min: 0 })
269
+ ], SystemBlock.prototype, "preWarmStepOffset", void 0);
270
+ __decorate([
271
+ editableInPropertyPage("Is billboard based", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
272
+ ], SystemBlock.prototype, "isBillboardBased", void 0);
273
+ __decorate([
274
+ editableInPropertyPage("Is local", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
275
+ ], SystemBlock.prototype, "isLocal", void 0);
276
+ __decorate([
277
+ editableInPropertyPage("Dispose on stop", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
278
+ ], SystemBlock.prototype, "disposeOnStop", void 0);
199
279
  __decorate([
200
280
  editableInPropertyPage("Do no start", 0 /* PropertyTypeForEdition.Boolean */, "ADVANCED", { embedded: true, notifiers: { rebuild: true } })
201
281
  ], SystemBlock.prototype, "doNoStart", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IA0D9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QA5DhB;;WAEG;QAYI,cAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QAEvD;;WAEG;QAEI,aAAQ,GAAG,IAAI,CAAC;QAEvB;;WAEG;QAEI,aAAQ,GAAG,EAAE,CAAC;QAErB;;WAEG;QAEI,uBAAkB,GAAG,CAAC,CAAC;QAE9B;;WAEG;QAEI,eAAU,GAAG,CAAC,CAAC;QAEtB;;WAEG;QAEI,gBAAW,GAAG,MAAM,CAAC;QAE5B;;WAEG;QAEI,cAAS,GAAG,KAAK,CAAC;QAEzB,gBAAgB;QACT,gBAAW,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC;QAS1C,IA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AAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;6CAC1H;AAMhB;IADN,sBAAsB,CAAC,WAAW,sCAA8B,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;6CACjH;AAMd;IADN,sBAAsB,CAAC,iBAAiB,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;uDAChH;AAMvB;IADN,sBAAsB,CAAC,iBAAiB,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;+CACxH;AAMf;IADN,sBAAsB,CAAC,aAAa,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;gDACxH;AAMrB;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;AAiK7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { _TriggerSubEmitter } from \"./Triggers/triggerTools\";\r\n\r\n/**\r\n * Block used to get a system of particles\r\n */\r\nexport class SystemBlock extends NodeParticleBlock {\r\n private static _IdCounter = 0;\r\n\r\n /**\r\n * Gets or sets the blend mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Blend mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"MultiplyAdd\", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },\r\n ],\r\n })\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Gets or sets the epsilon value used for comparison\r\n */\r\n @editableInPropertyPage(\"Capacity\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 10000 })\r\n public capacity = 1000;\r\n\r\n /**\r\n * Gets or sets the emit rate\r\n */\r\n @editableInPropertyPage(\"Emit rate\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public emitRate = 10;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Target duration\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public targetStopDuration = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Delay start(ms)\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"updateSpeed\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 0.1 })\r\n public updateSpeed = 0.0167;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should not start automatically\r\n */\r\n @editableInPropertyPage(\"Do no start\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public doNoStart = false;\r\n\r\n /** @internal */\r\n public _internalId = SystemBlock._IdCounter++;\r\n\r\n /**\r\n * Create a new SystemBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this._isSystem = true;\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"onStart\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"onEnd\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerOutput(\"system\", NodeParticleBlockConnectionPointTypes.System);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"SystemBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture input component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the onStart input component\r\n */\r\n public get onStart(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the onEnd input component\r\n */\r\n public get onEnd(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the system output component\r\n */\r\n public get system(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Builds the block and return a functional particle system\r\n * @param state defines the building state\r\n * @returns the built particle system\r\n */\r\n public createSystem(state: NodeParticleBuildState): ParticleSystem {\r\n state.capacity = this.capacity;\r\n state.buildId = this._buildId++;\r\n\r\n this.build(state);\r\n\r\n const particleSystem = this.particle.getConnectedValue(state) as ParticleSystem;\r\n particleSystem.particleTexture = this.texture.getConnectedValue(state);\r\n particleSystem.emitRate = this.emitRate;\r\n particleSystem.updateSpeed = this.updateSpeed;\r\n particleSystem.blendMode = this.blendMode;\r\n particleSystem.name = this.name;\r\n particleSystem._targetStopDuration = this.targetStopDuration;\r\n particleSystem.startDelay = this.startDelay;\r\n\r\n this.system._storedValue = this;\r\n\r\n particleSystem.canStart = () => {\r\n return !this.doNoStart;\r\n };\r\n\r\n particleSystem.onStartedObservable.add((system) => {\r\n // Triggers\r\n const onStartSystem = this.onStart.getConnectedValue(state);\r\n if (onStartSystem) {\r\n system.onStartedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onStartSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n\r\n const onEndSystem = this.onEnd.getConnectedValue(state);\r\n if (onEndSystem) {\r\n system.onStoppedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onEndSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n particleSystem.dispose();\r\n });\r\n\r\n // Return\r\n return particleSystem;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.capacity = this.capacity;\r\n serializationObject.emitRate = this.emitRate;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.doNoStart = this.doNoStart;\r\n serializationObject.targetStopDuration = this.targetStopDuration;\r\n serializationObject.startDelay = this.startDelay;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.capacity = serializationObject.capacity;\r\n this.emitRate = serializationObject.emitRate;\r\n this.doNoStart = !!serializationObject.doNoStart;\r\n\r\n if (serializationObject.blendMode !== undefined) {\r\n this.blendMode = serializationObject.blendMode;\r\n }\r\n\r\n if (serializationObject.targetStopDuration !== undefined) {\r\n this.targetStopDuration = serializationObject.targetStopDuration;\r\n }\r\n\r\n if (serializationObject.startDelay !== undefined) {\r\n this.startDelay = serializationObject.startDelay;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SystemBlock\", SystemBlock);\r\n"]}
1
+ {"version":3,"file":"systemBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/systemBlock.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,sBAAsB,EAA0B,6CAAsC;AAC/F,OAAO,EAAE,aAAa,EAAE,mCAA4B;AACpD,OAAO,EAAE,OAAO,EAAE,sCAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,kBAAkB,EAAE,oCAA0C;AACvE,OAAO,EAAE,iBAAiB,EAAE,gCAA8C;AAC1E,OAAO,EAAE,kBAAkB,EAAE,mCAAyD;AACtF,OAAO,EAAE,qCAAqC,EAAE,0DAAwE;AAExH;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IA8F9C;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,CAAC,CAAC;QAhGhB;;WAEG;QAYI,cAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC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sBAAsB,CAAC,0BAA0B,wCAAgC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;sDAC1H;AAMtB;IADN,sBAAsB,CAAC,oBAAoB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;qDAC5G;AAMxB;IADN,sBAAsB,CAAC,UAAU,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;4CAC1G;AAMhB;IADN,sBAAsB,CAAC,iBAAiB,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;kDAC3G;AAMtB;IADN,sBAAsB,CAAC,aAAa,0CAAkC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC;8CAC3G;AAuM7B,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"core/Particles/Node/nodeParticleBuildState\";\r\n\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"core/Decorators/nodeDecorator\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { BaseParticleSystem } from \"core/Particles/baseParticleSystem\";\r\nimport { NodeParticleBlock } from \"core/Particles/Node/nodeParticleBlock\";\r\nimport { _TriggerSubEmitter } from \"core/Particles/Node/Blocks/Triggers/triggerTools\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\n\r\n/**\r\n * Block used to get a system of particles\r\n */\r\nexport class SystemBlock extends NodeParticleBlock {\r\n private static _IdCounter = 0;\r\n\r\n /**\r\n * Gets or sets the blend mode for the particle system\r\n */\r\n @editableInPropertyPage(\"Blend mode\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"OneOne\", value: BaseParticleSystem.BLENDMODE_ONEONE },\r\n { label: \"Standard\", value: BaseParticleSystem.BLENDMODE_STANDARD },\r\n { label: \"Add\", value: BaseParticleSystem.BLENDMODE_ADD },\r\n { label: \"Multiply\", value: BaseParticleSystem.BLENDMODE_MULTIPLY },\r\n { label: \"MultiplyAdd\", value: BaseParticleSystem.BLENDMODE_MULTIPLYADD },\r\n ],\r\n })\r\n public blendMode = BaseParticleSystem.BLENDMODE_ONEONE;\r\n\r\n /**\r\n * Gets or sets the epsilon value used for comparison\r\n */\r\n @editableInPropertyPage(\"Capacity\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 10000 })\r\n public capacity = 1000;\r\n\r\n /**\r\n * Gets or sets the emit rate\r\n */\r\n @editableInPropertyPage(\"Emit rate\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public emitRate = 10;\r\n\r\n /**\r\n * Gets or sets the manual emit count\r\n */\r\n @editableInPropertyPage(\"Manual emit count\", PropertyTypeForEdition.Int, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: -1 })\r\n public manualEmitCount = -1;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Target duration\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public targetStopDuration = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"Delay start(ms)\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public startDelay = 0;\r\n\r\n /**\r\n * Gets or sets the target stop duration for the particle system\r\n */\r\n @editableInPropertyPage(\"updateSpeed\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0, max: 0.1 })\r\n public updateSpeed = 0.0167;\r\n\r\n /**\r\n * Gets or sets the number of pre-warm cycles before rendering the particle system\r\n */\r\n @editableInPropertyPage(\"Pre-warm cycles\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmCycles = 0;\r\n\r\n /**\r\n * Gets or sets the time step multiplier used for pre-warm\r\n */\r\n @editableInPropertyPage(\"Pre-warm step multiplier\", PropertyTypeForEdition.Float, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true }, min: 0 })\r\n public preWarmStepOffset = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system is billboard based\r\n */\r\n @editableInPropertyPage(\"Is billboard based\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isBillboardBased = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system coordinate space is local or global\r\n */\r\n @editableInPropertyPage(\"Is local\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public isLocal = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should be disposed when stopped\r\n */\r\n @editableInPropertyPage(\"Dispose on stop\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public disposeOnStop = false;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if the system should not start automatically\r\n */\r\n @editableInPropertyPage(\"Do no start\", PropertyTypeForEdition.Boolean, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\r\n public doNoStart = false;\r\n\r\n /** @internal */\r\n public _internalId = SystemBlock._IdCounter++;\r\n\r\n /**\r\n * Create a new SystemBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this._isSystem = true;\r\n\r\n this.registerInput(\"particle\", NodeParticleBlockConnectionPointTypes.Particle);\r\n this.registerInput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"onStart\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"onEnd\", NodeParticleBlockConnectionPointTypes.System, true);\r\n this.registerInput(\"translationPivot\", NodeParticleBlockConnectionPointTypes.Vector2, true);\r\n this.registerInput(\"textureMask\", NodeParticleBlockConnectionPointTypes.Color4, true);\r\n this.registerOutput(\"system\", NodeParticleBlockConnectionPointTypes.System);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"SystemBlock\";\r\n }\r\n\r\n /**\r\n * Gets the particle input component\r\n */\r\n public get particle(): NodeParticleConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture input component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the onStart input component\r\n */\r\n public get onStart(): NodeParticleConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the onEnd input component\r\n */\r\n public get onEnd(): NodeParticleConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the translationPivot input component\r\n */\r\n public get translationPivot(): NodeParticleConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the textureMask input component\r\n */\r\n public get textureMask(): NodeParticleConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the system output component\r\n */\r\n public get system(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Builds the block and return a functional particle system\r\n * @param state defines the building state\r\n * @returns the built particle system\r\n */\r\n public createSystem(state: NodeParticleBuildState): ParticleSystem {\r\n state.capacity = this.capacity;\r\n state.buildId = this._buildId++;\r\n\r\n this.build(state);\r\n\r\n const particleSystem = this.particle.getConnectedValue(state) as ParticleSystem;\r\n particleSystem.particleTexture = this.texture.getConnectedValue(state);\r\n particleSystem.emitRate = this.emitRate;\r\n particleSystem.manualEmitCount = this.manualEmitCount;\r\n particleSystem.updateSpeed = this.updateSpeed;\r\n particleSystem.preWarmCycles = this.preWarmCycles;\r\n particleSystem.preWarmStepOffset = this.preWarmStepOffset;\r\n particleSystem.blendMode = this.blendMode;\r\n particleSystem.name = this.name;\r\n particleSystem._targetStopDuration = this.targetStopDuration;\r\n particleSystem.startDelay = this.startDelay;\r\n particleSystem.isBillboardBased = this.isBillboardBased;\r\n particleSystem.translationPivot = (this.translationPivot.getConnectedValue(state) as Vector2) || Vector2.Zero();\r\n particleSystem.textureMask = this.textureMask.getConnectedValue(state) ?? new Color4(1, 1, 1, 1);\r\n particleSystem.isLocal = this.isLocal;\r\n particleSystem.disposeOnStop = this.disposeOnStop;\r\n\r\n this.system._storedValue = this;\r\n\r\n particleSystem.canStart = () => {\r\n return !this.doNoStart;\r\n };\r\n\r\n particleSystem.onStartedObservable.add((system) => {\r\n // Triggers\r\n const onStartSystem = this.onStart.getConnectedValue(state);\r\n if (onStartSystem) {\r\n system.onStartedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onStartSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n\r\n const onEndSystem = this.onEnd.getConnectedValue(state);\r\n if (onEndSystem) {\r\n system.onStoppedObservable.addOnce(() => {\r\n state.systemContext = particleSystem;\r\n const clone = _TriggerSubEmitter(onEndSystem, state.scene, state.emitterPosition!);\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n // Clean up the cloned system when the original system is disposed\r\n clone.dispose();\r\n });\r\n });\r\n }\r\n });\r\n\r\n this.onDisposeObservable.addOnce(() => {\r\n particleSystem.dispose();\r\n });\r\n\r\n // Return\r\n return particleSystem;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.capacity = this.capacity;\r\n serializationObject.emitRate = this.emitRate;\r\n serializationObject.manualEmitCount = this.manualEmitCount;\r\n serializationObject.blendMode = this.blendMode;\r\n serializationObject.updateSpeed = this.updateSpeed;\r\n serializationObject.preWarmCycles = this.preWarmCycles;\r\n serializationObject.preWarmStepOffset = this.preWarmStepOffset;\r\n serializationObject.isBillboardBased = this.isBillboardBased;\r\n serializationObject.isLocal = this.isLocal;\r\n serializationObject.disposeOnStop = this.disposeOnStop;\r\n serializationObject.doNoStart = this.doNoStart;\r\n serializationObject.targetStopDuration = this.targetStopDuration;\r\n serializationObject.startDelay = this.startDelay;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.capacity = serializationObject.capacity;\r\n this.emitRate = serializationObject.emitRate;\r\n this.manualEmitCount = serializationObject.manualEmitCount ?? -1;\r\n this.updateSpeed = serializationObject.updateSpeed ?? 0.0167;\r\n this.preWarmCycles = serializationObject.preWarmCycles ?? 0;\r\n this.preWarmStepOffset = serializationObject.preWarmStepOffset ?? 0;\r\n this.isBillboardBased = serializationObject.isBillboardBased ?? true;\r\n this.isLocal = serializationObject.isLocal ?? false;\r\n this.disposeOnStop = serializationObject.disposeOnStop ?? false;\r\n this.doNoStart = !!serializationObject.doNoStart;\r\n\r\n if (serializationObject.blendMode !== undefined) {\r\n this.blendMode = serializationObject.blendMode;\r\n }\r\n\r\n if (serializationObject.targetStopDuration !== undefined) {\r\n this.targetStopDuration = serializationObject.targetStopDuration;\r\n }\r\n\r\n if (serializationObject.startDelay !== undefined) {\r\n this.startDelay = serializationObject.startDelay;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SystemBlock\", SystemBlock);\r\n"]}
@@ -8,7 +8,6 @@ import { Vector2, Vector3 } from "../../Maths/math.vector.js";
8
8
  import type { ThinParticleSystem } from "../thinParticleSystem.js";
9
9
  import { Color4 } from "../../Maths/math.color.js";
10
10
  import { NodeParticleSystemSources } from "./Enums/nodeParticleSystemSources.js";
11
- import type { AbstractMesh } from "../../Meshes/abstractMesh.js";
12
11
  /**
13
12
  * Class used to store node based geometry build state
14
13
  */
@@ -64,10 +63,6 @@ export declare class NodeParticleBuildState {
64
63
  * @returns the value associated with the source
65
64
  */
66
65
  getContextualValue(source: NodeParticleContextualSources): number | Color4 | Nullable<Vector3> | Vector2;
67
- /**
68
- * Gets a boolean indicating if the emitter is a transform node (or a simple vector3)
69
- */
70
- get isEmitterTransformNode(): boolean;
71
66
  /**
72
67
  * Gets the emitter world matrix
73
68
  */
@@ -79,11 +74,11 @@ export declare class NodeParticleBuildState {
79
74
  /**
80
75
  * Gets the emitter position
81
76
  */
82
- get emitterPosition(): Vector3 | null;
77
+ get emitterPosition(): Nullable<Vector3>;
83
78
  /**
84
79
  * Gets the value associated with a system source
85
80
  * @param source Source of the system value
86
81
  * @returns the value associated with the source
87
82
  */
88
- getSystemValue(source: NodeParticleSystemSources): number | Nullable<Vector3 | AbstractMesh>;
83
+ getSystemValue(source: NodeParticleSystemSources): number | Nullable<Vector3>;
89
84
  }
@@ -110,18 +110,6 @@ export class NodeParticleBuildState {
110
110
  }
111
111
  return null;
112
112
  }
113
- /**
114
- * Gets a boolean indicating if the emitter is a transform node (or a simple vector3)
115
- */
116
- get isEmitterTransformNode() {
117
- if (!this.systemContext) {
118
- return false;
119
- }
120
- if (this.systemContext.emitter.position) {
121
- return true;
122
- }
123
- return false;
124
- }
125
113
  /**
126
114
  * Gets the emitter world matrix
127
115
  */
@@ -147,10 +135,13 @@ export class NodeParticleBuildState {
147
135
  if (!this.systemContext) {
148
136
  return null;
149
137
  }
150
- if (this.isEmitterTransformNode) {
151
- return this.systemContext.emitter.absolutePosition;
138
+ if (!this.systemContext.emitter) {
139
+ return null;
140
+ }
141
+ if (this.systemContext.emitter instanceof Vector3) {
142
+ return this.systemContext.emitter;
152
143
  }
153
- return this.systemContext.emitter;
144
+ return this.systemContext.emitter.absolutePosition;
154
145
  }
155
146
  /**
156
147
  * Gets the value associated with a system source
@@ -167,13 +158,7 @@ export class NodeParticleBuildState {
167
158
  case NodeParticleSystemSources.Delta:
168
159
  return this.systemContext._scaledUpdateSpeed;
169
160
  case NodeParticleSystemSources.Emitter:
170
- if (this.isEmitterTransformNode) {
171
- const emitterMesh = this.systemContext.emitter;
172
- return emitterMesh.absolutePosition;
173
- }
174
- else {
175
- return this.systemContext.emitter;
176
- }
161
+ return this.emitterPosition;
177
162
  case NodeParticleSystemSources.CameraPosition:
178
163
  return this.scene.activeCamera?.globalPosition || Vector3.Zero();
179
164
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAE1D,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAG9E;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAcI,8DAA8D;QACvD,kCAA6B,GAAkC,EAAE,CAAC;QAKzE;;WAEG;QACI,oBAAe,GAAuB,IAAI,CAAC;QAElD;;WAEG;QACI,kBAAa,GAAiC,IAAI,CAAC;QAE1D;;WAEG;QAC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IAAW,eAAe;QACtB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,OAAsB,IAAI,CAAC,aAAa,CAAC,OAAQ,CAAC,gBAAgB,CAAC;QACvE,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,OAAkB,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,MAAiC;QACnD,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,QAAQ,MAAM,EAAE,CAAC;YACb,KAAK,yBAAyB,CAAC,IAAI;gBAC/B,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;YAC3C,KAAK,yBAAyB,CAAC,KAAK;gBAChC,OAAO,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC;YACjD,KAAK,yBAAyB,CAAC,OAAO;gBAClC,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;oBAC9B,MAAM,WAAW,GAAiB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;oBAC7D,OAAO,WAAW,CAAC,gBAAgB,CAAC;gBACxC,CAAC;qBAAM,CAAC;oBACJ,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;gBACtC,CAAC;YACL,KAAK,yBAAyB,CAAC,cAAc;gBACzC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport type { Particle } from \"../particle\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { ThinParticleSystem } from \"../thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { NodeParticleSystemSources } from \"./Enums/nodeParticleSystemSources\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.systemContext._directionScale, this.systemContext._scaledDirection);\r\n return this.systemContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.particleContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n case NodeParticleContextualSources.InitialDirection:\r\n return this.particleContext._initialDirection;\r\n case NodeParticleContextualSources.ColorStep:\r\n return this.particleContext.colorStep;\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);\r\n return this.systemContext._scaledColorStep;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the emitter is a transform node (or a simple vector3)\r\n */\r\n public get isEmitterTransformNode() {\r\n if (!this.systemContext) {\r\n return false;\r\n }\r\n\r\n if ((<AbstractMesh>this.systemContext.emitter).position) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (this.isEmitterTransformNode) {\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n return this.systemContext.emitter as Vector3;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n if (this.isEmitterTransformNode) {\r\n const emitterMesh = <AbstractMesh>this.systemContext.emitter;\r\n return emitterMesh.absolutePosition;\r\n } else {\r\n return this.systemContext.emitter;\r\n }\r\n case NodeParticleSystemSources.CameraPosition:\r\n return this.scene.activeCamera?.globalPosition || Vector3.Zero();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAE1D,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAG9E;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAcI,8DAA8D;QACvD,kCAA6B,GAAkC,EAAE,CAAC;QAKzE;;WAEG;QACI,oBAAe,GAAuB,IAAI,CAAC;QAElD;;WAEG;QACI,kBAAa,GAAiC,IAAI,CAAC;QAE1D;;WAEG;QACI,kBAAa,GAAW,CAAC,CAAC;QACjC;;WAEG;QACI,sBAAiB,GAAW,CAAC,CAAC;IAmKzC,CAAC;IA7JG;;OAEG;IACI,UAAU;QACb,IAAI,YAAY,GAAG,EAAE,CAAC;QAEtB,KAAK,MAAM,iBAAiB,IAAI,IAAI,CAAC,6BAA6B,EAAE,CAAC;YACjE,YAAY,IAAI,SAAS,iBAAiB,CAAC,IAAI,eAC3C,iBAAiB,CAAC,UAAU,CAAC,IACjC,IAAI,iBAAiB,CAAC,UAAU,CAAC,YAAY,EAAE,2CAA2C,CAAC;QAC/F,CAAC;QA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,CAAC,aAAa,CAAC,YAAY,CAAC;YAC3C,KAAK,yBAAyB,CAAC,KAAK;gBAChC,OAAO,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC;YACjD,KAAK,yBAAyB,CAAC,OAAO;gBAClC,OAAO,IAAI,CAAC,eAAe,CAAC;YAChC,KAAK,yBAAyB,CAAC,cAAc;gBACzC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport type { Particle } from \"../particle\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { ThinParticleSystem } from \"../thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { NodeParticleSystemSources } from \"./Enums/nodeParticleSystemSources\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.systemContext._directionScale, this.systemContext._scaledDirection);\r\n return this.systemContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.particleContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n case NodeParticleContextualSources.InitialDirection:\r\n return this.particleContext._initialDirection;\r\n case NodeParticleContextualSources.ColorStep:\r\n return this.particleContext.colorStep;\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);\r\n return this.systemContext._scaledColorStep;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition(): Nullable<Vector3> {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (!this.systemContext.emitter) {\r\n return null;\r\n }\r\n\r\n if (this.systemContext.emitter instanceof Vector3) {\r\n return this.systemContext.emitter;\r\n }\r\n\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n return this.emitterPosition;\r\n case NodeParticleSystemSources.CameraPosition:\r\n return this.scene.activeCamera?.globalPosition || Vector3.Zero();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}