David Catuhe 7 年之前
父節點
當前提交
3053188cdf

文件差異過大導致無法顯示
+ 12003 - 11998
Playground/babylon.d.txt


文件差異過大導致無法顯示
+ 12039 - 12033
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 40 - 40
dist/preview release/babylon.js


+ 54 - 44
dist/preview release/babylon.max.js

@@ -1380,6 +1380,10 @@ var BABYLON;
         __extends(PointerInfoPre, _super);
         function PointerInfoPre(type, event, localX, localY) {
             var _this = _super.call(this, type, event) || this;
+            /**
+             * Ray from a pointer if availible (eg. 6dof controller)
+             */
+            _this.ray = null;
             _this.skipOnPointerObservable = false;
             _this.localPosition = new BABYLON.Vector2(localX, localY);
             return _this;
@@ -25051,6 +25055,9 @@ var BABYLON;
          */
         Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {
             var evt = new PointerEvent("pointermove", pointerEventInit);
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERMOVE)) {
+                return this;
+            }
             return this._processPointerMove(pickResult, evt);
         };
         Scene.prototype._processPointerMove = function (pickResult, evt) {
@@ -25105,6 +25112,19 @@ var BABYLON;
             }
             return this;
         };
+        Scene.prototype._checkPrePointerObservable = function (pickResult, evt, type) {
+            var pi = new BABYLON.PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);
+            if (pickResult) {
+                pi.ray = pickResult.ray;
+            }
+            this.onPrePointerObservable.notifyObservers(pi, type);
+            if (pi.skipOnPointerObservable) {
+                return true;
+            }
+            else {
+                return false;
+            }
+        };
         /**
          * Use this method to simulate a pointer down on a mesh
          * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
@@ -25114,6 +25134,9 @@ var BABYLON;
          */
         Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {
             var evt = new PointerEvent("pointerdown", pointerEventInit);
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
+                return this;
+            }
             return this._processPointerDown(pickResult, evt);
         };
         Scene.prototype._processPointerDown = function (pickResult, evt) {
@@ -25177,6 +25200,9 @@ var BABYLON;
             var clickInfo = new ClickInfo();
             clickInfo.singleClick = true;
             clickInfo.ignore = true;
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERUP)) {
+                return this;
+            }
             return this._processPointerUp(pickResult, evt, clickInfo);
         };
         Scene.prototype._processPointerUp = function (pickResult, evt, clickInfo) {
@@ -25387,13 +25413,8 @@ var BABYLON;
             this._onPointerMove = function (evt) {
                 _this._updatePointerPosition(evt);
                 // PreObservable support
-                if (_this.onPrePointerObservable.hasObservers() && !_this._pointerCaptures[evt.pointerId]) {
-                    var type = evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE;
-                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                    if (pi.skipOnPointerObservable) {
-                        return;
-                    }
+                if (_this._checkPrePointerObservable(null, evt, evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE)) {
+                    return;
                 }
                 if (!_this.cameraToUseForPointers && !_this.activeCamera) {
                     return;
@@ -25415,13 +25436,8 @@ var BABYLON;
                     canvas.focus();
                 }
                 // PreObservable support
-                if (_this.onPrePointerObservable.hasObservers()) {
-                    var type = BABYLON.PointerEventTypes.POINTERDOWN;
-                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                    if (pi.skipOnPointerObservable) {
-                        return;
-                    }
+                if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
+                    return;
                 }
                 if (!_this.cameraToUseForPointers && !_this.activeCamera) {
                     return;
@@ -25478,28 +25494,19 @@ var BABYLON;
                         if (!clickInfo.ignore) {
                             if (!clickInfo.hasSwiped) {
                                 if (clickInfo.singleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERTAP)) {
-                                    var type = BABYLON.PointerEventTypes.POINTERTAP;
-                                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                                    if (pi.skipOnPointerObservable) {
+                                    if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERTAP)) {
                                         return;
                                     }
                                 }
                                 if (clickInfo.doubleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
-                                    var type = BABYLON.PointerEventTypes.POINTERDOUBLETAP;
-                                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                                    if (pi.skipOnPointerObservable) {
+                                    if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
                                         return;
                                     }
                                 }
                             }
                         }
                         else {
-                            var type = BABYLON.PointerEventTypes.POINTERUP;
-                            var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                            _this.onPrePointerObservable.notifyObservers(pi, type);
-                            if (pi.skipOnPointerObservable) {
+                            if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERUP)) {
                                 return;
                             }
                         }
@@ -27739,8 +27746,10 @@ var BABYLON;
         };
         /**
          * Render the scene
+         * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)
          */
-        Scene.prototype.render = function () {
+        Scene.prototype.render = function (updateCameras) {
+            if (updateCameras === void 0) { updateCameras = true; }
             if (this.isDisposed) {
                 return;
             }
@@ -27807,24 +27816,26 @@ var BABYLON;
                 this._gamepadManager._checkGamepadsStatus();
             }
             // Update Cameras
-            if (this.activeCameras.length > 0) {
-                for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
-                    var camera = this.activeCameras[cameraIndex];
-                    camera.update();
-                    if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                        // rig cameras
-                        for (var index = 0; index < camera._rigCameras.length; index++) {
-                            camera._rigCameras[index].update();
+            if (updateCameras) {
+                if (this.activeCameras.length > 0) {
+                    for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
+                        var camera = this.activeCameras[cameraIndex];
+                        camera.update();
+                        if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
+                            // rig cameras
+                            for (var index = 0; index < camera._rigCameras.length; index++) {
+                                camera._rigCameras[index].update();
+                            }
                         }
                     }
                 }
-            }
-            else if (this.activeCamera) {
-                this.activeCamera.update();
-                if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                    // rig cameras
-                    for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
-                        this.activeCamera._rigCameras[index].update();
+                else if (this.activeCamera) {
+                    this.activeCamera.update();
+                    if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
+                        // rig cameras
+                        for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
+                            this.activeCamera._rigCameras[index].update();
+                        }
                     }
                 }
             }
