IParticleEmitterType.ts 2.4 KB

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