abstractEngine.dom.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import type { IViewportLike } from "../../Maths/math.like";
  2. import type { Nullable } from "../../types";
  3. /**
  4. * Defines the interface used by objects containing a viewport (like a camera)
  5. */
  6. interface IViewportOwnerLike {
  7. /**
  8. * Gets or sets the viewport
  9. */
  10. viewport: IViewportLike;
  11. }
  12. declare module "../../Engines/abstractEngine" {
  13. interface AbstractEngine {
  14. /**
  15. * Gets the HTML element used to attach event listeners
  16. * @returns a HTML element
  17. */
  18. getInputElement(): Nullable<HTMLElement>;
  19. /**
  20. * Gets the client rect of the HTML canvas attached with the current webGL context
  21. * @returns a client rectangle
  22. */
  23. getRenderingCanvasClientRect(): Nullable<ClientRect>;
  24. /**
  25. * Gets the client rect of the HTML element used for events
  26. * @returns a client rectangle
  27. */
  28. getInputElementClientRect(): Nullable<ClientRect>;
  29. /**
  30. * Gets current aspect ratio
  31. * @param viewportOwner defines the camera to use to get the aspect ratio
  32. * @param useScreen defines if screen size must be used (or the current render target if any)
  33. * @returns a number defining the aspect ratio
  34. */
  35. getAspectRatio(viewportOwner: IViewportOwnerLike, useScreen?: boolean): number;
  36. /**
  37. * Gets current screen aspect ratio
  38. * @returns a number defining the aspect ratio
  39. */
  40. getScreenAspectRatio(): number;
  41. /**
  42. * Toggle full screen mode
  43. * @param requestPointerLock defines if a pointer lock should be requested from the user
  44. */
  45. switchFullscreen(requestPointerLock: boolean): void;
  46. /**
  47. * Enters full screen mode
  48. * @param requestPointerLock defines if a pointer lock should be requested from the user
  49. */
  50. enterFullscreen(requestPointerLock: boolean): void;
  51. /**
  52. * Exits full screen mode
  53. */
  54. exitFullscreen(): void;
  55. /** @internal */
  56. _onPointerLockChange: () => void;
  57. /** @internal */
  58. _verifyPointerLock(): void;
  59. }
  60. }
  61. export {};