Sebastien Vandenberghe 7 år sedan
förälder
incheckning
a9954a96a4

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


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


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


+ 47 - 11
dist/preview release/babylon.max.js

@@ -22110,7 +22110,7 @@ var BABYLON;
                     proxy._swapAndDie(this);
                     return;
                 case InternalTexture.DATASOURCE_RAW:
-                    proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
+                    proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression, this.type);
                     proxy._swapAndDie(this);
                     this.isReady = true;
                     return;
@@ -29101,26 +29101,31 @@ var BABYLON;
             this.uvs4 = this._mergeElement(this.uvs4, other.uvs4, count * 2);
             this.uvs5 = this._mergeElement(this.uvs5, other.uvs5, count * 2);
             this.uvs6 = this._mergeElement(this.uvs6, other.uvs6, count * 2);
-            this.colors = this._mergeElement(this.colors, other.colors, count * 4);
+            this.colors = this._mergeElement(this.colors, other.colors, count * 4, 1);
             this.matricesIndices = this._mergeElement(this.matricesIndices, other.matricesIndices, count * 4);
             this.matricesWeights = this._mergeElement(this.matricesWeights, other.matricesWeights, count * 4);
             this.matricesIndicesExtra = this._mergeElement(this.matricesIndicesExtra, other.matricesIndicesExtra, count * 4);
             this.matricesWeightsExtra = this._mergeElement(this.matricesWeightsExtra, other.matricesWeightsExtra, count * 4);
             return this;
         };
-        VertexData.prototype._mergeElement = function (source, other, length) {
+        VertexData.prototype._mergeElement = function (source, other, length, defaultValue) {
             if (length === void 0) { length = 0; }
+            if (defaultValue === void 0) { defaultValue = 0; }
             if (!other && !source) {
                 return null;
             }
             if (!other) {
-                return this._mergeElement(source, new Float32Array(source.length), length);
+                var padding = new Float32Array(source.length);
+                padding.fill(defaultValue);
+                return this._mergeElement(source, padding, length);
             }
             if (!source) {
                 if (length === 0 || length === other.length) {
                     return other;
                 }
-                return this._mergeElement(new Float32Array(length - other.length), other, length);
+                var padding = new Float32Array(length - other.length);
+                padding.fill(defaultValue);
+                return this._mergeElement(padding, other, length);
             }
             var len = other.length + source.length;
             var isSrcTypedArray = source instanceof Float32Array;
@@ -36297,11 +36302,42 @@ var BABYLON;
             // Values that need to be evaluated on every frame
             BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false, this._forceAlphaTest);
             // Attribs
-            if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE)) {
-                if (mesh) {
-                    if (!scene.getEngine().getCaps().standardDerivatives && !mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
-                        mesh.createNormals(true);
-                        BABYLON.Tools.Warn("PBRMaterial: Normals have been created for the mesh: " + mesh.name);
+            if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE) && mesh) {
+                var bufferMesh = null;
+                if (mesh instanceof BABYLON.InstancedMesh) {
+                    bufferMesh = mesh.sourceMesh;
+                }
+                else if (mesh instanceof BABYLON.Mesh) {
+                    bufferMesh = mesh;
+                }
+                if (bufferMesh) {
+                    if (bufferMesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
+                        // If the first normal's components is the zero vector in one of the submeshes, we have invalid normals
+                        var normalVertexBuffer = bufferMesh.getVertexBuffer(BABYLON.VertexBuffer.NormalKind);
+                        var normals = normalVertexBuffer.getData();
+                        var vertexBufferOffset = normalVertexBuffer.getOffset();
+                        var strideSize = normalVertexBuffer.getStrideSize();
+                        var offset = vertexBufferOffset + subMesh.indexStart * strideSize;
+                        if (normals[offset] === 0 && normals[offset + 1] === 0 && normals[offset + 2] === 0) {
+                            defines.NORMAL = false;
+                        }
+                        if (bufferMesh.isVerticesDataPresent(BABYLON.VertexBuffer.TangentKind)) {
+                            // If the first tangent's components is the zero vector in one of the submeshes, we have invalid tangents
+                            var tangentVertexBuffer = bufferMesh.getVertexBuffer(BABYLON.VertexBuffer.TangentKind);
+                            var tangents = tangentVertexBuffer.getData();
+                            var vertexBufferOffset_1 = tangentVertexBuffer.getOffset();
+                            var strideSize_1 = tangentVertexBuffer.getStrideSize();
+                            var offset_1 = vertexBufferOffset_1 + subMesh.indexStart * strideSize_1;
+                            if (tangents[offset_1] === 0 && tangents[offset_1 + 1] === 0 && tangents[offset_1 + 2] === 0) {
+                                defines.TANGENT = false;
+                            }
+                        }
+                    }
+                    else {
+                        if (!scene.getEngine().getCaps().standardDerivatives) {
+                            bufferMesh.createNormals(true);
+                            BABYLON.Tools.Warn("PBRMaterial: Normals have been created for the mesh: " + bufferMesh.name);
+                        }
                     }
                 }
             }
@@ -51811,7 +51847,7 @@ var BABYLON;
             return _this;
         }
         RawTexture.prototype.update = function (data) {
-            this._engine.updateRawTexture(this._texture, data, this.format, this._invertY);
+            this._engine.updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, undefined, this._texture.type);
         };
         // Statics
         RawTexture.CreateLuminanceTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {

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


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


+ 308 - 147
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -18953,6 +18953,7 @@ var BABYLON;
             var evt = new PointerEvent("pointerup");
             var clickInfo = new ClickInfo();
             clickInfo.singleClick = true;
+            clickInfo.ignore = true;
             return this._processPointerUp(pickResult, evt, clickInfo);
         };
         Scene.prototype._processPointerUp = function (pickResult, evt, clickInfo) {
@@ -22109,7 +22110,7 @@ var BABYLON;
                     proxy._swapAndDie(this);
                     return;
                 case InternalTexture.DATASOURCE_RAW:
-                    proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
+                    proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression, this.type);
                     proxy._swapAndDie(this);
                     this.isReady = true;
                     return;