@@ -86803,7 +86814,6 @@ var BABYLON;
             this.utilityLayerScene = new BABYLON.Scene(originalScene.getEngine());
             originalScene.getEngine().scenes.pop();
             // Render directly on top of existing scene without clearing
-            this.utilityLayerScene.clearColor = new BABYLON.Color4(0, 0, 0, 0);
             this.utilityLayerScene.autoClear = false;
             this._afterRenderObserver = this.originalScene.onAfterRenderObservable.add(function () {
                 if (_this.shouldRender) {
@@ -86819,7 +86829,7 @@ var BABYLON;
          */
         UtilityLayerRenderer.prototype.render = function () {
             this._updateCamera();
-            this.utilityLayerScene.render();
+            this.utilityLayerScene.render(false);
         };
         /**
          * Disposes of the renderer

+ 54 - 44
dist/preview release/babylon.no-module.max.js

@@ -1347,6 +1347,10 @@ var BABYLON;
         __extends(PointerInfoPre, _super);
         function PointerInfoPre(type, event, localX, localY) {
             var _this = _super.call(this, type, event) || this;
+            /**
+             * Ray from a pointer if availible (eg. 6dof controller)
+             */
+            _this.ray = null;
             _this.skipOnPointerObservable = false;
             _this.localPosition = new BABYLON.Vector2(localX, localY);
             return _this;
@@ -25018,6 +25022,9 @@ var BABYLON;
          */
         Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {
             var evt = new PointerEvent("pointermove", pointerEventInit);
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERMOVE)) {
+                return this;
+            }
             return this._processPointerMove(pickResult, evt);
         };
         Scene.prototype._processPointerMove = function (pickResult, evt) {
@@ -25072,6 +25079,19 @@ var BABYLON;
             }
             return this;
         };
+        Scene.prototype._checkPrePointerObservable = function (pickResult, evt, type) {
+            var pi = new BABYLON.PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);
+            if (pickResult) {
+                pi.ray = pickResult.ray;
+            }
+            this.onPrePointerObservable.notifyObservers(pi, type);
+            if (pi.skipOnPointerObservable) {
+                return true;
+            }
+            else {
+                return false;
+            }
+        };
         /**
          * Use this method to simulate a pointer down on a mesh
          * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
@@ -25081,6 +25101,9 @@ var BABYLON;
          */
         Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {
             var evt = new PointerEvent("pointerdown", pointerEventInit);
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
+                return this;
+            }
             return this._processPointerDown(pickResult, evt);
         };
         Scene.prototype._processPointerDown = function (pickResult, evt) {
@@ -25144,6 +25167,9 @@ var BABYLON;
             var clickInfo = new ClickInfo();
             clickInfo.singleClick = true;
             clickInfo.ignore = true;
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERUP)) {
+                return this;
+            }
             return this._processPointerUp(pickResult, evt, clickInfo);
         };
         Scene.prototype._processPointerUp = function (pickResult, evt, clickInfo) {
@@ -25354,13 +25380,8 @@ var BABYLON;
             this._onPointerMove = function (evt) {
                 _this._updatePointerPosition(evt);
                 // PreObservable support
-                if (_this.onPrePointerObservable.hasObservers() && !_this._pointerCaptures[evt.pointerId]) {
-                    var type = evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE;
-                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                    if (pi.skipOnPointerObservable) {
-                        return;
-                    }
+                if (_this._checkPrePointerObservable(null, evt, evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE)) {
+                    return;
                 }
                 if (!_this.cameraToUseForPointers && !_this.activeCamera) {
                     return;
@@ -25382,13 +25403,8 @@ var BABYLON;
                     canvas.focus();
                 }
                 // PreObservable support
-                if (_this.onPrePointerObservable.hasObservers()) {
-                    var type = BABYLON.PointerEventTypes.POINTERDOWN;
-                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                    if (pi.skipOnPointerObservable) {
-                        return;
-                    }
+                if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
+                    return;
                 }
                 if (!_this.cameraToUseForPointers && !_this.activeCamera) {
                     return;
@@ -25445,28 +25461,19 @@ var BABYLON;
                         if (!clickInfo.ignore) {
                             if (!clickInfo.hasSwiped) {
                                 if (clickInfo.singleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERTAP)) {
-                                    var type = BABYLON.PointerEventTypes.POINTERTAP;
-                                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                                    if (pi.skipOnPointerObservable) {
+                                    if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERTAP)) {
                                         return;
                                     }
                                 }
                                 if (clickInfo.doubleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
-                                    var type = BABYLON.PointerEventTypes.POINTERDOUBLETAP;
-                                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                                    if (pi.skipOnPointerObservable) {
+                                    if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
                                         return;
                                     }
                                 }
                             }
                         }
                         else {
-                            var type = BABYLON.PointerEventTypes.POINTERUP;
-                            var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                            _this.onPrePointerObservable.notifyObservers(pi, type);
-                            if (pi.skipOnPointerObservable) {
+                            if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERUP)) {
                                 return;
                             }
                         }
@@ -27706,8 +27713,10 @@ var BABYLON;
         };
         /**
          * Render the scene
+         * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)
          */
