David Catuhe 7 år sedan
förälder
incheckning
5c84592c9a

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4597 - 4607
Playground/babylon.d.txt


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4408 - 4406
dist/preview release/babylon.d.ts


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 14 - 14
dist/preview release/babylon.js


+ 25 - 4
dist/preview release/babylon.max.js

@@ -59822,6 +59822,11 @@ var BABYLON;
             var maxSize = engine.getCaps().maxTextureSize;
             var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;
             var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;
+            // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen
+            var webVRCamera = camera.parent;
+            if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {
+                requiredWidth /= 2;
+            }
             var desiredWidth = (this._options.width || requiredWidth);
             var desiredHeight = this._options.height || requiredHeight;
             if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {
@@ -66688,6 +66693,7 @@ var BABYLON;
 (function (BABYLON) {
     var PostProcessRenderPipeline = /** @class */ (function () {
         function PostProcessRenderPipeline(engine, name) {
+            this.engine = engine;
             this._name = name;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
@@ -66787,6 +66793,18 @@ var BABYLON;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
         };
+        PostProcessRenderPipeline.prototype._enableMSAAOnFirstPostProcess = function () {
+            // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)
+            var effectKeys = Object.keys(this._renderEffects);
+            if (this.engine.webGLVersion >= 2 && effectKeys.length > 0) {
+                var postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();
+                if (postProcesses) {
+                    postProcesses[0].samples = 4;
+                    return true;
+                }
+            }
+            return false;
+        };
         PostProcessRenderPipeline.prototype.dispose = function () {
             // Must be implemented by children 
         };
@@ -69136,6 +69154,7 @@ var BABYLON;
             if (this._cameras !== null) {
                 this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);
             }
+            this._enableMSAAOnFirstPostProcess();
         };
         DefaultRenderingPipeline.prototype._disposePostProcesses = function () {
             for (var i = 0; i < this._cameras.length; i++) {
@@ -80572,7 +80591,7 @@ var BABYLON;
                 this._deviceToWorld.invertToRef(this._worldToDevice);
                 // Update the gamepad to ensure the mesh is updated on the same frame as camera
                 this.controllers.forEach(function (controller) {
-                    controller._deviceToWorld = _this._deviceToWorld;
+                    controller._deviceToWorld.copyFrom(_this._deviceToWorld);
                     controller.update();
                 });
             }
@@ -80606,6 +80625,9 @@ var BABYLON;
          */
         WebVRFreeCamera.prototype._getWebVRViewMatrix = function () {
             var _this = this;
+            // Update the parent camera prior to using a child camera to avoid desynchronization
+            var parentCamera = this._cameraRigParams["parentCamera"];
+            parentCamera._updateCache();
             //WebVR 1.1
             var viewArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftViewMatrix : this._cameraRigParams["frameData"].rightViewMatrix;
             BABYLON.Matrix.FromArrayToRef(viewArray, 0, this._webvrViewMatrix);
@@ -80619,7 +80641,6 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-            var parentCamera = this._cameraRigParams["parentCamera"];
             // should the view matrix be updated with scale and position offset?
             if (parentCamera.deviceScaleFactor !== 1) {
                 this._webvrViewMatrix.invert();
@@ -80666,7 +80687,7 @@ var BABYLON;
                         _this._rightController = null;
                     }
                     if (webVrController.hand === "left") {
-                        _this._rightController = null;
+                        _this._leftController = null;
                     }
                     var controllerIndex = _this.controllers.indexOf(webVrController);
                     if (controllerIndex !== -1) {
@@ -80677,7 +80698,7 @@ var BABYLON;
             this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {
                 if (gamepad.type === BABYLON.Gamepad.POSE_ENABLED) {
                     var webVrController_1 = gamepad;
-                    webVrController_1._deviceToWorld = _this._deviceToWorld;
+                    webVrController_1._deviceToWorld.copyFrom(_this._deviceToWorld);
                     if (_this.webVROptions.controllerMeshes) {
                         if (webVrController_1.defaultModel) {
                             webVrController_1.defaultModel.setEnabled(true);

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 14 - 14
dist/preview release/babylon.worker.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 4484 - 4482
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 14 - 14
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 25 - 4
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -59133,6 +59133,11 @@ var BABYLON;
             var maxSize = engine.getCaps().maxTextureSize;
             var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;
             var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;
+            // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen
+            var webVRCamera = camera.parent;
+            if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {
+                requiredWidth /= 2;
+            }
             var desiredWidth = (this._options.width || requiredWidth);
             var desiredHeight = this._options.height || requiredHeight;
             if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {
@@ -65999,6 +66004,7 @@ var BABYLON;
 (function (BABYLON) {
     var PostProcessRenderPipeline = /** @class */ (function () {
         function PostProcessRenderPipeline(engine, name) {
+            this.engine = engine;
             this._name = name;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
@@ -66098,6 +66104,18 @@ var BABYLON;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
         };
+        PostProcessRenderPipeline.prototype._enableMSAAOnFirstPostProcess = function () {
+            // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)
+            var effectKeys = Object.keys(this._renderEffects);
+            if (this.engine.webGLVersion >= 2 && effectKeys.length > 0) {
+                var postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();
+                if (postProcesses) {
+                    postProcesses[0].samples = 4;
+                    return true;
+                }
+            }
+            return false;
+        };
         PostProcessRenderPipeline.prototype.dispose = function () {
             // Must be implemented by children 
         };
@@ -68447,6 +68465,7 @@ var BABYLON;
             if (this._cameras !== null) {
                 this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);
             }
+            this._enableMSAAOnFirstPostProcess();
         };
         DefaultRenderingPipeline.prototype._disposePostProcesses = function () {
             for (var i = 0; i < this._cameras.length; i++) {
@@ -79833,7 +79852,7 @@ var BABYLON;
                 this._deviceToWorld.invertToRef(this._worldToDevice);
                 // Update the gamepad to ensure the mesh is updated on the same frame as camera
                 this.controllers.forEach(function (controller) {
-                    controller._deviceToWorld = _this._deviceToWorld;
+                    controller._deviceToWorld.copyFrom(_this._deviceToWorld);
                     controller.update();
                 });
             }
@@ -79867,6 +79886,9 @@ var BABYLON;
          */
         WebVRFreeCamera.prototype._getWebVRViewMatrix = function () {
             var _this = this;
+            // Update the parent camera prior to using a child camera to avoid desynchronization
+            var parentCamera = this._cameraRigParams["parentCamera"];
+            parentCamera._updateCache();
             //WebVR 1.1
             var viewArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftViewMatrix : this._cameraRigParams["frameData"].rightViewMatrix;
             BABYLON.Matrix.FromArrayToRef(viewArray, 0, this._webvrViewMatrix);
@@ -79880,7 +79902,6 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-            var parentCamera = this._cameraRigParams["parentCamera"];
             // should the view matrix be updated with scale and position offset?
             if (parentCamera.deviceScaleFactor !== 1) {
                 this._webvrViewMatrix.invert();
@@ -79927,7 +79948,7 @@ var BABYLON;
                         _this._rightController = null;
                     }
                     if (webVrController.hand === "left") {
-                        _this._rightController = null;
+                        _this._leftController = null;
                     }
                     var controllerIndex = _this.controllers.indexOf(webVrController);
                     if (controllerIndex !== -1) {
@@ -79938,7 +79959,7 @@ var BABYLON;
             this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {
                 if (gamepad.type === BABYLON.Gamepad.POSE_ENABLED) {
                     var webVrController_1 = gamepad;
-                    webVrController_1._deviceToWorld = _this._deviceToWorld;
+                    webVrController_1._deviceToWorld.copyFrom(_this._deviceToWorld);
                     if (_this.webVROptions.controllerMeshes) {
                         if (webVrController_1.defaultModel) {
                             webVrController_1.defaultModel.setEnabled(true);

+ 25 - 4
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -59119,6 +59119,11 @@ var BABYLON;
             var maxSize = engine.getCaps().maxTextureSize;
             var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;
             var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;
+            // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen
+            var webVRCamera = camera.parent;
+            if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {
+                requiredWidth /= 2;
+            }
             var desiredWidth = (this._options.width || requiredWidth);
             var desiredHeight = this._options.height || requiredHeight;
             if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {
@@ -65985,6 +65990,7 @@ var BABYLON;
 (function (BABYLON) {
     var PostProcessRenderPipeline = /** @class */ (function () {
         function PostProcessRenderPipeline(engine, name) {
+            this.engine = engine;
             this._name = name;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
@@ -66084,6 +66090,18 @@ var BABYLON;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
         };
+        PostProcessRenderPipeline.prototype._enableMSAAOnFirstPostProcess = function () {
+            // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)
+            var effectKeys = Object.keys(this._renderEffects);
+            if (this.engine.webGLVersion >= 2 && effectKeys.length > 0) {
+                var postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();
+                if (postProcesses) {
+                    postProcesses[0].samples = 4;
+                    return true;
+                }
+            }
+            return false;
+        };
         PostProcessRenderPipeline.prototype.dispose = function () {
             // Must be implemented by children 
         };
@@ -68433,6 +68451,7 @@ var BABYLON;
             if (this._cameras !== null) {
                 this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);
             }
+            this._enableMSAAOnFirstPostProcess();
         };
         DefaultRenderingPipeline.prototype._disposePostProcesses = function () {
             for (var i = 0; i < this._cameras.length; i++) {
@@ -79819,7 +79838,7 @@ var BABYLON;
                 this._deviceToWorld.invertToRef(this._worldToDevice);
                 // Update the gamepad to ensure the mesh is updated on the same frame as camera
                 this.controllers.forEach(function (controller) {
-                    controller._deviceToWorld = _this._deviceToWorld;
+                    controller._deviceToWorld.copyFrom(_this._deviceToWorld);
                     controller.update();
                 });
             }
@@ -79853,6 +79872,9 @@ var BABYLON;
          */
         WebVRFreeCamera.prototype._getWebVRViewMatrix = function () {
             var _this = this;
+            // Update the parent camera prior to using a child camera to avoid desynchronization
+            var parentCamera = this._cameraRigParams["parentCamera"];
+            parentCamera._updateCache();
             //WebVR 1.1
             var viewArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftViewMatrix : this._cameraRigParams["frameData"].rightViewMatrix;
             BABYLON.Matrix.FromArrayToRef(viewArray, 0, this._webvrViewMatrix);
@@ -79866,7 +79888,6 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-            var parentCamera = this._cameraRigParams["parentCamera"];
             // should the view matrix be updated with scale and position offset?
             if (parentCamera.deviceScaleFactor !== 1) {
                 this._webvrViewMatrix.invert();
@@ -79913,7 +79934,7 @@ var BABYLON;
                         _this._rightController = null;
                     }
                     if (webVrController.hand === "left") {
-                        _this._rightController = null;
+                        _this._leftController = null;
                     }
                     var controllerIndex = _this.controllers.indexOf(webVrController);
                     if (controllerIndex !== -1) {
@@ -79924,7 +79945,7 @@ var BABYLON;
             this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {
                 if (gamepad.type === BABYLON.Gamepad.POSE_ENABLED) {
                     var webVrController_1 = gamepad;
-                    webVrController_1._deviceToWorld = _this._deviceToWorld;
+                    webVrController_1._deviceToWorld.copyFrom(_this._deviceToWorld);
                     if (_this.webVROptions.controllerMeshes) {
                         if (webVrController_1.defaultModel) {
                             webVrController_1.defaultModel.setEnabled(true);

+ 25 - 4
dist/preview release/es6.js

@@ -59808,6 +59808,11 @@ var BABYLON;
             var maxSize = engine.getCaps().maxTextureSize;
             var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;
             var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;
+            // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen
+            var webVRCamera = camera.parent;
+            if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {
+                requiredWidth /= 2;
+            }
             var desiredWidth = (this._options.width || requiredWidth);
             var desiredHeight = this._options.height || requiredHeight;
             if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {
@@ -66674,6 +66679,7 @@ var BABYLON;
 (function (BABYLON) {
     var PostProcessRenderPipeline = /** @class */ (function () {
         function PostProcessRenderPipeline(engine, name) {
+            this.engine = engine;
             this._name = name;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
@@ -66773,6 +66779,18 @@ var BABYLON;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
         };
+        PostProcessRenderPipeline.prototype._enableMSAAOnFirstPostProcess = function () {
+            // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)
+            var effectKeys = Object.keys(this._renderEffects);
+            if (this.engine.webGLVersion >= 2 && effectKeys.length > 0) {
+                var postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();
+                if (postProcesses) {
+                    postProcesses[0].samples = 4;
+                    return true;
+                }
+            }
+            return false;
+        };
         PostProcessRenderPipeline.prototype.dispose = function () {
             // Must be implemented by children 
         };
@@ -69122,6 +69140,7 @@ var BABYLON;
             if (this._cameras !== null) {
                 this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);
             }
+            this._enableMSAAOnFirstPostProcess();
         };
         DefaultRenderingPipeline.prototype._disposePostProcesses = function () {
             for (var i = 0; i < this._cameras.length; i++) {
@@ -80558,7 +80577,7 @@ var BABYLON;
                 this._deviceToWorld.invertToRef(this._worldToDevice);
                 // Update the gamepad to ensure the mesh is updated on the same frame as camera
                 this.controllers.forEach(function (controller) {
-                    controller._deviceToWorld = _this._deviceToWorld;
+                    controller._deviceToWorld.copyFrom(_this._deviceToWorld);
                     controller.update();
                 });
             }
@@ -80592,6 +80611,9 @@ var BABYLON;
          */
         WebVRFreeCamera.prototype._getWebVRViewMatrix = function () {
             var _this = this;
+            // Update the parent camera prior to using a child camera to avoid desynchronization
+            var parentCamera = this._cameraRigParams["parentCamera"];
+            parentCamera._updateCache();
             //WebVR 1.1
             var viewArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftViewMatrix : this._cameraRigParams["frameData"].rightViewMatrix;
             BABYLON.Matrix.FromArrayToRef(viewArray, 0, this._webvrViewMatrix);
@@ -80605,7 +80627,6 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-            var parentCamera = this._cameraRigParams["parentCamera"];
             // should the view matrix be updated with scale and position offset?
             if (parentCamera.deviceScaleFactor !== 1) {
                 this._webvrViewMatrix.invert();
@@ -80652,7 +80673,7 @@ var BABYLON;
                         _this._rightController = null;
                     }
                     if (webVrController.hand === "left") {
-                        _this._rightController = null;
+                        _this._leftController = null;
                     }
                     var controllerIndex = _this.controllers.indexOf(webVrController);
                     if (controllerIndex !== -1) {
@@ -80663,7 +80684,7 @@ var BABYLON;
             this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {
                 if (gamepad.type === BABYLON.Gamepad.POSE_ENABLED) {
                     var webVrController_1 = gamepad;
-                    webVrController_1._deviceToWorld = _this._deviceToWorld;
+                    webVrController_1._deviceToWorld.copyFrom(_this._deviceToWorld);
                     if (_this.webVROptions.controllerMeshes) {
                         if (webVrController_1.defaultModel) {
                             webVrController_1.defaultModel.setEnabled(true);

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 17 - 17
dist/preview release/viewer/babylon.viewer.js


+ 25 - 4
dist/preview release/viewer/babylon.viewer.max.js

@@ -59892,6 +59892,11 @@ var BABYLON;
             var maxSize = engine.getCaps().maxTextureSize;
             var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;
             var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;
+            // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen
+            var webVRCamera = camera.parent;
+            if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {
+                requiredWidth /= 2;
+            }
             var desiredWidth = (this._options.width || requiredWidth);
             var desiredHeight = this._options.height || requiredHeight;
             if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {
@@ -66758,6 +66763,7 @@ var BABYLON;
 (function (BABYLON) {
     var PostProcessRenderPipeline = /** @class */ (function () {
         function PostProcessRenderPipeline(engine, name) {
+            this.engine = engine;
             this._name = name;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
@@ -66857,6 +66863,18 @@ var BABYLON;
             this._renderEffects = {};
             this._renderEffectsForIsolatedPass = new Array();
         };
+        PostProcessRenderPipeline.prototype._enableMSAAOnFirstPostProcess = function () {
+            // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)
+            var effectKeys = Object.keys(this._renderEffects);
+            if (this.engine.webGLVersion >= 2 && effectKeys.length > 0) {
+                var postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();
+                if (postProcesses) {
+                    postProcesses[0].samples = 4;
+                    return true;
+                }
+            }
+            return false;
+        };
         PostProcessRenderPipeline.prototype.dispose = function () {
             // Must be implemented by children 
         };
@@ -69206,6 +69224,7 @@ var BABYLON;
             if (this._cameras !== null) {
                 this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);
             }
+            this._enableMSAAOnFirstPostProcess();
         };
         DefaultRenderingPipeline.prototype._disposePostProcesses = function () {
             for (var i = 0; i < this._cameras.length; i++) {
@@ -80642,7 +80661,7 @@ var BABYLON;
                 this._deviceToWorld.invertToRef(this._worldToDevice);
                 // Update the gamepad to ensure the mesh is updated on the same frame as camera
                 this.controllers.forEach(function (controller) {
-                    controller._deviceToWorld = _this._deviceToWorld;
+                    controller._deviceToWorld.copyFrom(_this._deviceToWorld);
                     controller.update();
                 });
             }
@@ -80676,6 +80695,9 @@ var BABYLON;
          */
         WebVRFreeCamera.prototype._getWebVRViewMatrix = function () {
             var _this = this;
+            // Update the parent camera prior to using a child camera to avoid desynchronization
+            var parentCamera = this._cameraRigParams["parentCamera"];
+            parentCamera._updateCache();
             //WebVR 1.1
             var viewArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftViewMatrix : this._cameraRigParams["frameData"].rightViewMatrix;
             BABYLON.Matrix.FromArrayToRef(viewArray, 0, this._webvrViewMatrix);
@@ -80689,7 +80711,6 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-            var parentCamera = this._cameraRigParams["parentCamera"];
             // should the view matrix be updated with scale and position offset?
             if (parentCamera.deviceScaleFactor !== 1) {
                 this._webvrViewMatrix.invert();
@@ -80736,7 +80757,7 @@ var BABYLON;
                         _this._rightController = null;
                     }
                     if (webVrController.hand === "left") {
-                        _this._rightController = null;
+                        _this._leftController = null;
                     }
                     var controllerIndex = _this.controllers.indexOf(webVrController);
                     if (controllerIndex !== -1) {
@@ -80747,7 +80768,7 @@ var BABYLON;
             this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {
                 if (gamepad.type === BABYLON.Gamepad.POSE_ENABLED) {
                     var webVrController_1 = gamepad;
-                    webVrController_1._deviceToWorld = _this._deviceToWorld;
+                    webVrController_1._deviceToWorld.copyFrom(_this._deviceToWorld);
                     if (_this.webVROptions.controllerMeshes) {
                         if (webVrController_1.defaultModel) {
                             webVrController_1.defaultModel.setEnabled(true);