arcRotateCameraVRDeviceOrientationInput.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import type { ArcRotateCamera } from "../../Cameras/arcRotateCamera";
  2. import type { ICameraInput } from "../../Cameras/cameraInputsManager";
  3. declare module "../../Cameras/arcRotateCameraInputsManager" {
  4. interface ArcRotateCameraInputsManager {
  5. /**
  6. * Add orientation input support to the input manager.
  7. * @returns the current input manager
  8. */
  9. addVRDeviceOrientation(): ArcRotateCameraInputsManager;
  10. }
  11. }
  12. /**
  13. * Manage the device orientation inputs (gyroscope) to control an arc rotate camera.
  14. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  15. */
  16. export declare class ArcRotateCameraVRDeviceOrientationInput implements ICameraInput<ArcRotateCamera> {
  17. /**
  18. * Defines the camera the input is attached to.
  19. */
  20. camera: ArcRotateCamera;
  21. /**
  22. * Defines a correction factor applied on the alpha value retrieved from the orientation events.
  23. */
  24. alphaCorrection: number;
  25. /**
  26. * Defines a correction factor applied on the gamma value retrieved from the orientation events.
  27. */
  28. gammaCorrection: number;
  29. private _alpha;
  30. private _gamma;
  31. private _dirty;
  32. private _deviceOrientationHandler;
  33. /**
  34. * Instantiate a new ArcRotateCameraVRDeviceOrientationInput.
  35. */
  36. constructor();
  37. /**
  38. * Attach the input controls to a specific dom element to get the input from.
  39. * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
  40. */
  41. attachControl(noPreventDefault?: boolean): void;
  42. /**
  43. * @internal
  44. */
  45. _onOrientationEvent(evt: DeviceOrientationEvent): void;
  46. /**
  47. * Update the current camera state depending on the inputs that have been used this frame.
  48. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
  49. */
  50. checkInputs(): void;
  51. /**
  52. * Detach the current controls from the specified dom element.
  53. */
  54. detachControl(): void;
  55. /**
  56. * Gets the class name of the current input.
  57. * @returns the class name
  58. */
  59. getClassName(): string;
  60. /**
  61. * Get the friendly name associated with the input class.
  62. * @returns the input friendly name
  63. */
  64. getSimpleName(): string;
  65. }