@babylonjs/core 6.45.0 → 6.46.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 (235) hide show
  1. package/Animations/animation.js +1 -1
  2. package/Animations/animation.js.map +1 -1
  3. package/BakedVertexAnimation/bakedVertexAnimationManager.js +2 -1
  4. package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
  5. package/Bones/skeleton.js +2 -2
  6. package/Bones/skeleton.js.map +1 -1
  7. package/Cameras/camera.d.ts +3 -3
  8. package/Cameras/camera.js +2 -1
  9. package/Cameras/camera.js.map +1 -1
  10. package/Cameras/cameraInputsManager.js +1 -1
  11. package/Cameras/cameraInputsManager.js.map +1 -1
  12. package/Cameras/targetCamera.js +4 -0
  13. package/Cameras/targetCamera.js.map +1 -1
  14. package/Compute/computeShader.d.ts +4 -2
  15. package/Compute/computeShader.js +7 -3
  16. package/Compute/computeShader.js.map +1 -1
  17. package/Debug/directionalLightFrustumViewer.js +6 -6
  18. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  19. package/Engines/Extensions/engine.computeShader.d.ts +2 -1
  20. package/Engines/Extensions/engine.computeShader.js +1 -0
  21. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  22. package/Engines/Extensions/engine.rawTexture.js +3 -3
  23. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  24. package/Engines/Native/nativePipelineContext.js +1 -1
  25. package/Engines/Native/nativePipelineContext.js.map +1 -1
  26. package/Engines/WebGL/webGLPipelineContext.js +1 -1
  27. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  28. package/Engines/WebGPU/webgpuComputeContext.js +7 -3
  29. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  30. package/Engines/engine.d.ts +1 -1
  31. package/Engines/thinEngine.js +2 -2
  32. package/Engines/thinEngine.js.map +1 -1
  33. package/Engines/webgpuEngine.js +2 -15
  34. package/Engines/webgpuEngine.js.map +1 -1
  35. package/Layers/glowLayer.js +2 -1
  36. package/Layers/glowLayer.js.map +1 -1
  37. package/Layers/highlightLayer.js +2 -1
  38. package/Layers/highlightLayer.js.map +1 -1
  39. package/Lights/light.js +2 -1
  40. package/Lights/light.js.map +1 -1
  41. package/Loading/Plugins/babylonFileLoader.js +9 -0
  42. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  43. package/Loading/sceneLoader.d.ts +6 -1
  44. package/Loading/sceneLoader.js +6 -5
  45. package/Loading/sceneLoader.js.map +1 -1
  46. package/Materials/Background/backgroundMaterial.js +2 -1
  47. package/Materials/Background/backgroundMaterial.js.map +1 -1
  48. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +1 -1
  49. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  50. package/Materials/Node/nodeMaterial.d.ts +2 -1
  51. package/Materials/Node/nodeMaterial.js +5 -1
  52. package/Materials/Node/nodeMaterial.js.map +1 -1
  53. package/Materials/PBR/pbrBaseMaterial.d.ts +1 -1
  54. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  55. package/Materials/PBR/pbrMaterial.js +2 -1
  56. package/Materials/PBR/pbrMaterial.js.map +1 -1
  57. package/Materials/PBR/pbrMetallicRoughnessMaterial.js +2 -1
  58. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  59. package/Materials/PBR/pbrSpecularGlossinessMaterial.js +2 -1
  60. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  61. package/Materials/Textures/baseTexture.js +2 -1
  62. package/Materials/Textures/baseTexture.js.map +1 -1
  63. package/Materials/Textures/cubeTexture.js +2 -1
  64. package/Materials/Textures/cubeTexture.js.map +1 -1
  65. package/Materials/Textures/rawCubeTexture.js +1 -1
  66. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  67. package/Materials/Textures/texture.js +2 -1
  68. package/Materials/Textures/texture.js.map +1 -1
  69. package/Materials/colorCurves.d.ts +1 -1
  70. package/Materials/colorCurves.functions.d.ts +5 -0
  71. package/Materials/colorCurves.functions.js +8 -0
  72. package/Materials/colorCurves.functions.js.map +1 -0
  73. package/Materials/colorCurves.js +8 -8
  74. package/Materials/colorCurves.js.map +1 -1
  75. package/Materials/fresnelParameters.js +1 -1
  76. package/Materials/fresnelParameters.js.map +1 -1
  77. package/Materials/imageProcessingConfiguration.d.ts +3 -48
  78. package/Materials/imageProcessingConfiguration.defines.d.ts +46 -0
  79. package/Materials/imageProcessingConfiguration.defines.js +27 -0
  80. package/Materials/imageProcessingConfiguration.defines.js.map +1 -0
  81. package/Materials/imageProcessingConfiguration.functions.d.ts +13 -0
  82. package/Materials/imageProcessingConfiguration.functions.js +41 -0
  83. package/Materials/imageProcessingConfiguration.functions.js.map +1 -0
  84. package/Materials/imageProcessingConfiguration.js +18 -69
  85. package/Materials/imageProcessingConfiguration.js.map +1 -1
  86. package/Materials/material.js +2 -1
  87. package/Materials/material.js.map +1 -1
  88. package/Materials/materialHelper.d.ts +33 -33
  89. package/Materials/materialHelper.js +244 -286
  90. package/Materials/materialHelper.js.map +1 -1
  91. package/Materials/materialPluginBase.js +2 -1
  92. package/Materials/materialPluginBase.js.map +1 -1
  93. package/Materials/materialStencilState.js +2 -1
  94. package/Materials/materialStencilState.js.map +1 -1
  95. package/Materials/shaderMaterial.js +1 -1
  96. package/Materials/shaderMaterial.js.map +1 -1
  97. package/Materials/standardMaterial.d.ts +1 -1
  98. package/Materials/standardMaterial.js +2 -1
  99. package/Materials/standardMaterial.js.map +1 -1
  100. package/Materials/uniformBuffer.js +2 -2
  101. package/Materials/uniformBuffer.js.map +1 -1
  102. package/Maths/math.color.d.ts +392 -66
  103. package/Maths/math.color.js +541 -65
  104. package/Maths/math.color.js.map +1 -1
  105. package/Maths/math.like.d.ts +17 -28
  106. package/Maths/math.like.js.map +1 -1
  107. package/Maths/math.plane.d.ts +2 -1
  108. package/Maths/math.plane.js.map +1 -1
  109. package/Maths/math.polar.d.ts +1 -1
  110. package/Maths/math.polar.js.map +1 -1
  111. package/Maths/math.scalar.d.ts +6 -6
  112. package/Maths/math.scalar.functions.d.ts +51 -0
  113. package/Maths/math.scalar.functions.js +80 -0
  114. package/Maths/math.scalar.functions.js.map +1 -0
  115. package/Maths/math.scalar.js +48 -73
  116. package/Maths/math.scalar.js.map +1 -1
  117. package/Maths/math.vector.d.ts +571 -72
  118. package/Maths/math.vector.js +917 -119
  119. package/Maths/math.vector.js.map +1 -1
  120. package/Maths/math.viewport.d.ts +2 -1
  121. package/Maths/math.viewport.js.map +1 -1
  122. package/Maths/tensor.d.ts +411 -0
  123. package/Maths/tensor.js +3 -0
  124. package/Maths/tensor.js.map +1 -0
  125. package/Meshes/Node/Blocks/Set/setColorsBlock.js +20 -4
  126. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  127. package/Meshes/Node/nodeGeometry.js +2 -1
  128. package/Meshes/Node/nodeGeometry.js.map +1 -1
  129. package/Meshes/mesh.js +2 -2
  130. package/Meshes/mesh.js.map +1 -1
  131. package/Meshes/mesh.vertexData.d.ts +4 -0
  132. package/Meshes/mesh.vertexData.js +10 -0
  133. package/Meshes/mesh.vertexData.js.map +1 -1
  134. package/Meshes/transformNode.js +2 -1
  135. package/Meshes/transformNode.js.map +1 -1
  136. package/Misc/arrayTools.d.ts +2 -19
  137. package/Misc/arrayTools.js.map +1 -1
  138. package/Misc/decorators.d.ts +0 -80
  139. package/Misc/decorators.functions.d.ts +7 -0
  140. package/Misc/decorators.functions.js +52 -0
  141. package/Misc/decorators.functions.js.map +1 -0
  142. package/Misc/decorators.js +2 -318
  143. package/Misc/decorators.js.map +1 -1
  144. package/Misc/decorators.serialization.d.ts +81 -0
  145. package/Misc/decorators.serialization.js +269 -0
  146. package/Misc/decorators.serialization.js.map +1 -0
  147. package/Misc/index.d.ts +1 -0
  148. package/Misc/index.js +1 -0
  149. package/Misc/index.js.map +1 -1
  150. package/Misc/sceneRecorder.js +1 -1
  151. package/Misc/sceneRecorder.js.map +1 -1
  152. package/Misc/sceneSerializer.js +8 -1
  153. package/Misc/sceneSerializer.js.map +1 -1
  154. package/Misc/tools.functions.d.ts +14 -0
  155. package/Misc/tools.functions.js +23 -0
  156. package/Misc/tools.functions.js.map +1 -0
  157. package/Misc/tools.js +5 -6
  158. package/Misc/tools.js.map +1 -1
  159. package/Morph/morphTarget.js +2 -1
  160. package/Morph/morphTarget.js.map +1 -1
  161. package/Particles/EmitterTypes/boxParticleEmitter.js +8 -8
  162. package/Particles/EmitterTypes/boxParticleEmitter.js.map +1 -1
  163. package/Particles/baseParticleSystem.d.ts +8 -11
  164. package/Particles/baseParticleSystem.js +9 -40
  165. package/Particles/baseParticleSystem.js.map +1 -1
  166. package/Particles/gpuParticleSystem.d.ts +71 -1
  167. package/Particles/gpuParticleSystem.js +102 -1
  168. package/Particles/gpuParticleSystem.js.map +1 -1
  169. package/Particles/particle.d.ts +3 -3
  170. package/Particles/particle.js +3 -3
  171. package/Particles/particle.js.map +1 -1
  172. package/Particles/particleSystem.d.ts +81 -455
  173. package/Particles/particleSystem.functions.d.ts +61 -0
  174. package/Particles/particleSystem.functions.js +79 -0
  175. package/Particles/particleSystem.functions.js.map +1 -0
  176. package/Particles/particleSystem.js +390 -1984
  177. package/Particles/particleSystem.js.map +1 -1
  178. package/Particles/thinParticleSystem.d.ts +485 -0
  179. package/Particles/thinParticleSystem.js +1768 -0
  180. package/Particles/thinParticleSystem.js.map +1 -0
  181. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -1
  182. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  183. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +2 -1
  184. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  185. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +2 -1
  186. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  187. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +2 -1
  188. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  189. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +2 -1
  190. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  191. package/PostProcesses/blackAndWhitePostProcess.js +2 -1
  192. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  193. package/PostProcesses/blurPostProcess.js +2 -1
  194. package/PostProcesses/blurPostProcess.js.map +1 -1
  195. package/PostProcesses/chromaticAberrationPostProcess.js +2 -1
  196. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  197. package/PostProcesses/colorCorrectionPostProcess.js +2 -1
  198. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  199. package/PostProcesses/convolutionPostProcess.js +2 -1
  200. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  201. package/PostProcesses/displayPassPostProcess.js +1 -1
  202. package/PostProcesses/displayPassPostProcess.js.map +1 -1
  203. package/PostProcesses/filterPostProcess.js +2 -1
  204. package/PostProcesses/filterPostProcess.js.map +1 -1
  205. package/PostProcesses/fxaaPostProcess.js +1 -1
  206. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  207. package/PostProcesses/grainPostProcess.js +2 -1
  208. package/PostProcesses/grainPostProcess.js.map +1 -1
  209. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  210. package/PostProcesses/motionBlurPostProcess.js +2 -1
  211. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  212. package/PostProcesses/passPostProcess.js +1 -1
  213. package/PostProcesses/passPostProcess.js.map +1 -1
  214. package/PostProcesses/postProcess.js +2 -1
  215. package/PostProcesses/postProcess.js.map +1 -1
  216. package/PostProcesses/refractionPostProcess.js +2 -1
  217. package/PostProcesses/refractionPostProcess.js.map +1 -1
  218. package/PostProcesses/screenSpaceCurvaturePostProcess.js +2 -1
  219. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  220. package/PostProcesses/screenSpaceReflectionPostProcess.js +2 -1
  221. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  222. package/PostProcesses/sharpenPostProcess.js +2 -1
  223. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  224. package/Probes/reflectionProbe.js +2 -1
  225. package/Probes/reflectionProbe.js.map +1 -1
  226. package/Sprites/spriteManager.d.ts +4 -0
  227. package/Sprites/spriteManager.js.map +1 -1
  228. package/XR/features/WebXRControllerTeleportation.d.ts +9 -0
  229. package/XR/features/WebXRControllerTeleportation.js +75 -31
  230. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  231. package/node.js +2 -1
  232. package/node.js.map +1 -1
  233. package/package.json +1 -1
  234. package/types.d.ts +105 -0
  235. package/types.js.map +1 -1
