babylon.IParticleSystem.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. module BABYLON {
  2. /**
  3. * Interface representing a particle system in Babylon.
  4. * This groups the common functionalities that needs to be implemented in order to create a particle system.
  5. * A particle system represents a way to manage particles (@see Particle) from their emission to their animation and rendering.
  6. */
  7. export interface IParticleSystem {
  8. /**
  9. * The id of the Particle system.
  10. */
  11. id: string;
  12. /**
  13. * The name of the Particle system.
  14. */
  15. name: string;
  16. /**
  17. * The emitter represents the Mesh or position we are attaching the particle system to.
  18. */
  19. emitter: Nullable<AbstractMesh | Vector3>;
  20. /**
  21. * The rendering group used by the Particle system to chose when to render.
  22. */
  23. renderingGroupId: number;
  24. /**
  25. * The layer mask we are rendering the particles through.
  26. */
  27. layerMask: number;
  28. /**
  29. * The overall motion speed (0.01 is default update speed, faster updates = faster animation)
  30. */
  31. updateSpeed: number;
  32. /**
  33. * The amount of time the particle system is running (depends of the overall update speed).
  34. */
  35. targetStopDuration: number;
  36. /**
  37. * The texture used to render each particle. (this can be a spritesheet)
  38. */
  39. particleTexture: Nullable<Texture>;
  40. /**
  41. * Blend mode use to render the particle, it can be either ParticleSystem.BLENDMODE_ONEONE or ParticleSystem.BLENDMODE_STANDARD.
  42. */
  43. blendMode: number;
  44. /**
  45. * Minimum life time of emitting particles.
  46. */
  47. minLifeTime: number;
  48. /**
  49. * Maximum life time of emitting particles.
  50. */
  51. maxLifeTime: number;
  52. /**
  53. * Minimum Size of emitting particles.
  54. */
  55. minSize: number;
  56. /**
  57. * Maximum Size of emitting particles.
  58. */
  59. maxSize: number;
  60. /**
  61. * Random color of each particle after it has been emitted, between color1 and color2 vectors.
  62. */
  63. color1: Color4;
  64. /**
  65. * Random color of each particle after it has been emitted, between color1 and color2 vectors.
  66. */
  67. color2: Color4;
  68. /**
  69. * Color the particle will have at the end of its lifetime.
  70. */
  71. colorDead: Color4;
  72. /**
  73. * The maximum number of particles to emit per frame until we reach the activeParticleCount value
  74. */
  75. emitRate: number;
  76. /**
  77. * You can use gravity if you want to give an orientation to your particles.
  78. */
  79. gravity: Vector3;
  80. /**
  81. * Minimum power of emitting particles.
  82. */
  83. minEmitPower: number;
  84. /**
  85. * Maximum power of emitting particles.
  86. */
  87. maxEmitPower: number;
  88. /**
  89. * The particle emitter type defines the emitter used by the particle system.
  90. * It can be for example box, sphere, or cone...
  91. */
  92. particleEmitterType: Nullable<IParticleEmitterType>;
  93. /**
  94. * Gets the maximum number of particles active at the same time.
  95. * @returns The max number of active particles.
  96. */
  97. getCapacity(): number;
  98. /**
  99. * Gets Wether the system has been started.
  100. * @returns True if it has been started, otherwise false.
  101. */
  102. isStarted(): boolean;
  103. /**
  104. * Gets if the particle system has been started.
  105. * @return true if the system has been started, otherwise false.
  106. */
  107. isStarted(): boolean;
  108. /**
  109. * Animates the particle system for this frame.
  110. */
  111. animate(): void;
  112. /**
  113. * Renders the particle system in its current state.
  114. * @returns the current number of particles
  115. */
  116. render(): number;
  117. /**
  118. * Dispose the particle system and frees its associated resources.
  119. * @param disposeTexture defines if the particule texture must be disposed as well (true by default)
  120. */
  121. dispose(disposeTexture: boolean): void;
  122. /**
  123. * Clones the particle system.
  124. * @param name The name of the cloned object
  125. * @param newEmitter The new emitter to use
  126. * @returns the cloned particle system
  127. */
  128. clone(name: string, newEmitter: any): Nullable<IParticleSystem>;
  129. /**
  130. * Serializes the particle system to a JSON object.
  131. * @returns the JSON object
  132. */
  133. serialize(): any;
  134. /**
  135. * Rebuild the particle system
  136. */
  137. rebuild(): void;
  138. /**
  139. * Starts the particle system and begins to emit.
  140. */
  141. start(): void;
  142. /**
  143. * Stops the particle system.
  144. */
  145. stop(): void;
  146. /**
  147. * Remove all active particles
  148. */
  149. reset(): void;
  150. }
  151. }