vrDeviceOrientationGamepadCamera.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. module BABYLON {
  2. Node.AddNodeConstructor("VRDeviceOrientationGamepadCamera", (name, scene) => {
  3. return () => new VRDeviceOrientationGamepadCamera(name, Vector3.Zero(), scene);
  4. });
  5. /**
  6. * Camera used to simulate VR rendering (based on VRDeviceOrientationFreeCamera)
  7. * @see http://doc.babylonjs.com/babylon101/cameras#vr-device-orientation-cameras
  8. */
  9. export class VRDeviceOrientationGamepadCamera extends VRDeviceOrientationFreeCamera {
  10. /**
  11. * Creates a new VRDeviceOrientationGamepadCamera
  12. * @param name defines camera name
  13. * @param position defines the start position of the camera
  14. * @param scene defines the scene the camera belongs to
  15. * @param compensateDistortion defines if the camera needs to compensate the lens distorsion
  16. * @param vrCameraMetrics defines the vr metrics associated to the camera
  17. */
  18. constructor(name: string, position: Vector3, scene: Scene, compensateDistortion = true, vrCameraMetrics: VRCameraMetrics = VRCameraMetrics.GetDefault()) {
  19. super(name, position, scene, compensateDistortion, vrCameraMetrics);
  20. this.inputs.addGamepad();
  21. }
  22. /**
  23. * Gets camera class name
  24. * @returns VRDeviceOrientationGamepadCamera
  25. */
  26. public getClassName(): string {
  27. return "VRDeviceOrientationGamepadCamera";
  28. }
  29. }
  30. }