@@ -1,29 +1,23 @@
1
- import type { Immutable, Nullable } from "../types";
2
- import { FactorGradient, Color3Gradient } from "../Misc/gradients";
3
- import { Observable } from "../Misc/observable";
4
- import { Vector3, Matrix } from "../Maths/math.vector";
5
- import { VertexBuffer } from "../Buffers/buffer";
6
- import type { Effect } from "../Materials/effect";
7
- import type { IDisposable } from "../scene";
8
- import { Scene } from "../scene";
9
- import type { IParticleSystem } from "./IParticleSystem";
10
- import { BaseParticleSystem } from "./baseParticleSystem";
11
- import { Particle } from "./particle";
1
+ import { ThinParticleSystem } from "./thinParticleSystem";
12
2
  import { SubEmitter } from "./subEmitter";
13
- import type { IAnimatable } from "../Animations/animatable.interface";
14
- import "../Shaders/particles.fragment";
15
- import "../Shaders/particles.vertex";
16
- import type { DataBuffer } from "../Buffers/dataBuffer";
17
- import { Color4, Color3 } from "../Maths/math.color";
3
+ import { Vector3 } from "../Maths/math.vector";
4
+ import type { IParticleSystem } from "./IParticleSystem";
5
+ import type { Scene } from "../scene";
18
6
  import { ThinEngine } from "../Engines/thinEngine";