-        Scene.prototype.render = function () {
+        Scene.prototype.render = function (updateCameras) {
+            if (updateCameras === void 0) { updateCameras = true; }
             if (this.isDisposed) {
                 return;
             }
@@ -27774,24 +27783,26 @@ var BABYLON;
                 this._gamepadManager._checkGamepadsStatus();
             }
             // Update Cameras
-            if (this.activeCameras.length > 0) {
-                for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
-                    var camera = this.activeCameras[cameraIndex];
-                    camera.update();
-                    if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                        // rig cameras
-                        for (var index = 0; index < camera._rigCameras.length; index++) {
-                            camera._rigCameras[index].update();
+            if (updateCameras) {
+                if (this.activeCameras.length > 0) {
+                    for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
+                        var camera = this.activeCameras[cameraIndex];
+                        camera.update();
+                        if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
+                            // rig cameras
+                            for (var index = 0; index < camera._rigCameras.length; index++) {
+                                camera._rigCameras[index].update();
+                            }
                         }
                     }
                 }
-            }
-            else if (this.activeCamera) {
-                this.activeCamera.update();
-                if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                    // rig cameras
-                    for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
-                        this.activeCamera._rigCameras[index].update();
+                else if (this.activeCamera) {
+                    this.activeCamera.update();
+                    if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
+                        // rig cameras
+                        for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
+                            this.activeCamera._rigCameras[index].update();
+                        }
                     }
                 }
             }
@@ -86770,7 +86781,6 @@ var BABYLON;
             this.utilityLayerScene = new BABYLON.Scene(originalScene.getEngine());
             originalScene.getEngine().scenes.pop();
             // Render directly on top of existing scene without clearing
-            this.utilityLayerScene.clearColor = new BABYLON.Color4(0, 0, 0, 0);
             this.utilityLayerScene.autoClear = false;
             this._afterRenderObserver = this.originalScene.onAfterRenderObservable.add(function () {
                 if (_this.shouldRender) {
@@ -86786,7 +86796,7 @@ var BABYLON;
          */
         UtilityLayerRenderer.prototype.render = function () {
             this._updateCamera();
-            this.utilityLayerScene.render();
+            this.utilityLayerScene.render(false);
         };
         /**
          * Disposes of the renderer

文件差異過大導致無法顯示
+ 40 - 40
dist/preview release/babylon.worker.js


+ 54 - 44
dist/preview release/es6.js

@@ -1347,6 +1347,10 @@ var BABYLON;
         __extends(PointerInfoPre, _super);
         function PointerInfoPre(type, event, localX, localY) {
             var _this = _super.call(this, type, event) || this;
+            /**
+             * Ray from a pointer if availible (eg. 6dof controller)
+             */
+            _this.ray = null;
             _this.skipOnPointerObservable = false;
             _this.localPosition = new BABYLON.Vector2(localX, localY);
             return _this;
@@ -25018,6 +25022,9 @@ var BABYLON;
          */
         Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {
             var evt = new PointerEvent("pointermove", pointerEventInit);
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERMOVE)) {
+                return this;
+            }
             return this._processPointerMove(pickResult, evt);
         };
         Scene.prototype._processPointerMove = function (pickResult, evt) {
@@ -25072,6 +25079,19 @@ var BABYLON;
             }
             return this;
         };
+        Scene.prototype._checkPrePointerObservable = function (pickResult, evt, type) {
+            var pi = new BABYLON.PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);
+            if (pickResult) {
+                pi.ray = pickResult.ray;
+            }
+            this.onPrePointerObservable.notifyObservers(pi, type);
+            if (pi.skipOnPointerObservable) {
+                return true;
+            }
+            else {
+                return false;
+            }
+        };
         /**
          * Use this method to simulate a pointer down on a mesh
          * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
@@ -25081,6 +25101,9 @@ var BABYLON;
          */
         Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {
             var evt = new PointerEvent("pointerdown", pointerEventInit);
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
+                return this;
+            }
             return this._processPointerDown(pickResult, evt);
         };
         Scene.prototype._processPointerDown = function (pickResult, evt) {
@@ -25144,6 +25167,9 @@ var BABYLON;
             var clickInfo = new ClickInfo();
             clickInfo.singleClick = true;
             clickInfo.ignore = true;
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERUP)) {
+                return this;
+            }
             return this._processPointerUp(pickResult, evt, clickInfo);
         };
         Scene.prototype._processPointerUp = function (pickResult, evt, clickInfo) {
@@ -25354,13 +25380,8 @@ var BABYLON;
             this._onPointerMove = function (evt) {
                 _this._updatePointerPosition(evt);
                 // PreObservable support
-                if (_this.onPrePointerObservable.hasObservers() && !_this._pointerCaptures[evt.pointerId]) {
-                    var type = evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE;
-                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                    if (pi.skipOnPointerObservable) {
-                        return;
-                    }
+                if (_this._checkPrePointerObservable(null, evt, evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE)) {
+                    return;
                 }
                 if (!_this.cameraToUseForPointers && !_this.activeCamera) {
                     return;
@@ -25382,13 +25403,8 @@ var BABYLON;
                     canvas.focus();
                 }
                 // PreObservable support
-                if (_this.onPrePointerObservable.hasObservers()) {
-                    var type = BABYLON.PointerEventTypes.POINTERDOWN;
-                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                    if (pi.skipOnPointerObservable) {
-                        return;
-                    }
+                if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
+                    return;
                 }
                 if (!_this.cameraToUseForPointers && !_this.activeCamera) {
                     return;
@@ -25445,28 +25461,19 @@ var BABYLON;
                         if (!clickInfo.ignore) {
                             if (!clickInfo.hasSwiped) {
                                 if (clickInfo.singleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERTAP)) {
-                                    var type = BABYLON.PointerEventTypes.POINTERTAP;
-                                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                                    if (pi.skipOnPointerObservable) {
+                                    if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERTAP)) {
                                         return;
                                     }
                                 }
                                 if (clickInfo.doubleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
-                                    var type = BABYLON.PointerEventTypes.POINTERDOUBLETAP;
-                                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                                    if (pi.skipOnPointerObservable) {
+                                    if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
                                         return;
                                     }
                                 }
                             }
                         }
                         else {
-                            var type = BABYLON.PointerEventTypes.POINTERUP;
-                            var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                            _this.onPrePointerObservable.notifyObservers(pi, type);
-                            if (pi.skipOnPointerObservable) {
+                            if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERUP)) {
                                 return;
                             }
                         }
@@ -27706,8 +27713,10 @@ var BABYLON;
         };
         /**
          * Render the scene
+         * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)
          */
