David Catuhe 7 years ago
parent
commit
7e727354f4
30 changed files with 34985 additions and 34775 deletions
  1. 17 0
      .github/ISSUE_TEMPLATE.md
  2. 11821 11702
      Playground/babylon.d.txt
  3. 14855 14842
      dist/preview release/babylon.d.ts
  4. 50 50
      dist/preview release/babylon.js
  5. 75 49
      dist/preview release/babylon.max.js
  6. 51 51
      dist/preview release/babylon.worker.js
  7. 7742 7729
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  8. 52 52
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  9. 75 49
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  10. 75 49
      dist/preview release/customConfigurations/minimalGLTFViewer/es6.js
  11. 75 49
      dist/preview release/es6.js
  12. 3 3
      dist/preview release/gui/babylon.gui.min.js
  13. 4 4
      dist/preview release/inspector/babylon.inspector.bundle.js
  14. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  15. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  16. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  17. 3 3
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  18. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  19. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  20. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  22. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  23. 3 3
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  24. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  25. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  26. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  27. 1 1
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  28. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  29. 2 58
      dist/preview release/typedocValidationBaseline.json
  30. 63 63
      dist/preview release/viewer/babylon.viewer.js

+ 17 - 0
.github/ISSUE_TEMPLATE.md

@@ -0,0 +1,17 @@
+Before creating an issue, please make sure to provide the following template (based on why you create the issue):
+
+# Bugs
+
+- Title must describe the bug
+- A [playground](https://playground.babylonjs.com) repro must be provided
+- Please explain what should be the expected result
+
+# Feature request
+
+- Title must describe the feature
+- Make sure to first discuss the feature on our [forum](http://www.html5gamedevs.com/forum/16-babylonjs/)
+- Describe how the feature should work
+- Provide any additional links that could help implementing the feature
+
+
+**Please do not use Github issues for questions** - We have a really active forum to help answering questions (http://www.html5gamedevs.com/forum/16-babylonjs/)

File diff suppressed because it is too large
+ 11821 - 11702
Playground/babylon.d.txt


File diff suppressed because it is too large
+ 14855 - 14842
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 50 - 50
dist/preview release/babylon.js


+ 75 - 49
dist/preview release/babylon.max.js

@@ -11649,7 +11649,21 @@ var BABYLON;
         Engine.prototype.getVRDevice = function () {
             return this._vrDisplay;
         };
+        /**
+         * Initializes a webVR display and starts listening to display change events.
+         * The onVRDisplayChangedObservable will be notified upon these changes.
+         * @returns The onVRDisplayChangedObservable.
+         */
         Engine.prototype.initWebVR = function () {
+            this.initWebVRAsync();
+            return this.onVRDisplayChangedObservable;
+        };
+        /**
+         * Initializes a webVR display and starts listening to display change events.
+         * The onVRDisplayChangedObservable will be notified upon these changes.
+         * @returns A promise containing a VRDisplay and if vr is supported.
+         */
+        Engine.prototype.initWebVRAsync = function () {
             var _this = this;
             var notifyObservers = function () {
                 var eventArgs = {
@@ -11657,6 +11671,7 @@ var BABYLON;
                     vrSupported: _this._vrSupported
                 };
                 _this.onVRDisplayChangedObservable.notifyObservers(eventArgs);
+                _this._webVRInitPromise = new Promise(function (res) { res(eventArgs); });
             };
             if (!this._onVrDisplayConnect) {
                 this._onVrDisplayConnect = function (event) {
@@ -11676,8 +11691,9 @@ var BABYLON;
                 window.addEventListener('vrdisplaydisconnect', this._onVrDisplayDisconnect);
                 window.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);
             }
-            this._getVRDisplays(notifyObservers);
-            return this.onVRDisplayChangedObservable;
+            this._webVRInitPromise = this._webVRInitPromise || this._getVRDisplaysAsync();
+            this._webVRInitPromise.then(notifyObservers);
+            return this._webVRInitPromise;
         };
         Engine.prototype.enableVR = function () {
             var _this = this;
@@ -11698,27 +11714,30 @@ var BABYLON;
                 this._vrDisplay.exitPresent().then(this._onVRFullScreenTriggered).catch(this._onVRFullScreenTriggered);
             }
         };
-        Engine.prototype._getVRDisplays = function (callback) {
+        Engine.prototype._getVRDisplaysAsync = function () {
             var _this = this;
-            var getWebVRDevices = function (devices) {
-                _this._vrSupported = true;
-                // note that devices may actually be an empty array. This is fine;
-                // we expect this._vrDisplay to be undefined in this case.
-                return _this._vrDisplay = devices[0];
-            };
-            if (navigator.getVRDisplays) {
-                navigator.getVRDisplays().then(getWebVRDevices).then(callback).catch(function (error) {
-                    // TODO: System CANNOT support WebVR, despite API presence.
+            return new Promise(function (res, rej) {
+                if (navigator.getVRDisplays) {
+                    navigator.getVRDisplays().then(function (devices) {
+                        _this._vrSupported = true;
+                        // note that devices may actually be an empty array. This is fine;
+                        // we expect this._vrDisplay to be undefined in this case.
+                        _this._vrDisplay = devices[0];
+                        res({
+                            vrDisplay: _this._vrDisplay,
+                            vrSupported: _this._vrSupported
+                        });
+                    });
+                }
+                else {
+                    _this._vrDisplay = undefined;
                     _this._vrSupported = false;
-                    callback();
-                });
-            }
-            else {
-                // TODO: Browser does not support WebVR
-                this._vrDisplay = undefined;
-                this._vrSupported = false;
-                callback();
-            }
+                    res({
+                        vrDisplay: _this._vrDisplay,
+                        vrSupported: _this._vrSupported
+                    });
+                }
+            });
         };
         Engine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) {
             if (this._currentRenderTarget) {
@@ -51612,7 +51631,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {
@@ -79160,11 +79179,11 @@ 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.
+         * Gets the device distance from the ground in meters.
+         * @returns the distance in meters 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) {
+            if (this._standingMatrix) {
                 // Add standing matrix offset to get real offset from ground in room
                 this._standingMatrix.getTranslationToRef(this._workingVector);
                 return this._deviceRoomPosition.y + this._workingVector.y;
@@ -79180,28 +79199,35 @@ var BABYLON;
             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);
+            this.getEngine().initWebVRAsync().then(function (result) {
+                if (!result.vrDisplay || !result.vrDisplay.stageParameters || !result.vrDisplay.stageParameters.sittingToStandingTransform) {
+                    callback(false);
+                }
+                else {
+                    _this._standingMatrix = new BABYLON.Matrix();
+                    BABYLON.Matrix.FromFloat32ArrayToRefScaled(result.vrDisplay.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);
+                }
+            });
+        };
+        /**
+         * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.
+         * @returns A promise with a boolean set to if the standing matrix is supported.
+         */
+        WebVRFreeCamera.prototype.useStandingMatrixAsync = function () {
+            var _this = this;
+            return new Promise(function (res, rej) {
+                _this.useStandingMatrix(function (supported) {
+                    res(supported);
                 });
-            }
+            });
         };
         /**
          * Disposes the camera
@@ -80209,14 +80235,13 @@ var BABYLON;
         });
         Object.defineProperty(VRExperienceHelper.prototype, "gazeTrackerMesh", {
             /**
-             * The mesh used to display where the user is selecting.
+             * The mesh used to display where the user is selecting,
+             * when set bakeCurrentTransformIntoVertices will be called on the mesh.
+             * See http://doc.babylonjs.com/resources/baking_transformations
              */
             get: function () {
                 return this._gazeTracker;
             },
-            /**
-             * Sets the mesh to be used to display where the user is selecting.
-             */
             set: function (value) {
                 if (value) {
                     this._gazeTracker = value;
@@ -85557,6 +85582,7 @@ var BABYLON;
             this._waitingTasksCount = this._tasks.length;
             this._totalTasksCount = this._tasks.length;
             if (this._waitingTasksCount === 0) {
+                this._isLoading = false;
                 if (this.onFinish) {
                     this.onFinish(this._tasks);
                 }

File diff suppressed because it is too large
+ 51 - 51
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 7742 - 7729
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 52 - 52
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 75 - 49
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -11649,7 +11649,21 @@ var BABYLON;
         Engine.prototype.getVRDevice = function () {
             return this._vrDisplay;
         };
+        /**
+         * Initializes a webVR display and starts listening to display change events.
+         * The onVRDisplayChangedObservable will be notified upon these changes.
+         * @returns The onVRDisplayChangedObservable.
+         */
         Engine.prototype.initWebVR = function () {
+            this.initWebVRAsync();
+            return this.onVRDisplayChangedObservable;
+        };
+        /**
+         * Initializes a webVR display and starts listening to display change events.
+         * The onVRDisplayChangedObservable will be notified upon these changes.
+         * @returns A promise containing a VRDisplay and if vr is supported.
+         */
+        Engine.prototype.initWebVRAsync = function () {
             var _this = this;
             var notifyObservers = function () {
                 var eventArgs = {
@@ -11657,6 +11671,7 @@ var BABYLON;
                     vrSupported: _this._vrSupported
                 };
                 _this.onVRDisplayChangedObservable.notifyObservers(eventArgs);
+                _this._webVRInitPromise = new Promise(function (res) { res(eventArgs); });
             };
             if (!this._onVrDisplayConnect) {
                 this._onVrDisplayConnect = function (event) {
@@ -11676,8 +11691,9 @@ var BABYLON;
                 window.addEventListener('vrdisplaydisconnect', this._onVrDisplayDisconnect);
                 window.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);
             }
-            this._getVRDisplays(notifyObservers);
-            return this.onVRDisplayChangedObservable;
+            this._webVRInitPromise = this._webVRInitPromise || this._getVRDisplaysAsync();
+            this._webVRInitPromise.then(notifyObservers);
+            return this._webVRInitPromise;
         };
         Engine.prototype.enableVR = function () {
             var _this = this;
@@ -11698,27 +11714,30 @@ var BABYLON;
                 this._vrDisplay.exitPresent().then(this._onVRFullScreenTriggered).catch(this._onVRFullScreenTriggered);
             }
         };
-        Engine.prototype._getVRDisplays = function (callback) {
+        Engine.prototype._getVRDisplaysAsync = function () {
             var _this = this;
-            var getWebVRDevices = function (devices) {
-                _this._vrSupported = true;
-                // note that devices may actually be an empty array. This is fine;
-                // we expect this._vrDisplay to be undefined in this case.
-                return _this._vrDisplay = devices[0];
-            };
-            if (navigator.getVRDisplays) {
-                navigator.getVRDisplays().then(getWebVRDevices).then(callback).catch(function (error) {
-                    // TODO: System CANNOT support WebVR, despite API presence.
+            return new Promise(function (res, rej) {
+                if (navigator.getVRDisplays) {
+                    navigator.getVRDisplays().then(function (devices) {
+                        _this._vrSupported = true;
+                        // note that devices may actually be an empty array. This is fine;
+                        // we expect this._vrDisplay to be undefined in this case.
+                        _this._vrDisplay = devices[0];
+                        res({
+                            vrDisplay: _this._vrDisplay,
+                            vrSupported: _this._vrSupported
+                        });
+                    });
+                }
+                else {
+                    _this._vrDisplay = undefined;
                     _this._vrSupported = false;
-                    callback();
-                });
-            }
-            else {
-                // TODO: Browser does not support WebVR
-                this._vrDisplay = undefined;
-                this._vrSupported = false;
-                callback();
-            }
+                    res({
+                        vrDisplay: _this._vrDisplay,
+                        vrSupported: _this._vrSupported
+                    });
+                }
+            });
         };
         Engine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) {
             if (this._currentRenderTarget) {
@@ -51612,7 +51631,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {
@@ -78736,11 +78755,11 @@ 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.
+         * Gets the device distance from the ground in meters.
+         * @returns the distance in meters 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) {
+            if (this._standingMatrix) {
                 // Add standing matrix offset to get real offset from ground in room
                 this._standingMatrix.getTranslationToRef(this._workingVector);
                 return this._deviceRoomPosition.y + this._workingVector.y;
@@ -78756,28 +78775,35 @@ var BABYLON;
             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);
+            this.getEngine().initWebVRAsync().then(function (result) {
+                if (!result.vrDisplay || !result.vrDisplay.stageParameters || !result.vrDisplay.stageParameters.sittingToStandingTransform) {
+                    callback(false);
+                }
+                else {
+                    _this._standingMatrix = new BABYLON.Matrix();
+                    BABYLON.Matrix.FromFloat32ArrayToRefScaled(result.vrDisplay.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);
+                }
+            });
+        };
+        /**
+         * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.
+         * @returns A promise with a boolean set to if the standing matrix is supported.
+         */
+        WebVRFreeCamera.prototype.useStandingMatrixAsync = function () {
+            var _this = this;
+            return new Promise(function (res, rej) {
+                _this.useStandingMatrix(function (supported) {
+                    res(supported);
                 });
-            }
+            });
         };
         /**
          * Disposes the camera
@@ -79785,14 +79811,13 @@ var BABYLON;
         });
         Object.defineProperty(VRExperienceHelper.prototype, "gazeTrackerMesh", {
             /**
-             * The mesh used to display where the user is selecting.
+             * The mesh used to display where the user is selecting,
+             * when set bakeCurrentTransformIntoVertices will be called on the mesh.
+             * See http://doc.babylonjs.com/resources/baking_transformations
              */
             get: function () {
                 return this._gazeTracker;
             },
-            /**
-             * Sets the mesh to be used to display where the user is selecting.
-             */
             set: function (value) {
                 if (value) {
                     this._gazeTracker = value;
@@ -85133,6 +85158,7 @@ var BABYLON;
             this._waitingTasksCount = this._tasks.length;
             this._totalTasksCount = this._tasks.length;
             if (this._waitingTasksCount === 0) {
+                this._isLoading = false;
                 if (this.onFinish) {
                     this.onFinish(this._tasks);
                 }

+ 75 - 49
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -11635,7 +11635,21 @@ var BABYLON;
         Engine.prototype.getVRDevice = function () {
             return this._vrDisplay;
         };
+        /**
+         * Initializes a webVR display and starts listening to display change events.
+         * The onVRDisplayChangedObservable will be notified upon these changes.
+         * @returns The onVRDisplayChangedObservable.
+         */
         Engine.prototype.initWebVR = function () {
+            this.initWebVRAsync();
+            return this.onVRDisplayChangedObservable;
+        };
+        /**
+         * Initializes a webVR display and starts listening to display change events.
+         * The onVRDisplayChangedObservable will be notified upon these changes.
+         * @returns A promise containing a VRDisplay and if vr is supported.
+         */
+        Engine.prototype.initWebVRAsync = function () {
             var _this = this;
             var notifyObservers = function () {
                 var eventArgs = {
@@ -11643,6 +11657,7 @@ var BABYLON;
                     vrSupported: _this._vrSupported
                 };
                 _this.onVRDisplayChangedObservable.notifyObservers(eventArgs);
+                _this._webVRInitPromise = new Promise(function (res) { res(eventArgs); });
             };
             if (!this._onVrDisplayConnect) {
                 this._onVrDisplayConnect = function (event) {
@@ -11662,8 +11677,9 @@ var BABYLON;
                 window.addEventListener('vrdisplaydisconnect', this._onVrDisplayDisconnect);
                 window.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);
             }
-            this._getVRDisplays(notifyObservers);
-            return this.onVRDisplayChangedObservable;
+            this._webVRInitPromise = this._webVRInitPromise || this._getVRDisplaysAsync();
+            this._webVRInitPromise.then(notifyObservers);
+            return this._webVRInitPromise;
         };
         Engine.prototype.enableVR = function () {
             var _this = this;
@@ -11684,27 +11700,30 @@ var BABYLON;
                 this._vrDisplay.exitPresent().then(this._onVRFullScreenTriggered).catch(this._onVRFullScreenTriggered);
             }
         };
-        Engine.prototype._getVRDisplays = function (callback) {
+        Engine.prototype._getVRDisplaysAsync = function () {
             var _this = this;
-            var getWebVRDevices = function (devices) {
-                _this._vrSupported = true;
-                // note that devices may actually be an empty array. This is fine;
-                // we expect this._vrDisplay to be undefined in this case.
-                return _this._vrDisplay = devices[0];
-            };
-            if (navigator.getVRDisplays) {
-                navigator.getVRDisplays().then(getWebVRDevices).then(callback).catch(function (error) {
-                    // TODO: System CANNOT support WebVR, despite API presence.
+            return new Promise(function (res, rej) {
+                if (navigator.getVRDisplays) {
+                    navigator.getVRDisplays().then(function (devices) {
+                        _this._vrSupported = true;
+                        // note that devices may actually be an empty array. This is fine;
+                        // we expect this._vrDisplay to be undefined in this case.
+                        _this._vrDisplay = devices[0];
+                        res({
+                            vrDisplay: _this._vrDisplay,
+                            vrSupported: _this._vrSupported
+                        });
+                    });
+                }
+                else {
+                    _this._vrDisplay = undefined;
                     _this._vrSupported = false;
-                    callback();
-                });
-            }
-            else {
-                // TODO: Browser does not support WebVR
-                this._vrDisplay = undefined;
-                this._vrSupported = false;
-                callback();
-            }
+                    res({
+                        vrDisplay: _this._vrDisplay,
+                        vrSupported: _this._vrSupported
+                    });
+                }
+            });
         };
         Engine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) {
             if (this._currentRenderTarget) {
@@ -51598,7 +51617,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {
@@ -78722,11 +78741,11 @@ 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.
+         * Gets the device distance from the ground in meters.
+         * @returns the distance in meters 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) {
+            if (this._standingMatrix) {
                 // Add standing matrix offset to get real offset from ground in room
                 this._standingMatrix.getTranslationToRef(this._workingVector);
                 return this._deviceRoomPosition.y + this._workingVector.y;
@@ -78742,28 +78761,35 @@ var BABYLON;
             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);
+            this.getEngine().initWebVRAsync().then(function (result) {
+                if (!result.vrDisplay || !result.vrDisplay.stageParameters || !result.vrDisplay.stageParameters.sittingToStandingTransform) {
+                    callback(false);
+                }
+                else {
+                    _this._standingMatrix = new BABYLON.Matrix();
+                    BABYLON.Matrix.FromFloat32ArrayToRefScaled(result.vrDisplay.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);
+                }
+            });
+        };
+        /**
+         * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.
+         * @returns A promise with a boolean set to if the standing matrix is supported.
+         */
+        WebVRFreeCamera.prototype.useStandingMatrixAsync = function () {
+            var _this = this;
+            return new Promise(function (res, rej) {
+                _this.useStandingMatrix(function (supported) {
+                    res(supported);
                 });
-            }
+            });
         };
         /**
          * Disposes the camera
@@ -79771,14 +79797,13 @@ var BABYLON;
         });
         Object.defineProperty(VRExperienceHelper.prototype, "gazeTrackerMesh", {
             /**
-             * The mesh used to display where the user is selecting.
+             * The mesh used to display where the user is selecting,
+             * when set bakeCurrentTransformIntoVertices will be called on the mesh.
+             * See http://doc.babylonjs.com/resources/baking_transformations
              */
             get: function () {
                 return this._gazeTracker;
             },
-            /**
-             * Sets the mesh to be used to display where the user is selecting.
-             */
             set: function (value) {
                 if (value) {
                     this._gazeTracker = value;
@@ -85119,6 +85144,7 @@ var BABYLON;
             this._waitingTasksCount = this._tasks.length;
             this._totalTasksCount = this._tasks.length;
             if (this._waitingTasksCount === 0) {
+                this._isLoading = false;
                 if (this.onFinish) {
                     this.onFinish(this._tasks);
                 }

+ 75 - 49
dist/preview release/es6.js

@@ -11635,7 +11635,21 @@ var BABYLON;
         Engine.prototype.getVRDevice = function () {
             return this._vrDisplay;
         };
+        /**
+         * Initializes a webVR display and starts listening to display change events.
+         * The onVRDisplayChangedObservable will be notified upon these changes.
+         * @returns The onVRDisplayChangedObservable.
+         */
         Engine.prototype.initWebVR = function () {
+            this.initWebVRAsync();
+            return this.onVRDisplayChangedObservable;
+        };
+        /**
+         * Initializes a webVR display and starts listening to display change events.
+         * The onVRDisplayChangedObservable will be notified upon these changes.
+         * @returns A promise containing a VRDisplay and if vr is supported.
+         */
+        Engine.prototype.initWebVRAsync = function () {
             var _this = this;
             var notifyObservers = function () {
                 var eventArgs = {
@@ -11643,6 +11657,7 @@ var BABYLON;
                     vrSupported: _this._vrSupported
                 };
                 _this.onVRDisplayChangedObservable.notifyObservers(eventArgs);
+                _this._webVRInitPromise = new Promise(function (res) { res(eventArgs); });
             };
             if (!this._onVrDisplayConnect) {
                 this._onVrDisplayConnect = function (event) {
@@ -11662,8 +11677,9 @@ var BABYLON;
                 window.addEventListener('vrdisplaydisconnect', this._onVrDisplayDisconnect);
                 window.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);
             }
-            this._getVRDisplays(notifyObservers);
-            return this.onVRDisplayChangedObservable;
+            this._webVRInitPromise = this._webVRInitPromise || this._getVRDisplaysAsync();
+            this._webVRInitPromise.then(notifyObservers);
+            return this._webVRInitPromise;
         };
         Engine.prototype.enableVR = function () {
             var _this = this;
@@ -11684,27 +11700,30 @@ var BABYLON;
                 this._vrDisplay.exitPresent().then(this._onVRFullScreenTriggered).catch(this._onVRFullScreenTriggered);
             }
         };
-        Engine.prototype._getVRDisplays = function (callback) {
+        Engine.prototype._getVRDisplaysAsync = function () {
             var _this = this;
-            var getWebVRDevices = function (devices) {
-                _this._vrSupported = true;
-                // note that devices may actually be an empty array. This is fine;
-                // we expect this._vrDisplay to be undefined in this case.
-                return _this._vrDisplay = devices[0];
-            };
-            if (navigator.getVRDisplays) {
-                navigator.getVRDisplays().then(getWebVRDevices).then(callback).catch(function (error) {
-                    // TODO: System CANNOT support WebVR, despite API presence.
+            return new Promise(function (res, rej) {
+                if (navigator.getVRDisplays) {
+                    navigator.getVRDisplays().then(function (devices) {
+                        _this._vrSupported = true;
+                        // note that devices may actually be an empty array. This is fine;
+                        // we expect this._vrDisplay to be undefined in this case.
+                        _this._vrDisplay = devices[0];
+                        res({
+                            vrDisplay: _this._vrDisplay,
+                            vrSupported: _this._vrSupported
+                        });
+                    });
+                }
+                else {
+                    _this._vrDisplay = undefined;
                     _this._vrSupported = false;
-                    callback();
-                });
-            }
-            else {
-                // TODO: Browser does not support WebVR
-                this._vrDisplay = undefined;
-                this._vrSupported = false;
-                callback();
-            }
+                    res({
+                        vrDisplay: _this._vrDisplay,
+                        vrSupported: _this._vrSupported
+                    });
+                }
+            });
         };
         Engine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport) {
             if (this._currentRenderTarget) {
@@ -51598,7 +51617,7 @@ var BABYLON;
 
 
 
-//# sourceMappingURL=babylon.iParticleEmitterType.js.map
+//# sourceMappingURL=babylon.IParticleEmitterType.js.map
 
 var BABYLON;
 (function (BABYLON) {
@@ -79146,11 +79165,11 @@ 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.
+         * Gets the device distance from the ground in meters.
+         * @returns the distance in meters 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) {
+            if (this._standingMatrix) {
                 // Add standing matrix offset to get real offset from ground in room
                 this._standingMatrix.getTranslationToRef(this._workingVector);
                 return this._deviceRoomPosition.y + this._workingVector.y;
@@ -79166,28 +79185,35 @@ var BABYLON;
             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);
+            this.getEngine().initWebVRAsync().then(function (result) {
+                if (!result.vrDisplay || !result.vrDisplay.stageParameters || !result.vrDisplay.stageParameters.sittingToStandingTransform) {
+                    callback(false);
+                }
+                else {
+                    _this._standingMatrix = new BABYLON.Matrix();
+                    BABYLON.Matrix.FromFloat32ArrayToRefScaled(result.vrDisplay.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);
+                }
+            });
+        };
+        /**
+         * Enables the standing matrix when supported. This can be used to position the user's view the correct height from the ground.
+         * @returns A promise with a boolean set to if the standing matrix is supported.
+         */
+        WebVRFreeCamera.prototype.useStandingMatrixAsync = function () {
+            var _this = this;
+            return new Promise(function (res, rej) {
+                _this.useStandingMatrix(function (supported) {
+                    res(supported);
                 });
-            }
+            });
         };
         /**
          * Disposes the camera
@@ -80195,14 +80221,13 @@ var BABYLON;
         });
         Object.defineProperty(VRExperienceHelper.prototype, "gazeTrackerMesh", {
             /**
-             * The mesh used to display where the user is selecting.
+             * The mesh used to display where the user is selecting,
+             * when set bakeCurrentTransformIntoVertices will be called on the mesh.
+             * See http://doc.babylonjs.com/resources/baking_transformations
              */
             get: function () {
                 return this._gazeTracker;
             },
-            /**
-             * Sets the mesh to be used to display where the user is selecting.
-             */
             set: function (value) {
                 if (value) {
                     this._gazeTracker = value;
@@ -85543,6 +85568,7 @@ var BABYLON;
             this._waitingTasksCount = this._tasks.length;
             this._totalTasksCount = this._tasks.length;
             if (this._waitingTasksCount === 0) {
+                this._isLoading = false;
                 if (this.onFinish) {
                     this.onFinish(this._tasks);
                 }

File diff suppressed because it is too large
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


File diff suppressed because it is too large
+ 4 - 4
dist/preview release/inspector/babylon.inspector.bundle.js


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/materialsLibrary/babylonjs.materials.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


+ 2 - 58
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 7263,
+  "errors": 7253,
   "babylon.typedoc.json": {
-    "errors": 7263,
+    "errors": 7253,
     "AnimationKeyInterpolation": {
       "Enumeration": {
         "Comments": {
@@ -5733,13 +5733,6 @@
           }
         }
       },
-      "Property": {
-        "instanceDivisor": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      },
       "Method": {
         "_rebuild": {
           "Comments": {
@@ -5758,33 +5751,6 @@
             }
           }
         },
-        "createVertexBuffer": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "kind": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "offset": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "size": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "stride": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "dispose": {
           "Comments": {
             "MissingText": true
@@ -5800,11 +5766,6 @@
             "MissingText": true
           }
         },
-        "getIsInstanced": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
         "getStrideSize": {
           "Comments": {
             "MissingText": true
@@ -9733,18 +9694,6 @@
             }
           }
         },
-        "_getRGBABufferInternalSizedFormat": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "type": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "_getRGBAMultiSampleBufferFormat": {
           "Comments": {
             "MissingText": true
@@ -11439,11 +11388,6 @@
             "MissingText": true
           }
         },
-        "initWebVR": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
         "isDeterministicLockStep": {
           "Comments": {
             "MissingText": true

File diff suppressed because it is too large
+ 63 - 63
dist/preview release/viewer/babylon.viewer.js