19
- import "../Engines/Extensions/engine.alpha";
7
+ import type { Particle } from "./particle";
8
+ import { BoxParticleEmitter } from "./EmitterTypes/boxParticleEmitter";
9
+ import { PointParticleEmitter } from "./EmitterTypes/pointParticleEmitter";
10
+ import { HemisphericParticleEmitter } from "./EmitterTypes/hemisphericParticleEmitter";
11
+ import { SphereDirectedParticleEmitter, SphereParticleEmitter } from "./EmitterTypes/sphereParticleEmitter";
12
+ import { CylinderDirectedParticleEmitter, CylinderParticleEmitter } from "./EmitterTypes/cylinderParticleEmitter";
13
+ import { ConeParticleEmitter } from "./EmitterTypes/coneParticleEmitter";
20
14
  /**
21
15
  * This represents a particle system in Babylon.
22
16
  * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.
23
17
  * Particles can take different shapes while emitted like box, sphere, cone or you can write your custom function.
24
18
  * @example https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro
25
19
  */
26
- export declare class ParticleSystem extends BaseParticleSystem implements IDisposable, IAnimatable, IParticleSystem {
20
+ export declare class ParticleSystem extends ThinParticleSystem {
27
21
  /**
28
22
  * Billboard mode will only apply to Y axis
29
23
  */
@@ -40,94 +34,7 @@ export declare class ParticleSystem extends BaseParticleSystem implements IDispo
40
34
  * Special billboard mode where the particle will be billboard to the camera but only around the axis of the direction of particle emission
41
35
  */
42
36
  static readonly BILLBOARDMODE_STRETCHED_LOCAL = 9;
43
- /**
44
- * This function can be defined to provide custom update for active particles.
45
- * This function will be called instead of regular update (age, position, color, etc.).
46
- * Do not forget that this function will be called on every frame so try to keep it simple and fast :)
47
- */
48
- updateFunction: (particles: Particle[]) => void;
49
- private _emitterWorldMatrix;
50
- private _emitterInverseWorldMatrix;
51
- /**
52
- * This function can be defined to specify initial direction for every new particle.
53
- * It by default use the emitterType defined function
54
- */
55
- startDirectionFunction: (worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean) => void;
56
- /**
57
- * This function can be defined to specify initial position for every new particle.
58
- * It by default use the emitterType defined function
59
- */
60
- startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean) => void;
61
- /**
62
- * @internal
63
- */
64
- _inheritedVelocityOffset: Vector3;
65
- /**
66
- * An event triggered when the system is disposed
67
- */
68
- onDisposeObservable: Observable<IParticleSystem>;
69
- /**
70
- * An event triggered when the system is stopped
71
- */
72
- onStoppedObservable: Observable<IParticleSystem>;
73
- private _onDisposeObserver;
74
- /**
75
- * Sets a callback that will be triggered when the system is disposed
76
- */
77
- set onDispose(callback: () => void);
78
- private _particles;
79
- private _epsilon;
80
- private _capacity;
81
- private _stockParticles;
82
- private _newPartsExcess;
83
- private _vertexData;
84
- private _vertexBuffer;
85
- private _vertexBuffers;
86
- private _spriteBuffer;
87
- private _indexBuffer;
88
- private _linesIndexBuffer;
89
- private _linesIndexBufferUseInstancing;
90
- private _drawWrappers;
91
- private _customWrappers;
92
- private _scaledColorStep;
93
- private _colorDiff;
94
- private _scaledDirection;
95
- private _scaledGravity;
96
- private _currentRenderId;
97
- private _alive;
98
- private _useInstancing;
99
- private _vertexArrayObject;
100
- private _started;
101
- private _stopped;
102
- private _actualFrame;
103
- private _scaledUpdateSpeed;
104
- private _vertexBufferSize;
105
- /** @internal */
106
- _currentEmitRateGradient: Nullable<FactorGradient>;
107
- /** @internal */
108
- _currentEmitRate1: number;
109
- /** @internal */
110
- _currentEmitRate2: number;
111
- /** @internal */
112
- _currentStartSizeGradient: Nullable<FactorGradient>;
113
- /** @internal */
114
- _currentStartSize1: number;
115
- /** @internal */
116
- _currentStartSize2: number;
117
- /** Indicates that the update of particles is done in the animate function */
118
- readonly updateInAnimate = true;
119
- private readonly _rawTextureWidth;
120
- private _rampGradientsTexture;
121
- private _useRampGradients;
122
- /** Gets or sets a matrix to use to compute projection */
123
- defaultProjectionMatrix: Matrix;
124
- /** Gets or sets a matrix to use to compute view */
125
- defaultViewMatrix: Matrix;
126
- /** Gets or sets a boolean indicating that ramp gradients must be used
127
- * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro#ramp-gradients
128
- */
129
- get useRampGradients(): boolean;
130
- set useRampGradients(value: boolean);
37
+ private _rootParticleSystem;
131
38
  /**
132
39
  * The Sub-emitters templates that will be used to generate the sub particle system to be associated with the system, this property is used by the root particle system only.
133
40
  * When a particle is spawned, an array will be chosen at random and all the emitters in that array will be attached to the particle. (Default: [])
@@ -144,359 +51,102 @@ export declare class ParticleSystem extends BaseParticleSystem implements IDispo
144
51
  */
145
52
  activeSubSystems: Array<ParticleSystem>;
146
53
  /**
147
- * Specifies if the particles are updated in emitter local space or world space
148
- */
149
- isLocal: boolean;
150
- /** Indicates that the particle system is CPU based */
151
- readonly isGPU = false;
152
- private _rootParticleSystem;
153
- /**
154
- * Gets the current list of active particles
155
- */
156
- get particles(): Particle[];
157
- /**
158
- * Gets the number of particles active at the same time.
159
- * @returns The number of active particles.
160
- */
161
- getActiveCount(): number;
162
- /**
163
- * Returns the string "ParticleSystem"
164
- * @returns a string containing the class name
165
- */
166
- getClassName(): string;
167
- /**
168
- * Gets a boolean indicating that the system is stopping
169
- * @returns true if the system is currently stopping
170
- */
171
- isStopping(): boolean;
172
- /**
173
- * Gets the custom effect used to render the particles
174
- * @param blendMode Blend mode for which the effect should be retrieved
175
- * @returns The effect
176
- */
177
- getCustomEffect(blendMode?: number): Nullable<Effect>;
178
- private _getCustomDrawWrapper;
179
- /**
180
- * Sets the custom effect used to render the particles
181
- * @param effect The effect to set
182
- * @param blendMode Blend mode for which the effect should be set
183
- */
184
- setCustomEffect(effect: Nullable<Effect>, blendMode?: number): void;
185
- /** @internal */
186
- private _onBeforeDrawParticlesObservable;
187
- /**
188
- * Observable that will be called just before the particles are drawn
189
- */
190
- get onBeforeDrawParticlesObservable(): Observable<Nullable<Effect>>;
191
- /**
192
- * Gets the name of the particle vertex shader
193
- */
194
- get vertexShaderName(): string;
195
- /**
196
- * Gets the vertex buffers used by the particle system
197
- */
198
- get vertexBuffers(): Immutable<{
199
- [key: string]: VertexBuffer;
200
- }>;
201
- /**
202
- * Gets the index buffer used by the particle system (or null if no index buffer is used (if _useInstancing=true))
203
- */
204
- get indexBuffer(): Nullable<DataBuffer>;
205
- /**
206
- * Instantiates a particle system.
207
- * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.
208
- * @param name The name of the particle system
209
- * @param capacity The max number of particles alive at the same time
210
- * @param sceneOrEngine The scene the particle system belongs to or the engine to use if no scene
211
- * @param customEffect a custom effect used to change the way particles are rendered by default
212
- * @param isAnimationSheetEnabled Must be true if using a spritesheet to animate the particles texture
213
- * @param epsilon Offset used to render the particles
214
- */
215
- constructor(name: string, capacity: number, sceneOrEngine: Scene | ThinEngine, customEffect?: Nullable<Effect>, isAnimationSheetEnabled?: boolean, epsilon?: number);
216
- private _addFactorGradient;
217
- private _removeFactorGradient;
218
- /**
219
- * Adds a new life time gradient
220
- * @param gradient defines the gradient to use (between 0 and 1)
221
- * @param factor defines the life time factor to affect to the specified gradient
222
- * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
223
- * @returns the current particle system
224
- */
225
- addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;
226
- /**
227
- * Remove a specific life time gradient
228
- * @param gradient defines the gradient to remove
229
- * @returns the current particle system
230
- */
231
- removeLifeTimeGradient(gradient: number): IParticleSystem;
232
- /**
233
- * Adds a new size gradient
234
- * @param gradient defines the gradient to use (between 0 and 1)
235
- * @param factor defines the size factor to affect to the specified gradient
236
- * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
237
- * @returns the current particle system
238
- */
239
- addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;
240
- /**
241
- * Remove a specific size gradient
242
- * @param gradient defines the gradient to remove
243
- * @returns the current particle system
244
- */
245
- removeSizeGradient(gradient: number): IParticleSystem;
246
- /**
247
- * Adds a new color remap gradient
248
- * @param gradient defines the gradient to use (between 0 and 1)
249
- * @param min defines the color remap minimal range
250
- * @param max defines the color remap maximal range
251
- * @returns the current particle system
54
+ * Creates a Point Emitter for the particle system (emits directly from the emitter position)
55
+ * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
56
+ * @param direction2 Particles are emitted between the direction1 and direction2 from within the box
57
+ * @returns the emitter
252
58
  */
253
- addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;
59
+ createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;
254
60
  /**
255
- * Remove a specific color remap gradient
256
- * @param gradient defines the gradient to remove
257
- * @returns the current particle system
61
+ * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)
62
+ * @param radius The radius of the hemisphere to emit from
63
+ * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
64
+ * @returns the emitter
258
65
  */
259
- removeColorRemapGradient(gradient: number): IParticleSystem;
66
+ createHemisphericEmitter(radius?: number, radiusRange?: number): HemisphericParticleEmitter;
260
67
  /**
261
- * Adds a new alpha remap gradient
262
- * @param gradient defines the gradient to use (between 0 and 1)
263
- * @param min defines the alpha remap minimal range
264
- * @param max defines the alpha remap maximal range
265
- * @returns the current particle system
68
+ * Creates a Sphere Emitter for the particle system (emits along the sphere radius)
69
+ * @param radius The radius of the sphere to emit from
70
+ * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
71
+ * @returns the emitter
266
72
  */
267
- addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;
73
+ createSphereEmitter(radius?: number, radiusRange?: number): SphereParticleEmitter;
268
74
  /**
269
- * Remove a specific alpha remap gradient
270
- * @param gradient defines the gradient to remove
271
- * @returns the current particle system
75
+ * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)
76
+ * @param radius The radius of the sphere to emit from
77
+ * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
78
+ * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
79
+ * @returns the emitter
272
80
  */
273
- removeAlphaRemapGradient(gradient: number): IParticleSystem;
81
+ createDirectedSphereEmitter(radius?: number, direction1?: Vector3, direction2?: Vector3): SphereDirectedParticleEmitter;
274
82
  /**
275
- * Adds a new angular speed gradient
276
- * @param gradient defines the gradient to use (between 0 and 1)
277
- * @param factor defines the angular speed to affect to the specified gradient
278
- * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
279
- * @returns the current particle system
83
+ * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)
84
+ * @param radius The radius of the emission cylinder
85
+ * @param height The height of the emission cylinder
86
+ * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius
87
+ * @param directionRandomizer How much to randomize the particle direction [0-1]
88
+ * @returns the emitter
280
89
  */
281
- addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;
90
+ createCylinderEmitter(radius?: number, height?: number, radiusRange?: number, directionRandomizer?: number): CylinderParticleEmitter;
282
91
  /**
283
- * Remove a specific angular speed gradient
284
- * @param gradient defines the gradient to remove
285
- * @returns the current particle system
92
+ * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)
93
+ * @param radius The radius of the cylinder to emit from
94
+ * @param height The height of the emission cylinder
95
+ * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)
96
+ * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder
97
+ * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder
98
+ * @returns the emitter
286
99
  */
287
- removeAngularSpeedGradient(gradient: number): IParticleSystem;
100
+ createDirectedCylinderEmitter(radius?: number, height?: number, radiusRange?: number, direction1?: Vector3, direction2?: Vector3): CylinderDirectedParticleEmitter;
288
101
  /**
289
- * Adds a new velocity gradient
290
- * @param gradient defines the gradient to use (between 0 and 1)
291
- * @param factor defines the velocity to affect to the specified gradient
292
- * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
293
- * @returns the current particle system
102
+ * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)
103
+ * @param radius The radius of the cone to emit from
104
+ * @param angle The base angle of the cone
105
+ * @returns the emitter
294
106
  */
295
- addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;
107
+ createConeEmitter(radius?: number, angle?: number): ConeParticleEmitter;
296
108
  /**
297
- * Remove a specific velocity gradient
298
- * @param gradient defines the gradient to remove
299
- * @returns the current particle system
109
+ * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)
110
+ * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
111
+ * @param direction2 Particles are emitted between the direction1 and direction2 from within the box
112
+ * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox
113
+ * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox
114
+ * @returns the emitter
300
115
  */
301
- removeVelocityGradient(gradient: number): IParticleSystem;
302
- /**
303
- * Adds a new limit velocity gradient
304
- * @param gradient defines the gradient to use (between 0 and 1)
305
- * @param factor defines the limit velocity value to affect to the specified gradient
306
- * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
307
- * @returns the current particle system
308
- */
309
- addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;
310
- /**
311
- * Remove a specific limit velocity gradient
312
- * @param gradient defines the gradient to remove
313
- * @returns the current particle system
314
- */
315
- removeLimitVelocityGradient(gradient: number): IParticleSystem;
316
- /**
317
- * Adds a new drag gradient
318
- * @param gradient defines the gradient to use (between 0 and 1)
319
- * @param factor defines the drag value to affect to the specified gradient
320
- * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
321
- * @returns the current particle system
322
- */
323
- addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;
324
- /**
325
- * Remove a specific drag gradient
326
- * @param gradient defines the gradient to remove
327
- * @returns the current particle system
328
- */
329
- removeDragGradient(gradient: number): IParticleSystem;
330
- /**
331
- * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)
332
- * @param gradient defines the gradient to use (between 0 and 1)
333
- * @param factor defines the emit rate value to affect to the specified gradient
334
- * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
335
- * @returns the current particle system
336
- */
337
- addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;
338
- /**
339
- * Remove a specific emit rate gradient
340
- * @param gradient defines the gradient to remove
341
- * @returns the current particle system
342
- */
343
- removeEmitRateGradient(gradient: number): IParticleSystem;
344
- /**
345
- * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)
346
- * @param gradient defines the gradient to use (between 0 and 1)
347
- * @param factor defines the start size value to affect to the specified gradient
348
- * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from
349
- * @returns the current particle system
350
- */
351
- addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;
352
- /**
353
- * Remove a specific start size gradient
354
- * @param gradient defines the gradient to remove
355
- * @returns the current particle system
356
- */
357
- removeStartSizeGradient(gradient: number): IParticleSystem;
358
- private _createRampGradientTexture;
359
- /**
360
- * Gets the current list of ramp gradients.
361
- * You must use addRampGradient and removeRampGradient to update this list
362
- * @returns the list of ramp gradients
363
- */
364
- getRampGradients(): Nullable<Array<Color3Gradient>>;
365
- /** Force the system to rebuild all gradients that need to be resync */
366
- forceRefreshGradients(): void;
367
- private _syncRampGradientTexture;
368
- /**
369
- * Adds a new ramp gradient used to remap particle colors
370
- * @param gradient defines the gradient to use (between 0 and 1)
371
- * @param color defines the color to affect to the specified gradient
372
- * @returns the current particle system
373
- */
374
- addRampGradient(gradient: number, color: Color3): ParticleSystem;
375
- /**
376
- * Remove a specific ramp gradient
377
- * @param gradient defines the gradient to remove
378
- * @returns the current particle system
379
- */
380
- removeRampGradient(gradient: number): ParticleSystem;
381
- /**
382
- * Adds a new color gradient
383
- * @param gradient defines the gradient to use (between 0 and 1)
384
- * @param color1 defines the color to affect to the specified gradient
385
- * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from
386
- * @returns this particle system
387
- */
388
- addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;
389
- /**
390
- * Remove a specific color gradient
391
- * @param gradient defines the gradient to remove
392
- * @returns this particle system
393
- */
394
- removeColorGradient(gradient: number): IParticleSystem;
395
- /**
396
- * Resets the draw wrappers cache
397
- */
398
- resetDrawCache(): void;
399
- private _fetchR;
400
- protected _reset(): void;
401
- private _resetEffect;
402
- private _createVertexBuffers;
403
- private _createIndexBuffer;
404
- /**
405
- * Gets the maximum number of particles active at the same time.
406
- * @returns The max number of active particles.
407
- */
408
- getCapacity(): number;
409
- /**
410
- * Gets whether there are still active particles in the system.
411
- * @returns True if it is alive, otherwise false.
412
- */
413
- isAlive(): boolean;
414
- /**
415
- * Gets if the system has been started. (Note: this will still be true after stop is called)
416
- * @returns True if it has been started, otherwise false.
417
- */
418
- isStarted(): boolean;
116
+ createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;
419
117
  private _prepareSubEmitterInternalArray;
420
- /**
421
- * Starts the particle system and begins to emit
422
- * @param delay defines the delay in milliseconds before starting the system (this.startDelay by default)
423
- */
424
- start(delay?: number): void;
425
- /**
426
- * Stops the particle system.
427
- * @param stopSubEmitters if true it will stop the current system and all created sub-Systems if false it will stop the current root system only, this param is used by the root particle system only. the default value is true.
428
- */
429
- stop(stopSubEmitters?: boolean): void;
430
- /**
431
- * Remove all active particles
432
- */
433
- reset(): void;
434
- /**
435
- * @internal (for internal use only)
436
- */
437
- _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
438
- /**
439
- * "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
440
- * Its lifetime will start back at 0.
441
- * @param particle
442
- */
443
- recycleParticle: (particle: Particle) => void;
444
118
  private _stopSubEmitters;
445
- private _createParticle;
446
119
  private _removeFromRoot;
447
- private _emitFromParticle;
448
- private _update;
449
- /**
450
- * @internal
451
- */
452
- static _GetAttributeNamesOrOptions(isAnimationSheetEnabled?: boolean, isBillboardBased?: boolean, useRampGradients?: boolean): string[];
120
+ _emitFromParticle: (particle: Particle) => void;
121
+ _preStart(): void;
122
+ _postStop(stopSubEmitters: boolean): void;
123
+ _prepareParticle(particle: Particle): void;
124
+ /** @internal */
125
+ _onDispose(): void;
453
126
  /**
454
127
  * @internal
455
128
  */
456
- static _GetEffectCreationOptions(isAnimationSheetEnabled?: boolean, useLogarithmicDepth?: boolean, applyFog?: boolean): string[];
129
+ static _Parse(parsedParticleSystem: any, particleSystem: IParticleSystem, sceneOrEngine: Scene | ThinEngine, rootUrl: string): void;
457
130
  /**
458
- * Fill the defines array according to the current settings of the particle system
459
- * @param defines Array to be updated
460
- * @param blendMode blend mode to take into account when updating the array
131
+ * Parses a JSON object to create a particle system.
132
+ * @param parsedParticleSystem The JSON object to parse
133
+ * @param sceneOrEngine The scene or the engine to create the particle system in
134
+ * @param rootUrl The root url to use to load external dependencies like texture
135
+ * @param doNotStart Ignore the preventAutoStart attribute and does not start
136
+ * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)
137
+ * @returns the Parsed particle system
461
138
  */
462
- fillDefines(defines: Array<string>, blendMode: number): void;
139
+ static Parse(parsedParticleSystem: any, sceneOrEngine: Scene | ThinEngine, rootUrl: string, doNotStart?: boolean, capacity?: number): ParticleSystem;
463
140
  /**
464
- * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system
465
- * @param uniforms Uniforms array to fill
466
- * @param attributes Attributes array to fill
467
- * @param samplers Samplers array to fill
141
+ * Serializes the particle system to a JSON object
142
+ * @param serializeTexture defines if the texture must be serialized as well
143
+ * @returns the JSON object
468
144
  */
469
- fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;
145
+ serialize(serializeTexture?: boolean): any;
470
146
  /**
471
147
  * @internal
472
148
  */
473
- private _getWrapper;
474
- /**
475
- * Animates the particle system for the current frame by emitting new particles and or animating the living ones.
476
- * @param preWarmOnly will prevent the system from updating the vertex buffer (default is false)
477
- */
478
- animate(preWarmOnly?: boolean): void;
479
- private _appendParticleVertices;
480
- /**
481
- * Rebuilds the particle system.
482
- */
483
- rebuild(): void;
484
- /**
485
- * Is this system ready to be used/rendered
486
- * @returns true if the system is ready
487
- */
488
- isReady(): boolean;
489
- private _render;
490
- /**
491
- * Renders the particle system in its current state.
492
- * @returns the current number of particles
493
- */
494
- render(): number;
495
- /**
496
- * Disposes the particle system and free the associated resources
497
- * @param disposeTexture defines if the particle texture must be disposed as well (true by default)
498
- */
499
- dispose(disposeTexture?: boolean): void;
149
+ static _Serialize(serializationObject: any, particleSystem: IParticleSystem, serializeTexture: boolean): void;
500
150
  /**
501
151
  * Clones the particle system.
502
152
  * @param name The name of the cloned object
@@ -505,28 +155,4 @@ export declare class ParticleSystem extends BaseParticleSystem implements IDispo
505
155
  * @returns the cloned particle system
506
156
  */
507
157
  clone(name: string, newEmitter: any, cloneTexture?: boolean): ParticleSystem;
508
- /**
509
- * Serializes the particle system to a JSON object
510
- * @param serializeTexture defines if the texture must be serialized as well
511
- * @returns the JSON object
512
- */
513
- serialize(serializeTexture?: boolean): any;
514
- /**
515
- * @internal
516
- */
517
- static _Serialize(serializationObject: any, particleSystem: IParticleSystem, serializeTexture: boolean): void;
518
- /**
519
- * @internal
520
- */
521
- static _Parse(parsedParticleSystem: any, particleSystem: IParticleSystem, sceneOrEngine: Scene | ThinEngine, rootUrl: string): void;
522
- /**
523
- * Parses a JSON object to create a particle system.
524
- * @param parsedParticleSystem The JSON object to parse
525
- * @param sceneOrEngine The scene or the engine to create the particle system in
526
- * @param rootUrl The root url to use to load external dependencies like texture
527
- * @param doNotStart Ignore the preventAutoStart attribute and does not start
528
- * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)
529
- * @returns the Parsed particle system
530
- */
531
- static Parse(parsedParticleSystem: any, sceneOrEngine: Scene | ThinEngine, rootUrl: string, doNotStart?: boolean, capacity?: number): ParticleSystem;
532
158
  }