-        Scene.prototype.render = function () {
+        Scene.prototype.render = function (updateCameras) {
+            if (updateCameras === void 0) { updateCameras = true; }
             if (this.isDisposed) {
                 return;
             }
@@ -27774,24 +27783,26 @@ var BABYLON;
                 this._gamepadManager._checkGamepadsStatus();
             }
             // Update Cameras
-            if (this.activeCameras.length > 0) {
-                for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
-                    var camera = this.activeCameras[cameraIndex];
-                    camera.update();
-                    if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                        // rig cameras
-                        for (var index = 0; index < camera._rigCameras.length; index++) {
-                            camera._rigCameras[index].update();
+            if (updateCameras) {
+                if (this.activeCameras.length > 0) {
+                    for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
+                        var camera = this.activeCameras[cameraIndex];
+                        camera.update();
+                        if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
+                            // rig cameras
+                            for (var index = 0; index < camera._rigCameras.length; index++) {
+                                camera._rigCameras[index].update();
+                            }
                         }
                     }
                 }
-            }
-            else if (this.activeCamera) {
-                this.activeCamera.update();
-                if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                    // rig cameras
-                    for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
-                        this.activeCamera._rigCameras[index].update();
+                else if (this.activeCamera) {
+                    this.activeCamera.update();
+                    if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
+                        // rig cameras
+                        for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
+                            this.activeCamera._rigCameras[index].update();
+                        }
                     }
                 }
             }
@@ -86770,7 +86781,6 @@ var BABYLON;
             this.utilityLayerScene = new BABYLON.Scene(originalScene.getEngine());
             originalScene.getEngine().scenes.pop();
             // Render directly on top of existing scene without clearing
-            this.utilityLayerScene.clearColor = new BABYLON.Color4(0, 0, 0, 0);
             this.utilityLayerScene.autoClear = false;
             this._afterRenderObserver = this.originalScene.onAfterRenderObservable.add(function () {
                 if (_this.shouldRender) {
@@ -86786,7 +86796,7 @@ var BABYLON;
          */
         UtilityLayerRenderer.prototype.render = function () {
             this._updateCamera();
-            this.utilityLayerScene.render();
+            this.utilityLayerScene.render(false);
         };
         /**
          * Disposes of the renderer

+ 2 - 3
dist/preview release/gui/babylon.gui.d.ts

@@ -995,7 +995,7 @@ declare module BABYLON.GUI {
          * @param scene
          */
         constructor(scene?: Scene);
-        private _doPicking(type, pointerEvent);
+        private _doPicking(type, pointerEvent, ray?);
         /**
          * Gets the root container
          */
@@ -1214,7 +1214,7 @@ declare module BABYLON.GUI {
          * Node creation.
          * Can be overriden by children
          * @param scene defines the scene where the node must be attached
-         * @returns the attached node or null if none
+         * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
          */
         protected _createNode(scene: Scene): Nullable<TransformNode>;
         /**
@@ -1332,7 +1332,6 @@ declare module BABYLON.GUI {
         private _backFluentMaterial;
         private _frontFluentMaterial;
         private _text;
-        private _imageUrl;
         /**
          * Gets or sets text for the button
          */

+ 9 - 5
dist/preview release/gui/babylon.gui.js

@@ -5643,7 +5643,7 @@ var BABYLON;
                     if (!camera) {
                         return;
                     }
-                    pi.skipOnPointerObservable = _this._doPicking(pi.type, pointerEvent);
+                    pi.skipOnPointerObservable = _this._doPicking(pi.type, pointerEvent, pi.ray);
                 });
                 // Scene
                 this._utilityLayer.utilityLayerScene.autoClear = false;
@@ -5665,14 +5665,14 @@ var BABYLON;
                 enumerable: true,
                 configurable: true
             });
