effectLayerSceneComponent.d.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import type { Scene } from "../scene";
  2. import type { ISceneSerializableComponent } from "../sceneComponent";
  3. import { EffectLayer } from "./effectLayer";
  4. import { AbstractScene } from "../abstractScene";
  5. declare module "../abstractScene" {
  6. interface AbstractScene {
  7. /**
  8. * The list of effect layers (highlights/glow) added to the scene
  9. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/highlightLayer
  10. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer
  11. */
  12. effectLayers: Array<EffectLayer>;
  13. /**
  14. * Removes the given effect layer from this scene.
  15. * @param toRemove defines the effect layer to remove
  16. * @returns the index of the removed effect layer
  17. */
  18. removeEffectLayer(toRemove: EffectLayer): number;
  19. /**
  20. * Adds the given effect layer to this scene
  21. * @param newEffectLayer defines the effect layer to add
  22. */
  23. addEffectLayer(newEffectLayer: EffectLayer): void;
  24. }
  25. }
  26. /**
  27. * Defines the layer scene component responsible to manage any effect layers
  28. * in a given scene.
  29. */
  30. export declare class EffectLayerSceneComponent implements ISceneSerializableComponent {
  31. /**
  32. * The component name helpful to identify the component in the list of scene components.
  33. */
  34. readonly name = "EffectLayer";
  35. /**
  36. * The scene the component belongs to.
  37. */
  38. scene: Scene;
  39. private _engine;
  40. private _renderEffects;
  41. private _needStencil;
  42. private _previousStencilState;
  43. /**
  44. * Creates a new instance of the component for the given scene
  45. * @param scene Defines the scene to register the component in
  46. */
  47. constructor(scene?: Scene);
  48. /**
  49. * Registers the component in a given scene
  50. */
  51. register(): void;
  52. /**
  53. * Rebuilds the elements related to this component in case of
  54. * context lost for instance.
  55. */
  56. rebuild(): void;
  57. /**
  58. * Serializes the component data to the specified json object
  59. * @param serializationObject The object to serialize to
  60. */
  61. serialize(serializationObject: any): void;
  62. /**
  63. * Adds all the elements from the container to the scene
  64. * @param container the container holding the elements
  65. */
  66. addFromContainer(container: AbstractScene): void;
  67. /**
  68. * Removes all the elements in the container from the scene
  69. * @param container contains the elements to remove
  70. * @param dispose if the removed element should be disposed (default: false)
  71. */
  72. removeFromContainer(container: AbstractScene, dispose?: boolean): void;
  73. /**
  74. * Disposes the component and the associated resources.
  75. */
  76. dispose(): void;
  77. private _isReadyForMesh;
  78. private _renderMainTexture;
  79. private _setStencil;
  80. private _setStencilBack;
  81. private _draw;
  82. private _drawCamera;
  83. private _drawRenderingGroup;
  84. }