cameraGizmo.d.ts 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import type { Nullable } from "../types";
  2. import { Color3 } from "../Maths/math.color";
  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 { StandardMaterial } from "../Materials/standardMaterial";
  8. import type { Camera } from "../Cameras/camera";
  9. import type { PointerInfo } from "../Events/pointerEvents";
  10. import type { Observer } from "../Misc/observable";
  11. import { Observable } from "../Misc/observable";
  12. /**
  13. * Interface for camera gizmo
  14. */
  15. export interface ICameraGizmo extends IGizmo {
  16. /** Event that fires each time the gizmo is clicked */
  17. onClickedObservable: Observable<Camera>;
  18. /** A boolean indicating if frustum lines must be rendered */
  19. displayFrustum: boolean;
  20. /** The camera that the gizmo is attached to */
  21. camera: Nullable<Camera>;
  22. /** The material used to render the camera gizmo */
  23. readonly material: StandardMaterial;
  24. }
  25. /**
  26. * Gizmo that enables viewing a camera
  27. */
  28. export declare class CameraGizmo extends Gizmo implements ICameraGizmo {
  29. protected _cameraMesh: Mesh;
  30. protected _cameraLinesMesh: Mesh;
  31. protected _material: StandardMaterial;
  32. protected _pointerObserver: Nullable<Observer<PointerInfo>>;
  33. private _frustumLinesColor?;
  34. /**
  35. * Event that fires each time the gizmo is clicked
  36. */
  37. onClickedObservable: Observable<Camera>;
  38. /**
  39. * Creates a CameraGizmo
  40. * @param gizmoLayer The utility layer the gizmo will be added to
  41. * @param gizmoColor Camera mesh color. Default is Gray
  42. * @param frustumLinesColor Frustum lines color. Default is White
  43. */
  44. constructor(gizmoLayer?: UtilityLayerRenderer, gizmoColor?: Color3, frustumLinesColor?: Color3);
  45. protected _camera: Nullable<Camera>;
  46. /** Gets or sets a boolean indicating if frustum lines must be rendered (true by default)) */
  47. get displayFrustum(): boolean;
  48. set displayFrustum(value: boolean);
  49. /**
  50. * The camera that the gizmo is attached to
  51. */
  52. set camera(camera: Nullable<Camera>);
  53. get camera(): Nullable<Camera>;
  54. /**
  55. * Gets the material used to render the camera gizmo
  56. */
  57. get material(): StandardMaterial;
  58. /**
  59. * @internal
  60. * Updates the gizmo to match the attached mesh's position/rotation
  61. */
  62. protected _update(): void;
  63. private static _Scale;
  64. private _invProjection;
  65. /**
  66. * Disposes and replaces the current camera mesh in the gizmo with the specified mesh
  67. * @param mesh The mesh to replace the default mesh of the camera gizmo
  68. */
  69. setCustomMesh(mesh: Mesh): void;
  70. /**
  71. * Disposes of the camera gizmo
  72. */
  73. dispose(): void;
  74. private static _CreateCameraMesh;
  75. private static _CreateCameraFrustum;
  76. }