-            GUI3DManager.prototype._doPicking = function (type, pointerEvent) {
+            GUI3DManager.prototype._doPicking = function (type, pointerEvent, ray) {
                 if (!this._utilityLayer || !this._utilityLayer.utilityLayerScene.activeCamera) {
                     return false;
                 }
                 var pointerId = pointerEvent.pointerId || 0;
                 var buttonIndex = pointerEvent.button;
                 var utilityScene = this._utilityLayer.utilityLayerScene;
-                var pickingInfo = utilityScene.pick(this._scene.pointerX, this._scene.pointerY);
+                var pickingInfo = ray ? utilityScene.pickWithRay(ray) : utilityScene.pick(this._scene.pointerX, this._scene.pointerY);
                 if (!pickingInfo || !pickingInfo.hit) {
                     var previousControlOver = this._lastControlOver[pointerId];
                     if (previousControlOver) {
@@ -6214,7 +6214,7 @@ var BABYLON;
              * Node creation.
              * Can be overriden by children
              * @param scene defines the scene where the node must be attached
-             * @returns the attached node or null if none
+             * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
              */
             Control3D.prototype._createNode = function (scene) {
                 // Do nothing by default
@@ -6573,6 +6573,7 @@ var BABYLON;
                 return _this;
             }
             Object.defineProperty(HolographicButton.prototype, "text", {
+                // private _imageUrl: string;
                 /**
                  * Gets or sets text for the button
                  */
@@ -6682,11 +6683,14 @@ var BABYLON;
                     return this._isVertical;
                 },
                 set: function (value) {
+                    var _this = this;
                     if (this._isVertical === value) {
                         return;
                     }
                     this._isVertical = value;
-                    this._arrangeChildren();
+                    BABYLON.Tools.SetImmediate(function () {
+                        _this._arrangeChildren();
+                    });
                 },
                 enumerable: true,
                 configurable: true

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


+ 2 - 3
dist/preview release/gui/babylon.gui.module.d.ts

@@ -1000,7 +1000,7 @@ declare module BABYLON.GUI {
          * @param scene
          */
         constructor(scene?: Scene);
-        private _doPicking(type, pointerEvent);
+        private _doPicking(type, pointerEvent, ray?);
         /**
          * Gets the root container
          */
@@ -1219,7 +1219,7 @@ declare module BABYLON.GUI {
          * Node creation.
          * Can be overriden by children
          * @param scene defines the scene where the node must be attached
-         * @returns the attached node or null if none
+         * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
          */
         protected _createNode(scene: Scene): Nullable<TransformNode>;
         /**
@@ -1337,7 +1337,6 @@ declare module BABYLON.GUI {
         private _backFluentMaterial;
         private _frontFluentMaterial;
         private _text;
-        private _imageUrl;
         /**
          * Gets or sets text for the button
          */

+ 6 - 3
dist/preview release/viewer/babylon.viewer.d.ts

@@ -969,7 +969,7 @@ declare module BabylonViewer {
             skybox?: boolean | ISkyboxConfiguration;
             ground?: boolean | IGroundConfiguration;
             lights?: {
-                    [name: string]: boolean | ILightConfiguration;
+                    [name: string]: number | boolean | ILightConfiguration;
             };
             engine?: {
                     renderInBackground?: boolean;
@@ -1035,6 +1035,7 @@ declare module BabylonViewer {
                             tintLevel: number;
                     };
                     defaultRenderingPipelines?: boolean | IDefaultRenderingPipelineConfiguration;
+                    globalLightRotation?: number;
             };
     }
     /**
@@ -1751,7 +1752,7 @@ declare module BabylonViewer {
                 * Will notify after the lights were configured. Can be used to further configure lights
                 */
             onLightsConfiguredObservable: BABYLON.Observable<IPostConfigurationCallback<Array<BABYLON.Light>, {
-                    [name: string]: ILightConfiguration | boolean;
+                    [name: string]: ILightConfiguration | boolean | number;
             }>>;
             /**
                 * Will notify after the model(s) were configured. Can be used to further configure models
@@ -1866,7 +1867,7 @@ declare module BabylonViewer {
                 * @param model optionally use the model to configure the camera.
                 */
             protected _configureLights(lightsConfiguration?: {
-                    [name: string]: ILightConfiguration | boolean;
+                    [name: string]: ILightConfiguration | boolean | number;
             }): void;
             /**
                 * Gets the shadow map blur kernel according to the light configuration.
@@ -1951,6 +1952,7 @@ declare module BabylonViewer {
 declare module BabylonViewer {
     
     
+    
     /**
         * The ViewerLabs class will hold functions that are not (!) backwards compatible.
         * The APIs in all labs-related classes and configuration  might change.
@@ -1995,6 +1997,7 @@ declare module BabylonViewer {
                 * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
                 */
             getAssetUrl(url: string): string;
+            rotateShadowLight(shadowLight: BABYLON.ShadowLight, amount: number, point?: BABYLON.Vector3, axis?: BABYLON.Vector3, target?: BABYLON.Vector3): void;
     }
 }
 

文件差異過大導致無法顯示
+ 19 - 19
dist/preview release/viewer/babylon.viewer.js


+ 106 - 60
dist/preview release/viewer/babylon.viewer.max.js

@@ -1468,6 +1468,10 @@ var BABYLON;
         __extends(PointerInfoPre, _super);
         function PointerInfoPre(type, event, localX, localY) {
             var _this = _super.call(this, type, event) || this;
+            /**
+             * Ray from a pointer if availible (eg. 6dof controller)
+             */
+            _this.ray = null;
             _this.skipOnPointerObservable = false;
             _this.localPosition = new BABYLON.Vector2(localX, localY);
             return _this;
@@ -25139,6 +25143,9 @@ var BABYLON;
          */
         Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {
             var evt = new PointerEvent("pointermove", pointerEventInit);
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERMOVE)) {
+                return this;
+            }
             return this._processPointerMove(pickResult, evt);
         };
         Scene.prototype._processPointerMove = function (pickResult, evt) {
@@ -25193,6 +25200,19 @@ var BABYLON;
             }
             return this;
         };
+        Scene.prototype._checkPrePointerObservable = function (pickResult, evt, type) {
+            var pi = new BABYLON.PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);
+            if (pickResult) {
+                pi.ray = pickResult.ray;
+            }
+            this.onPrePointerObservable.notifyObservers(pi, type);
+            if (pi.skipOnPointerObservable) {
+                return true;
+            }
+            else {
+                return false;
+            }
+        };
         /**
          * Use this method to simulate a pointer down on a mesh
          * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
@@ -25202,6 +25222,9 @@ var BABYLON;
          */
         Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {
             var evt = new PointerEvent("pointerdown", pointerEventInit);
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
+                return this;
+            }
             return this._processPointerDown(pickResult, evt);
         };
         Scene.prototype._processPointerDown = function (pickResult, evt) {
@@ -25265,6 +25288,9 @@ var BABYLON;
             var clickInfo = new ClickInfo();
             clickInfo.singleClick = true;
             clickInfo.ignore = true;
+            if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERUP)) {
+                return this;
+            }
             return this._processPointerUp(pickResult, evt, clickInfo);
         };
         Scene.prototype._processPointerUp = function (pickResult, evt, clickInfo) {
@@ -25475,13 +25501,8 @@ var BABYLON;
             this._onPointerMove = function (evt) {
                 _this._updatePointerPosition(evt);
                 // PreObservable support
-                if (_this.onPrePointerObservable.hasObservers() && !_this._pointerCaptures[evt.pointerId]) {
-                    var type = evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE;
-                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                    if (pi.skipOnPointerObservable) {
-                        return;
-                    }
+                if (_this._checkPrePointerObservable(null, evt, evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE)) {
+                    return;
                 }
                 if (!_this.cameraToUseForPointers && !_this.activeCamera) {
                     return;
@@ -25503,13 +25524,8 @@ var BABYLON;
                     canvas.focus();
                 }
                 // PreObservable support
-                if (_this.onPrePointerObservable.hasObservers()) {
-                    var type = BABYLON.PointerEventTypes.POINTERDOWN;
-                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                    if (pi.skipOnPointerObservable) {
-                        return;
-                    }
+                if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
+                    return;
                 }
                 if (!_this.cameraToUseForPointers && !_this.activeCamera) {
                     return;
@@ -25566,28 +25582,19 @@ var BABYLON;
                         if (!clickInfo.ignore) {
                             if (!clickInfo.hasSwiped) {
                                 if (clickInfo.singleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERTAP)) {
-                                    var type = BABYLON.PointerEventTypes.POINTERTAP;
-                                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                                    if (pi.skipOnPointerObservable) {
+                                    if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERTAP)) {
                                         return;
                                     }
                                 }
                                 if (clickInfo.doubleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
-                                    var type = BABYLON.PointerEventTypes.POINTERDOUBLETAP;
-                                    var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                                    _this.onPrePointerObservable.notifyObservers(pi, type);
-                                    if (pi.skipOnPointerObservable) {
+                                    if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
                                         return;
                                     }
                                 }
                             }
                         }
                         else {
-                            var type = BABYLON.PointerEventTypes.POINTERUP;
-                            var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
-                            _this.onPrePointerObservable.notifyObservers(pi, type);
-                            if (pi.skipOnPointerObservable) {
+                            if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERUP)) {
                                 return;
                             }
                         }
@@ -27827,8 +27834,10 @@ var BABYLON;
         };
         /**
          * Render the scene
+         * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)
          */
