IParticleEmitterType.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { Vector3, Matrix } from "../../Maths/math.vector";
  2. import { Effect } from "../../Materials/effect";
  3. import { Particle } from "../../Particles/particle";
  4. import { Nullable } from '../../types';
  5. declare type Scene = import("../../scene").Scene;
  6. /**
  7. * Particle emitter represents a volume emitting particles.
  8. * This is the responsibility of the implementation to define the volume shape like cone/sphere/box.
  9. */
  10. export interface IParticleEmitterType {
  11. /**
  12. * Called by the particle System when the direction is computed for the created particle.
  13. * @param worldMatrix is the world matrix of the particle system
  14. * @param directionToUpdate is the direction vector to update with the result
  15. * @param particle is the particle we are computed the direction for
  16. * @param isLocal defines if the direction should be set in local space
  17. */
  18. startDirectionFunction(worldMatrix: Matrix, directionToUpdate: Vector3, particle: Particle, isLocal: boolean): void;
  19. /**
  20. * Called by the particle System when the position is computed for the created particle.
  21. * @param worldMatrix is the world matrix of the particle system
  22. * @param positionToUpdate is the position vector to update with the result
  23. * @param particle is the particle we are computed the position for
  24. * @param isLocal defines if the position should be set in local space
  25. */
  26. startPositionFunction(worldMatrix: Matrix, positionToUpdate: Vector3, particle: Particle, isLocal: boolean): void;
  27. /**
  28. * Clones the current emitter and returns a copy of it
  29. * @returns the new emitter
  30. */
  31. clone(): IParticleEmitterType;
  32. /**
  33. * Called by the GPUParticleSystem to setup the update shader
  34. * @param effect defines the update shader
  35. */
  36. applyToShader(effect: Effect): void;
  37. /**
  38. * Returns a string to use to update the GPU particles update shader
  39. * @returns the effect defines string
  40. */
  41. getEffectDefines(): string;
  42. /**
  43. * Returns a string representing the class name
  44. * @returns a string containing the class name
  45. */
  46. getClassName(): string;
  47. /**
  48. * Serializes the particle system to a JSON object.
  49. * @returns the JSON object
  50. */
  51. serialize(): any;
  52. /**
  53. * Parse properties from a JSON object
  54. * @param serializationObject defines the JSON object
  55. * @param scene defines the hosting scene
  56. */
  57. parse(serializationObject: any, scene: Nullable<Scene>): void;
  58. }