particleHelper.d.ts 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import type { Nullable } from "../types";
  2. import type { Scene } from "../scene";
  3. import type { Vector3 } from "../Maths/math.vector";
  4. import type { AbstractMesh } from "../Meshes/abstractMesh";
  5. import type { IParticleSystem } from "./IParticleSystem";
  6. import { ParticleSystemSet } from "./particleSystemSet";
  7. /**
  8. * This class is made for on one-liner static method to help creating particle system set.
  9. */
  10. export declare class ParticleHelper {
  11. /**
  12. * Gets or sets base Assets URL
  13. */
  14. static BaseAssetsUrl: string;
  15. /** Define the Url to load snippets */
  16. static SnippetUrl: string;
  17. /**
  18. * Create a default particle system that you can tweak
  19. * @param emitter defines the emitter to use
  20. * @param capacity defines the system capacity (default is 500 particles)
  21. * @param scene defines the hosting scene
  22. * @param useGPU defines if a GPUParticleSystem must be created (default is false)
  23. * @returns the new Particle system
  24. */
  25. static CreateDefault(emitter: Nullable<AbstractMesh | Vector3>, capacity?: number, scene?: Scene, useGPU?: boolean): IParticleSystem;
  26. /**
  27. * This is the main static method (one-liner) of this helper to create different particle systems
  28. * @param type This string represents the type to the particle system to create
  29. * @param scene The scene where the particle system should live
  30. * @param gpu If the system will use gpu
  31. * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)
  32. * @returns the ParticleSystemSet created
  33. */
  34. static CreateAsync(type: string, scene: Nullable<Scene>, gpu?: boolean, capacity?: number): Promise<ParticleSystemSet>;
  35. /**
  36. * Static function used to export a particle system to a ParticleSystemSet variable.
  37. * Please note that the emitter shape is not exported
  38. * @param systems defines the particle systems to export
  39. * @returns the created particle system set
  40. */
  41. static ExportSet(systems: IParticleSystem[]): ParticleSystemSet;
  42. /**
  43. * Creates a particle system from a snippet saved in a remote file
  44. * @param name defines the name of the particle system to create (can be null or empty to use the one from the json data)
  45. * @param url defines the url to load from
  46. * @param scene defines the hosting scene
  47. * @param gpu If the system will use gpu
  48. * @param rootUrl defines the root URL to use to load textures and relative dependencies
  49. * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)
  50. * @returns a promise that will resolve to the new particle system
  51. */
  52. static ParseFromFileAsync(name: Nullable<string>, url: string, scene: Scene, gpu?: boolean, rootUrl?: string, capacity?: number): Promise<IParticleSystem>;
  53. /**
  54. * Creates a particle system from a snippet saved by the particle system editor
  55. * @param snippetId defines the snippet to load (can be set to _BLANK to create a default one)
  56. * @param scene defines the hosting scene
  57. * @param gpu If the system will use gpu
  58. * @param rootUrl defines the root URL to use to load textures and relative dependencies
  59. * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)
  60. * @returns a promise that will resolve to the new particle system
  61. */
  62. static ParseFromSnippetAsync(snippetId: string, scene: Scene, gpu?: boolean, rootUrl?: string, capacity?: number): Promise<IParticleSystem>;
  63. /**
  64. * Creates a particle system from a snippet saved by the particle system editor
  65. * @deprecated Please use ParseFromSnippetAsync instead
  66. * @param snippetId defines the snippet to load (can be set to _BLANK to create a default one)
  67. * @param scene defines the hosting scene
  68. * @param gpu If the system will use gpu
  69. * @param rootUrl defines the root URL to use to load textures and relative dependencies
  70. * @param capacity defines the system capacity (if null or undefined the sotred capacity will be used)
  71. * @returns a promise that will resolve to the new particle system
  72. */
  73. static CreateFromSnippetAsync: typeof ParticleHelper.ParseFromSnippetAsync;
  74. }