babylon.vrDeviceOrientationCamera.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. var metrics = BABYLON.VRCameraMetrics.GetDefault();
  14. metrics.compensateDistortion = compensateDistortion;
  15. this.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: metrics });
  16. this.inputs.addVRDeviceOrientation();
  17. }
  18. VRDeviceOrientationFreeCamera.prototype.getTypeName = function () {
  19. return "VRDeviceOrientationFreeCamera";
  20. };
  21. return VRDeviceOrientationFreeCamera;
  22. })(BABYLON.FreeCamera);
  23. BABYLON.VRDeviceOrientationFreeCamera = VRDeviceOrientationFreeCamera;
  24. var VRDeviceOrientationArcRotateCamera = (function (_super) {
  25. __extends(VRDeviceOrientationArcRotateCamera, _super);
  26. function VRDeviceOrientationArcRotateCamera(name, alpha, beta, radius, target, scene, compensateDistortion) {
  27. if (compensateDistortion === void 0) { compensateDistortion = true; }
  28. _super.call(this, name, alpha, beta, radius, target, scene);
  29. var metrics = BABYLON.VRCameraMetrics.GetDefault();
  30. metrics.compensateDistortion = compensateDistortion;
  31. this.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: metrics });
  32. this.inputs.addVRDeviceOrientation();
  33. }
  34. VRDeviceOrientationArcRotateCamera.prototype.getTypeName = function () {
  35. return "VRDeviceOrientationArcRotateCamera";
  36. };
  37. return VRDeviceOrientationArcRotateCamera;
  38. })(BABYLON.ArcRotateCamera);
  39. BABYLON.VRDeviceOrientationArcRotateCamera = VRDeviceOrientationArcRotateCamera;
  40. })(BABYLON || (BABYLON = {}));