@@ -0,0 +1,61 @@
1
+ import { Vector3 } from "../Maths/math.vector.js";
2
+ import { PointParticleEmitter } from "./EmitterTypes/pointParticleEmitter";
3
+ import { HemisphericParticleEmitter } from "./EmitterTypes/hemisphericParticleEmitter";
4
+ import { SphereDirectedParticleEmitter, SphereParticleEmitter } from "./EmitterTypes/sphereParticleEmitter";
5
+ import { CylinderDirectedParticleEmitter, CylinderParticleEmitter } from "./EmitterTypes/cylinderParticleEmitter";
6
+ import { ConeParticleEmitter } from "./EmitterTypes/coneParticleEmitter";
7
+ /**
8
+ * Creates a Point Emitter for the particle system (emits directly from the emitter position)
9
+ * @param direction1 Particles are emitted between the direction1 and direction2 from within the box
10
+ * @param direction2 Particles are emitted between the direction1 and direction2 from within the box
11
+ * @returns the emitter
12
+ */
13
+ export declare function CreatePointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;
14
+ /**
15
+ * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)
16
+ * @param radius The radius of the hemisphere to emit from
17
+ * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
18
+ * @returns the emitter
19
+ */
20
+ export declare function CreateHemisphericEmitter(radius?: number, radiusRange?: number): HemisphericParticleEmitter;
21
+ /**
22
+ * Creates a Sphere Emitter for the particle system (emits along the sphere radius)
23
+ * @param radius The radius of the sphere to emit from
24
+ * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius
25
+ * @returns the emitter
26
+ */
27
+ export declare function CreateSphereEmitter(radius?: number, radiusRange?: number): SphereParticleEmitter;
28
+ /**
29
+ * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)
30
+ * @param radius The radius of the sphere to emit from
31
+ * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere
32
+ * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere
33
+ * @returns the emitter
34
+ */
35
+ export declare function CreateDirectedSphereEmitter(radius?: number, direction1?: Vector3, direction2?: Vector3): SphereDirectedParticleEmitter;
36
+ /**
37
+ * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)
38
+ * @param radius The radius of the emission cylinder
39
+ * @param height The height of the emission cylinder
40
+ * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius
41
+ * @param directionRandomizer How much to randomize the particle direction [0-1]
42
+ * @returns the emitter
43
+ */
44
+ export declare function CreateCylinderEmitter(radius?: number, height?: number, radiusRange?: number, directionRandomizer?: number): CylinderParticleEmitter;
45
+ /**
46
+ * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)
47
+ * @param radius The radius of the cylinder to emit from
48
+ * @param height The height of the emission cylinder
49
+ * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)
50
+ * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder
51
+ * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder
52
+ * @returns the emitter
53
+ */
54
+ export declare function CreateDirectedCylinderEmitter(radius?: number, height?: number, radiusRange?: number, direction1?: Vector3, direction2?: Vector3): CylinderDirectedParticleEmitter;
55
+ /**
56
+ * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)
57
+ * @param radius The radius of the cone to emit from
58
+ * @param angle The base angle of the cone
59
+ * @returns the emitter
60
+ */
61
+ export declare function CreateConeEmitter(radius?: number, angle?: number): ConeParticleEmitter;