|
@@ -8274,6 +8274,136 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ var PromiseStates;
|
|
|
+ (function (PromiseStates) {
|
|
|
+ PromiseStates[PromiseStates["Pending"] = 0] = "Pending";
|
|
|
+ PromiseStates[PromiseStates["Fulfilled"] = 1] = "Fulfilled";
|
|
|
+ PromiseStates[PromiseStates["Rejected"] = 2] = "Rejected";
|
|
|
+ })(PromiseStates || (PromiseStates = {}));
|
|
|
+ var InternalPromise = /** @class */ (function () {
|
|
|
+ function InternalPromise(resolver) {
|
|
|
+ var _this = this;
|
|
|
+ this._state = PromiseStates.Pending;
|
|
|
+ if (!resolver) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ resolver(function (value) {
|
|
|
+ _this._resolve(value);
|
|
|
+ }, function (reason) {
|
|
|
+ _this._reject(reason);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ catch (e) {
|
|
|
+ this._reject(e.message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Object.defineProperty(InternalPromise.prototype, "state", {
|
|
|
+ get: function () {
|
|
|
+ return this._state;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ InternalPromise.prototype.isFulfilled = function () {
|
|
|
+ return this._state === PromiseStates.Fulfilled;
|
|
|
+ };
|
|
|
+ InternalPromise.prototype.isRejected = function () {
|
|
|
+ return this._state === PromiseStates.Rejected;
|
|
|
+ };
|
|
|
+ InternalPromise.prototype.isPending = function () {
|
|
|
+ return this._state === PromiseStates.Pending;
|
|
|
+ };
|
|
|
+ InternalPromise.prototype.value = function () {
|
|
|
+ if (!this.isFulfilled()) {
|
|
|
+ throw new Error("Promise is not fulfilled");
|
|
|
+ }
|
|
|
+ return this._result;
|
|
|
+ };
|
|
|
+ InternalPromise.prototype.reason = function () {
|
|
|
+ if (!this.isRejected()) {
|
|
|
+ throw new Error("Promise is not rejected");
|
|
|
+ }
|
|
|
+ return this._reason;
|
|
|
+ };
|
|
|
+ InternalPromise.prototype.catch = function (onRejected) {
|
|
|
+ return this.then(undefined, onRejected);
|
|
|
+ };
|
|
|
+ InternalPromise.prototype.then = function (onFulfilled, onRejected) {
|
|
|
+ var newPromise = new InternalPromise();
|
|
|
+ newPromise._onFulfilled = onFulfilled;
|
|
|
+ newPromise._onRejected = onRejected;
|
|
|
+ // Composition
|
|
|
+ this._child = newPromise;
|
|
|
+ switch (this._state) {
|
|
|
+ case PromiseStates.Fulfilled:
|
|
|
+ var returnedPromise = newPromise._resolve(this._result);
|
|
|
+ if (returnedPromise) {
|
|
|
+ newPromise._child = returnedPromise;
|
|
|
+ newPromise = returnedPromise;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PromiseStates.Rejected:
|
|
|
+ newPromise._reject(this._reason);
|
|
|
+ newPromise._state = PromiseStates.Fulfilled;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return newPromise;
|
|
|
+ };
|
|
|
+ InternalPromise.prototype._resolve = function (value) {
|
|
|
+ try {
|
|
|
+ this._state = PromiseStates.Fulfilled;
|
|
|
+ this._result = value;
|
|
|
+ var returnedPromise = null;
|
|
|
+ if (this._onFulfilled) {
|
|
|
+ returnedPromise = this._onFulfilled(value);
|
|
|
+ }
|
|
|
+ if (this._child) {
|
|
|
+ this._child._resolve(value);
|
|
|
+ }
|
|
|
+ return returnedPromise;
|
|
|
+ }
|
|
|
+ catch (e) {
|
|
|
+ this._reject(e.message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ };
|
|
|
+ InternalPromise.prototype._reject = function (reason) {
|
|
|
+ this._state = PromiseStates.Rejected;
|
|
|
+ this._reason = reason;
|
|
|
+ if (this._onRejected) {
|
|
|
+ this._onRejected(reason);
|
|
|
+ }
|
|
|
+ if (this._child) {
|
|
|
+ this._child._resolve(null);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ InternalPromise.resolve = function (value) {
|
|
|
+ var newPromise = new InternalPromise();
|
|
|
+ newPromise._resolve(value);
|
|
|
+ return newPromise;
|
|
|
+ };
|
|
|
+ return InternalPromise;
|
|
|
+ }());
|
|
|
+ var PromisePolyfill = /** @class */ (function () {
|
|
|
+ function PromisePolyfill() {
|
|
|
+ }
|
|
|
+ PromisePolyfill.Apply = function (force) {
|
|
|
+ if (force === void 0) { force = false; }
|
|
|
+ if (force || typeof Promise === 'undefined') {
|
|
|
+ var root = window;
|
|
|
+ root.Promise = InternalPromise;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return PromisePolyfill;
|
|
|
+ }());
|
|
|
+ BABYLON.PromisePolyfill = PromisePolyfill;
|
|
|
+})(BABYLON || (BABYLON = {}));
|
|
|
+
|
|
|
+//# sourceMappingURL=babylon.promise.js.map
|
|
|
+
|
|
|
+var BABYLON;
|
|
|
+(function (BABYLON) {
|
|
|
var _AlphaState = /** @class */ (function () {
|
|
|
/**
|
|
|
* Initializes the state.
|
|
@@ -9106,6 +9236,8 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
this._boundUniforms = {};
|
|
|
+ // Register promises
|
|
|
+ BABYLON.PromisePolyfill.Apply();
|
|
|
var canvas = null;
|
|
|
Engine.Instances.push(this);
|
|
|
if (!canvasOrContext) {
|
|
@@ -74923,13 +75055,31 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ /**
|
|
|
+ * This represents a WebVR camera.
|
|
|
+ * The WebVR camera is Babylon's simple interface to interaction with Windows Mixed Reality, HTC Vive and Oculus Rift.
|
|
|
+ * @example http://doc.babylonjs.com/how_to/webvr_camera
|
|
|
+ */
|
|
|
var WebVRFreeCamera = /** @class */ (function (_super) {
|
|
|
__extends(WebVRFreeCamera, _super);
|
|
|
+ /**
|
|
|
+ * Instantiates a WebVRFreeCamera.
|
|
|
+ * @param name The name of the WebVRFreeCamera
|
|
|
+ * @param position The starting anchor position for the camera
|
|
|
+ * @param scene The scene the camera belongs to
|
|
|
+ * @param webVROptions a set of customizable options for the webVRCamera
|
|
|
+ */
|
|
|
function WebVRFreeCamera(name, position, scene, webVROptions) {
|
|
|
if (webVROptions === void 0) { webVROptions = {}; }
|
|
|
var _this = _super.call(this, name, position, scene) || this;
|
|
|
_this.webVROptions = webVROptions;
|
|
|
+ /**
|
|
|
+ * The vrDisplay tied to the camera. See https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay
|
|
|
+ */
|
|
|
_this._vrDevice = null;
|
|
|
+ /**
|
|
|
+ * The rawPose of the vrDevice.
|
|
|
+ */
|
|
|
_this.rawPose = null;
|
|
|
_this._specsVersion = "1.1";
|
|
|
_this._attached = false;
|
|
@@ -74938,52 +75088,37 @@ var BABYLON;
|
|
|
_this._deviceRoomPosition = BABYLON.Vector3.Zero();
|
|
|
_this._deviceRoomRotationQuaternion = BABYLON.Quaternion.Identity();
|
|
|
_this._standingMatrix = null;
|
|
|
- // Represents device position and rotation in babylon space
|
|
|
+ /**
|
|
|
+ * Represents device position in babylon space.
|
|
|
+ */
|
|
|
_this.devicePosition = BABYLON.Vector3.Zero();
|
|
|
+ /**
|
|
|
+ * Represents device rotation in babylon space.
|
|
|
+ */
|
|
|
_this.deviceRotationQuaternion = BABYLON.Quaternion.Identity();
|
|
|
+ /**
|
|
|
+ * The scale of the device to be used when translating from device space to babylon space.
|
|
|
+ */
|
|
|
_this.deviceScaleFactor = 1;
|
|
|
_this._deviceToWorld = BABYLON.Matrix.Identity();
|
|
|
_this._worldToDevice = BABYLON.Matrix.Identity();
|
|
|
+ /**
|
|
|
+ * References to the webVR controllers for the vrDevice.
|
|
|
+ */
|
|
|
_this.controllers = [];
|
|
|
+ /**
|
|
|
+ * Emits an event when a controller is attached.
|
|
|
+ */
|
|
|
_this.onControllersAttachedObservable = new BABYLON.Observable();
|
|
|
+ /**
|
|
|
+ * Emits an event when a controller's mesh has been loaded;
|
|
|
+ */
|
|
|
_this.onControllerMeshLoadedObservable = new BABYLON.Observable();
|
|
|
- _this.rigParenting = true; // should the rig cameras be used as parent instead of this camera.
|
|
|
+ /**
|
|
|
+ * If the rig cameras be used as parent instead of this camera.
|
|
|
+ */
|
|
|
+ _this.rigParenting = true;
|
|
|
_this._defaultHeight = undefined;
|
|
|
- _this.deviceDistanceToRoomGround = function () {
|
|
|
- if (_this._standingMatrix && _this._defaultHeight === undefined) {
|
|
|
- // Add standing matrix offset to get real offset from ground in room
|
|
|
- _this._standingMatrix.getTranslationToRef(_this._workingVector);
|
|
|
- return _this._deviceRoomPosition.y + _this._workingVector.y;
|
|
|
- }
|
|
|
- //If VRDisplay does not inform stage parameters and no default height is set we fallback to zero.
|
|
|
- return _this._defaultHeight || 0;
|
|
|
- };
|
|
|
- _this.useStandingMatrix = function (callback) {
|
|
|
- if (callback === void 0) { callback = function (bool) { }; }
|
|
|
- // Use standing matrix if availible
|
|
|
- if (!navigator || !navigator.getVRDisplays) {
|
|
|
- callback(false);
|
|
|
- }
|
|
|
- else {
|
|
|
- navigator.getVRDisplays().then(function (displays) {
|
|
|
- if (!displays || !displays[0] || !displays[0].stageParameters || !displays[0].stageParameters.sittingToStandingTransform) {
|
|
|
- callback(false);
|
|
|
- }
|
|
|
- else {
|
|
|
- _this._standingMatrix = new BABYLON.Matrix();
|
|
|
- BABYLON.Matrix.FromFloat32ArrayToRefScaled(displays[0].stageParameters.sittingToStandingTransform, 0, 1, _this._standingMatrix);
|
|
|
- if (!_this.getScene().useRightHandedSystem) {
|
|
|
- [2, 6, 8, 9, 14].forEach(function (num) {
|
|
|
- if (_this._standingMatrix) {
|
|
|
- _this._standingMatrix.m[num] *= -1;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- callback(true);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
_this._workingVector = BABYLON.Vector3.Zero();
|
|
|
_this._oneVector = BABYLON.Vector3.One();
|
|
|
_this._workingMatrix = BABYLON.Matrix.Identity();
|
|
@@ -75063,10 +75198,62 @@ var BABYLON;
|
|
|
});
|
|
|
return _this;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * Gets the device distance from the ground.
|
|
|
+ * @returns the distance from the vrDevice to ground in device space. If standing matrix is not supported for the vrDevice 0 is returned.
|
|
|
+ */
|
|
|
+ WebVRFreeCamera.prototype.deviceDistanceToRoomGround = function () {
|
|
|
+ if (this._standingMatrix && this._defaultHeight === undefined) {
|
|
|
+ // Add standing matrix offset to get real offset from ground in room
|
|
|
+ this._standingMatrix.getTranslationToRef(this._workingVector);
|
|
|
+ return this._deviceRoomPosition.y + this._workingVector.y;
|
|
|
+ }
|
|
|
+ //If VRDisplay does not inform stage parameters and no default height is set we fallback to zero.
|
|
|
+ return this._defaultHeight || 0;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.
|
|
|
+ * @param callback will be called when the standing matrix is set. Callback parameter is if the standing matrix is supported.
|
|
|
+ */
|
|
|
+ WebVRFreeCamera.prototype.useStandingMatrix = function (callback) {
|
|
|
+ var _this = this;
|
|
|
+ if (callback === void 0) { callback = function (bool) { }; }
|
|
|
+ // Use standing matrix if available
|
|
|
+ if (!navigator || !navigator.getVRDisplays) {
|
|
|
+ callback(false);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ navigator.getVRDisplays().then(function (displays) {
|
|
|
+ if (!displays || !displays[0] || !displays[0].stageParameters || !displays[0].stageParameters.sittingToStandingTransform) {
|
|
|
+ callback(false);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _this._standingMatrix = new BABYLON.Matrix();
|
|
|
+ BABYLON.Matrix.FromFloat32ArrayToRefScaled(displays[0].stageParameters.sittingToStandingTransform, 0, 1, _this._standingMatrix);
|
|
|
+ if (!_this.getScene().useRightHandedSystem) {
|
|
|
+ [2, 6, 8, 9, 14].forEach(function (num) {
|
|
|
+ if (_this._standingMatrix) {
|
|
|
+ _this._standingMatrix.m[num] *= -1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ callback(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Disposes the camera
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.dispose = function () {
|
|
|
this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled);
|
|
|
_super.prototype.dispose.call(this);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets a vrController by name.
|
|
|
+ * @param name The name of the controller to retreive
|
|
|
+ * @returns the controller matching the name specified or null if not found
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.getControllerByName = function (name) {
|
|
|
for (var _i = 0, _a = this.controllers; _i < _a.length; _i++) {
|
|
|
var gp = _a[_i];
|
|
@@ -75077,6 +75264,9 @@ var BABYLON;
|
|
|
return null;
|
|
|
};
|
|
|
Object.defineProperty(WebVRFreeCamera.prototype, "leftController", {
|
|
|
+ /**
|
|
|
+ * The controller corrisponding to the users left hand.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
if (!this._leftController) {
|
|
|
this._leftController = this.getControllerByName("left");
|
|
@@ -75088,6 +75278,9 @@ var BABYLON;
|
|
|
});
|
|
|
;
|
|
|
Object.defineProperty(WebVRFreeCamera.prototype, "rightController", {
|
|
|
+ /**
|
|
|
+ * The controller corrisponding to the users right hand.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
if (!this._rightController) {
|
|
|
this._rightController = this.getControllerByName("right");
|
|
@@ -75098,6 +75291,11 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
;
|
|
|
+ /**
|
|
|
+ * Casts a ray forward from the vrCamera's gaze.
|
|
|
+ * @param length Length of the ray (default: 100)
|
|
|
+ * @returns the ray corrisponding to the gaze
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.getForwardRay = function (length) {
|
|
|
if (length === void 0) { length = 100; }
|
|
|
if (this.leftCamera) {
|
|
@@ -75108,6 +75306,9 @@ var BABYLON;
|
|
|
return _super.prototype.getForwardRay.call(this, length);
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Updates the camera based on device's frame data
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype._checkInputs = function () {
|
|
|
if (this._vrDevice && this._vrDevice.isPresenting) {
|
|
|
this._vrDevice.getFrameData(this._frameData);
|
|
@@ -75115,6 +75316,10 @@ var BABYLON;
|
|
|
}
|
|
|
_super.prototype._checkInputs.call(this);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Updates the poseControlled values based on the input device pose.
|
|
|
+ * @param poseData Pose coming from the device
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.updateFromDevice = function (poseData) {
|
|
|
if (poseData && poseData.orientation) {
|
|
|
this.rawPose = poseData;
|
|
@@ -75137,10 +75342,8 @@ var BABYLON;
|
|
|
* within a user-interaction callback. Example:
|
|
|
* <pre> scene.onPointerDown = function() { camera.attachControl(canvas); }</pre>
|
|
|
*
|
|
|
- * @param {HTMLElement} element
|
|
|
- * @param {boolean} [noPreventDefault]
|
|
|
- *
|
|
|
- * @memberOf WebVRFreeCamera
|
|
|
+ * @param element html element to attach the vrDevice to
|
|
|
+ * @param noPreventDefault prevent the default html element operation when attaching the vrDevice
|
|
|
*/
|
|
|
WebVRFreeCamera.prototype.attachControl = function (element, noPreventDefault) {
|
|
|
_super.prototype.attachControl.call(this, element, noPreventDefault);
|
|
@@ -75150,6 +75353,11 @@ var BABYLON;
|
|
|
this.getEngine().enableVR();
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Detaches the camera from the html element and disables VR
|
|
|
+ *
|
|
|
+ * @param element html element to detach from
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.detachControl = function (element) {
|
|
|
this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver);
|
|
|
this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver);
|
|
@@ -75157,14 +75365,24 @@ var BABYLON;
|
|
|
this._attached = false;
|
|
|
this.getEngine().disableVR();
|
|
|
};
|
|
|
+ /**
|
|
|
+ * @returns the name of this class
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.getClassName = function () {
|
|
|
return "WebVRFreeCamera";
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Calls resetPose on the vrDisplay
|
|
|
+ * See: https://developer.mozilla.org/en-US/docs/Web/API/VRDisplay/resetPose
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.resetToCurrentRotation = function () {
|
|
|
//uses the vrDisplay's "resetPose()".
|
|
|
//pitch and roll won't be affected.
|
|
|
this._vrDevice.resetPose();
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Updates the rig cameras (left and right eye)
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype._updateRigCameras = function () {
|
|
|
var camLeft = this._rigCameras[0];
|
|
|
var camRight = this._rigCameras[1];
|
|
@@ -75173,6 +75391,10 @@ var BABYLON;
|
|
|
camLeft.position.copyFrom(this._deviceRoomPosition);
|
|
|
camRight.position.copyFrom(this._deviceRoomPosition);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Updates the cached values of the camera
|
|
|
+ * @param ignoreParentClass ignores updating the parent class's cache (default: false)
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype._updateCache = function (ignoreParentClass) {
|
|
|
var _this = this;
|
|
|
if (!this.rotationQuaternion.equals(this._cache.rotationQuaternion) || !this.position.equals(this._cache.position)) {
|
|
@@ -75206,6 +75428,9 @@ var BABYLON;
|
|
|
}
|
|
|
this.updateCacheCalled = false;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Updates the current device position and rotation in the babylon world
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.update = function () {
|
|
|
// Get current device position in babylon world
|
|
|
BABYLON.Vector3.TransformCoordinatesToRef(this._deviceRoomPosition, this._deviceToWorld, this.devicePosition);
|
|
@@ -75215,6 +75440,10 @@ var BABYLON;
|
|
|
BABYLON.Quaternion.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);
|
|
|
_super.prototype.update.call(this);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the view matrix of this camera (Always set to identity as left and right eye cameras contain the actual view matrix)
|
|
|
+ * @returns an identity matrix
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype._getViewMatrix = function () {
|
|
|
return BABYLON.Matrix.Identity();
|
|
|
};
|
|
@@ -75267,6 +75496,9 @@ var BABYLON;
|
|
|
}
|
|
|
return this._projectionMatrix;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Initializes the controllers and their meshes
|
|
|
+ */
|
|
|
WebVRFreeCamera.prototype.initControllers = function () {
|
|
|
var _this = this;
|
|
|
this.controllers = [];
|
|
@@ -75608,8 +75840,18 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
+ /**
|
|
|
+ * Helps to quickly add VR support to an existing scene.
|
|
|
+ * See http://doc.babylonjs.com/how_to/webvr_helper
|
|
|
+ */
|
|
|
var VRExperienceHelper = /** @class */ (function () {
|
|
|
- function VRExperienceHelper(scene, webVROptions) {
|
|
|
+ /**
|
|
|
+ * Instantiates a VRExperienceHelper.
|
|
|
+ * Helps to quickly add VR support to an existing scene.
|
|
|
+ * @param scene The scene the VRExperienceHelper belongs to.
|
|
|
+ * @param webVROptions Options to modify the vr experience helper's behavior.
|
|
|
+ */
|
|
|
+ function VRExperienceHelper(scene, /** Options to modify the vr experience helper's behavior. */ webVROptions) {
|
|
|
if (webVROptions === void 0) { webVROptions = {}; }
|
|
|
var _this = this;
|
|
|
this.webVROptions = webVROptions;
|
|
@@ -75985,9 +76227,15 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "teleportationTarget", {
|
|
|
+ /**
|
|
|
+ * The mesh used to display where the user is going to teleport.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this._teleportationTarget;
|
|
|
},
|
|
|
+ /**
|
|
|
+ * Sets the mesh to be used to display where the user is going to teleport.
|
|
|
+ */
|
|
|
set: function (value) {
|
|
|
if (value) {
|
|
|
value.name = "teleportationTarget";
|
|
@@ -75999,9 +76247,15 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "displayGaze", {
|
|
|
+ /**
|
|
|
+ * If the ray of the gaze should be displayed.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this._displayGaze;
|
|
|
},
|
|
|
+ /**
|
|
|
+ * Sets if the ray of the gaze should be displayed.
|
|
|
+ */
|
|
|
set: function (value) {
|
|
|
this._displayGaze = value;
|
|
|
if (!value) {
|
|
@@ -76012,9 +76266,15 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "displayLaserPointer", {
|
|
|
+ /**
|
|
|
+ * If the ray of the LaserPointer should be displayed.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this._displayLaserPointer;
|
|
|
},
|
|
|
+ /**
|
|
|
+ * Sets if the ray of the LaserPointer should be displayed.
|
|
|
+ */
|
|
|
set: function (value) {
|
|
|
this._displayLaserPointer = value;
|
|
|
if (!value) {
|
|
@@ -76038,6 +76298,9 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "deviceOrientationCamera", {
|
|
|
+ /**
|
|
|
+ * The deviceOrientationCamera used as the camera when not in VR.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this._deviceOrientationCamera;
|
|
|
},
|
|
@@ -76045,7 +76308,9 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "currentVRCamera", {
|
|
|
- // Based on the current WebVR support, returns the current VR camera used
|
|
|
+ /**
|
|
|
+ * Based on the current WebVR support, returns the current VR camera used.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
if (this._webVRready) {
|
|
|
return this._webVRCamera;
|
|
@@ -76058,6 +76323,9 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "webVRCamera", {
|
|
|
+ /**
|
|
|
+ * The webVRCamera which is used when in VR.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this._webVRCamera;
|
|
|
},
|
|
@@ -76065,6 +76333,9 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "vrDeviceOrientationCamera", {
|
|
|
+ /**
|
|
|
+ * The deviceOrientationCamera that is used as a fallback when vr device is not connected.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this._vrDeviceOrientationCamera;
|
|
|
},
|
|
@@ -76215,9 +76486,15 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "position", {
|
|
|
+ /**
|
|
|
+ * The position of the vr experience helper.
|
|
|
+ */
|
|
|
get: function () {
|
|
|
return this._position;
|
|
|
},
|
|
|
+ /**
|
|
|
+ * Sets the position of the vr experience helper.
|
|
|
+ */
|
|
|
set: function (value) {
|
|
|
this._position = value;
|
|
|
if (this._scene.activeCamera) {
|
|
@@ -76227,6 +76504,9 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ /**
|
|
|
+ * Enables controllers and user interactions suck as selecting and object or clicking on an object.
|
|
|
+ */
|
|
|
VRExperienceHelper.prototype.enableInteractions = function () {
|
|
|
var _this = this;
|
|
|
if (!this._interactionsEnabled) {
|
|
@@ -76267,6 +76547,10 @@ var BABYLON;
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Adds a floor mesh to be used for teleportation.
|
|
|
+ * @param floorMesh the mesh to be used for teleportation.
|
|
|
+ */
|
|
|
VRExperienceHelper.prototype.addFloorMesh = function (floorMesh) {
|
|
|
if (!this._floorMeshesCollection) {
|
|
|
return;
|
|
@@ -76276,6 +76560,10 @@ var BABYLON;
|
|
|
}
|
|
|
this._floorMeshesCollection.push(floorMesh);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Removes a floor mesh from being used for teleportation.
|
|
|
+ * @param floorMesh the mesh to be removed.
|
|
|
+ */
|
|
|
VRExperienceHelper.prototype.removeFloorMesh = function (floorMesh) {
|
|
|
if (!this._floorMeshesCollection) {
|
|
|
return;
|
|
@@ -76285,6 +76573,10 @@ var BABYLON;
|
|
|
this._floorMeshesCollection.splice(meshIndex, 1);
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Enables interactions and teleportation using the VR controllers and gaze.
|
|
|
+ * @param vrTeleportationOptions options to modify teleportation behavior.
|
|
|
+ */
|
|
|
VRExperienceHelper.prototype.enableTeleportation = function (vrTeleportationOptions) {
|
|
|
if (vrTeleportationOptions === void 0) { vrTeleportationOptions = {}; }
|
|
|
if (!this._teleportationInitialized) {
|
|
@@ -76917,6 +77209,10 @@ var BABYLON;
|
|
|
this.changeLaserColor(new BABYLON.Color3(0.7, 0.7, 0.7));
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Sets the color of the laser ray from the vr controllers.
|
|
|
+ * @param color new color for the ray.
|
|
|
+ */
|
|
|
VRExperienceHelper.prototype.changeLaserColor = function (color) {
|
|
|
if (this._leftLaserPointer && this._leftLaserPointer.material) {
|
|
|
this._leftLaserPointer.material.emissiveColor = color;
|
|
@@ -76925,11 +77221,18 @@ var BABYLON;
|
|
|
this._rightLaserPointer.material.emissiveColor = color;
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Sets the color of the ray from the vr headsets gaze.
|
|
|
+ * @param color new color for the ray.
|
|
|
+ */
|
|
|
VRExperienceHelper.prototype.changeGazeColor = function (color) {
|
|
|
if (this._gazeTracker.material) {
|
|
|
this._gazeTracker.material.emissiveColor = color;
|
|
|
}
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Exits VR and disposes of the vr experience helper
|
|
|
+ */
|
|
|
VRExperienceHelper.prototype.dispose = function () {
|
|
|
if (this.isInVRMode) {
|
|
|
this.exitVR();
|
|
@@ -76974,6 +77277,10 @@ var BABYLON;
|
|
|
this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected);
|
|
|
this._scene.unregisterBeforeRender(this.beforeRender);
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the name of the VRExperienceHelper class
|
|
|
+ * @returns "VRExperienceHelper"
|
|
|
+ */
|
|
|
VRExperienceHelper.prototype.getClassName = function () {
|
|
|
return "VRExperienceHelper";
|
|
|
};
|