-        Scene.prototype.render = function () {
+        Scene.prototype.render = function (updateCameras) {
+            if (updateCameras === void 0) { updateCameras = true; }
             if (this.isDisposed) {
                 return;
             }
@@ -27895,24 +27904,26 @@ var BABYLON;
                 this._gamepadManager._checkGamepadsStatus();
             }
             // Update Cameras
-            if (this.activeCameras.length > 0) {
-                for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
-                    var camera = this.activeCameras[cameraIndex];
-                    camera.update();
-                    if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                        // rig cameras
-                        for (var index = 0; index < camera._rigCameras.length; index++) {
-                            camera._rigCameras[index].update();
+            if (updateCameras) {
+                if (this.activeCameras.length > 0) {
+                    for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
+                        var camera = this.activeCameras[cameraIndex];
+                        camera.update();
+                        if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
+                            // rig cameras
+                            for (var index = 0; index < camera._rigCameras.length; index++) {
+                                camera._rigCameras[index].update();
+                            }
                         }
                     }
                 }
-            }
-            else if (this.activeCamera) {
-                this.activeCamera.update();
-                if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                    // rig cameras
-                    for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
-                        this.activeCamera._rigCameras[index].update();
+                else if (this.activeCamera) {
+                    this.activeCamera.update();
+                    if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
+                        // rig cameras
+                        for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
+                            this.activeCamera._rigCameras[index].update();
+                        }
                     }
                 }
             }
@@ -86891,7 +86902,6 @@ var BABYLON;
             this.utilityLayerScene = new BABYLON.Scene(originalScene.getEngine());
             originalScene.getEngine().scenes.pop();
             // Render directly on top of existing scene without clearing