@@ -29100,26 +29101,31 @@ var BABYLON;
             this.uvs4 = this._mergeElement(this.uvs4, other.uvs4, count * 2);
             this.uvs5 = this._mergeElement(this.uvs5, other.uvs5, count * 2);
             this.uvs6 = this._mergeElement(this.uvs6, other.uvs6, count * 2);
-            this.colors = this._mergeElement(this.colors, other.colors, count * 4);
+            this.colors = this._mergeElement(this.colors, other.colors, count * 4, 1);
             this.matricesIndices = this._mergeElement(this.matricesIndices, other.matricesIndices, count * 4);
             this.matricesWeights = this._mergeElement(this.matricesWeights, other.matricesWeights, count * 4);
             this.matricesIndicesExtra = this._mergeElement(this.matricesIndicesExtra, other.matricesIndicesExtra, count * 4);
             this.matricesWeightsExtra = this._mergeElement(this.matricesWeightsExtra, other.matricesWeightsExtra, count * 4);
             return this;
         };
-        VertexData.prototype._mergeElement = function (source, other, length) {
+        VertexData.prototype._mergeElement = function (source, other, length, defaultValue) {
             if (length === void 0) { length = 0; }
+            if (defaultValue === void 0) { defaultValue = 0; }
             if (!other && !source) {
                 return null;
             }
             if (!other) {
-                return this._mergeElement(source, new Float32Array(source.length), length);
+                var padding = new Float32Array(source.length);
+                padding.fill(defaultValue);
+                return this._mergeElement(source, padding, length);
             }
             if (!source) {
                 if (length === 0 || length === other.length) {
                     return other;
                 }
-                return this._mergeElement(new Float32Array(length - other.length), other, length);
+                var padding = new Float32Array(length - other.length);
+                padding.fill(defaultValue);
+                return this._mergeElement(padding, other, length);
             }
             var len = other.length + source.length;
             var isSrcTypedArray = source instanceof Float32Array;
@@ -36296,11 +36302,42 @@ var BABYLON;
             // Values that need to be evaluated on every frame
             BABYLON.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false, this._forceAlphaTest);
             // Attribs
-            if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE)) {
-                if (mesh) {
-                    if (!scene.getEngine().getCaps().standardDerivatives && !mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
-                        mesh.createNormals(true);
-                        BABYLON.Tools.Warn("PBRMaterial: Normals have been created for the mesh: " + mesh.name);
+            if (BABYLON.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== BABYLON.PBRMaterial.PBRMATERIAL_OPAQUE) && mesh) {
+                var bufferMesh = null;
+                if (mesh instanceof BABYLON.InstancedMesh) {
+                    bufferMesh = mesh.sourceMesh;
+                }
+                else if (mesh instanceof BABYLON.Mesh) {
+                    bufferMesh = mesh;
+                }
+                if (bufferMesh) {
+                    if (bufferMesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
+                        // If the first normal's components is the zero vector in one of the submeshes, we have invalid normals
+                        var normalVertexBuffer = bufferMesh.getVertexBuffer(BABYLON.VertexBuffer.NormalKind);
+                        var normals = normalVertexBuffer.getData();
+                        var vertexBufferOffset = normalVertexBuffer.getOffset();
+                        var strideSize = normalVertexBuffer.getStrideSize();
+                        var offset = vertexBufferOffset + subMesh.indexStart * strideSize;
+                        if (normals[offset] === 0 && normals[offset + 1] === 0 && normals[offset + 2] === 0) {
+                            defines.NORMAL = false;
+                        }
+                        if (bufferMesh.isVerticesDataPresent(BABYLON.VertexBuffer.TangentKind)) {
+                            // If the first tangent's components is the zero vector in one of the submeshes, we have invalid tangents
+                            var tangentVertexBuffer = bufferMesh.getVertexBuffer(BABYLON.VertexBuffer.TangentKind);
+                            var tangents = tangentVertexBuffer.getData();
+                            var vertexBufferOffset_1 = tangentVertexBuffer.getOffset();
+                            var strideSize_1 = tangentVertexBuffer.getStrideSize();
+                            var offset_1 = vertexBufferOffset_1 + subMesh.indexStart * strideSize_1;
+                            if (tangents[offset_1] === 0 && tangents[offset_1 + 1] === 0 && tangents[offset_1 + 2] === 0) {
+                                defines.TANGENT = false;
+                            }
+                        }
+                    }
+                    else {
+                        if (!scene.getEngine().getCaps().standardDerivatives) {
+                            bufferMesh.createNormals(true);
+                            BABYLON.Tools.Warn("PBRMaterial: Normals have been created for the mesh: " + bufferMesh.name);
+                        }
                     }
                 }
             }
@@ -51656,7 +51693,7 @@ var BABYLON;
             return _this;
         }
         RawTexture.prototype.update = function (data) {
-            this._engine.updateRawTexture(this._texture, data, this.format, this._invertY);
+            this._engine.updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, undefined, this._texture.type);
         };
         // Statics
         RawTexture.CreateLuminanceTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
