babylon.vrDeviceOrientationCamera.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. var __extends = (this && this.__extends) || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5. };
  6. var BABYLON;
  7. (function (BABYLON) {
  8. var VRDeviceOrientationFreeCamera = (function (_super) {
  9. __extends(VRDeviceOrientationFreeCamera, _super);
  10. function VRDeviceOrientationFreeCamera(name, position, scene, compensateDistortion) {
  11. if (compensateDistortion === void 0) { compensateDistortion = true; }
  12. _super.call(this, name, position, scene);
  13. this.rotationQuaternion = new BABYLON.Quaternion();
  14. var metrics = BABYLON.VRCameraMetrics.GetDefault();
  15. metrics.compensateDistortion = compensateDistortion;
  16. this.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: metrics });
  17. this.inputs.addDeviceOrientation();
  18. }
  19. VRDeviceOrientationFreeCamera.prototype.getTypeName = function () {
  20. return "VRDeviceOrientationFreeCamera";
  21. };
  22. return VRDeviceOrientationFreeCamera;
  23. }(BABYLON.FreeCamera));
  24. BABYLON.VRDeviceOrientationFreeCamera = VRDeviceOrientationFreeCamera;
  25. var VRDeviceOrientationArcRotateCamera = (function (_super) {
  26. __extends(VRDeviceOrientationArcRotateCamera, _super);
  27. function VRDeviceOrientationArcRotateCamera(name, alpha, beta, radius, target, scene, compensateDistortion) {
  28. if (compensateDistortion === void 0) { compensateDistortion = true; }
  29. _super.call(this, name, alpha, beta, radius, target, scene);
  30. var metrics = BABYLON.VRCameraMetrics.GetDefault();
  31. metrics.compensateDistortion = compensateDistortion;
  32. this.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: metrics });
  33. this.inputs.addVRDeviceOrientation();
  34. }
  35. VRDeviceOrientationArcRotateCamera.prototype.getTypeName = function () {
  36. return "VRDeviceOrientationArcRotateCamera";
  37. };
  38. return VRDeviceOrientationArcRotateCamera;
  39. }(BABYLON.ArcRotateCamera));
  40. BABYLON.VRDeviceOrientationArcRotateCamera = VRDeviceOrientationArcRotateCamera;
  41. })(BABYLON || (BABYLON = {}));