-            this.utilityLayerScene.clearColor = new BABYLON.Color4(0, 0, 0, 0);
             this.utilityLayerScene.autoClear = false;
             this._afterRenderObserver = this.originalScene.onAfterRenderObservable.add(function () {
                 if (_this.shouldRender) {
@@ -86907,7 +86917,7 @@ var BABYLON;
          */
         UtilityLayerRenderer.prototype.render = function () {
             this._updateCamera();
-            this.utilityLayerScene.render();
+            this.utilityLayerScene.render(false);
         };
         /**
          * Disposes of the renderer
@@ -108622,6 +108632,7 @@ var SceneManager = /** @class */ (function () {
         this._mainColor = babylonjs_1.Color3.White();
         this._reflectionColor = babylonjs_1.Color3.White();
         this._white = babylonjs_1.Color3.White();
+        this._forceShadowUpdate = false;
         this._processShadows = true;
         this._groundEnabled = true;
         this._groundMirrorEnabled = true;
@@ -108640,6 +108651,10 @@ var SceneManager = /** @class */ (function () {
             _this.camera.alpha = (_this._viewer.configuration.camera && _this._viewer.configuration.camera.alpha) || _this.camera.alpha;
             _this.camera.beta = (_this._viewer.configuration.camera && _this._viewer.configuration.camera.beta) || _this.camera.beta;
             _this.camera.radius = (_this._viewer.configuration.camera && _this._viewer.configuration.camera.radius) || _this.camera.radius;
+            /*this.scene.lights.filter(light => light instanceof ShadowLight).forEach(light => {
+                // casting ais safe, due to the constraints tested before
+                (<ShadowLight>light).setDirectionToTarget(center);
+            });*/
         };
         this._cameraBehaviorMapping = {};
         this.models = [];
@@ -108669,9 +108684,10 @@ var SceneManager = /** @class */ (function () {
                 }
             };
             scene.registerBeforeRender(function () {
-                if (scene.animatables && scene.animatables.length > 0) {
+                if (_this._forceShadowUpdate || (scene.animatables && scene.animatables.length > 0)) {
                     // make sure all models are loaded
                     updateShadows();
+                    _this._forceShadowUpdate = false;
                 }
                 else if (!(_this.models.every(function (model) {
                     if (!model.shadowsRenderedAfterLoad) {
@@ -108958,6 +108974,14 @@ var SceneManager = /** @class */ (function () {
                 var mainColor = new babylonjs_1.Color3().copyFrom(newConfiguration.lab.environmentMainColor);
                 this.environmentHelper.setMainColor(mainColor);
             }
+            if (newConfiguration.lab.globalLightRotation !== undefined) {
+                // rotate all lights that are shadow lights
+                this.scene.lights.filter(function (light) { return light instanceof babylonjs_1.ShadowLight; }).forEach(function (light) {
+                    // casting and '!' are safe, due to the constraints tested before
+                    _this.labs.rotateShadowLight(light, newConfiguration.lab.globalLightRotation);
+                });
+                this._forceShadowUpdate = true;
+            }
         }
         if (this._defaultRenderingPipeline && this._defaultRenderingPipeline.imageProcessing) {
             this._defaultRenderingPipeline.imageProcessing.fromLinearSpace = true;
@@ -109282,7 +109306,7 @@ var SceneManager = /** @class */ (function () {
         if (this.scene.imageProcessingConfiguration) {
             this.scene.imageProcessingConfiguration.colorCurvesEnabled = true;
             this.scene.imageProcessingConfiguration.vignetteEnabled = true;
-            this.scene.imageProcessingConfiguration.toneMappingEnabled = !!cameraConfig.toneMappingEnabled;
+            this.scene.imageProcessingConfiguration.toneMappingEnabled = !!configuration_1.getConfigurationKey("camera.toneMappingEnabled", this._viewer.configuration);
         }
         helper_1.extendClassWithConfig(this.camera, cameraConfig);
         this.onCameraConfiguredObservable.notifyObservers({
@@ -109452,7 +109476,8 @@ var SceneManager = /** @class */ (function () {
         var _this = this;
         if (lightsConfiguration === void 0) { lightsConfiguration = {}; }
         // sanity check!
-        if (!Object.keys(lightsConfiguration).length) {
+        var lightKeys = Object.keys(lightsConfiguration).filter(function (name) { return name !== 'globalRotation'; });
+        if (!lightKeys.length) {
             if (!this.scene.lights.length)
                 this.scene.createDefaultLight(true);
         }
@@ -109467,11 +109492,14 @@ var SceneManager = /** @class */ (function () {
                     }
                 });
             }
-            Object.keys(lightsConfiguration).forEach(function (name, idx) {
+            lightKeys.forEach(function (name, idx) {
                 var lightConfig = { type: 0 };
                 if (typeof lightsConfiguration[name] === 'object') {
                     lightConfig = lightsConfiguration[name];
                 }
+                if (typeof lightsConfiguration[name] === 'number') {
+                    lightConfig.type = lightsConfiguration[name];
+                }
                 lightConfig.name = name;
                 var light;
                 // light is not already available
@@ -109484,6 +109512,9 @@ var SceneManager = /** @class */ (function () {
                 else {
                     // available? get it from the scene
                     light = _this.scene.getLightByName(name);
+                    if (typeof lightsConfiguration[name] === 'boolean') {
+                        lightConfig.type = light.getTypeID();
+                    }
                     lightsAvailable_1 = lightsAvailable_1.filter(function (ln) { return ln !== name; });
                     if (lightConfig.type !== undefined && light.getTypeID() !== lightConfig.type) {
                         light.dispose();
@@ -110043,15 +110074,15 @@ var ViewerLabs = /** @class */ (function () {
         this.environment = {
             //irradiance
             irradiancePolynomialCoefficients: {
-                x: new BABYLON.Vector3(0, 0, 0),
-                y: new BABYLON.Vector3(0, 0, 0),
-                z: new BABYLON.Vector3(0, 0, 0),
-                xx: new BABYLON.Vector3(0, 0, 0),
-                yy: new BABYLON.Vector3(0, 0, 0),
-                zz: new BABYLON.Vector3(0, 0, 0),
-                yz: new BABYLON.Vector3(0, 0, 0),
-                zx: new BABYLON.Vector3(0, 0, 0),
-                xy: new BABYLON.Vector3(0, 0, 0)
+                x: new babylonjs_1.Vector3(0, 0, 0),
+                y: new babylonjs_1.Vector3(0, 0, 0),
+                z: new babylonjs_1.Vector3(0, 0, 0),
+                xx: new babylonjs_1.Vector3(0, 0, 0),
+                yy: new babylonjs_1.Vector3(0, 0, 0),
+                zz: new babylonjs_1.Vector3(0, 0, 0),
+                yz: new babylonjs_1.Vector3(0, 0, 0),
+                zx: new babylonjs_1.Vector3(0, 0, 0),
+                xy: new babylonjs_1.Vector3(0, 0, 0)
             },
             textureIntensityScale: 1.0
         };
@@ -110092,7 +110123,7 @@ var ViewerLabs = /** @class */ (function () {
         if (!this.environment)
             return;
         //set orientation
-        var rotatquatRotationionY = babylonjs_1.Quaternion.RotationAxis(BABYLON.Axis.Y, rotationY || 0);
+        var rotatquatRotationionY = babylonjs_1.Quaternion.RotationAxis(babylonjs_1.Axis.Y, rotationY || 0);
         // Add env texture to the scene.
         if (this.environment.specularTexture) {
             // IE crashes when disposing the old texture and setting a new one
@@ -110103,7 +110134,7 @@ var ViewerLabs = /** @class */ (function () {
                 this._sceneManager.scene.environmentTexture.level = this.environment.textureIntensityScale;
                 this._sceneManager.scene.environmentTexture.invertZ = true;
                 this._sceneManager.scene.environmentTexture.lodLevelInAlpha = true;
-                var poly = this._sceneManager.scene.environmentTexture.sphericalPolynomial || new BABYLON.SphericalPolynomial();
+                var poly = this._sceneManager.scene.environmentTexture.sphericalPolynomial || new babylonjs_1.SphericalPolynomial();
                 poly.x = this.environment.irradiancePolynomialCoefficients.x;
                 poly.y = this.environment.irradiancePolynomialCoefficients.y;
                 poly.z = this.environment.irradiancePolynomialCoefficients.z;
@@ -110115,7 +110146,7 @@ var ViewerLabs = /** @class */ (function () {
                 poly.zz = this.environment.irradiancePolynomialCoefficients.zz;
                 this._sceneManager.scene.environmentTexture.sphericalPolynomial = poly;
                 //set orientation
-                BABYLON.Matrix.FromQuaternionToRef(rotatquatRotationionY, this._sceneManager.scene.environmentTexture.getReflectionTextureMatrix());
+                babylonjs_1.Matrix.FromQuaternionToRef(rotatquatRotationionY, this._sceneManager.scene.environmentTexture.getReflectionTextureMatrix());
             }
         }
     };
@@ -110135,6 +110166,21 @@ var ViewerLabs = /** @class */ (function () {
         }
         return returnUrl;
     };
+    ViewerLabs.prototype.rotateShadowLight = function (shadowLight, amount, point, axis, target) {
+        if (point === void 0) { point = babylonjs_1.Vector3.Zero(); }
+        if (axis === void 0) { axis = babylonjs_1.Axis.Y; }
+        if (target === void 0) { target = babylonjs_1.Vector3.Zero(); }
+        axis.normalize();
+        point.subtractToRef(shadowLight.position, babylonjs_1.Tmp.Vector3[0]);
+        babylonjs_1.Matrix.TranslationToRef(babylonjs_1.Tmp.Vector3[0].x, babylonjs_1.Tmp.Vector3[0].y, babylonjs_1.Tmp.Vector3[0].z, babylonjs_1.Tmp.Matrix[0]);
+        babylonjs_1.Tmp.Matrix[0].invertToRef(babylonjs_1.Tmp.Matrix[2]);
+        babylonjs_1.Matrix.RotationAxisToRef(axis, amount, babylonjs_1.Tmp.Matrix[1]);
+        babylonjs_1.Tmp.Matrix[2].multiplyToRef(babylonjs_1.Tmp.Matrix[1], babylonjs_1.Tmp.Matrix[2]);
+        babylonjs_1.Tmp.Matrix[2].multiplyToRef(babylonjs_1.Tmp.Matrix[0], babylonjs_1.Tmp.Matrix[2]);
+        babylonjs_1.Tmp.Matrix[2].decompose(babylonjs_1.Tmp.Vector3[0], babylonjs_1.Tmp.Quaternion[0], babylonjs_1.Tmp.Vector3[1]);
+        shadowLight.position.addInPlace(babylonjs_1.Tmp.Vector3[1]);
+        shadowLight.setDirectionToTarget(target);
+    };
     return ViewerLabs;
 }());
 exports.ViewerLabs = ViewerLabs;

+ 6 - 3
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -969,7 +969,7 @@ declare module 'babylonjs-viewer/configuration/configuration' {
             skybox?: boolean | ISkyboxConfiguration;
             ground?: boolean | IGroundConfiguration;
             lights?: {
-                    [name: string]: boolean | ILightConfiguration;
+                    [name: string]: number | boolean | ILightConfiguration;
             };
             engine?: {
                     renderInBackground?: boolean;
@@ -1035,6 +1035,7 @@ declare module 'babylonjs-viewer/configuration/configuration' {
                             tintLevel: number;
                     };
                     defaultRenderingPipelines?: boolean | IDefaultRenderingPipelineConfiguration;
+                    globalLightRotation?: number;
             };
     }
     /**
@@ -1751,7 +1752,7 @@ declare module 'babylonjs-viewer/viewer/sceneManager' {
                 * Will notify after the lights were configured. Can be used to further configure lights
                 */
             onLightsConfiguredObservable: Observable<IPostConfigurationCallback<Array<Light>, {
-                    [name: string]: ILightConfiguration | boolean;
+                    [name: string]: ILightConfiguration | boolean | number;
             }>>;
             /**
                 * Will notify after the model(s) were configured. Can be used to further configure models
@@ -1866,7 +1867,7 @@ declare module 'babylonjs-viewer/viewer/sceneManager' {
                 * @param model optionally use the model to configure the camera.
                 */
             protected _configureLights(lightsConfiguration?: {
-                    [name: string]: ILightConfiguration | boolean;
+                    [name: string]: ILightConfiguration | boolean | number;
             }): void;
             /**
                 * Gets the shadow map blur kernel according to the light configuration.
@@ -1980,6 +1981,7 @@ declare module 'babylonjs-viewer/eventManager' {
 declare module 'babylonjs-viewer/labs/viewerLabs' {
     import { PBREnvironment } from "babylonjs-viewer/labs/environmentSerializer";
     import { SceneManager } from 'babylonjs-viewer/viewer/sceneManager';
+    import { ShadowLight, Vector3 } from 'babylonjs';
     /**
         * The ViewerLabs class will hold functions that are not (!) backwards compatible.
         * The APIs in all labs-related classes and configuration  might change.
@@ -2024,6 +2026,7 @@ declare module 'babylonjs-viewer/labs/viewerLabs' {
                 * @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
                 */
             getAssetUrl(url: string): string;
+            rotateShadowLight(shadowLight: ShadowLight, amount: number, point?: Vector3, axis?: Vector3, target?: Vector3): void;
     }
 }
 

+ 1 - 1
src/babylon.scene.ts

@@ -4716,7 +4716,7 @@
 
         /** 
          * Render the scene
-         * @param updateCamerasd defines a boolean indicating if cameras must update according to their inputs (true by default)
+         * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)
          */
         public render(updateCameras = true): void {
             if (this.isDisposed) {