@@ -71862,8 +71899,11 @@ var BABYLON;
             this._teleportationRequested = false;
             this._teleportationEnabledOnLeftController = false;
             this._teleportationEnabledOnRightController = false;
+            this._interactionsEnabledOnLeftController = false;
+            this._interactionsEnabledOnRightController = false;
             this._leftControllerReady = false;
             this._rightControllerReady = false;
+            this._floorMeshesCollection = [];
             this._teleportationAllowed = false;
             this._rotationAllowed = true;
             this._teleportationRequestInitiated = false;
@@ -71878,6 +71918,11 @@ var BABYLON;
             this.onNewMeshSelected = new BABYLON.Observable();
             this._pointerDownOnMeshAsked = false;
             this._isActionableMesh = false;
+            this._teleportationEnabled = false;
+            this._interactionsEnabled = false;
+            this._interactionsRequested = false;
+            this._displayGaze = true;
+            this._displayLaserPointer = true;
             this._workingVector = BABYLON.Vector3.Zero();
             this._scene = scene;
             this._defaultHeight = webVROptions.defaultHeight || 1.7;
@@ -71995,11 +72040,43 @@ var BABYLON;
             this._vrDeviceOrientationCamera = new BABYLON.VRDeviceOrientationFreeCamera("VRDeviceOrientationVRHelper", 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._scene.gamepadManager.onGamepadConnectedObservable.add(function (pad) { return _this._onNewGamepadConnected(pad); });
             this.updateButtonVisibility();
             //create easing functions
             this._circleEase = new BABYLON.CircleEase();
             this._circleEase.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEINOUT);
         }
