@babylonjs/core 8.11.0 → 8.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/Cameras/arcRotateCamera.js +8 -0
  2. package/Cameras/arcRotateCamera.js.map +1 -1
  3. package/Cameras/targetCamera.js +2 -0
  4. package/Cameras/targetCamera.js.map +1 -1
  5. package/Collisions/gpuPicker.d.ts +4 -0
  6. package/Collisions/gpuPicker.js +6 -0
  7. package/Collisions/gpuPicker.js.map +1 -1
  8. package/Engines/abstractEngine.js +2 -2
  9. package/Engines/abstractEngine.js.map +1 -1
  10. package/Engines/constants.d.ts +4 -0
  11. package/Engines/constants.js +4 -0
  12. package/Engines/constants.js.map +1 -1
  13. package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.d.ts +1 -0
  14. package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js +2 -0
  15. package/FrameGraph/Node/Blocks/Rendering/baseShadowGeneratorBlock.js.map +1 -1
  16. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.d.ts +6 -1
  17. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +29 -0
  18. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js.map +1 -1
  19. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +6 -0
  20. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +36 -9
  21. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  22. package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js +1 -0
  23. package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js.map +1 -1
  24. package/FrameGraph/Node/Blocks/inputBlock.js +1 -0
  25. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  26. package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +2 -0
  27. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +2 -0
  28. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -1
  29. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +23 -0
  30. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +126 -21
  31. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
  32. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +5 -0
  33. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +4 -0
  34. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  35. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +2 -4
  36. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +4 -17
  37. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
  38. package/FrameGraph/frameGraph.js +1 -1
  39. package/FrameGraph/frameGraph.js.map +1 -1
  40. package/FrameGraph/frameGraphContext.d.ts +30 -0
  41. package/FrameGraph/frameGraphContext.js +47 -0
  42. package/FrameGraph/frameGraphContext.js.map +1 -1
  43. package/FrameGraph/frameGraphRenderContext.d.ts +1 -4
  44. package/FrameGraph/frameGraphRenderContext.js +2 -5
  45. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  46. package/Lights/Shadows/cascadedShadowGenerator.d.ts +0 -1
  47. package/Lights/Shadows/cascadedShadowGenerator.js +0 -12
  48. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  49. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +1 -1
  50. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +4 -1
  51. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  52. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +2 -3
  53. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +1 -1
  54. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  55. package/Materials/Node/Blocks/Dual/fogBlock.d.ts +1 -1
  56. package/Materials/Node/Blocks/Dual/fogBlock.js +4 -1
  57. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  58. package/Materials/Node/Blocks/Dual/lightBlock.d.ts +1 -1
  59. package/Materials/Node/Blocks/Dual/lightBlock.js +2 -2
  60. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  61. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +1 -2
  62. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +1 -1
  63. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  64. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +3 -4
  65. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
  66. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +2 -3
  67. package/Materials/Node/Blocks/Dual/textureBlock.js +2 -2
  68. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  69. package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +1 -1
  70. package/Materials/Node/Blocks/Fragment/TBNBlock.js +4 -1
  71. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  72. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +2 -2
  73. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  74. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +1 -2
  75. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +1 -1
  76. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  77. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +2 -2
  78. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  79. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +1 -2
  80. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  81. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +1 -1
  82. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +1 -1
  83. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  84. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +1 -2
  85. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +1 -1
  86. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  87. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +2 -2
  88. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  89. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.d.ts +3 -3
  90. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +6 -3
  91. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  92. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +1 -2
  93. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -4
  94. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  95. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -2
  96. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +1 -2
  97. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  98. package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +2 -3
  99. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +1 -2
  100. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  101. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
  102. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +5 -2
  103. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  104. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +1 -2
  105. package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -2
  106. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  107. package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +1 -2
  108. package/Materials/Node/Blocks/PBR/refractionBlock.js +1 -2
  109. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  110. package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +2 -3
  111. package/Materials/Node/Blocks/PBR/sheenBlock.js +1 -2
  112. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  113. package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +2 -3
  114. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +1 -2
  115. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  116. package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +1 -2
  117. package/Materials/Node/Blocks/Particle/particleTextureBlock.js +1 -1
  118. package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
  119. package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +2 -2
  120. package/Materials/Node/Blocks/Vertex/bonesBlock.js +3 -3
  121. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  122. package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +1 -1
  123. package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -1
  124. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  125. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +1 -2
  126. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +1 -1
  127. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  128. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +2 -2
  129. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +8 -2
  130. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  131. package/Materials/Node/Blocks/transformBlock.d.ts +3 -3
  132. package/Materials/Node/Blocks/transformBlock.js +4 -5
  133. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  134. package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -3
  135. package/Materials/Node/Blocks/triPlanarBlock.js +1 -1
  136. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  137. package/Materials/Node/nodeMaterial.d.ts +1 -1
  138. package/Materials/Node/nodeMaterial.js +28 -42
  139. package/Materials/Node/nodeMaterial.js.map +1 -1
  140. package/Materials/Node/nodeMaterialBlock.d.ts +8 -12
  141. package/Materials/Node/nodeMaterialBlock.js +10 -12
  142. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  143. package/Materials/Node/nodeMaterialBuildState.js +3 -1
  144. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  145. package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +7 -3
  146. package/Materials/Node/nodeMaterialBuildStateSharedData.js +17 -6
  147. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  148. package/Materials/PBR/pbrBaseMaterial.d.ts +2 -0
  149. package/Materials/PBR/pbrBaseMaterial.js +11 -0
  150. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  151. package/Materials/Textures/Loaders/exrTextureLoader.d.ts +10 -0
  152. package/Materials/Textures/Loaders/exrTextureLoader.js +28 -1
  153. package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -1
  154. package/Materials/materialHelper.functions.js +1 -1
  155. package/Materials/materialHelper.functions.js.map +1 -1
  156. package/Materials/materialHelper.geometryrendering.js +7 -0
  157. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  158. package/Materials/standardMaterial.d.ts +2 -0
  159. package/Materials/standardMaterial.js +11 -0
  160. package/Materials/standardMaterial.js.map +1 -1
  161. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +7 -0
  162. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +11 -5
  163. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  164. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +6 -0
  165. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +42 -4
  166. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  167. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +8 -0
  168. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  169. package/Misc/environmentTextureTools.js +1 -1
  170. package/Misc/environmentTextureTools.js.map +1 -1
  171. package/Misc/minMaxReducer.d.ts +8 -6
  172. package/Misc/minMaxReducer.js +57 -90
  173. package/Misc/minMaxReducer.js.map +1 -1
  174. package/Misc/thinMinMaxReducer.d.ts +47 -0
  175. package/Misc/thinMinMaxReducer.js +148 -0
  176. package/Misc/thinMinMaxReducer.js.map +1 -0
  177. package/Particles/EmitterTypes/customParticleEmitter.d.ts +5 -0
  178. package/Particles/EmitterTypes/customParticleEmitter.js +9 -1
  179. package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
  180. package/Particles/IParticleSystem.d.ts +4 -0
  181. package/Particles/IParticleSystem.js.map +1 -1
  182. package/Particles/Node/Blocks/Conditions/particleConditionBlock.d.ts +75 -0
  183. package/Particles/Node/Blocks/Conditions/particleConditionBlock.js +179 -0
  184. package/Particles/Node/Blocks/Conditions/particleConditionBlock.js.map +1 -0
  185. package/Particles/Node/Blocks/Emitters/boxShapeBlock.d.ts +47 -0
  186. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +107 -0
  187. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -0
  188. package/Particles/Node/Blocks/Emitters/createParticleBlock.d.ts +46 -0
  189. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +97 -0
  190. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -0
  191. package/Particles/Node/Blocks/Emitters/customShapeBlock.d.ts +39 -0
  192. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +84 -0
  193. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -0
  194. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.d.ts +48 -0
  195. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +120 -0
  196. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -0
  197. package/Particles/Node/Blocks/Emitters/index.d.ts +7 -0
  198. package/Particles/Node/Blocks/Emitters/index.js +8 -0
  199. package/Particles/Node/Blocks/Emitters/index.js.map +1 -0
  200. package/Particles/Node/Blocks/Emitters/pointShapeBlock.d.ts +39 -0
  201. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +86 -0
  202. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -0
  203. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.d.ts +53 -0
  204. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js +111 -0
  205. package/Particles/Node/Blocks/Emitters/setupSpriteSheetBlock.js.map +1 -0
  206. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.d.ts +43 -0
  207. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +108 -0
  208. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -0
  209. package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.d.ts +48 -0
  210. package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.js +100 -0
  211. package/Particles/Node/Blocks/Teleport/particleTeleportInBlock.js.map +1 -0
  212. package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.d.ts +47 -0
  213. package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.js +82 -0
  214. package/Particles/Node/Blocks/Teleport/particleTeleportOutBlock.js.map +1 -0
  215. package/Particles/Node/Blocks/Triggers/particleTriggerBlock.d.ts +48 -0
  216. package/Particles/Node/Blocks/Triggers/particleTriggerBlock.js +133 -0
  217. package/Particles/Node/Blocks/Triggers/particleTriggerBlock.js.map +1 -0
  218. package/Particles/Node/Blocks/Triggers/triggerTools.d.ts +9 -0
  219. package/Particles/Node/Blocks/Triggers/triggerTools.js +16 -0
  220. package/Particles/Node/Blocks/Triggers/triggerTools.js.map +1 -0
  221. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.d.ts +31 -0
  222. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +64 -0
  223. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -0
  224. package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.d.ts +31 -0
  225. package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.js +63 -0
  226. package/Particles/Node/Blocks/Update/basicSpriteUpdateBlock.js.map +1 -0
  227. package/Particles/Node/Blocks/Update/updateAngleBlock.d.ts +35 -0
  228. package/Particles/Node/Blocks/Update/updateAngleBlock.js +73 -0
  229. package/Particles/Node/Blocks/Update/updateAngleBlock.js.map +1 -0
  230. package/Particles/Node/Blocks/Update/updateColorBlock.d.ts +35 -0
  231. package/Particles/Node/Blocks/Update/updateColorBlock.js +73 -0
  232. package/Particles/Node/Blocks/Update/updateColorBlock.js.map +1 -0
  233. package/Particles/Node/Blocks/Update/updateDirectionBlock.d.ts +35 -0
  234. package/Particles/Node/Blocks/Update/updateDirectionBlock.js +73 -0
  235. package/Particles/Node/Blocks/Update/updateDirectionBlock.js.map +1 -0
  236. package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +41 -0
  237. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +102 -0
  238. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -0
  239. package/Particles/Node/Blocks/Update/updatePositionBlock.d.ts +35 -0
  240. package/Particles/Node/Blocks/Update/updatePositionBlock.js +73 -0
  241. package/Particles/Node/Blocks/Update/updatePositionBlock.js.map +1 -0
  242. package/Particles/Node/Blocks/Update/updateScaleBlock.d.ts +35 -0
  243. package/Particles/Node/Blocks/Update/updateScaleBlock.js +73 -0
  244. package/Particles/Node/Blocks/Update/updateScaleBlock.js.map +1 -0
  245. package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.d.ts +35 -0
  246. package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.js +74 -0
  247. package/Particles/Node/Blocks/Update/updateSpriteCellIndexBlock.js.map +1 -0
  248. package/Particles/Node/Blocks/index.d.ts +27 -0
  249. package/Particles/Node/Blocks/index.js +29 -0
  250. package/Particles/Node/Blocks/index.js.map +1 -0
  251. package/Particles/Node/Blocks/particleConverterBlock.d.ts +85 -0
  252. package/Particles/Node/Blocks/particleConverterBlock.js +267 -0
  253. package/Particles/Node/Blocks/particleConverterBlock.js.map +1 -0
  254. package/Particles/Node/Blocks/particleDebugBlock.d.ts +37 -0
  255. package/Particles/Node/Blocks/particleDebugBlock.js +109 -0
  256. package/Particles/Node/Blocks/particleDebugBlock.js.map +1 -0
  257. package/Particles/Node/Blocks/particleElbowBlock.d.ts +27 -0
  258. package/Particles/Node/Blocks/particleElbowBlock.js +47 -0
  259. package/Particles/Node/Blocks/particleElbowBlock.js.map +1 -0
  260. package/Particles/Node/Blocks/particleGradientBlock.d.ts +28 -0
  261. package/Particles/Node/Blocks/particleGradientBlock.js +118 -0
  262. package/Particles/Node/Blocks/particleGradientBlock.js.map +1 -0
  263. package/Particles/Node/Blocks/particleGradientValueBlock.d.ts +32 -0
  264. package/Particles/Node/Blocks/particleGradientValueBlock.js +79 -0
  265. package/Particles/Node/Blocks/particleGradientValueBlock.js.map +1 -0
  266. package/Particles/Node/Blocks/particleInputBlock.d.ts +87 -0
  267. package/Particles/Node/Blocks/particleInputBlock.js +279 -0
  268. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -0
  269. package/Particles/Node/Blocks/particleLerpBlock.d.ts +34 -0
  270. package/Particles/Node/Blocks/particleLerpBlock.js +92 -0
  271. package/Particles/Node/Blocks/particleLerpBlock.js.map +1 -0
  272. package/Particles/Node/Blocks/particleMathBlock.d.ts +64 -0
  273. package/Particles/Node/Blocks/particleMathBlock.js +321 -0
  274. package/Particles/Node/Blocks/particleMathBlock.js.map +1 -0
  275. package/Particles/Node/Blocks/particleRandomBlock.d.ts +52 -0
  276. package/Particles/Node/Blocks/particleRandomBlock.js +161 -0
  277. package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -0
  278. package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +65 -0
  279. package/Particles/Node/Blocks/particleSourceTextureBlock.js +173 -0
  280. package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -0
  281. package/Particles/Node/Blocks/particleTrigonometryBlock.d.ts +80 -0
  282. package/Particles/Node/Blocks/particleTrigonometryBlock.js +272 -0
  283. package/Particles/Node/Blocks/particleTrigonometryBlock.js.map +1 -0
  284. package/Particles/Node/Blocks/randomRangeBlock.d.ts +45 -0
  285. package/Particles/Node/Blocks/randomRangeBlock.js +151 -0
  286. package/Particles/Node/Blocks/randomRangeBlock.js.map +1 -0
  287. package/Particles/Node/Blocks/systemBlock.d.ts +71 -0
  288. package/Particles/Node/Blocks/systemBlock.js +193 -0
  289. package/Particles/Node/Blocks/systemBlock.js.map +1 -0
  290. package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.d.ts +39 -0
  291. package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.js +41 -0
  292. package/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes.js.map +1 -0
  293. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +31 -0
  294. package/Particles/Node/Enums/nodeParticleContextualSources.js +34 -0
  295. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -0
  296. package/Particles/Node/Enums/nodeParticleSystemSources.d.ts +13 -0
  297. package/Particles/Node/Enums/nodeParticleSystemSources.js +15 -0
  298. package/Particles/Node/Enums/nodeParticleSystemSources.js.map +1 -0
  299. package/Particles/Node/index.d.ts +8 -0
  300. package/Particles/Node/index.js +10 -0
  301. package/Particles/Node/index.js.map +1 -0
  302. package/Particles/Node/nodeParticleBlock.d.ts +154 -0
  303. package/Particles/Node/nodeParticleBlock.js +355 -0
  304. package/Particles/Node/nodeParticleBlock.js.map +1 -0
  305. package/Particles/Node/nodeParticleBlockConnectionPoint.d.ts +188 -0
  306. package/Particles/Node/nodeParticleBlockConnectionPoint.js +337 -0
  307. package/Particles/Node/nodeParticleBlockConnectionPoint.js.map +1 -0
  308. package/Particles/Node/nodeParticleBuildState.d.ts +89 -0
  309. package/Particles/Node/nodeParticleBuildState.js +170 -0
  310. package/Particles/Node/nodeParticleBuildState.js.map +1 -0
  311. package/Particles/Node/nodeParticleSystemSet.d.ts +120 -0
  312. package/Particles/Node/nodeParticleSystemSet.js +382 -0
  313. package/Particles/Node/nodeParticleSystemSet.js.map +1 -0
  314. package/Particles/Queue/executionQueue.d.ts +2 -0
  315. package/Particles/Queue/executionQueue.js +10 -0
  316. package/Particles/Queue/executionQueue.js.map +1 -1
  317. package/Particles/baseParticleSystem.d.ts +2 -1
  318. package/Particles/baseParticleSystem.js +1 -0
  319. package/Particles/baseParticleSystem.js.map +1 -1
  320. package/Particles/flowMap.d.ts +7 -0
  321. package/Particles/flowMap.js +32 -0
  322. package/Particles/flowMap.js.map +1 -1
  323. package/Particles/gpuParticleSystem.d.ts +4 -0
  324. package/Particles/gpuParticleSystem.js +4 -0
  325. package/Particles/gpuParticleSystem.js.map +1 -1
  326. package/Particles/index.d.ts +1 -0
  327. package/Particles/index.js +1 -0
  328. package/Particles/index.js.map +1 -1
  329. package/Particles/particleSystem.d.ts +12 -0
  330. package/Particles/particleSystem.js +22 -1
  331. package/Particles/particleSystem.js.map +1 -1
  332. package/Particles/thinParticleSystem.d.ts +32 -11
  333. package/Particles/thinParticleSystem.js +62 -36
  334. package/Particles/thinParticleSystem.js.map +1 -1
  335. package/PostProcesses/postProcessManager.d.ts +2 -1
  336. package/PostProcesses/postProcessManager.js +3 -2
  337. package/PostProcesses/postProcessManager.js.map +1 -1
  338. package/Shaders/ShadersInclude/defaultUboDeclaration.js +1 -1
  339. package/Shaders/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  340. package/Shaders/ShadersInclude/defaultVertexDeclaration.js +1 -0
  341. package/Shaders/ShadersInclude/defaultVertexDeclaration.js.map +1 -1
  342. package/Shaders/ShadersInclude/lightFragment.js +5 -2
  343. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  344. package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js +3 -0
  345. package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
  346. package/Shaders/ShadersInclude/pbrBlockPrePass.js +3 -0
  347. package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  348. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
  349. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  350. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  351. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  352. package/Shaders/ShadersInclude/pbrVertexDeclaration.js +1 -0
  353. package/Shaders/ShadersInclude/pbrVertexDeclaration.js.map +1 -1
  354. package/Shaders/ShadersInclude/prePassDeclaration.js +3 -0
  355. package/Shaders/ShadersInclude/prePassDeclaration.js.map +1 -1
  356. package/Shaders/ShadersInclude/prePassVertex.js +3 -0
  357. package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
  358. package/Shaders/ShadersInclude/prePassVertexDeclaration.js +3 -0
  359. package/Shaders/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
  360. package/Shaders/default.fragment.js +3 -0
  361. package/Shaders/default.fragment.js.map +1 -1
  362. package/Shaders/minmaxRedux.fragment.js +13 -5
  363. package/Shaders/minmaxRedux.fragment.js.map +1 -1
  364. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +1 -1
  365. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  366. package/ShadersWGSL/ShadersInclude/lightFragment.js +5 -2
  367. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  368. package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js +3 -0
  369. package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
  370. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +3 -0
  371. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -1
  372. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
  373. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  374. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  375. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  376. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js +3 -0
  377. package/ShadersWGSL/ShadersInclude/prePassDeclaration.js.map +1 -1
  378. package/ShadersWGSL/ShadersInclude/prePassVertex.js +3 -0
  379. package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
  380. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js +3 -0
  381. package/ShadersWGSL/ShadersInclude/prePassVertexDeclaration.js.map +1 -1
  382. package/ShadersWGSL/default.fragment.js +3 -0
  383. package/ShadersWGSL/default.fragment.js.map +1 -1
  384. package/ShadersWGSL/minmaxRedux.fragment.js +14 -6
  385. package/ShadersWGSL/minmaxRedux.fragment.js.map +1 -1
  386. package/package.json +1 -1
  387. package/scene.d.ts +5 -0
  388. package/scene.js +8 -0
  389. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"minMaxReducer.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/minMaxReducer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAKzE,OAAO,iCAAiC,CAAC;AACzC,OAAO,qCAAqC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAct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ACX,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChF,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,UAAU,GAAG,IAAI;QAC5B,IAAI,UAAU,EAAE,CAAC;YACb,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;YAEvC,IAAI,IAAI,CAAC,0BAA0B,EAAE,CAAC;gBAClC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;gBAC7F,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;YAC3C,CAAC;QACL,CAAC;QAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;gBACnD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YACtC,CAAC;YACD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAChC,CAAC;QAED,IAAI,IAAI,CAAC,mBAAmB,IAAI,UAAU,EAAE,CAAC;YACzC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { Observer } from \"./observable\";\r\nimport { Observable } from \"./observable\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { PostProcessManager } from \"../PostProcesses/postProcessManager\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nimport \"../Shaders/minmaxRedux.fragment\";\r\nimport \"../ShadersWGSL/minmaxRedux.fragment\";\r\n\r\n/**\r\n * This class computes a min/max reduction from a texture: it means it computes the minimum\r\n * and maximum values from all values of the texture.\r\n * It is performed on the GPU for better performances, thanks to a succession of post processes.\r\n * The source values are read from the red channel of the texture.\r\n */\r\nexport class MinMaxReducer {\r\n /**\r\n * Observable triggered when the computation has been performed\r\n */\r\n public onAfterReductionPerformed = new Observable<{ min: number; max: number }>();\r\n\r\n protected _camera: Camera;\r\n protected _sourceTexture: Nullable<RenderTargetTexture>;\r\n protected _reductionSteps: Nullable<Array<PostProcess>>;\r\n protected _postProcessManager: PostProcessManager;\r\n protected _onAfterUnbindObserver: Nullable<Observer<RenderTargetTexture>>;\r\n protected _forceFullscreenViewport = true;\r\n protected _onContextRestoredObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n /**\r\n * Creates a min/max reducer\r\n * @param camera The camera to use for the post processes\r\n */\r\n constructor(camera: Camera) {\r\n this._camera = camera;\r\n this._postProcessManager = new PostProcessManager(camera.getScene());\r\n\r\n this._onContextRestoredObserver = camera.getEngine().onContextRestoredObservable.add(() => {\r\n this._postProcessManager._rebuild();\r\n });\r\n }\r\n\r\n /**\r\n * Gets the texture used to read the values from.\r\n */\r\n public get sourceTexture(): Nullable<RenderTargetTexture> {\r\n return this._sourceTexture;\r\n }\r\n\r\n /**\r\n * Sets the source texture to read the values from.\r\n * One must indicate if the texture is a depth texture or not through the depthRedux parameter\r\n * because in such textures '1' value must not be taken into account to compute the maximum\r\n * as this value is used to clear the texture.\r\n * Note that the computation is not activated by calling this function, you must call activate() for that!\r\n * @param sourceTexture The texture to read the values from. The values should be in the red channel.\r\n * @param depthRedux Indicates if the texture is a depth texture or not\r\n * @param type The type of the textures created for the reduction (defaults to TEXTURETYPE_HALF_FLOAT)\r\n * @param forceFullscreenViewport Forces the post processes used for the reduction to be applied without taking into account viewport (defaults to true)\r\n */\r\n public setSourceTexture(sourceTexture: RenderTargetTexture, depthRedux: boolean, type: number = Constants.TEXTURETYPE_HALF_FLOAT, forceFullscreenViewport = true): void {\r\n if (sourceTexture === this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this.dispose(false);\r\n\r\n this._sourceTexture = sourceTexture;\r\n this._reductionSteps = [];\r\n this._forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n const scene = this._camera.getScene();\r\n\r\n // create the first step\r\n const reductionInitial = new PostProcess(\r\n \"Initial reduction phase\",\r\n \"minmaxRedux\", // shader\r\n [\"texSize\"],\r\n [\"sourceTexture\"], // textures\r\n 1.0, // options\r\n null, // camera\r\n Constants.TEXTURE_NEAREST_NEAREST, // sampling\r\n scene.getEngine(), // engine\r\n false, // reusable\r\n \"#define INITIAL\" + (depthRedux ? \"\\n#define DEPTH_REDUX\" : \"\"), // defines\r\n type,\r\n undefined,\r\n undefined,\r\n undefined,\r\n Constants.TEXTUREFORMAT_RG,\r\n scene.getEngine().isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL\r\n );\r\n\r\n reductionInitial.autoClear = false;\r\n reductionInitial.forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n let w = this._sourceTexture.getRenderWidth(),\r\n h = this._sourceTexture.getRenderHeight();\r\n\r\n reductionInitial.onApply = ((w: number, h: number) => {\r\n return (effect: Effect) => {\r\n effect.setTexture(\"sourceTexture\", this._sourceTexture);\r\n effect.setFloat2(\"texSize\", w, h);\r\n };\r\n })(w, h);\r\n\r\n this._reductionSteps.push(reductionInitial);\r\n\r\n let index = 1;\r\n\r\n // create the additional steps\r\n while (w > 1 || h > 1) {\r\n w = Math.max(Math.round(w / 2), 1);\r\n h = Math.max(Math.round(h / 2), 1);\r\n\r\n const reduction = new PostProcess(\r\n \"Reduction phase \" + index,\r\n \"minmaxRedux\", // shader\r\n [\"texSize\"],\r\n null,\r\n { width: w, height: h }, // options\r\n null, // camera\r\n Constants.TEXTURE_NEAREST_NEAREST, // sampling\r\n scene.getEngine(), // engine\r\n false, // reusable\r\n \"#define \" + (w == 1 && h == 1 ? \"LAST\" : w == 1 || h == 1 ? \"ONEBEFORELAST\" : \"MAIN\"), // defines\r\n type,\r\n undefined,\r\n undefined,\r\n undefined,\r\n Constants.TEXTUREFORMAT_RG,\r\n scene.getEngine().isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL\r\n );\r\n\r\n reduction.autoClear = false;\r\n reduction.forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n reduction.onApply = ((w: number, h: number) => {\r\n return (effect: Effect) => {\r\n if (w == 1 || h == 1) {\r\n effect.setInt2(\"texSize\", w, h);\r\n } else {\r\n effect.setFloat2(\"texSize\", w, h);\r\n }\r\n };\r\n })(w, h);\r\n\r\n this._reductionSteps.push(reduction);\r\n\r\n index++;\r\n\r\n if (w == 1 && h == 1) {\r\n const func = (w: number, h: number, reduction: PostProcess) => {\r\n const buffer = new Float32Array(4 * w * h),\r\n minmax = { min: 0, max: 0 };\r\n return () => {\r\n // Note that we should normally await the call to _readTexturePixels!\r\n // But because WebGL does the read synchronously, we know the values will be updated without waiting for the promise to be resolved, which will let us get the updated values\r\n // in the current frame, whereas in WebGPU, the read is asynchronous and we should normally wait for the promise to be resolved to get the updated values.\r\n // However, it's safe to avoid waiting for the promise to be resolved in WebGPU as well, because we will simply use the current values until \"buffer\" is updated later on.\r\n // Note that it means we can suffer some rendering artifacts in WebGPU because we may use previous min/max values for the current frame.\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n scene.getEngine()._readTexturePixels(reduction.inputTexture.texture!, w, h, -1, 0, buffer, false);\r\n minmax.min = buffer[0];\r\n minmax.max = buffer[1];\r\n this.onAfterReductionPerformed.notifyObservers(minmax);\r\n };\r\n };\r\n reduction.onAfterRenderObservable.add(func(w, h, reduction));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Defines the refresh rate of the computation.\r\n * Use 0 to compute just once, 1 to compute on every frame, 2 to compute every two frames and so on...\r\n */\r\n public get refreshRate(): number {\r\n return this._sourceTexture ? this._sourceTexture.refreshRate : -1;\r\n }\r\n\r\n public set refreshRate(value: number) {\r\n if (this._sourceTexture) {\r\n this._sourceTexture.refreshRate = value;\r\n }\r\n }\r\n\r\n protected _activated = false;\r\n\r\n /**\r\n * Gets the activation status of the reducer\r\n */\r\n public get activated(): boolean {\r\n return this._activated;\r\n }\r\n\r\n /**\r\n * Activates the reduction computation.\r\n * When activated, the observers registered in onAfterReductionPerformed are\r\n * called after the computation is performed\r\n */\r\n public activate(): void {\r\n if (this._onAfterUnbindObserver || !this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._onAfterUnbindObserver = this._sourceTexture.onAfterUnbindObservable.add(() => {\r\n const engine = this._camera.getScene().getEngine();\r\n engine._debugPushGroup?.(`min max reduction`, 1);\r\n this._reductionSteps![0].activate(this._camera);\r\n this._postProcessManager.directRender(this._reductionSteps!, this._reductionSteps![0].inputTexture, this._forceFullscreenViewport);\r\n engine.unBindFramebuffer(this._reductionSteps![0].inputTexture, false);\r\n engine._debugPopGroup?.(1);\r\n });\r\n\r\n this._activated = true;\r\n }\r\n\r\n /**\r\n * Deactivates the reduction computation.\r\n */\r\n public deactivate(): void {\r\n if (!this._onAfterUnbindObserver || !this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\r\n this._onAfterUnbindObserver = null;\r\n this._activated = false;\r\n }\r\n\r\n /**\r\n * Disposes the min/max reducer\r\n * @param disposeAll true to dispose all the resources. You should always call this function with true as the parameter (or without any parameter as it is the default one). This flag is meant to be used internally.\r\n */\r\n public dispose(disposeAll = true): void {\r\n if (disposeAll) {\r\n this.onAfterReductionPerformed.clear();\r\n\r\n if (this._onContextRestoredObserver) {\r\n this._camera.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\r\n this._onContextRestoredObserver = null;\r\n }\r\n }\r\n\r\n this.deactivate();\r\n\r\n if (this._reductionSteps) {\r\n for (let i = 0; i < this._reductionSteps.length; ++i) {\r\n this._reductionSteps[i].dispose();\r\n }\r\n this._reductionSteps = null;\r\n }\r\n\r\n if (this._postProcessManager && disposeAll) {\r\n this._postProcessManager.dispose();\r\n }\r\n\r\n this._sourceTexture = null;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"minMaxReducer.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/minMaxReducer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEtF,OAAO,iCAAiC,CAAC;AACzC,OAAO,qCAAqC,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IACtB;;OAEG;IACH,IAAW,yBAAyB;QAChC,OAAO,IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC;IAC7D,CAAC;IAWD;;;OAGG;IACH,YAAY,MAAc;QARhB,2BAAsB,GAA4C,IAAI,CAAC;QACvE,6BAAwB,GAAG,IAAI,CAAC;QAoGhC,eAAU,GAAG,KAAK,CAAC;QA5FzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,mBAAmB,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,kBAAkB,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAA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CAAC,cAAc,EAAE,CAAC;YACvD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChF,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,UAAU,GAAG,IAAI;QAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,OAAO;QACX,CAAC;QAED,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QAEvC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,2BAA2B,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAC5F,IAAI,CAAC,0BAAkC,GAAG,SAAS,CAAC;QAErD,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE7B,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,mBAA2B,GAAG,SAAgB,CAAC;QACrD,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,kBAA0B,GAAG,SAAS,CAAC;QAC7C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAEO,qBAAqB;QACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACtC,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IACpC,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport type { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { Observer } from \"./observable\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport { PostProcessManager } from \"../PostProcesses/postProcessManager\";\r\n\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { ThinMinMaxReducer, ThinMinMaxReducerPostProcess } from \"./thinMinMaxReducer\";\r\n\r\nimport \"../Shaders/minmaxRedux.fragment\";\r\nimport \"../ShadersWGSL/minmaxRedux.fragment\";\r\n\r\n/**\r\n * This class computes a min/max reduction from a texture: it means it computes the minimum\r\n * and maximum values from all values of the texture.\r\n * It is performed on the GPU for better performances, thanks to a succession of post processes.\r\n * The source values are read from the red channel of the texture.\r\n */\r\nexport class MinMaxReducer {\r\n /**\r\n * Observable triggered when the computation has been performed\r\n */\r\n public get onAfterReductionPerformed() {\r\n return this._thinMinMaxReducer.onAfterReductionPerformed;\r\n }\r\n\r\n protected readonly _camera: Camera;\r\n protected readonly _thinMinMaxReducer: ThinMinMaxReducer;\r\n protected _sourceTexture: Nullable<RenderTargetTexture>;\r\n protected readonly _reductionSteps: Array<PostProcess>;\r\n protected readonly _postProcessManager: PostProcessManager;\r\n protected _onAfterUnbindObserver: Nullable<Observer<RenderTargetTexture>> = null;\r\n protected _forceFullscreenViewport = true;\r\n protected readonly _onContextRestoredObserver: Observer<AbstractEngine>;\r\n\r\n /**\r\n * Creates a min/max reducer\r\n * @param camera The camera to use for the post processes\r\n */\r\n constructor(camera: Camera) {\r\n this._camera = camera;\r\n this._postProcessManager = new PostProcessManager(camera.getScene());\r\n this._thinMinMaxReducer = new ThinMinMaxReducer(camera.getScene());\r\n this._reductionSteps = [];\r\n\r\n this._onContextRestoredObserver = camera.getEngine().onContextRestoredObservable.add(() => {\r\n this._postProcessManager._rebuild();\r\n });\r\n }\r\n\r\n /**\r\n * Gets the texture used to read the values from.\r\n */\r\n public get sourceTexture(): Nullable<RenderTargetTexture> {\r\n return this._sourceTexture;\r\n }\r\n\r\n /**\r\n * Sets the source texture to read the values from.\r\n * One must indicate if the texture is a depth texture or not through the depthRedux parameter\r\n * because in such textures '1' value must not be taken into account to compute the maximum\r\n * as this value is used to clear the texture.\r\n * Note that the computation is not activated by calling this function, you must call activate() for that!\r\n * @param sourceTexture The texture to read the values from. The values should be in the red channel.\r\n * @param depthRedux Indicates if the texture is a depth texture or not\r\n * @param type The type of the textures created for the reduction (defaults to TEXTURETYPE_HALF_FLOAT)\r\n * @param forceFullscreenViewport Forces the post processes used for the reduction to be applied without taking into account viewport (defaults to true)\r\n */\r\n public setSourceTexture(sourceTexture: RenderTargetTexture, depthRedux: boolean, type: number = Constants.TEXTURETYPE_HALF_FLOAT, forceFullscreenViewport = true): void {\r\n if (sourceTexture === this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._thinMinMaxReducer.depthRedux = depthRedux;\r\n\r\n this.deactivate();\r\n\r\n this._sourceTexture = sourceTexture;\r\n this._forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n if (this._thinMinMaxReducer.setTextureDimensions(sourceTexture.getRenderWidth(), sourceTexture.getRenderHeight())) {\r\n this._disposePostProcesses();\r\n\r\n const reductionSteps = this._thinMinMaxReducer.reductionSteps;\r\n\r\n for (let i = 0; i < reductionSteps.length; ++i) {\r\n const reductionStep = reductionSteps[i];\r\n\r\n const postProcess = new PostProcess(reductionStep.name, ThinMinMaxReducerPostProcess.FragmentUrl, {\r\n effectWrapper: reductionStep,\r\n samplingMode: Constants.TEXTURE_NEAREST_NEAREST,\r\n engine: this._camera.getScene().getEngine(),\r\n textureType: type,\r\n textureFormat: Constants.TEXTUREFORMAT_RG,\r\n size: { width: reductionStep.textureWidth, height: reductionStep.textureHeight },\r\n });\r\n\r\n this._reductionSteps.push(postProcess);\r\n\r\n postProcess.autoClear = false;\r\n postProcess.forceFullscreenViewport = forceFullscreenViewport;\r\n\r\n if (i === 0) {\r\n postProcess.externalTextureSamplerBinding = true;\r\n postProcess.onApplyObservable.add((effect: Effect) => {\r\n effect.setTexture(\"textureSampler\", this._sourceTexture);\r\n });\r\n }\r\n\r\n if (i === reductionSteps.length - 1) {\r\n this._reductionSteps[i - 1].onAfterRenderObservable.add(() => {\r\n this._thinMinMaxReducer.readMinMax(postProcess.inputTexture.texture!);\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Defines the refresh rate of the computation.\r\n * Use 0 to compute just once, 1 to compute on every frame, 2 to compute every two frames and so on...\r\n */\r\n public get refreshRate(): number {\r\n return this._sourceTexture ? this._sourceTexture.refreshRate : -1;\r\n }\r\n\r\n public set refreshRate(value: number) {\r\n if (this._sourceTexture) {\r\n this._sourceTexture.refreshRate = value;\r\n }\r\n }\r\n\r\n protected _activated = false;\r\n\r\n /**\r\n * Gets the activation status of the reducer\r\n */\r\n public get activated(): boolean {\r\n return this._activated;\r\n }\r\n\r\n /**\r\n * Activates the reduction computation.\r\n * When activated, the observers registered in onAfterReductionPerformed are\r\n * called after the computation is performed\r\n */\r\n public activate(): void {\r\n if (this._onAfterUnbindObserver || !this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._onAfterUnbindObserver = this._sourceTexture.onAfterUnbindObservable.add(() => {\r\n const engine = this._camera.getScene().getEngine();\r\n engine._debugPushGroup?.(`min max reduction`, 1);\r\n this._reductionSteps![0].activate(this._camera);\r\n this._postProcessManager.directRender(\r\n this._reductionSteps!,\r\n this._reductionSteps![0].inputTexture,\r\n this._forceFullscreenViewport,\r\n 0,\r\n 0,\r\n true,\r\n this._reductionSteps.length - 1\r\n );\r\n engine.unBindFramebuffer(this._reductionSteps![this._reductionSteps.length - 1].inputTexture, false);\r\n engine._debugPopGroup?.(1);\r\n });\r\n\r\n this._activated = true;\r\n }\r\n\r\n /**\r\n * Deactivates the reduction computation.\r\n */\r\n public deactivate(): void {\r\n if (!this._onAfterUnbindObserver || !this._sourceTexture) {\r\n return;\r\n }\r\n\r\n this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\r\n this._onAfterUnbindObserver = null;\r\n this._activated = false;\r\n }\r\n\r\n /**\r\n * Disposes the min/max reducer\r\n * @param disposeAll true to dispose all the resources. You should always call this function with true as the parameter (or without any parameter as it is the default one). This flag is meant to be used internally.\r\n */\r\n public dispose(disposeAll = true): void {\r\n if (!disposeAll) {\r\n return;\r\n }\r\n\r\n this.onAfterReductionPerformed.clear();\r\n\r\n this._camera.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\r\n (this._onContextRestoredObserver as any) = undefined;\r\n\r\n this._disposePostProcesses();\r\n\r\n this._postProcessManager.dispose();\r\n (this._postProcessManager as any) = undefined as any;\r\n this._thinMinMaxReducer.dispose();\r\n (this._thinMinMaxReducer as any) = undefined;\r\n this._sourceTexture = null;\r\n }\r\n\r\n private _disposePostProcesses() {\r\n for (let i = 0; i < this._reductionSteps.length; ++i) {\r\n this._reductionSteps[i].dispose();\r\n }\r\n this._reductionSteps.length = 0;\r\n }\r\n}\r\n"]}
