lightGizmo.d.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import type { Nullable } from "../types";
  2. import { Vector3 } from "../Maths/math.vector";
  3. import { Mesh } from "../Meshes/mesh";
  4. import type { IGizmo } from "./gizmo";
  5. import { Gizmo } from "./gizmo";
  6. import { UtilityLayerRenderer } from "../Rendering/utilityLayerRenderer";
  7. import type { Node } from "../node";
  8. import { StandardMaterial } from "../Materials/standardMaterial";
  9. import type { Light } from "../Lights/light";
  10. import { TransformNode } from "../Meshes/transformNode";
  11. import type { PointerInfo } from "../Events/pointerEvents";
  12. import type { Observer } from "../Misc/observable";
  13. import { Observable } from "../Misc/observable";
  14. /**
  15. * Interface for light gizmo
  16. */
  17. export interface ILightGizmo extends IGizmo {
  18. /** Event that fires each time the gizmo is clicked */
  19. onClickedObservable: Observable<Light>;
  20. /** The light that the gizmo is attached to */
  21. light: Nullable<Light>;
  22. /** The material used to render the light gizmo */
  23. readonly material: StandardMaterial;
  24. }
  25. /**
  26. * Gizmo that enables viewing a light
  27. */
  28. export declare class LightGizmo extends Gizmo implements ILightGizmo {
  29. protected _lightMesh: Mesh;
  30. protected _material: StandardMaterial;
  31. protected _cachedPosition: Vector3;
  32. protected _cachedForward: Vector3;
  33. protected _attachedMeshParent: TransformNode;
  34. protected _pointerObserver: Nullable<Observer<PointerInfo>>;
  35. /**
  36. * Event that fires each time the gizmo is clicked
  37. */
  38. onClickedObservable: Observable<Light>;
  39. /**
  40. * Creates a LightGizmo
  41. * @param gizmoLayer The utility layer the gizmo will be added to
  42. */
  43. constructor(gizmoLayer?: UtilityLayerRenderer);
  44. protected _light: Nullable<Light>;
  45. /**
  46. * Override attachedNode because lightgizmo only support attached mesh
  47. * It will return the attached mesh (if any) and setting an attached node will log
  48. * a warning
  49. */
  50. get attachedNode(): Nullable<Node>;
  51. set attachedNode(value: Nullable<Node>);
  52. /**
  53. * The light that the gizmo is attached to
  54. */
  55. set light(light: Nullable<Light>);
  56. get light(): Nullable<Light>;
  57. /**
  58. * Gets the material used to render the light gizmo
  59. */
  60. get material(): StandardMaterial;
  61. /**
  62. * @internal
  63. * returns mesh forward
  64. */
  65. protected _getMeshForward(): Vector3;
  66. /**
  67. * @internal
  68. * Updates the gizmo to match the attached mesh's position/rotation
  69. */
  70. protected _update(): void;
  71. private static _Scale;
  72. /**
  73. * Creates the lines for a light mesh
  74. * @param levels
  75. * @param scene
  76. * @returns the light lines mesh
  77. */
  78. private static _CreateLightLines;
  79. /**
  80. * Disposes of the light gizmo
  81. */
  82. dispose(): void;
  83. private static _CreateHemisphericLightMesh;
  84. private static _CreatePointLightMesh;
  85. private static _CreateSpotLightMesh;
  86. private static _CreateDirectionalLightMesh;
  87. }