+        Object.defineProperty(VRExperienceHelper.prototype, "displayGaze", {
+            get: function () {
+                return this._displayGaze;
+            },
+            set: function (value) {
+                this._displayGaze = value;
+                if (!value) {
+                    this._gazeTracker.isVisible = false;
+                }
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(VRExperienceHelper.prototype, "displayLaserPointer", {
+            get: function () {
+                return this._displayLaserPointer;
+            },
+            set: function (value) {
+                this._displayLaserPointer = value;
+                if (!value) {
+                    if (this._rightLaserPointer) {
+                        this._rightLaserPointer.isVisible = false;
+                    }
+                    if (this._leftLaserPointer) {
+                        this._leftLaserPointer.isVisible = false;
+                    }
+                }
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(VRExperienceHelper.prototype, "deviceOrientationCamera", {
             get: function () {
                 return this._deviceOrientationCamera;
@@ -72038,19 +72115,28 @@ var BABYLON;
         VRExperienceHelper.prototype._onDefaultMeshLoaded = function (webVRController) {
             if (webVRController.hand === "left") {
                 this._leftControllerReady = true;
+                if (this._interactionsRequested && !this._interactionsEnabledOnLeftController) {
+                    this._enableInteractionOnController(webVRController);
+                }
                 if (this._teleportationRequested && !this._teleportationEnabledOnLeftController) {
                     this._enableTeleportationOnController(webVRController);
                 }
             }
             if (webVRController.hand === "right") {
                 this._rightControllerReady = true;
+                if (this._interactionsRequested && !this._interactionsEnabledOnRightController) {
+                    this._enableInteractionOnController(webVRController);
+                }
                 if (this._teleportationRequested && !this._teleportationEnabledOnRightController) {
                     this._enableTeleportationOnController(webVRController);
                 }
             }
-            if (this.onControllerMeshLoaded) {
+            try {
                 this.onControllerMeshLoaded.notifyObservers(webVRController);
             }
+            catch (err) {
+                BABYLON.Tools.Warn("Error in your custom logic onControllerMeshLoaded: " + err);
+            }
         };
         VRExperienceHelper.prototype._onFullscreenChange = function () {
             if (document.fullscreen !== undefined) {
@@ -72122,7 +72208,12 @@ var BABYLON;
                 this._position = this._scene.activeCamera.position.clone();
             }
             if (this.onEnteringVR) {
-                this.onEnteringVR.notifyObservers({});
+                try {
+                    this.onEnteringVR.notifyObservers({});
+                }
+                catch (err) {
+                    BABYLON.Tools.Warn("Error in your custom logic onEnteringVR: " + err);
+                }
             }
             if (this._webVRrequesting)
                 return;
@@ -72148,7 +72239,12 @@ var BABYLON;
          */
         VRExperienceHelper.prototype.exitVR = function () {
             if (this.onExitingVR) {
-                this.onExitingVR.notifyObservers({});
+                try {
+                    this.onExitingVR.notifyObservers({});
+                }
+                catch (err) {
+                    BABYLON.Tools.Warn("Error in your custom logic onExitingVR: " + err);
+                }
             }
             if (this._webVRpresenting) {
                 this._scene.getEngine().disableVR();
@@ -72176,72 +72272,103 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
-        VRExperienceHelper.prototype.enableTeleportation = function (vrTeleportationOptions) {
+        VRExperienceHelper.prototype.enableInteractions = function () {
             var _this = this;
-            if (vrTeleportationOptions === void 0) { vrTeleportationOptions = {}; }
-            this._teleportationRequested = true;
-            if (vrTeleportationOptions) {
-                if (vrTeleportationOptions.floorMeshName) {
-                    this._floorMeshName = vrTeleportationOptions.floorMeshName;
+            if (!this._interactionsEnabled) {
+                this._interactionsRequested = true;
+                if (this._leftControllerReady && this._webVRCamera.leftController) {
+                    this._enableInteractionOnController(this._webVRCamera.leftController);
                 }
+                if (this._rightControllerReady && this._webVRCamera.rightController) {
+                    this._enableInteractionOnController(this._webVRCamera.rightController);
+                }
+                this._createGazeTracker();
+                this.raySelectionPredicate = function (mesh) {
+                    return true;
+                };
+                this.meshSelectionPredicate = function (mesh) {
+                    return true;
+                };
+                this._raySelectionPredicate = function (mesh) {
+                    if (_this._isTeleportationFloor(mesh) || (mesh.isVisible && mesh.name.indexOf("gazeTracker") === -1
+                        && mesh.name.indexOf("teleportationCircle") === -1
+                        && mesh.name.indexOf("torusTeleportation") === -1
+                        && mesh.name.indexOf("laserPointer") === -1)) {
+                        return _this.raySelectionPredicate(mesh);
+                    }
+                    return false;
+                };
+                this._scene.registerBeforeRender(function () {
+                    _this._castRayAndSelectObject();
+                });
+                this._interactionsEnabled = true;
             }
-            if (this._leftControllerReady && this._webVRCamera.leftController) {
-                this._enableTeleportationOnController(this._webVRCamera.leftController);
-            }
-            if (this._rightControllerReady && this._webVRCamera.rightController) {
-                this._enableTeleportationOnController(this._webVRCamera.rightController);
+        };
+        VRExperienceHelper.prototype._isTeleportationFloor = function (mesh) {
+            for (var i = 0; i < this._floorMeshesCollection.length; i++) {
+                if (this._floorMeshesCollection[i].id === mesh.id) {
+                    return true;
+                }
             }
-            this._scene.gamepadManager.onGamepadConnectedObservable.add(function (pad) { return _this._onNewGamepadConnected(pad); });
-            // Creates an image processing post process for the vignette not relying
-            // on the main scene configuration for image processing to reduce setup and spaces 
-            // (gamma/linear) conflicts.
-            var imageProcessingConfiguration = new BABYLON.ImageProcessingConfiguration();
-            imageProcessingConfiguration.vignetteColor = new BABYLON.Color4(0, 0, 0, 0);
-            imageProcessingConfiguration.vignetteEnabled = true;
-            this._postProcessMove = new BABYLON.ImageProcessingPostProcess("postProcessMove", 1.0, this._webVRCamera, undefined, undefined, undefined, undefined, imageProcessingConfiguration);
-            this._webVRCamera.detachPostProcess(this._postProcessMove);
-            this._passProcessMove = new BABYLON.PassPostProcess("pass", 1.0, this._webVRCamera);
-            this._createGazeTracker();
-            this._createTeleportationCircles();
-            this.raySelectionPredicate = function (mesh) {
-                return true;
-            };
-            this.meshSelectionPredicate = function (mesh) {
+            if (this._floorMeshName && mesh.name.indexOf(this._floorMeshName) !== -1) {
                 return true;
-            };
-            this._raySelectionPredicate = function (mesh) {
-                if (mesh.name.indexOf(_this._floorMeshName) !== -1 || (mesh.isVisible && mesh.name.indexOf("gazeTracker") === -1
-                    && mesh.name.indexOf("teleportationCircle") === -1
-                    && mesh.name.indexOf("torusTeleportation") === -1
-                    && mesh.name.indexOf("laserPointer") === -1)) {
-                    return _this.raySelectionPredicate(mesh);
+            }
+            return false;
+        };
+        VRExperienceHelper.prototype.enableTeleportation = function (vrTeleportationOptions) {
+            if (vrTeleportationOptions === void 0) { vrTeleportationOptions = {}; }
+            if (!this._teleportationEnabled) {
+                this._teleportationRequested = true;
+                this.enableInteractions();
+                if (vrTeleportationOptions) {
+                    if (vrTeleportationOptions.floorMeshName) {
+                        this._floorMeshName = vrTeleportationOptions.floorMeshName;
+                    }
+                    if (vrTeleportationOptions.floorMeshes) {
+                        this._floorMeshesCollection = vrTeleportationOptions.floorMeshes;
+                    }
                 }
-                return false;
-            };
-            this._scene.registerBeforeRender(function () {
-                _this._castRayAndSelectObject();
-            });
+                if (this._leftControllerReady && this._webVRCamera.leftController) {
+                    this._enableTeleportationOnController(this._webVRCamera.leftController);
+                }
+                if (this._rightControllerReady && this._webVRCamera.rightController) {
+                    this._enableTeleportationOnController(this._webVRCamera.rightController);
+                }
+                // Creates an image processing post process for the vignette not relying
+                // on the main scene configuration for image processing to reduce setup and spaces 
+                // (gamma/linear) conflicts.
+                var imageProcessingConfiguration = new BABYLON.ImageProcessingConfiguration();
+                imageProcessingConfiguration.vignetteColor = new BABYLON.Color4(0, 0, 0, 0);
+                imageProcessingConfiguration.vignetteEnabled = true;
+                this._postProcessMove = new BABYLON.ImageProcessingPostProcess("postProcessMove", 1.0, this._webVRCamera, undefined, undefined, undefined, undefined, imageProcessingConfiguration);
+                this._webVRCamera.detachPostProcess(this._postProcessMove);
+                this._passProcessMove = new BABYLON.PassPostProcess("pass", 1.0, this._webVRCamera);
+                this._teleportationEnabled = true;
+                this._createTeleportationCircles();
+            }
         };
         VRExperienceHelper.prototype._onNewGamepadConnected = function (gamepad) {
             var _this = this;
             if (gamepad.type !== BABYLON.Gamepad.POSE_ENABLED) {
                 if (gamepad.leftStick) {
                     gamepad.onleftstickchanged(function (stickValues) {
-                        // Listening to classic/xbox gamepad only if no VR controller is active
-                        if ((!_this._leftLaserPointer && !_this._rightLaserPointer) ||
-                            ((_this._leftLaserPointer && !_this._leftLaserPointer.isVisible) &&
-                                (_this._rightLaserPointer && !_this._rightLaserPointer.isVisible))) {
-                            if (!_this._teleportationRequestInitiated) {
-                                if (stickValues.y < -_this._padSensibilityUp) {
-                                    _this._teleportationRequestInitiated = true;
+                        if (_this._teleportationEnabled) {
+                            // Listening to classic/xbox gamepad only if no VR controller is active
+                            if ((!_this._leftLaserPointer && !_this._rightLaserPointer) ||
+                                ((_this._leftLaserPointer && !_this._leftLaserPointer.isVisible) &&
+                                    (_this._rightLaserPointer && !_this._rightLaserPointer.isVisible))) {
+                                if (!_this._teleportationRequestInitiated) {
+                                    if (stickValues.y < -_this._padSensibilityUp) {
+                                        _this._teleportationRequestInitiated = true;
+                                    }
                                 }
-                            }
-                            else {
-                                if (stickValues.y > -_this._padSensibilityDown) {
-                                    if (_this._teleportationAllowed) {
-                                        _this._teleportCamera();
+                                else {
+                                    if (stickValues.y > -_this._padSensibilityDown) {
+                                        if (_this._teleportationAllowed) {
+                                            _this._teleportCamera();
+                                        }
+                                        _this._teleportationRequestInitiated = false;
                                     }
-                                    _this._teleportationRequestInitiated = false;
                                 }
                             }
                         }
@@ -72249,37 +72376,39 @@ var BABYLON;
                 }
                 if (gamepad.rightStick) {
                     gamepad.onrightstickchanged(function (stickValues) {
-                        if (!_this._rotationLeftAsked) {
-                            if (stickValues.x < -_this._padSensibilityUp) {
-                                _this._rotationLeftAsked = true;
-                                if (_this._rotationAllowed) {
-                                    _this._rotateCamera(false);
+                        if (_this._teleportationEnabled) {
+                            if (!_this._rotationLeftAsked) {
+                                if (stickValues.x < -_this._padSensibilityUp) {
+                                    _this._rotationLeftAsked = true;
+                                    if (_this._rotationAllowed) {
+                                        _this._rotateCamera(false);
+                                    }
                                 }
                             }
-                        }
-                        else {
-                            if (stickValues.x > -_this._padSensibilityDown) {
-                                _this._rotationLeftAsked = false;
+                            else {
+                                if (stickValues.x > -_this._padSensibilityDown) {
+                                    _this._rotationLeftAsked = false;
+                                }
                             }
-                        }
-                        if (!_this._rotationRightAsked) {
-                            if (stickValues.x > _this._padSensibilityUp) {
-                                _this._rotationRightAsked = true;
-                                if (_this._rotationAllowed) {
-                                    _this._rotateCamera(true);
+                            if (!_this._rotationRightAsked) {
+                                if (stickValues.x > _this._padSensibilityUp) {
+                                    _this._rotationRightAsked = true;
+                                    if (_this._rotationAllowed) {
+                                        _this._rotateCamera(true);
+                                    }
                                 }
                             }
-                        }
-                        else {
-                            if (stickValues.x < _this._padSensibilityDown) {
-                                _this._rotationRightAsked = false;
+                            else {
+                                if (stickValues.x < _this._padSensibilityDown) {
+                                    _this._rotationRightAsked = false;
+                                }
                             }
                         }
                     });
                 }
                 if (gamepad.type === BABYLON.Gamepad.XBOX) {
                     gamepad.onbuttondown(function (buttonPressed) {
-                        if (buttonPressed === BABYLON.Xbox360Button.A) {
+                        if (_this._interactionsEnabled && buttonPressed === BABYLON.Xbox360Button.A) {
                             _this._pointerDownOnMeshAsked = true;
                             if (_this._currentMeshSelected && _this._currentHit) {
                                 _this._scene.simulatePointerDown(_this._currentHit);
@@ -72287,7 +72416,7 @@ var BABYLON;
                         }
                     });
                     gamepad.onbuttonup(function (buttonPressed) {
-                        if (buttonPressed === BABYLON.Xbox360Button.A) {
+                        if (_this._interactionsEnabled && buttonPressed === BABYLON.Xbox360Button.A) {
                             if (_this._currentMeshSelected && _this._currentHit) {
                                 _this._scene.simulatePointerUp(_this._currentHit);
                             }
@@ -72297,7 +72426,7 @@ var BABYLON;
                 }
             }
         };
-        VRExperienceHelper.prototype._enableTeleportationOnController = function (webVRController) {
+        VRExperienceHelper.prototype._enableInteractionOnController = function (webVRController) {
             var _this = this;
             var controllerMesh = webVRController.mesh;
             if (controllerMesh) {
@@ -72320,13 +72449,15 @@ var BABYLON;
                 laserPointer.isVisible = false;
                 if (webVRController.hand === "left") {
                     this._leftLaserPointer = laserPointer;
+                    this._interactionsEnabledOnLeftController = true;
                 }
                 else {
                     this._rightLaserPointer = laserPointer;
+                    this._interactionsEnabledOnRightController = true;
                 }
                 webVRController.onMainButtonStateChangedObservable.add(function (stateObject) {
                     // Enabling / disabling laserPointer 
-                    if (stateObject.value === 1) {
+                    if (_this._displayLaserPointer && stateObject.value === 1) {
                         laserPointer.isVisible = !laserPointer.isVisible;
                         // Laser pointer can only be active on left or right, not both at the same time
                         if (webVRController.hand === "left" && _this._rightLaserPointer) {
@@ -72337,17 +72468,51 @@ var BABYLON;
                         }
                     }
                 });
+                webVRController.onTriggerStateChangedObservable.add(function (stateObject) {
+                    if (!_this._pointerDownOnMeshAsked) {
+                        if (stateObject.value > _this._padSensibilityUp) {
+                            _this._pointerDownOnMeshAsked = true;
+                            if (_this._currentMeshSelected && _this._currentHit) {
+                                _this._scene.simulatePointerDown(_this._currentHit);
+                            }
+                        }
+                    }
+                    else if (stateObject.value < _this._padSensibilityDown) {
+                        if (_this._currentMeshSelected && _this._currentHit) {
+                            _this._scene.simulatePointerUp(_this._currentHit);
+                        }
+                        _this._pointerDownOnMeshAsked = false;
+                    }
+                });
+            }
+        };
+        VRExperienceHelper.prototype._enableTeleportationOnController = function (webVRController) {
+            var _this = this;
+            var controllerMesh = webVRController.mesh;
+            if (controllerMesh) {
+                if (webVRController.hand === "left") {
+                    if (!this._interactionsEnabledOnLeftController) {
+                        this._enableInteractionOnController(webVRController);
+                    }
+                    this._teleportationEnabledOnLeftController = true;
+                }
+                else {
+                    if (!this._interactionsEnabledOnRightController) {
+                        this._enableInteractionOnController(webVRController);
+                    }
+                    this._teleportationEnabledOnRightController = true;
+                }
                 webVRController.onPadValuesChangedObservable.add(function (stateObject) {
                     if (!_this._teleportationRequestInitiated) {
                         if (stateObject.y < -_this._padSensibilityUp) {
                             // If laser pointer wasn't enabled yet
-                            if (webVRController.hand === "left" && _this._leftLaserPointer) {
+                            if (_this._displayLaserPointer && webVRController.hand === "left" && _this._leftLaserPointer) {
                                 _this._leftLaserPointer.isVisible = true;
                                 if (_this._rightLaserPointer) {
                                     _this._rightLaserPointer.isVisible = false;
                                 }
                             }
-                            else if (_this._rightLaserPointer) {
+                            else if (_this._displayLaserPointer && _this._rightLaserPointer) {
                                 _this._rightLaserPointer.isVisible = true;
                                 if (_this._leftLaserPointer) {
                                     _this._leftLaserPointer.isVisible = false;
@@ -72396,22 +72561,6 @@ var BABYLON;
                         }
                     }
                 });
-                webVRController.onTriggerStateChangedObservable.add(function (stateObject) {
-                    if (!_this._pointerDownOnMeshAsked) {
-                        if (stateObject.value > _this._padSensibilityUp) {
-                            _this._pointerDownOnMeshAsked = true;
-                            if (_this._currentMeshSelected && _this._currentHit) {
-                                _this._scene.simulatePointerDown(_this._currentHit);
-                            }
-                        }
-                    }
-                    else if (stateObject.value < _this._padSensibilityDown) {
-                        if (_this._currentMeshSelected && _this._currentHit) {
-                            _this._scene.simulatePointerUp(_this._currentHit);
-                        }
-                        _this._pointerDownOnMeshAsked = false;
-                    }
-                });
             }
         };
         // Gaze support used to point to teleport or to interact with an object
@@ -72419,6 +72568,7 @@ var BABYLON;
             this._gazeTracker = BABYLON.Mesh.CreateTorus("gazeTracker", 0.0035, 0.0025, 20, this._scene, false);
             this._gazeTracker.bakeCurrentTransformIntoVertices();
             this._gazeTracker.isPickable = false;
+            this._gazeTracker.isVisible = false;
             var targetMat = new BABYLON.StandardMaterial("targetMat", this._scene);
             targetMat.specularColor = BABYLON.Color3.Black();
             targetMat.emissiveColor = new BABYLON.Color3(0.7, 0.7, 0.7);
@@ -72474,12 +72624,16 @@ var BABYLON;
             this._hideTeleportationCircle();
         };
         VRExperienceHelper.prototype._displayTeleportationCircle = function () {
-            this._teleportationCircle.isVisible = true;
-            this._teleportationCircle.getChildren()[0].isVisible = true;
+            if (this._teleportationEnabled) {
+                this._teleportationCircle.isVisible = true;
+                this._teleportationCircle.getChildren()[0].isVisible = true;
+            }
         };
         VRExperienceHelper.prototype._hideTeleportationCircle = function () {
-            this._teleportationCircle.isVisible = false;
-            this._teleportationCircle.getChildren()[0].isVisible = false;
+            if (this._teleportationEnabled) {
+                this._teleportationCircle.isVisible = false;
+                this._teleportationCircle.getChildren()[0].isVisible = false;
+            }
         };
         VRExperienceHelper.prototype._rotateCamera = function (right) {
             var _this = this;
@@ -72649,40 +72803,42 @@ var BABYLON;
             var hit = this._scene.pickWithRay(ray, this._raySelectionPredicate);
             // Moving the gazeTracker on the mesh face targetted
             if (hit && hit.pickedPoint) {
-                this._gazeTracker.isVisible = true;
-                var multiplier = 1;
-                if (this._isActionableMesh) {
-                    multiplier = 3;
-                }
-                this._gazeTracker.scaling.x = hit.distance * multiplier;
-                this._gazeTracker.scaling.y = hit.distance * multiplier;
-                this._gazeTracker.scaling.z = hit.distance * multiplier;
-                var pickNormal = hit.getNormal();
-                // To avoid z-fighting
-                var deltaFighting = 0.002;
-                if (pickNormal) {
-                    var axis1 = BABYLON.Vector3.Cross(BABYLON.Axis.Y, pickNormal);
-                    var axis2 = BABYLON.Vector3.Cross(pickNormal, axis1);
-                    BABYLON.Vector3.RotationFromAxisToRef(axis2, pickNormal, axis1, this._gazeTracker.rotation);
-                }
-                this._gazeTracker.position.copyFrom(hit.pickedPoint);
-                if (this._gazeTracker.position.x < 0) {
-                    this._gazeTracker.position.x += deltaFighting;
-                }
-                else {
-                    this._gazeTracker.position.x -= deltaFighting;
-                }
-                if (this._gazeTracker.position.y < 0) {
-                    this._gazeTracker.position.y += deltaFighting;
-                }
-                else {
-                    this._gazeTracker.position.y -= deltaFighting;
-                }
-                if (this._gazeTracker.position.z < 0) {
-                    this._gazeTracker.position.z += deltaFighting;
-                }
-                else {
-                    this._gazeTracker.position.z -= deltaFighting;
+                if (this._displayGaze) {
+                    var multiplier = 1;
+                    this._gazeTracker.isVisible = true;
+                    if (this._isActionableMesh) {
+                        multiplier = 3;
+                    }
+                    this._gazeTracker.scaling.x = hit.distance * multiplier;
+                    this._gazeTracker.scaling.y = hit.distance * multiplier;
+                    this._gazeTracker.scaling.z = hit.distance * multiplier;
+                    var pickNormal = hit.getNormal();
+                    // To avoid z-fighting
+                    var deltaFighting = 0.002;
+                    if (pickNormal) {
+                        var axis1 = BABYLON.Vector3.Cross(BABYLON.Axis.Y, pickNormal);
+                        var axis2 = BABYLON.Vector3.Cross(pickNormal, axis1);
+                        BABYLON.Vector3.RotationFromAxisToRef(axis2, pickNormal, axis1, this._gazeTracker.rotation);
+                    }
+                    this._gazeTracker.position.copyFrom(hit.pickedPoint);
+                    if (this._gazeTracker.position.x < 0) {
+                        this._gazeTracker.position.x += deltaFighting;
+                    }
+                    else {
+                        this._gazeTracker.position.x -= deltaFighting;
+                    }
+                    if (this._gazeTracker.position.y < 0) {
+                        this._gazeTracker.position.y += deltaFighting;
+                    }
+                    else {
+                        this._gazeTracker.position.y -= deltaFighting;
+                    }
+                    if (this._gazeTracker.position.z < 0) {
+                        this._gazeTracker.position.z += deltaFighting;
+                    }
+                    else {
+                        this._gazeTracker.position.z -= deltaFighting;
+                    }
                 }
                 // Changing the size of the laser pointer based on the distance from the targetted point
                 if (this._rightLaserPointer && this._rightLaserPointer.isVisible) {
@@ -72703,7 +72859,7 @@ var BABYLON;
                     this._scene.simulatePointerMove(this._currentHit);
                 }
                 // The object selected is the floor, we're in a teleportation scenario
-                if (hit.pickedMesh.name.indexOf(this._floorMeshName) !== -1 && hit.pickedPoint) {
+                if (this._teleportationEnabled && this._isTeleportationFloor(hit.pickedMesh) && hit.pickedPoint) {
                     // Moving the teleportation area to this targetted point
                     this._moveTeleportationSelectorTo(hit);
                     return;
@@ -72724,7 +72880,12 @@ var BABYLON;
                             this.changeLaserColor(new BABYLON.Color3(0.7, 0.7, 0.7));
                             this._isActionableMesh = false;
                         }
-                        this.onNewMeshSelected.notifyObservers(this._currentMeshSelected);
+                        try {
+                            this.onNewMeshSelected.notifyObservers(this._currentMeshSelected);
+                        }
+                        catch (err) {
+                            BABYLON.Tools.Warn("Error in your custom logic onNewMeshSelected: " + err);
+                        }
                     }
                     else {
                         this._currentMeshSelected = null;

+ 3 - 0
dist/preview release/gui/babylon.gui.js

@@ -4347,6 +4347,9 @@ var BABYLON;
             InputText.prototype.processKey = function (keyCode, key) {
                 // Specific cases
                 switch (keyCode) {
+                    case 32://SPACE
+                        key = " "; //ie11 key for space is "Spacebar" 
+                        break;
                     case 8:// BACKSPACE
                         if (this._text && this._text.length > 0) {
                             if (this._cursorOffset === 0) {

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


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