@@ -0,0 +1,47 @@
1
+ import type { Nullable, EffectWrapperCreationOptions, AbstractEngine, InternalTexture, Scene } from "../index.js";
2
+ import { Observable } from "./observable.js";
3
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
4
+ /**
5
+ * @internal
6
+ */
7
+ export declare enum DepthTextureType {
8
+ NormalizedViewDepth = 0,
9
+ ViewDepth = 1,
10
+ ScreenDepth = 2
11
+ }
12
+ /**
13
+ * @internal
14
+ */
15
+ export declare class ThinMinMaxReducerPostProcess extends EffectWrapper {
16
+ static readonly FragmentUrl = "minmaxRedux";
17
+ static readonly Uniforms: string[];
18
+ protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
19
+ textureWidth: number;
20
+ textureHeight: number;
21
+ constructor(name: string, engine?: Nullable<AbstractEngine>, defines?: string, options?: EffectWrapperCreationOptions);
22
+ bind(noDefaultBindings?: boolean): void;
23
+ }
24
+ /**
25
+ * @internal
26
+ */
27
+ export declare class ThinMinMaxReducer {
28
+ readonly onAfterReductionPerformed: Observable<{
29
+ min: number;
30
+ max: number;
31
+ }>;
32
+ readonly reductionSteps: Array<ThinMinMaxReducerPostProcess>;
33
+ private _depthRedux;
34
+ private _depthTextureType;
35
+ get depthRedux(): boolean;
36
+ set depthRedux(value: boolean);
37
+ protected readonly _scene: Scene;
38
+ private _textureWidth;
39
+ private _textureHeight;
40
+ get textureWidth(): number;
41
+ get textureHeight(): number;
42
+ constructor(scene: Scene, depthRedux?: boolean);
43
+ setTextureDimensions(width: number, height: number, depthTextureType?: DepthTextureType): boolean;
44
+ readMinMax(texture: InternalTexture): void;
45
+ dispose(disposeAll?: boolean): void;
46
+ private _recreatePostProcesses;
47
+ }
@@ -0,0 +1,148 @@
1
+ import { Observable } from "./observable.js";
2
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
3
+ import { Engine } from "../Engines/engine.js";
4
+ /**
5
+ * @internal
6
+ */
7
+ export var DepthTextureType;
8
+ (function (DepthTextureType) {
9
+ DepthTextureType[DepthTextureType["NormalizedViewDepth"] = 0] = "NormalizedViewDepth";
10
+ DepthTextureType[DepthTextureType["ViewDepth"] = 1] = "ViewDepth";
11
+ DepthTextureType[DepthTextureType["ScreenDepth"] = 2] = "ScreenDepth";
12
+ })(DepthTextureType || (DepthTextureType = {}));
13
+ /**
14
+ * @internal
15
+ */
16
+ export class ThinMinMaxReducerPostProcess extends EffectWrapper {
17
+ _gatherImports(useWebGPU, list) {
18
+ if (useWebGPU) {
19
+ this._webGPUReady = true;
20
+ list.push(import("../ShadersWGSL/minmaxRedux.fragment.js"));
21
+ }
22
+ else {
23
+ list.push(import("../Shaders/minmaxRedux.fragment.js"));
24
+ }
25
+ }
26
+ constructor(name, engine = null, defines = "", options) {
27
+ super({
28
+ ...options,
29
+ name,
30
+ engine: engine || Engine.LastCreatedEngine,
31
+ useShaderStore: true,
32
+ useAsPostProcess: true,
33
+ fragmentShader: ThinMinMaxReducerPostProcess.FragmentUrl,
34
+ uniforms: ThinMinMaxReducerPostProcess.Uniforms,
35
+ defines,
36
+ });
37
+ this.textureWidth = 0;
38
+ this.textureHeight = 0;
39
+ }
40
+ bind(noDefaultBindings = false) {
41
+ super.bind(noDefaultBindings);
42
+ const effect = this.drawWrapper.effect;
43
+ if (this.textureWidth === 1 || this.textureHeight === 1) {
44
+ effect.setInt2("texSize", this.textureWidth, this.textureHeight);
45
+ }
46
+ else {
47
+ effect.setFloat2("texSize", this.textureWidth, this.textureHeight);
48
+ }
49
+ }
50
+ }
51
+ ThinMinMaxReducerPostProcess.FragmentUrl = "minmaxRedux";
52
+ ThinMinMaxReducerPostProcess.Uniforms = ["texSize"];
53
+ const BufferFloat = new Float32Array(4 * 1 * 1);
54
+ const BufferUint8 = new Uint8Array(4 * 1 * 1);
55
+ const MinMax = { min: 0, max: 0 };
56
+ /**
57
+ * @internal
58
+ */
59
+ export class ThinMinMaxReducer {
60
+ get depthRedux() {
61
+ return this._depthRedux;
62
+ }
63
+ set depthRedux(value) {
64
+ if (this._depthRedux === value) {
65
+ return;
66
+ }
67
+ this._depthRedux = value;
68
+ this._recreatePostProcesses();
69
+ }
70
+ get textureWidth() {
71
+ return this._textureWidth;
72
+ }
73
+ get textureHeight() {
74
+ return this._textureHeight;
75
+ }
76
+ constructor(scene, depthRedux = true) {
77
+ this.onAfterReductionPerformed = new Observable();
78
+ this._textureWidth = 0;
79
+ this._textureHeight = 0;
80
+ this._scene = scene;
81
+ this._depthRedux = depthRedux;
82
+ this.reductionSteps = [];
83
+ }
84
+ setTextureDimensions(width, height, depthTextureType = 0 /* DepthTextureType.NormalizedViewDepth */) {
85
+ if (width === this._textureWidth && height === this._textureHeight && depthTextureType === this._depthTextureType) {
86
+ return false;
87
+ }
88
+ this._textureWidth = width;
89
+ this._textureHeight = height;
90
+ this._depthTextureType = depthTextureType;
91
+ this._recreatePostProcesses();
92
+ return true;
93
+ }
94
+ readMinMax(texture) {
95
+ // Note that we should normally await the call to _readTexturePixels!
96
+ // But because WebGL does the read synchronously, we know the values will be updated without waiting for the promise to be resolved, which will let us get the updated values
97
+ // in the current frame, whereas in WebGPU, the read is asynchronous and we should normally wait for the promise to be resolved to get the updated values.
98
+ // However, it's safe to avoid waiting for the promise to be resolved in WebGPU as well, because we will simply use the current values until "buffer" is updated later on.
99
+ // Note that it means we can suffer some rendering artifacts in WebGPU because we may use previous min/max values for the current frame.
100
+ const isFloat = texture.type === Engine.TEXTURETYPE_FLOAT || texture.type === Engine.TEXTURETYPE_HALF_FLOAT;
101
+ const buffer = isFloat ? BufferFloat : BufferUint8;
102
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
103
+ this._scene.getEngine()._readTexturePixels(texture, 1, 1, -1, 0, buffer, false);
104
+ MinMax.min = buffer[0];
105
+ MinMax.max = buffer[1];
106
+ if (!isFloat) {
107
+ MinMax.min = MinMax.min / 255.0;
108
+ MinMax.max = MinMax.max / 255.0;
109
+ }
110
+ if (MinMax.min >= MinMax.max) {
111
+ MinMax.min = 0;
112
+ MinMax.max = 1;
113
+ }
114
+ this.onAfterReductionPerformed.notifyObservers(MinMax);
115
+ }
116
+ dispose(disposeAll = true) {
117
+ if (disposeAll) {
118
+ this.onAfterReductionPerformed.clear();
119
+ this._textureWidth = 0;
120
+ this._textureHeight = 0;
121
+ }
122
+ for (let i = 0; i < this.reductionSteps.length; ++i) {
123
+ this.reductionSteps[i].dispose();
124
+ }
125
+ this.reductionSteps.length = 0;
126
+ }
127
+ _recreatePostProcesses() {
128
+ this.dispose(false);
129
+ const scene = this._scene;
130
+ let w = this.textureWidth, h = this.textureHeight;
131
+ const reductionInitial = new ThinMinMaxReducerPostProcess("Initial reduction phase", scene.getEngine(), "#define INITIAL" + (this._depthRedux ? "\n#define DEPTH_REDUX" : "") + (this._depthTextureType === 1 /* DepthTextureType.ViewDepth */ ? "\n#define VIEW_DEPTH" : ""));
132
+ reductionInitial.textureWidth = w;
133
+ reductionInitial.textureHeight = h;
134
+ this.reductionSteps.push(reductionInitial);
135
+ let index = 1;
136
+ // create the additional steps
137
+ while (w > 1 || h > 1) {
138
+ w = Math.max(Math.round(w / 2), 1);
139
+ h = Math.max(Math.round(h / 2), 1);
140
+ const reduction = new ThinMinMaxReducerPostProcess("Reduction phase " + index, scene.getEngine(), "#define " + (w == 1 && h == 1 ? "LAST" : w == 1 || h == 1 ? "ONEBEFORELAST" : "MAIN"));
141
+ reduction.textureWidth = w;
142
+ reduction.textureHeight = h;
143
+ this.reductionSteps.push(reduction);
144
+ index++;
145
+ }
146
+ }
147
+ }
148
+ //# sourceMappingURL=thinMinMaxReducer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinMinMaxReducer.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/thinMinMaxReducer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,6BAA4B;AAE7C;;GAEG;AACH,MAAM,CAAN,IAAkB,gBAIjB;AAJD,WAAkB,gBAAgB;IAC9B,qFAAuB,CAAA;IACvB,iEAAa,CAAA;IACb,qEAAe,CAAA;AACnB,CAAC,EAJiB,gBAAgB,KAAhB,gBAAgB,QAIjC;AAED;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,aAAa;IAKxC,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;IAMD,YAAY,IAAY,EAAE,SAAmC,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,OAAsC;QACnH,KAAK,CAAC;YACF,GAAG,OAAO;YACV,IAAI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C,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CACzF,CAAC;YAEF,SAAS,CAAC,YAAY,GAAG,CAAC,CAAC;YAC3B,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC;YAE5B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAEpC,KAAK,EAAE,CAAC;QACZ,CAAC;IACL,CAAC;CACJ","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nimport type { Nullable, EffectWrapperCreationOptions, AbstractEngine, InternalTexture, Scene } from \"core/index\";\r\nimport { Observable } from \"./observable\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"core/Engines/engine\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport const enum DepthTextureType {\r\n NormalizedViewDepth = 0,\r\n ViewDepth = 1,\r\n ScreenDepth = 2,\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ThinMinMaxReducerPostProcess extends EffectWrapper {\r\n public static readonly FragmentUrl = \"minmaxRedux\";\r\n\r\n public static readonly Uniforms = [\"texSize\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/minmaxRedux.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/minmaxRedux.fragment\"));\r\n }\r\n }\r\n\r\n public textureWidth = 0;\r\n\r\n public textureHeight = 0;\r\n\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, defines = \"\", options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinMinMaxReducerPostProcess.FragmentUrl,\r\n uniforms: ThinMinMaxReducerPostProcess.Uniforms,\r\n defines,\r\n });\r\n }\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this.drawWrapper.effect!;\r\n\r\n if (this.textureWidth === 1 || this.textureHeight === 1) {\r\n effect.setInt2(\"texSize\", this.textureWidth, this.textureHeight);\r\n } else {\r\n effect.setFloat2(\"texSize\", this.textureWidth, this.textureHeight);\r\n }\r\n }\r\n}\r\n\r\nconst BufferFloat = new Float32Array(4 * 1 * 1);\r\nconst BufferUint8 = new Uint8Array(4 * 1 * 1);\r\nconst MinMax = { min: 0, max: 0 };\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class ThinMinMaxReducer {\r\n public readonly onAfterReductionPerformed = new Observable<{ min: number; max: number }>();\r\n\r\n public readonly reductionSteps: Array<ThinMinMaxReducerPostProcess>;\r\n\r\n private _depthRedux: boolean;\r\n private _depthTextureType: DepthTextureType;\r\n\r\n public get depthRedux() {\r\n return this._depthRedux;\r\n }\r\n\r\n public set depthRedux(value: boolean) {\r\n if (this._depthRedux === value) {\r\n return;\r\n }\r\n\r\n this._depthRedux = value;\r\n\r\n this._recreatePostProcesses();\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n\r\n private _textureWidth = 0;\r\n private _textureHeight = 0;\r\n\r\n public get textureWidth() {\r\n return this._textureWidth;\r\n }\r\n\r\n public get textureHeight() {\r\n return this._textureHeight;\r\n }\r\n\r\n constructor(scene: Scene, depthRedux = true) {\r\n this._scene = scene;\r\n this._depthRedux = depthRedux;\r\n this.reductionSteps = [];\r\n }\r\n\r\n public setTextureDimensions(width: number, height: number, depthTextureType: DepthTextureType = DepthTextureType.NormalizedViewDepth) {\r\n if (width === this._textureWidth && height === this._textureHeight && depthTextureType === this._depthTextureType) {\r\n return false;\r\n }\r\n\r\n this._textureWidth = width;\r\n this._textureHeight = height;\r\n this._depthTextureType = depthTextureType;\r\n\r\n this._recreatePostProcesses();\r\n\r\n return true;\r\n }\r\n\r\n public readMinMax(texture: InternalTexture) {\r\n // Note that we should normally await the call to _readTexturePixels!\r\n // But because WebGL does the read synchronously, we know the values will be updated without waiting for the promise to be resolved, which will let us get the updated values\r\n // in the current frame, whereas in WebGPU, the read is asynchronous and we should normally wait for the promise to be resolved to get the updated values.\r\n // However, it's safe to avoid waiting for the promise to be resolved in WebGPU as well, because we will simply use the current values until \"buffer\" is updated later on.\r\n // Note that it means we can suffer some rendering artifacts in WebGPU because we may use previous min/max values for the current frame.\r\n const isFloat = texture.type === Engine.TEXTURETYPE_FLOAT || texture.type === Engine.TEXTURETYPE_HALF_FLOAT;\r\n const buffer = isFloat ? BufferFloat : BufferUint8;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._scene.getEngine()._readTexturePixels(texture, 1, 1, -1, 0, buffer, false);\r\n\r\n MinMax.min = buffer[0];\r\n MinMax.max = buffer[1];\r\n\r\n if (!isFloat) {\r\n MinMax.min = MinMax.min / 255.0;\r\n MinMax.max = MinMax.max / 255.0;\r\n }\r\n\r\n if (MinMax.min >= MinMax.max) {\r\n MinMax.min = 0;\r\n MinMax.max = 1;\r\n }\r\n\r\n this.onAfterReductionPerformed.notifyObservers(MinMax);\r\n }\r\n\r\n public dispose(disposeAll = true): void {\r\n if (disposeAll) {\r\n this.onAfterReductionPerformed.clear();\r\n this._textureWidth = 0;\r\n this._textureHeight = 0;\r\n }\r\n\r\n for (let i = 0; i < this.reductionSteps.length; ++i) {\r\n this.reductionSteps[i].dispose();\r\n }\r\n this.reductionSteps.length = 0;\r\n }\r\n\r\n private _recreatePostProcesses() {\r\n this.dispose(false);\r\n\r\n const scene = this._scene;\r\n\r\n let w = this.textureWidth,\r\n h = this.textureHeight;\r\n\r\n const reductionInitial = new ThinMinMaxReducerPostProcess(\r\n \"Initial reduction phase\",\r\n scene.getEngine(),\r\n \"#define INITIAL\" + (this._depthRedux ? \"\\n#define DEPTH_REDUX\" : \"\") + (this._depthTextureType === DepthTextureType.ViewDepth ? \"\\n#define VIEW_DEPTH\" : \"\")\r\n );\r\n\r\n reductionInitial.textureWidth = w;\r\n reductionInitial.textureHeight = h;\r\n\r\n this.reductionSteps.push(reductionInitial);\r\n\r\n let index = 1;\r\n\r\n // create the additional steps\r\n while (w > 1 || h > 1) {\r\n w = Math.max(Math.round(w / 2), 1);\r\n h = Math.max(Math.round(h / 2), 1);\r\n\r\n const reduction = new ThinMinMaxReducerPostProcess(\r\n \"Reduction phase \" + index,\r\n scene.getEngine(),\r\n \"#define \" + (w == 1 && h == 1 ? \"LAST\" : w == 1 || h == 1 ? \"ONEBEFORELAST\" : \"MAIN\")\r\n );\r\n\r\n reduction.textureWidth = w;\r\n reduction.textureHeight = h;\r\n\r\n this.reductionSteps.push(reduction);\r\n\r\n index++;\r\n }\r\n }\r\n}\r\n"]}
@@ -19,6 +19,11 @@ export declare class CustomParticleEmitter implements IParticleEmitterType {
19
19
  * * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles
20
20
  */
21
21
  particleDestinationGenerator: (index: number, particle: Nullable<Particle>, outDestination: Vector3) => void;
22
+ /**
23
+ * Gets or sets the direction generator that will create the initial direction of each particle.
24
+ * * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles
25
+ */
26
+ particleDirectionGenerator: (index: number, particle: Nullable<Particle>, outDestination: Vector3) => void;
22
27
  /**
23
28
  * Creates a new instance CustomParticleEmitter
24
29
  */
@@ -18,6 +18,11 @@ export class CustomParticleEmitter {
18
18
  * * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles
19
19
  */
20
20
  this.particleDestinationGenerator = () => { };
21
+ /**
22
+ * Gets or sets the direction generator that will create the initial direction of each particle.
23
+ * * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles
24
+ */
25
+ this.particleDirectionGenerator = () => { };
21
26
  }
22
27
  /**
23
28
  * Called by the particle System when the direction is computed for the created particle.
@@ -28,7 +33,10 @@ export class CustomParticleEmitter {
28
33
  */
29
34
  startDirectionFunction(worldMatrix, directionToUpdate, particle, isLocal) {
30
35
  const tmpVector = TmpVectors.Vector3[0];
31
- if (this.particleDestinationGenerator) {
36
+ if (this.particleDirectionGenerator) {
37
+ this.particleDirectionGenerator(-1, particle, tmpVector);
38
+ }
39
+ else if (this.particleDestinationGenerator) {
32
40
  this.particleDestinationGenerator(-1, particle, tmpVector);
33
41
  // Get direction
34
42
  const diffVector = TmpVectors.Vector3[1];
@@ -1 +1 @@
1
- {"version":3,"file":"customParticleEmitter.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/EmitterTypes/customParticleEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAM9D;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAa9B;;OAEG;IACH;QAfA;;;WAGG;QACI,8BAAyB,GAAgF,GAAG,EAAE,GAAE,CAAC,CAAC;QAEzH;;;WAGG;QACI,iCAA4B,GAAmF,GAAG,EAAE,GAAE,CAAC,CAAC;IAKhH,CAAC;IAEhB;;;;;;OAMG;IACI,sBAAsB,CAAC,WAAmB,EAAE,iBAA0B,EAAE,QAAkB,EAAE,OAAgB;QAC/G,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAExC,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;YACpC,IAAI,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAE3D,gBAAgB;YAChB,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACzC,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAEvD,UAAU,CAAC,UAAU,CAAC,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC5D,CAA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nC,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,uBAAuB,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAQ,EAAE,CAAC;QAEpC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/C,mBAAmB,CAAC,yBAAyB,GAAG,IAAI,CAAC,yBAAyB,CAAC;QAC/E,mBAAmB,CAAC,4BAA4B,GAAG,IAAI,CAAC,4BAA4B,CAAC;QAErF,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAwB;QACjC,IAAI,mBAAmB,CAAC,yBAAyB,EAAE,CAAC;YAChD,IAAI,CAAC,yBAAyB,GAAG,mBAAmB,CAAC,yBAAyB,CAAC;QACnF,CAAC;QAED,IAAI,mBAAmB,CAAC,4BAA4B,EAAE,CAAC;YACnD,IAAI,CAAC,4BAA4B,GAAG,mBAAmB,CAAC,4BAA4B,CAAC;QACzF,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Particle } from \"../particle\";\r\nimport type { IParticleEmitterType } from \"./IParticleEmitterType\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { UniformBufferEffectCommonAccessor } from \"../../Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\n/**\r\n * Particle emitter emitting particles from a custom list of positions.\r\n */\r\nexport class CustomParticleEmitter implements IParticleEmitterType {\r\n /**\r\n * Gets or sets the position generator that will create the initial position of each particle.\r\n * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles\r\n */\r\n public particlePositionGenerator: (index: number, particle: Nullable<Particle>, outPosition: Vector3) => void = () => {};\r\n\r\n /**\r\n * Gets or sets the destination generator that will create the final destination of each particle.\r\n * * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles\r\n */\r\n public particleDestinationGenerator: (index: number, particle: Nullable<Particle>, outDestination: Vector3) => void = () => {};\r\n\r\n /**\r\n * Creates a new instance CustomParticleEmitter\r\n */\r\n constructor() {}\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const tmpVector = TmpVectors.Vector3[0];\r\n\r\n if (this.particleDestinationGenerator) {\r\n this.particleDestinationGenerator(-1, particle, tmpVector);\r\n\r\n // Get direction\r\n const diffVector = TmpVectors.Vector3[1];\r\n tmpVector.subtractToRef(particle.position, diffVector);\r\n\r\n diffVector.scaleToRef(1 / particle.lifeTime, tmpVector);\r\n } else {\r\n tmpVector.set(0, 0, 0);\r\n }\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFrom(tmpVector);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalToRef(tmpVector, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the position should be set in local space\r\n */\r\n public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const tmpVector = TmpVectors.Vector3[0];\r\n\r\n if (this.particlePositionGenerator) {\r\n this.particlePositionGenerator(-1, particle, tmpVector);\r\n } else {\r\n tmpVector.set(0, 0, 0);\r\n }\r\n\r\n if (isLocal) {\r\n positionToUpdate.copyFrom(tmpVector);\r\n return;\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(tmpVector, worldMatrix, positionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): CustomParticleEmitter {\r\n const newOne = new CustomParticleEmitter();\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {}\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public buildUniformLayout(ubo: UniformBuffer): void {}\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n return \"#define CUSTOMEMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"PointParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"CustomParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.type = this.getClassName();\r\n serializationObject.particlePositionGenerator = this.particlePositionGenerator;\r\n serializationObject.particleDestinationGenerator = this.particleDestinationGenerator;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n if (serializationObject.particlePositionGenerator) {\r\n this.particlePositionGenerator = serializationObject.particlePositionGenerator;\r\n }\r\n\r\n if (serializationObject.particleDestinationGenerator) {\r\n this.particleDestinationGenerator = serializationObject.particleDestinationGenerator;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"customParticleEmitter.js","sourceRoot":"","sources":["../../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GAAQ,EAAE,CAAC;QAEpC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/C,mBAAmB,CAAC,yBAAyB,GAAG,IAAI,CAAC,yBAAyB,CAAC;QAC/E,mBAAmB,CAAC,4BAA4B,GAAG,IAAI,CAAC,4BAA4B,CAAC;QAErF,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,mBAAwB;QACjC,IAAI,mBAAmB,CAAC,yBAAyB,EAAE,CAAC;YAChD,IAAI,CAAC,yBAAyB,GAAG,mBAAmB,CAAC,yBAAyB,CAAC;QACnF,CAAC;QAED,IAAI,mBAAmB,CAAC,4BAA4B,EAAE,CAAC;YACnD,IAAI,CAAC,4BAA4B,GAAG,mBAAmB,CAAC,4BAA4B,CAAC;QACzF,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { DeepCopier } from \"../../Misc/deepCopier\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport { Vector3, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Particle } from \"../particle\";\r\nimport type { IParticleEmitterType } from \"./IParticleEmitterType\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { UniformBufferEffectCommonAccessor } from \"../../Materials/uniformBufferEffectCommonAccessor\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\n/**\r\n * Particle emitter emitting particles from a custom list of positions.\r\n */\r\nexport class CustomParticleEmitter implements IParticleEmitterType {\r\n /**\r\n * Gets or sets the position generator that will create the initial position of each particle.\r\n * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles\r\n */\r\n public particlePositionGenerator: (index: number, particle: Nullable<Particle>, outPosition: Vector3) => void = () => {};\r\n\r\n /**\r\n * Gets or sets the destination generator that will create the final destination of each particle.\r\n * * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles\r\n */\r\n public particleDestinationGenerator: (index: number, particle: Nullable<Particle>, outDestination: Vector3) => void = () => {};\r\n\r\n /**\r\n * Gets or sets the direction generator that will create the initial direction of each particle.\r\n * * Index will be provided when used with GPU particle. Particle will be provided when used with CPU particles\r\n */\r\n public particleDirectionGenerator: (index: number, particle: Nullable<Particle>, outDestination: Vector3) => void = () => {};\r\n\r\n /**\r\n * Creates a new instance CustomParticleEmitter\r\n */\r\n constructor() {}\r\n\r\n /**\r\n * Called by the particle System when the direction is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param directionToUpdate is the direction vector to update with the result\r\n * @param particle is the particle we are computed the direction for\r\n * @param isLocal defines if the direction should be set in local space\r\n */\r\n public startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const tmpVector = TmpVectors.Vector3[0];\r\n\r\n if (this.particleDirectionGenerator) {\r\n this.particleDirectionGenerator(-1, particle, tmpVector);\r\n } else if (this.particleDestinationGenerator) {\r\n this.particleDestinationGenerator(-1, particle, tmpVector);\r\n\r\n // Get direction\r\n const diffVector = TmpVectors.Vector3[1];\r\n tmpVector.subtractToRef(particle.position, diffVector);\r\n\r\n diffVector.scaleToRef(1 / particle.lifeTime, tmpVector);\r\n } else {\r\n tmpVector.set(0, 0, 0);\r\n }\r\n\r\n if (isLocal) {\r\n directionToUpdate.copyFrom(tmpVector);\r\n return;\r\n }\r\n\r\n Vector3.TransformNormalToRef(tmpVector, worldMatrix, directionToUpdate);\r\n }\r\n\r\n /**\r\n * Called by the particle System when the position is computed for the created particle.\r\n * @param worldMatrix is the world matrix of the particle system\r\n * @param positionToUpdate is the position vector to update with the result\r\n * @param particle is the particle we are computed the position for\r\n * @param isLocal defines if the position should be set in local space\r\n */\r\n public startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void {\r\n const tmpVector = TmpVectors.Vector3[0];\r\n\r\n if (this.particlePositionGenerator) {\r\n this.particlePositionGenerator(-1, particle, tmpVector);\r\n } else {\r\n tmpVector.set(0, 0, 0);\r\n }\r\n\r\n if (isLocal) {\r\n positionToUpdate.copyFrom(tmpVector);\r\n return;\r\n }\r\n\r\n Vector3.TransformCoordinatesToRef(tmpVector, worldMatrix, positionToUpdate);\r\n }\r\n\r\n /**\r\n * Clones the current emitter and returns a copy of it\r\n * @returns the new emitter\r\n */\r\n public clone(): CustomParticleEmitter {\r\n const newOne = new CustomParticleEmitter();\r\n\r\n DeepCopier.DeepCopy(this, newOne);\r\n\r\n return newOne;\r\n }\r\n\r\n /**\r\n * Called by the GPUParticleSystem to setup the update shader\r\n * @param uboOrEffect defines the update shader\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public applyToShader(uboOrEffect: UniformBufferEffectCommonAccessor): void {}\r\n\r\n /**\r\n * Creates the structure of the ubo for this particle emitter\r\n * @param ubo ubo to create the structure for\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public buildUniformLayout(ubo: UniformBuffer): void {}\r\n\r\n /**\r\n * Returns a string to use to update the GPU particles update shader\r\n * @returns a string containing the defines string\r\n */\r\n public getEffectDefines(): string {\r\n return \"#define CUSTOMEMITTER\";\r\n }\r\n\r\n /**\r\n * Returns the string \"PointParticleEmitter\"\r\n * @returns a string containing the class name\r\n */\r\n public getClassName(): string {\r\n return \"CustomParticleEmitter\";\r\n }\r\n\r\n /**\r\n * Serializes the particle system to a JSON object.\r\n * @returns the JSON object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.type = this.getClassName();\r\n serializationObject.particlePositionGenerator = this.particlePositionGenerator;\r\n serializationObject.particleDestinationGenerator = this.particleDestinationGenerator;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parse properties from a JSON object\r\n * @param serializationObject defines the JSON object\r\n */\r\n public parse(serializationObject: any): void {\r\n if (serializationObject.particlePositionGenerator) {\r\n this.particlePositionGenerator = serializationObject.particlePositionGenerator;\r\n }\r\n\r\n if (serializationObject.particleDestinationGenerator) {\r\n this.particleDestinationGenerator = serializationObject.particleDestinationGenerator;\r\n }\r\n }\r\n}\r\n"]}
@@ -280,6 +280,10 @@ export interface IParticleSystem {
280
280
  * An event triggered when the system is stopped
281
281
  */
282
282
  onStoppedObservable: Observable<IParticleSystem>;
283
+ /**
284
+ * An event triggered when the system is started
285
+ */
286
+ onStartedObservable: Observable<IParticleSystem>;
283
287
  /**
284
288
  * Clones the particle system.
285
289
  * @param name The name of the cloned object
@@ -1 +1 @@
1
- {"version":3,"file":"IParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/IParticleSystem.ts"],"names":[],"mappings":"","sourcesContent":["import type { Immutable, Nullable } from \"../types\";\r\nimport type { Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport type { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type {\r\n BoxParticleEmitter,\r\n IParticleEmitterType,\r\n PointParticleEmitter,\r\n HemisphericParticleEmitter,\r\n SphereParticleEmitter,\r\n SphereDirectedParticleEmitter,\r\n CylinderParticleEmitter,\r\n CylinderDirectedParticleEmitter,\r\n ConeParticleEmitter,\r\n ConeDirectedParticleEmitter,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"../Particles/EmitterTypes/index\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient } from \"../Misc/gradients\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Observable } from \"../Misc/observable\";\r\nimport type { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Interface representing a particle system in Babylon.js.\r\n * This groups the common functionalities that needs to be implemented in order to create a particle system.\r\n * A particle system represents a way to manage particles from their emission to their animation and rendering.\r\n */\r\nexport interface IParticleSystem {\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n animations: Animation[];\r\n /**\r\n * The id of the Particle system.\r\n */\r\n id: string;\r\n /**\r\n * The name of the Particle system.\r\n */\r\n name: string;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n emitter: Nullable<AbstractMesh | Vector3>;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n isBillboardBased: boolean;\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n renderingGroupId: number;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n updateSpeed: number;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n targetStopDuration: number;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Blend mode use to render the particle. It can be any of the ParticleSystem.BLENDMODE_* constants\r\n */\r\n blendMode: number;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n minLifeTime: number;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n maxLifeTime: number;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n minSize: number;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n maxSize: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n minScaleX: number;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n maxScaleX: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n minScaleY: number;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n maxScaleY: number;\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color1: Color4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color2: Color4;\r\n\r\n /**\r\n * Color the particle will have at the end of its lifetime.\r\n */\r\n colorDead: Color4;\r\n\r\n /**\r\n * The maximum number of particles to emit per frame until we reach the activeParticleCount value\r\n */\r\n emitRate: number;\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n minEmitPower: number;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n maxEmitPower: number;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n minAngularSpeed: number;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n maxAngularSpeed: number;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n minInitialRotation: number;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n maxInitialRotation: number;\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n particleEmitterType: Nullable<IParticleEmitterType>;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n startDelay: number;\r\n /**\r\n * Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0\r\n */\r\n preWarmCycles: number;\r\n /**\r\n * Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)\r\n */\r\n preWarmStepOffset: number;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n spriteCellChangeSpeed: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n startSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n endSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines whether the sprite animation is looping\r\n */\r\n spriteCellLoop: boolean;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n spriteCellWidth: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n spriteCellHeight: number;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n spriteRandomStartCell: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture\r\n */\r\n isAnimationSheetEnabled: boolean;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n translationPivot: Vector2;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n noiseTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n noiseStrength: Vector3;\r\n\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n billboardMode: number;\r\n\r\n /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n useLogarithmicDepth: boolean;\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n limitVelocityDamping: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n beginAnimationOnStart: boolean;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n beginAnimationFrom: number;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n beginAnimationTo: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n beginAnimationLoop: boolean;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n disposeOnStop: boolean;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n manualEmitCount: number;\r\n\r\n /**\r\n * Specifies if the particles are updated in emitter local space or world space\r\n */\r\n isLocal: boolean;\r\n\r\n /** Snippet ID if the particle system was created from the snippet server */\r\n snippetId: string;\r\n\r\n /** Gets or sets a matrix to use to compute projection */\r\n defaultProjectionMatrix: Matrix;\r\n\r\n /** Indicates that the update of particles is done in the animate function (and not in render) */\r\n updateInAnimate: boolean;\r\n\r\n /** @internal */\r\n _wasDispatched: boolean;\r\n\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n getCapacity(): number;\r\n\r\n /**\r\n * Gets the number of particles active at the same time.\r\n * @returns The number of active particles.\r\n */\r\n getActiveCount(): number;\r\n\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n isStarted(): boolean;\r\n\r\n /**\r\n * Animates the particle system for this frame.\r\n */\r\n animate(): void;\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n render(): number;\r\n /**\r\n * Dispose the particle system and frees its associated resources.\r\n * @param disposeTexture defines if the particle texture must be disposed as well (true by default)\r\n * @param disposeAttachedSubEmitters defines if the attached sub-emitters must be disposed as well (false by default)\r\n * @param disposeEndSubEmitters defines if the end type sub-emitters must be disposed as well (false by default)\r\n */\r\n dispose(disposeTexture?: boolean, disposeAttachedSubEmitters?: boolean, disposeEndSubEmitters?: boolean): void;\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n onDisposeObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is stopped\r\n */\r\n onStoppedObservable: Observable<IParticleSystem>;\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n clone(name: string, newEmitter: any): Nullable<IParticleSystem>;\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n serialize(serializeTexture: boolean): any;\r\n /**\r\n * Rebuild the particle system\r\n */\r\n rebuild(): void;\r\n\r\n /** Force the system to rebuild all gradients that need to be resync */\r\n forceRefreshGradients(): void;\r\n\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n start(delay?: number): void;\r\n\r\n /**\r\n * Stops the particle system.\r\n */\r\n stop(): void;\r\n\r\n /**\r\n * Remove all active particles\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Gets a boolean indicating that the system is stopping\r\n * @returns true if the system is currently stopping\r\n */\r\n isStopping(): boolean;\r\n\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @returns true if the system is ready\r\n */\r\n isReady(): boolean;\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n getClassName(): string;\r\n /**\r\n * Gets the custom effect used to render the particles\r\n * @param blendMode Blend mode for which the effect should be retrieved\r\n * @returns The effect\r\n */\r\n getCustomEffect(blendMode: number): Nullable<Effect>;\r\n /**\r\n * Sets the custom effect used to render the particles\r\n * @param effect The effect to set\r\n * @param blendMode Blend mode for which the effect should be set\r\n */\r\n setCustomEffect(effect: Nullable<Effect>, blendMode: number): void;\r\n\r\n /**\r\n * Fill the defines array according to the current settings of the particle system\r\n * @param defines Array to be updated\r\n * @param blendMode blend mode to take into account when updating the array\r\n * @param fillImageProcessing fills the image processing defines\r\n */\r\n fillDefines(defines: Array<string>, blendMode: number, fillImageProcessing?: boolean): void;\r\n /**\r\n * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system\r\n * @param uniforms Uniforms array to fill\r\n * @param attributes Attributes array to fill\r\n * @param samplers Samplers array to fill\r\n */\r\n fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;\r\n /**\r\n * Observable that will be called just before the particles are drawn\r\n */\r\n onBeforeDrawParticlesObservable: Observable<Nullable<Effect>>;\r\n /**\r\n * Gets the name of the particle vertex shader\r\n */\r\n vertexShaderName: string;\r\n\r\n /**\r\n * Gets the vertex buffers used by the particle system\r\n */\r\n vertexBuffers: Immutable<{ [key: string]: VertexBuffer }>;\r\n /**\r\n * Gets the index buffer used by the particle system (or null if no index buffer is used)\r\n */\r\n indexBuffer: Nullable<DataBuffer>;\r\n\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeColorGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n getSizeGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n getAngularSpeedGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeAngularSpeedGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n getVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n getLimitVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLimitVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeDragGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n getDragGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeEmitRateGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n getEmitRateGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeStartSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n getStartSizeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLifeTimeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n getLifeTimeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n addRampGradient(gradient: number, color: Color3): IParticleSystem;\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to update this list\r\n * @returns the list of ramp gradients\r\n */\r\n getRampGradients(): Nullable<Array<Color3Gradient>>;\r\n\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/ramps_and_blends\r\n */\r\n useRampGradients: boolean;\r\n\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n getColorRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n getAlphaRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createHemisphericEmitter(radius: number, radiusRange: number): HemisphericParticleEmitter;\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createSphereEmitter(radius: number, radiusRange: number): SphereParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n createDirectedSphereEmitter(radius: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n createCylinderEmitter(radius: number, height: number, radiusRange: number, directionRandomizer: number): CylinderParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n createDirectedCylinderEmitter(radius: number, height: number, radiusRange: number, direction1: Vector3, direction2: Vector3): CylinderDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n createConeEmitter(radius: number, angle: number): ConeParticleEmitter;\r\n\r\n createDirectedConeEmitter(radius: number, angle: number, direction1: Vector3, direction2: Vector3): ConeDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n getScene(): Nullable<Scene>;\r\n}\r\n"]}
1
+ {"version":3,"file":"IParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/IParticleSystem.ts"],"names":[],"mappings":"","sourcesContent":["import type { Immutable, Nullable } from \"../types\";\r\nimport type { Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport type { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type {\r\n BoxParticleEmitter,\r\n IParticleEmitterType,\r\n PointParticleEmitter,\r\n HemisphericParticleEmitter,\r\n SphereParticleEmitter,\r\n SphereDirectedParticleEmitter,\r\n CylinderParticleEmitter,\r\n CylinderDirectedParticleEmitter,\r\n ConeParticleEmitter,\r\n ConeDirectedParticleEmitter,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"../Particles/EmitterTypes/index\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient } from \"../Misc/gradients\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Observable } from \"../Misc/observable\";\r\nimport type { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Interface representing a particle system in Babylon.js.\r\n * This groups the common functionalities that needs to be implemented in order to create a particle system.\r\n * A particle system represents a way to manage particles from their emission to their animation and rendering.\r\n */\r\nexport interface IParticleSystem {\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n animations: Animation[];\r\n /**\r\n * The id of the Particle system.\r\n */\r\n id: string;\r\n /**\r\n * The name of the Particle system.\r\n */\r\n name: string;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n emitter: Nullable<AbstractMesh | Vector3>;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n isBillboardBased: boolean;\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n renderingGroupId: number;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n updateSpeed: number;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n targetStopDuration: number;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Blend mode use to render the particle. It can be any of the ParticleSystem.BLENDMODE_* constants\r\n */\r\n blendMode: number;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n minLifeTime: number;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n maxLifeTime: number;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n minSize: number;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n maxSize: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n minScaleX: number;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n maxScaleX: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n minScaleY: number;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n maxScaleY: number;\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color1: Color4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color2: Color4;\r\n\r\n /**\r\n * Color the particle will have at the end of its lifetime.\r\n */\r\n colorDead: Color4;\r\n\r\n /**\r\n * The maximum number of particles to emit per frame until we reach the activeParticleCount value\r\n */\r\n emitRate: number;\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n minEmitPower: number;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n maxEmitPower: number;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n minAngularSpeed: number;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n maxAngularSpeed: number;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n minInitialRotation: number;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n maxInitialRotation: number;\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n particleEmitterType: Nullable<IParticleEmitterType>;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n startDelay: number;\r\n /**\r\n * Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0\r\n */\r\n preWarmCycles: number;\r\n /**\r\n * Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)\r\n */\r\n preWarmStepOffset: number;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n spriteCellChangeSpeed: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n startSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n endSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines whether the sprite animation is looping\r\n */\r\n spriteCellLoop: boolean;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n spriteCellWidth: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n spriteCellHeight: number;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n spriteRandomStartCell: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture\r\n */\r\n isAnimationSheetEnabled: boolean;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n translationPivot: Vector2;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n noiseTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n noiseStrength: Vector3;\r\n\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n billboardMode: number;\r\n\r\n /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n useLogarithmicDepth: boolean;\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n limitVelocityDamping: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n beginAnimationOnStart: boolean;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n beginAnimationFrom: number;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n beginAnimationTo: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n beginAnimationLoop: boolean;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n disposeOnStop: boolean;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n manualEmitCount: number;\r\n\r\n /**\r\n * Specifies if the particles are updated in emitter local space or world space\r\n */\r\n isLocal: boolean;\r\n\r\n /** Snippet ID if the particle system was created from the snippet server */\r\n snippetId: string;\r\n\r\n /** Gets or sets a matrix to use to compute projection */\r\n defaultProjectionMatrix: Matrix;\r\n\r\n /** Indicates that the update of particles is done in the animate function (and not in render) */\r\n updateInAnimate: boolean;\r\n\r\n /** @internal */\r\n _wasDispatched: boolean;\r\n\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n getCapacity(): number;\r\n\r\n /**\r\n * Gets the number of particles active at the same time.\r\n * @returns The number of active particles.\r\n */\r\n getActiveCount(): number;\r\n\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n isStarted(): boolean;\r\n\r\n /**\r\n * Animates the particle system for this frame.\r\n */\r\n animate(): void;\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n render(): number;\r\n /**\r\n * Dispose the particle system and frees its associated resources.\r\n * @param disposeTexture defines if the particle texture must be disposed as well (true by default)\r\n * @param disposeAttachedSubEmitters defines if the attached sub-emitters must be disposed as well (false by default)\r\n * @param disposeEndSubEmitters defines if the end type sub-emitters must be disposed as well (false by default)\r\n */\r\n dispose(disposeTexture?: boolean, disposeAttachedSubEmitters?: boolean, disposeEndSubEmitters?: boolean): void;\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n onDisposeObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is stopped\r\n */\r\n onStoppedObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is started\r\n */\r\n onStartedObservable: Observable<IParticleSystem>;\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n clone(name: string, newEmitter: any): Nullable<IParticleSystem>;\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n serialize(serializeTexture: boolean): any;\r\n /**\r\n * Rebuild the particle system\r\n */\r\n rebuild(): void;\r\n\r\n /** Force the system to rebuild all gradients that need to be resync */\r\n forceRefreshGradients(): void;\r\n\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n start(delay?: number): void;\r\n\r\n /**\r\n * Stops the particle system.\r\n */\r\n stop(): void;\r\n\r\n /**\r\n * Remove all active particles\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Gets a boolean indicating that the system is stopping\r\n * @returns true if the system is currently stopping\r\n */\r\n isStopping(): boolean;\r\n\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @returns true if the system is ready\r\n */\r\n isReady(): boolean;\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n getClassName(): string;\r\n /**\r\n * Gets the custom effect used to render the particles\r\n * @param blendMode Blend mode for which the effect should be retrieved\r\n * @returns The effect\r\n */\r\n getCustomEffect(blendMode: number): Nullable<Effect>;\r\n /**\r\n * Sets the custom effect used to render the particles\r\n * @param effect The effect to set\r\n * @param blendMode Blend mode for which the effect should be set\r\n */\r\n setCustomEffect(effect: Nullable<Effect>, blendMode: number): void;\r\n\r\n /**\r\n * Fill the defines array according to the current settings of the particle system\r\n * @param defines Array to be updated\r\n * @param blendMode blend mode to take into account when updating the array\r\n * @param fillImageProcessing fills the image processing defines\r\n */\r\n fillDefines(defines: Array<string>, blendMode: number, fillImageProcessing?: boolean): void;\r\n /**\r\n * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system\r\n * @param uniforms Uniforms array to fill\r\n * @param attributes Attributes array to fill\r\n * @param samplers Samplers array to fill\r\n */\r\n fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;\r\n /**\r\n * Observable that will be called just before the particles are drawn\r\n */\r\n onBeforeDrawParticlesObservable: Observable<Nullable<Effect>>;\r\n /**\r\n * Gets the name of the particle vertex shader\r\n */\r\n vertexShaderName: string;\r\n\r\n /**\r\n * Gets the vertex buffers used by the particle system\r\n */\r\n vertexBuffers: Immutable<{ [key: string]: VertexBuffer }>;\r\n /**\r\n * Gets the index buffer used by the particle system (or null if no index buffer is used)\r\n */\r\n indexBuffer: Nullable<DataBuffer>;\r\n\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeColorGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n getSizeGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n getAngularSpeedGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeAngularSpeedGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n getVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n getLimitVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLimitVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeDragGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n getDragGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeEmitRateGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n getEmitRateGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeStartSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n getStartSizeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLifeTimeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n getLifeTimeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n addRampGradient(gradient: number, color: Color3): IParticleSystem;\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to update this list\r\n * @returns the list of ramp gradients\r\n */\r\n getRampGradients(): Nullable<Array<Color3Gradient>>;\r\n\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/ramps_and_blends\r\n */\r\n useRampGradients: boolean;\r\n\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n getColorRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n getAlphaRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createHemisphericEmitter(radius: number, radiusRange: number): HemisphericParticleEmitter;\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createSphereEmitter(radius: number, radiusRange: number): SphereParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n createDirectedSphereEmitter(radius: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n createCylinderEmitter(radius: number, height: number, radiusRange: number, directionRandomizer: number): CylinderParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n createDirectedCylinderEmitter(radius: number, height: number, radiusRange: number, direction1: Vector3, direction2: Vector3): CylinderDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n createConeEmitter(radius: number, angle: number): ConeParticleEmitter;\r\n\r\n createDirectedConeEmitter(radius: number, angle: number, direction1: Vector3, direction2: Vector3): ConeDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n getScene(): Nullable<Scene>;\r\n}\r\n"]}