lensFlareSystem.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import type { Scene } from "../scene";
  2. import { Vector3 } from "../Maths/math.vector";
  3. import type { AbstractMesh } from "../Meshes/abstractMesh";
  4. import { LensFlare } from "./lensFlare";
  5. import "../Shaders/lensFlare.fragment";
  6. import "../Shaders/lensFlare.vertex";
  7. import type { Viewport } from "../Maths/math.viewport";
  8. /**
  9. * This represents a Lens Flare System or the shiny effect created by the light reflection on the camera lenses.
  10. * It is usually composed of several `lensFlare`.
  11. * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare
  12. */
  13. export declare class LensFlareSystem {
  14. /**
  15. * Define the name of the lens flare system
  16. */
  17. name: string;
  18. /**
  19. * List of lens flares used in this system.
  20. */
  21. lensFlares: LensFlare[];
  22. /**
  23. * Define a limit from the border the lens flare can be visible.
  24. */
  25. borderLimit: number;
  26. /**
  27. * Define a viewport border we do not want to see the lens flare in.
  28. */
  29. viewportBorder: number;
  30. /**
  31. * Define a predicate which could limit the list of meshes able to occlude the effect.
  32. */
  33. meshesSelectionPredicate: (mesh: AbstractMesh) => boolean;
  34. /**
  35. * Restricts the rendering of the effect to only the camera rendering this layer mask.
  36. */
  37. layerMask: number;
  38. /** Gets the scene */
  39. get scene(): Scene;
  40. /**
  41. * Define the id of the lens flare system in the scene.
  42. * (equal to name by default)
  43. */
  44. id: string;
  45. private _scene;
  46. private _emitter;
  47. private _vertexBuffers;
  48. private _indexBuffer;
  49. private _positionX;
  50. private _positionY;
  51. private _isEnabled;
  52. /**
  53. * @internal
  54. */
  55. static _SceneComponentInitialization: (scene: Scene) => void;
  56. /**
  57. * Instantiates a lens flare system.
  58. * This represents a Lens Flare System or the shiny effect created by the light reflection on the camera lenses.
  59. * It is usually composed of several `lensFlare`.
  60. * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare
  61. * @param name Define the name of the lens flare system in the scene
  62. * @param emitter Define the source (the emitter) of the lens flares (it can be a camera, a light or a mesh).
  63. * @param scene Define the scene the lens flare system belongs to
  64. */
  65. constructor(
  66. /**
  67. * Define the name of the lens flare system
  68. */
  69. name: string, emitter: any, scene: Scene);
  70. private _createIndexBuffer;
  71. /**
  72. * Define if the lens flare system is enabled.
  73. */
  74. get isEnabled(): boolean;
  75. set isEnabled(value: boolean);
  76. /**
  77. * Get the scene the effects belongs to.
  78. * @returns the scene holding the lens flare system
  79. */
  80. getScene(): Scene;
  81. /**
  82. * Get the emitter of the lens flare system.
  83. * It defines the source of the lens flares (it can be a camera, a light or a mesh).
  84. * @returns the emitter of the lens flare system
  85. */
  86. getEmitter(): any;
  87. /**
  88. * Set the emitter of the lens flare system.
  89. * It defines the source of the lens flares (it can be a camera, a light or a mesh).
  90. * @param newEmitter Define the new emitter of the system
  91. */
  92. setEmitter(newEmitter: any): void;
  93. /**
  94. * Get the lens flare system emitter position.
  95. * The emitter defines the source of the lens flares (it can be a camera, a light or a mesh).
  96. * @returns the position
  97. */
  98. getEmitterPosition(): Vector3;
  99. /**
  100. * @internal
  101. */
  102. computeEffectivePosition(globalViewport: Viewport): boolean;
  103. /** @internal */
  104. _isVisible(): boolean;
  105. /**
  106. * @internal
  107. */
  108. render(): boolean;
  109. /**
  110. * Rebuilds the lens flare system
  111. */
  112. rebuild(): void;
  113. /**
  114. * Dispose and release the lens flare with its associated resources.
  115. */
  116. dispose(): void;
  117. /**
  118. * Parse a lens flare system from a JSON representation
  119. * @param parsedLensFlareSystem Define the JSON to parse
  120. * @param scene Define the scene the parsed system should be instantiated in
  121. * @param rootUrl Define the rootUrl of the load sequence to easily find a load relative dependencies such as textures
  122. * @returns the parsed system
  123. */
  124. static Parse(parsedLensFlareSystem: any, scene: Scene, rootUrl: string): LensFlareSystem;
  125. /**
  126. * Serialize the current Lens Flare System into a JSON representation.
  127. * @returns the serialized JSON
  128. */
  129. serialize(): any;
  130. }