|
@@ -20033,8 +20033,9 @@ var BABYLON;
|
|
|
}
|
|
|
return hdrSkybox;
|
|
|
};
|
|
|
- Scene.prototype.createDefaultVRExperience = function () {
|
|
|
- this.VRHelper = new BABYLON.VRExperienceHelper(this, null);
|
|
|
+ Scene.prototype.createDefaultVRExperience = function (webVROptions) {
|
|
|
+ if (webVROptions === void 0) { webVROptions = {}; }
|
|
|
+ this.VRHelper = new BABYLON.VRExperienceHelper(this, webVROptions);
|
|
|
};
|
|
|
// Tags
|
|
|
Scene.prototype._getByTags = function (list, tagsQuery, forEach) {
|
|
@@ -35577,10 +35578,10 @@ var BABYLON;
|
|
|
function ArcRotateCameraMouseWheelInput() {
|
|
|
this.wheelPrecision = 3.0;
|
|
|
/**
|
|
|
- * wheelPrecisionPercentage will be used instead of whellPrecision if different from 0.
|
|
|
+ * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.
|
|
|
* It defines the percentage of current camera.radius to use as delta when wheel is used.
|
|
|
*/
|
|
|
- this.wheelPrecisionPercentage = 0;
|
|
|
+ this.wheelDeltaPercentage = 0;
|
|
|
}
|
|
|
ArcRotateCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {
|
|
|
var _this = this;
|
|
@@ -35591,7 +35592,7 @@ var BABYLON;
|
|
|
var event = p.event;
|
|
|
var delta = 0;
|
|
|
if (event.wheelDelta) {
|
|
|
- delta = _this.wheelPrecisionPercentage ? (event.wheelDelta * 0.01) * _this.camera.radius * _this.wheelPrecisionPercentage : event.wheelDelta / (_this.wheelPrecision * 40);
|
|
|
+ delta = _this.wheelDeltaPercentage ? (event.wheelDelta * 0.01) * _this.camera.radius * _this.wheelDeltaPercentage : event.wheelDelta / (_this.wheelPrecision * 40);
|
|
|
}
|
|
|
else if (event.detail) {
|
|
|
delta = -event.detail / _this.wheelPrecision;
|
|
@@ -35624,7 +35625,7 @@ var BABYLON;
|
|
|
], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecision", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize()
|
|
|
- ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecisionPercentage", void 0);
|
|
|
+ ], ArcRotateCameraMouseWheelInput.prototype, "wheelDeltaPercentage", void 0);
|
|
|
return ArcRotateCameraMouseWheelInput;
|
|
|
}());
|
|
|
BABYLON.ArcRotateCameraMouseWheelInput = ArcRotateCameraMouseWheelInput;
|
|
@@ -35643,6 +35644,11 @@ var BABYLON;
|
|
|
this.angularSensibilityX = 1000.0;
|
|
|
this.angularSensibilityY = 1000.0;
|
|
|
this.pinchPrecision = 12.0;
|
|
|
+ /**
|
|
|
+ * pinchDeltaPercentage will be used instead of pinchPrecision if different from 0.
|
|
|
+ * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.
|
|
|
+ */
|
|
|
+ this.pinchDeltaPercentage = 0;
|
|
|
this.panningSensibility = 1000.0;
|
|
|
this.multiTouchPanning = true;
|
|
|
this.multiTouchPanAndZoom = true;
|
|
@@ -35772,11 +35778,15 @@ var BABYLON;
|
|
|
return;
|
|
|
}
|
|
|
if (_this.multiTouchPanAndZoom) {
|
|
|
- _this.camera
|
|
|
- .inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
|
- (_this.pinchPrecision *
|
|
|
- ((_this.angularSensibilityX + _this.angularSensibilityY) / 2) *
|
|
|
- direction);
|
|
|
+ if (_this.pinchDeltaPercentage) {
|
|
|
+ _this.camera.inertialRadiusOffset += ((pinchSquaredDistance - previousPinchSquaredDistance) * 0.001) * _this.camera.radius * _this.pinchDeltaPercentage;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _this.camera.inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
|
+ (_this.pinchPrecision *
|
|
|
+ ((_this.angularSensibilityX + _this.angularSensibilityY) / 2) *
|
|
|
+ direction);
|
|
|
+ }
|
|
|
if (_this.panningSensibility !== 0) {
|
|
|
var pointersCenterX = (pointA.x + pointB.x) / 2;
|
|
|
var pointersCenterY = (pointA.y + pointB.y) / 2;
|
|
@@ -35791,11 +35801,15 @@ var BABYLON;
|
|
|
else {
|
|
|
twoFingerActivityCount++;
|
|
|
if (previousMultiTouchPanPosition.isPinching || (twoFingerActivityCount < 20 && Math.abs(pinchDistance - initialDistance) > _this.camera.pinchToPanMaxDistance)) {
|
|
|
- _this.camera
|
|
|
- .inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
|
- (_this.pinchPrecision *
|
|
|
- ((_this.angularSensibilityX + _this.angularSensibilityY) / 2) *
|
|
|
- direction);
|
|
|
+ if (_this.pinchDeltaPercentage) {
|
|
|
+ _this.camera.inertialRadiusOffset += ((pinchSquaredDistance - previousPinchSquaredDistance) * 0.001) * _this.camera.radius * _this.pinchDeltaPercentage;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _this.camera.inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) /
|
|
|
+ (_this.pinchPrecision *
|
|
|
+ ((_this.angularSensibilityX + _this.angularSensibilityY) / 2) *
|
|
|
+ direction);
|
|
|
+ }
|
|
|
previousMultiTouchPanPosition.isPaning = false;
|
|
|
previousMultiTouchPanPosition.isPinching = true;
|
|
|
}
|
|
@@ -35917,6 +35931,9 @@ var BABYLON;
|
|
|
], ArcRotateCameraPointersInput.prototype, "pinchPrecision", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize()
|
|
|
+ ], ArcRotateCameraPointersInput.prototype, "pinchDeltaPercentage", void 0);
|
|
|
+ __decorate([
|
|
|
+ BABYLON.serialize()
|
|
|
], ArcRotateCameraPointersInput.prototype, "panningSensibility", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize()
|
|
@@ -36077,6 +36094,21 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ Object.defineProperty(ArcRotateCamera.prototype, "pinchDeltaPercentage", {
|
|
|
+ get: function () {
|
|
|
+ var pointers = this.inputs.attached["pointers"];
|
|
|
+ if (pointers)
|
|
|
+ return pointers.pinchDeltaPercentage;
|
|
|
+ },
|
|
|
+ set: function (value) {
|
|
|
+ var pointers = this.inputs.attached["pointers"];
|
|
|
+ if (pointers) {
|
|
|
+ pointers.pinchDeltaPercentage = value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
Object.defineProperty(ArcRotateCamera.prototype, "panningSensibility", {
|
|
|
get: function () {
|
|
|
var pointers = this.inputs.attached["pointers"];
|
|
@@ -36162,16 +36194,16 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
- Object.defineProperty(ArcRotateCamera.prototype, "wheelPrecisionPercentage", {
|
|
|
+ Object.defineProperty(ArcRotateCamera.prototype, "wheelDeltaPercentage", {
|
|
|
get: function () {
|
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
|
if (mousewheel)
|
|
|
- return mousewheel.wheelPrecisionPercentage;
|
|
|
+ return mousewheel.wheelDeltaPercentage;
|
|
|
},
|
|
|
set: function (value) {
|
|
|
var mousewheel = this.inputs.attached["mousewheel"];
|
|
|
if (mousewheel)
|
|
|
- mousewheel.wheelPrecisionPercentage = value;
|
|
|
+ mousewheel.wheelDeltaPercentage = value;
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -49198,7 +49230,11 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- if (BABYLON.FilesInput.FilesToLoad[sceneFilename]) {
|
|
|
+ var fileOrString = sceneFilename;
|
|
|
+ if (fileOrString.name) {
|
|
|
+ BABYLON.Tools.ReadFile(fileOrString, dataCallback, onProgress, useArrayBuffer);
|
|
|
+ }
|
|
|
+ else if (BABYLON.FilesInput.FilesToLoad[sceneFilename]) {
|
|
|
BABYLON.Tools.ReadFile(BABYLON.FilesInput.FilesToLoad[sceneFilename], dataCallback, onProgress, useArrayBuffer);
|
|
|
}
|
|
|
else {
|
|
@@ -67406,6 +67442,7 @@ var BABYLON;
|
|
|
_this.deviceScaleFactor = 1;
|
|
|
_this.controllers = [];
|
|
|
_this.onControllersAttachedObservable = new BABYLON.Observable();
|
|
|
+ _this.onControllerMeshLoadedObservable = new BABYLON.Observable();
|
|
|
_this.rigParenting = true; // should the rig cameras be used as parent instead of this camera.
|
|
|
_this.minZ = 0.1;
|
|
|
//legacy support - the compensation boolean was removed.
|
|
@@ -67650,14 +67687,15 @@ var BABYLON;
|
|
|
});
|
|
|
this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {
|
|
|
if (gamepad.type === BABYLON.Gamepad.POSE_ENABLED) {
|
|
|
- var webVrController = gamepad;
|
|
|
+ var webVrController_1 = gamepad;
|
|
|
if (_this.webVROptions.controllerMeshes) {
|
|
|
- if (webVrController.defaultModel) {
|
|
|
- webVrController.defaultModel.setEnabled(true);
|
|
|
+ if (webVrController_1.defaultModel) {
|
|
|
+ webVrController_1.defaultModel.setEnabled(true);
|
|
|
}
|
|
|
else {
|
|
|
// Load the meshes
|
|
|
- webVrController.initControllerMesh(_this.getScene(), function (loadedMesh) {
|
|
|
+ webVrController_1.initControllerMesh(_this.getScene(), function (loadedMesh) {
|
|
|
+ _this.onControllerMeshLoadedObservable.notifyObservers(webVrController_1);
|
|
|
if (_this.webVROptions.defaultLightingOnControllers) {
|
|
|
if (!_this._lightOnControllers) {
|
|
|
_this._lightOnControllers = new BABYLON.HemisphericLight("vrControllersLight", new BABYLON.Vector3(0, 1, 0), _this.getScene());
|
|
@@ -67677,11 +67715,11 @@ var BABYLON;
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- webVrController.attachToPoseControlledCamera(_this);
|
|
|
+ webVrController_1.attachToPoseControlledCamera(_this);
|
|
|
// since this is async - sanity check. Is the controller already stored?
|
|
|
- if (_this.controllers.indexOf(webVrController) === -1) {
|
|
|
+ if (_this.controllers.indexOf(webVrController_1) === -1) {
|
|
|
//add to the controllers array
|
|
|
- _this.controllers.push(webVrController);
|
|
|
+ _this.controllers.push(webVrController_1);
|
|
|
//did we find enough controllers? Great! let the developer know.
|
|
|
if (_this.controllers.length >= 2) {
|
|
|
// Forced to add some control code for Vive as it doesn't always fill properly the "hand" property
|
|
@@ -68000,10 +68038,14 @@ var BABYLON;
|
|
|
window.addEventListener("resize", function () {
|
|
|
_this._btnVR.style.top = _this._canvas.offsetTop + _this._canvas.offsetHeight - 70 + "px";
|
|
|
_this._btnVR.style.left = _this._canvas.offsetLeft + _this._canvas.offsetWidth - 100 + "px";
|
|
|
- if (_this._fullscreenVRpresenting) {
|
|
|
+ if (_this._fullscreenVRpresenting && _this._webVRready) {
|
|
|
_this.exitVR();
|
|
|
}
|
|
|
});
|
|
|
+ document.addEventListener("fullscreenchange", function () { _this._onFullscreenChange(); }, false);
|
|
|
+ document.addEventListener("mozfullscreenchange", function () { _this._onFullscreenChange(); }, false);
|
|
|
+ document.addEventListener("webkitfullscreenchange", function () { _this._onFullscreenChange(); }, false);
|
|
|
+ document.addEventListener("msfullscreenchange", function () { _this._onFullscreenChange(); }, false);
|
|
|
document.body.appendChild(this._btnVR);
|
|
|
// Exiting VR mode using 'ESC' key on desktop
|
|
|
this._onKeyDown = function (event) {
|
|
@@ -68016,6 +68058,9 @@ var BABYLON;
|
|
|
this._scene.onPrePointerObservable.add(function (pointerInfo, eventState) {
|
|
|
if (_this.isInVRMode()) {
|
|
|
_this.exitVR();
|
|
|
+ if (_this._fullscreenVRpresenting) {
|
|
|
+ _this._scene.getEngine().switchFullscreen(true);
|
|
|
+ }
|
|
|
}
|
|
|
}, BABYLON.PointerEventTypes.POINTERDOUBLETAP, false);
|
|
|
// Listen for WebVR display changes
|
|
@@ -68035,9 +68080,34 @@ var BABYLON;
|
|
|
window.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);
|
|
|
// Create the cameras
|
|
|
this._vrDeviceOrientationCamera = new BABYLON.VRDeviceOrientationFreeCamera("VRDeviceOrientationVRHelper", this._position, this._scene);
|
|
|
- this._webVRCamera = new BABYLON.WebVRFreeCamera("WebVRHelper", this._position, this._scene);
|
|
|
+ this._webVRCamera = new BABYLON.WebVRFreeCamera("WebVRHelper", this._position, this._scene, webVROptions);
|
|
|
+ this._webVRCamera.onControllerMeshLoadedObservable.add(function (webVRController) { return _this._onDefaultMeshLoaded(webVRController); });
|
|
|
this.updateButtonVisibility();
|
|
|
}
|
|
|
+ VRExperienceHelper.prototype._onDefaultMeshLoaded = function (webVRController) {
|
|
|
+ if (this.onControllerMeshLoaded) {
|
|
|
+ this.onControllerMeshLoaded(webVRController);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ VRExperienceHelper.prototype._onFullscreenChange = function () {
|
|
|
+ if (document.fullscreen !== undefined) {
|
|
|
+ this._fullscreenVRpresenting = document.fullscreen;
|
|
|
+ }
|
|
|
+ else if (document.mozFullScreen !== undefined) {
|
|
|
+ this._fullscreenVRpresenting = document.mozFullScreen;
|
|
|
+ }
|
|
|
+ else if (document.webkitIsFullScreen !== undefined) {
|
|
|
+ this._fullscreenVRpresenting = document.webkitIsFullScreen;
|
|
|
+ }
|
|
|
+ else if (document.msIsFullScreen !== undefined) {
|
|
|
+ this._fullscreenVRpresenting = document.msIsFullScreen;
|
|
|
+ }
|
|
|
+ if (!this._fullscreenVRpresenting) {
|
|
|
+ this.exitVR();
|
|
|
+ this._btnVR.style.top = this._canvas.offsetTop + this._canvas.offsetHeight - 70 + "px";
|
|
|
+ this._btnVR.style.left = this._canvas.offsetLeft + this._canvas.offsetWidth - 100 + "px";
|
|
|
+ }
|
|
|
+ };
|
|
|
VRExperienceHelper.prototype.isInVRMode = function () {
|
|
|
return this._webVRpresenting || this._fullscreenVRpresenting;
|
|
|
};
|
|
@@ -68083,6 +68153,9 @@ var BABYLON;
|
|
|
* Otherwise, will use the fullscreen API.
|
|
|
*/
|
|
|
VRExperienceHelper.prototype.enterVR = function () {
|
|
|
+ if (this.onEnteringVR) {
|
|
|
+ this.onEnteringVR();
|
|
|
+ }
|
|
|
if (this._webVRrequesting)
|
|
|
return;
|
|
|
// If WebVR is supported and a headset is connected
|
|
@@ -68096,7 +68169,6 @@ var BABYLON;
|
|
|
this._vrDeviceOrientationCamera.position = this._position;
|
|
|
this._scene.activeCamera = this._vrDeviceOrientationCamera;
|
|
|
this._scene.getEngine().switchFullscreen(true);
|
|
|
- this._fullscreenVRpresenting = true;
|
|
|
this.updateButtonVisibility();
|
|
|
}
|
|
|
this._scene.activeCamera.attachControl(this._canvas);
|
|
@@ -68105,6 +68177,9 @@ var BABYLON;
|
|
|
* Attempt to exit VR, or fullscreen.
|
|
|
*/
|
|
|
VRExperienceHelper.prototype.exitVR = function () {
|
|
|
+ if (this.onExitingVR) {
|
|
|
+ this.onExitingVR();
|
|
|
+ }
|
|
|
if (this._webVRpresenting) {
|
|
|
this._scene.getEngine().disableVR();
|
|
|
}
|
|
@@ -68114,7 +68189,6 @@ var BABYLON;
|
|
|
this._deviceOrientationCamera.position = this._position;
|
|
|
this._scene.activeCamera = this._deviceOrientationCamera;
|
|
|
this._scene.activeCamera.attachControl(this._canvas);
|
|
|
- this._fullscreenVRpresenting = false;
|
|
|
this.updateButtonVisibility();
|
|
|
};
|
|
|
Object.defineProperty(VRExperienceHelper.prototype, "position", {
|