瀏覽代碼

Merge remote-tracking branch 'upstream/master'

sebastien 7 年之前
父節點
當前提交
c1ecc8c595

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


+ 2 - 2
Playground/indexStable.html

@@ -40,7 +40,7 @@
         <!-- Monaco -->
         <script src="node_modules/monaco-editor/min/vs/loader.js"></script>
         <!-- Babylon.js -->
-        <script src="https://cdn.babylonjs.com/babylon.js"></script>
+        <script src="https://cdn.babylonjs.com/babylon.max.js"></script>
         <script src="https://cdn.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
 
         <script src="https://cdn.babylonjs.com/loaders/babylon.glTFFileLoader.js"></script>
@@ -471,4 +471,4 @@
         </script>        
     </body>
 
-</html>
+</html>

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


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


+ 151 - 107
dist/preview release/babylon.max.js

@@ -17651,6 +17651,12 @@ var BABYLON;
             this._currentRenderId = -1;
             this._parentRenderId = -1;
             this._childRenderId = -1;
+            /** @hidden */
+            this._worldMatrixWasUpdated = false;
+            /** @hidden */
+            this._worldMatrix = BABYLON.Matrix.Zero();
+            /** @hidden */
+            this._worldMatrixDeterminant = 0;
             this._animationPropertiesOverride = null;
             /**
             * An event triggered when the mesh is disposed
@@ -17855,16 +17861,30 @@ var BABYLON;
             return null;
         };
         /**
-         * Returns the world matrix of the node
-         * @returns a matrix containing the node's world matrix
+         * Returns the latest update of the World matrix
+         * @returns a Matrix
          */
         Node.prototype.getWorldMatrix = function () {
-            return BABYLON.Matrix.Identity();
+            if (this._currentRenderId !== this.getScene().getRenderId()) {
+                this.computeWorldMatrix();
+            }
+            return this._worldMatrix;
         };
         /** @hidden */
         Node.prototype._getWorldMatrixDeterminant = function () {
-            return 1;
+            return this._worldMatrixDeterminant;
         };
+        Object.defineProperty(Node.prototype, "worldMatrixFromCache", {
+            /**
+             * Returns directly the latest state of the mesh World matrix.
+             * A Matrix is returned.
+             */
+            get: function () {
+                return this._worldMatrix;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // override it in derived class if you add new variables to the cache
         // and call the parent class method
         /** @hidden */
@@ -17891,34 +17911,37 @@ var BABYLON;
         };
         /** @hidden */
         Node.prototype._markSyncedWithParent = function () {
-            if (this.parent) {
-                this._parentRenderId = this.parent._childRenderId;
+            if (this._parentNode) {
+                this._parentRenderId = this._parentNode._childRenderId;
             }
         };
         /** @hidden */
         Node.prototype.isSynchronizedWithParent = function () {
-            if (!this.parent) {
+            if (!this._parentNode) {
                 return true;
             }
-            if (this._parentRenderId !== this.parent._childRenderId) {
+            if (this._parentRenderId !== this._parentNode._childRenderId) {
                 return false;
             }
-            return this.parent.isSynchronized();
+            return this._parentNode.isSynchronized();
         };
         /** @hidden */
-        Node.prototype.isSynchronized = function (updateCache) {
+        Node.prototype.isSynchronized = function (useWasUpdatedFlag) {
             var check = this.hasNewParent();
-            check = check || !this.isSynchronizedWithParent();
+            if (!useWasUpdatedFlag) {
+                check = check || !this.isSynchronizedWithParent();
+            }
+            else if (this._parentNode) {
+                check = this._parentNode._worldMatrixWasUpdated;
+            }
             check = check || !this._isSynchronized();
-            if (updateCache)
-                this.updateCache(true);
             return !check;
         };
         /** @hidden */
         Node.prototype.hasNewParent = function () {
-            if (this._cache.parent === this.parent)
+            if (this._cache.parent === this._parentNode)
                 return false;
-            this._cache.parent = this.parent;
+            this._cache.parent = this._parentNode;
             return true;
         };
         /**
@@ -17944,8 +17967,8 @@ var BABYLON;
             if (this._isEnabled === false) {
                 return false;
             }
-            if (this.parent !== undefined && this.parent !== null) {
-                return this.parent.isEnabled(checkAncestors);
+            if (this._parentNode !== undefined && this._parentNode !== null) {
+                return this._parentNode.isEnabled(checkAncestors);
             }
             return true;
         };
@@ -18139,10 +18162,14 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        Node.prototype.computeWorldMatrix = function (force) {
-            return BABYLON.Matrix.Identity();
+        Node.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+            if (!this._worldMatrix) {
+                this._worldMatrix = BABYLON.Matrix.Identity();
+            }
+            return this._worldMatrix;
         };
         /**
          * Releases resources associated with this node.
@@ -18671,6 +18698,7 @@ var BABYLON;
             _this._right = new BABYLON.Vector3(1, 0, 0);
             _this._rightInverted = new BABYLON.Vector3(-1, 0, 0);
             // Properties
+            _this._position = BABYLON.Vector3.Zero();
             _this._rotation = BABYLON.Vector3.Zero();
             _this._scaling = BABYLON.Vector3.One();
             _this._isDirty = false;
@@ -18694,12 +18722,7 @@ var BABYLON;
              * By default the system will update normals to compensate
              */
             _this.ignoreNonUniformScaling = false;
-            _this.position = BABYLON.Vector3.Zero();
             _this._localWorld = BABYLON.Matrix.Zero();
-            /** @hidden */
-            _this._worldMatrix = BABYLON.Matrix.Zero();
-            /** @hidden */
-            _this._worldMatrixDeterminant = 0;
             _this._absolutePosition = BABYLON.Vector3.Zero();
             _this._pivotMatrix = BABYLON.Matrix.Identity();
             _this._postMultiplyPivotMatrix = false;
@@ -18721,44 +18744,53 @@ var BABYLON;
         TransformNode.prototype.getClassName = function () {
             return "TransformNode";
         };
+        Object.defineProperty(TransformNode.prototype, "position", {
+            /**
+              * Gets or set the node position (default is (0.0, 0.0, 0.0))
+              */
+            get: function () {
+                return this._position;
+            },
+            set: function (newPosition) {
+                this._position = newPosition;
+                this._isDirty = true;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(TransformNode.prototype, "rotation", {
             /**
-              * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
-              * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
-              * Default : (0.0, 0.0, 0.0)
+              * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z  (default is (0.0, 0.0, 0.0)).
+              * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion
               */
             get: function () {
                 return this._rotation;
             },
             set: function (newRotation) {
                 this._rotation = newRotation;
+                this._isDirty = true;
             },
             enumerable: true,
             configurable: true
         });
         Object.defineProperty(TransformNode.prototype, "scaling", {
             /**
-             * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
-             * Default : (1.0, 1.0, 1.0)
+             * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).
              */
             get: function () {
                 return this._scaling;
             },
-            /**
-             * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
-             * Default : (1.0, 1.0, 1.0)
-            */
             set: function (newScaling) {
                 this._scaling = newScaling;
+                this._isDirty = true;
             },
             enumerable: true,
             configurable: true
         });
         Object.defineProperty(TransformNode.prototype, "rotationQuaternion", {
             /**
-             * Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
-             * It's null by default.
-             * If set, only the rotationQuaternion is then used to compute the mesh rotation and its property `.rotation\ is then ignored and set to (0.0, 0.0, 0.0)
+             * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (null by default).
+             * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)
              */
             get: function () {
                 return this._rotationQuaternion;
@@ -18804,31 +18836,6 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Returns the latest update of the World matrix
-         * Returns a Matrix.
-         */
-        TransformNode.prototype.getWorldMatrix = function () {
-            if (this._currentRenderId !== this.getScene().getRenderId()) {
-                this.computeWorldMatrix();
-            }
-            return this._worldMatrix;
-        };
-        /** @hidden */
-        TransformNode.prototype._getWorldMatrixDeterminant = function () {
-            return this._worldMatrixDeterminant;
-        };
-        Object.defineProperty(TransformNode.prototype, "worldMatrixFromCache", {
-            /**
-             * Returns directly the latest state of the mesh World matrix.
-             * A Matrix is returned.
-             */
-            get: function () {
-                return this._worldMatrix;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
          * Copies the parameter passed Matrix into the mesh Pose matrix.
          * Returns the TransformNode.
          */
@@ -18856,15 +18863,15 @@ var BABYLON;
             if (this.infiniteDistance) {
                 return false;
             }
-            if (!this._cache.position.equals(this.position))
+            if (!this._cache.position.equals(this._position))
                 return false;
             if (this._rotationQuaternion) {
                 if (!this._cache.rotationQuaternion.equals(this._rotationQuaternion))
                     return false;
             }
-            if (!this._cache.rotation.equals(this.rotation))
+            if (!this._cache.rotation.equals(this._rotation))
                 return false;
-            if (!this._cache.scaling.equals(this.scaling))
+            if (!this._cache.scaling.equals(this._scaling))
                 return false;
             return true;
         };
@@ -19341,20 +19348,20 @@ var BABYLON;
             return this;
         };
         /**
-         * Computes the mesh World matrix and returns it.
-         * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
-         * If the parameter `force` is let to `false` (default), the current cached World matrix is returned.
-         * If the parameter `force`is set to `true`, the actual computation is done.
-         * Returns the mesh World Matrix.
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        TransformNode.prototype.computeWorldMatrix = function (force) {
+        TransformNode.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
             if (this._isWorldMatrixFrozen) {
                 return this._worldMatrix;
             }
-            if (!force && this.isSynchronized(true)) {
+            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
+            this._updateCache();
             this._cache.position.copyFrom(this.position);
             this._cache.scaling.copyFrom(this.scaling);
             this._cache.pivotMatrixUpdated = false;
@@ -19362,6 +19369,7 @@ var BABYLON;
             this._currentRenderId = this.getScene().getRenderId();
             this._childRenderId = this.getScene().getRenderId();
             this._isDirty = false;
+            this._worldMatrixWasUpdated = true;
             // Scaling
             BABYLON.Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, BABYLON.Tmp.Matrix[1]);
             // Rotation
@@ -19606,13 +19614,16 @@ var BABYLON;
         TransformNode._lookAtVectorCache = new BABYLON.Vector3(0, 0, 0);
         TransformNode._rotationAxisCache = new BABYLON.Quaternion();
         __decorate([
-            BABYLON.serializeAsVector3()
+            BABYLON.serializeAsVector3("position")
+        ], TransformNode.prototype, "_position", void 0);
+        __decorate([
+            BABYLON.serializeAsVector3("rotation")
         ], TransformNode.prototype, "_rotation", void 0);
         __decorate([
-            BABYLON.serializeAsQuaternion()
+            BABYLON.serializeAsQuaternion("rotationQuaternion")
         ], TransformNode.prototype, "_rotationQuaternion", void 0);
         __decorate([
-            BABYLON.serializeAsVector3()
+            BABYLON.serializeAsVector3("scaling")
         ], TransformNode.prototype, "_scaling", void 0);
         __decorate([
             BABYLON.serialize()
@@ -19626,9 +19637,6 @@ var BABYLON;
         __decorate([
             BABYLON.serialize()
         ], TransformNode.prototype, "ignoreNonUniformScaling", void 0);
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], TransformNode.prototype, "position", void 0);
         return TransformNode;
     }(BABYLON.Node));
     BABYLON.TransformNode = TransformNode;
@@ -21826,24 +21834,6 @@ var BABYLON;
             return true;
         };
         /**
-         * Computes and Returns the light World matrix.
-         * @returns the world matrix
-         */
-        Light.prototype.getWorldMatrix = function () {
-            this._currentRenderId = this.getScene().getRenderId();
-            this._childRenderId = this._currentRenderId;
-            var worldMatrix = this._getWorldMatrix();
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._parentedWorldMatrix) {
-                    this._parentedWorldMatrix = BABYLON.Matrix.Identity();
-                }
-                worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._parentedWorldMatrix);
-                this._markSyncedWithParent();
-                return this._parentedWorldMatrix;
-            }
-            return worldMatrix;
-        };
-        /**
          * Sort function to order lights for rendering.
          * @param a First Light object to compare to second.
          * @param b Second Light object to compare first.
@@ -22311,7 +22301,6 @@ var BABYLON;
             _this._computedViewMatrix = BABYLON.Matrix.Identity();
             _this._projectionMatrix = new BABYLON.Matrix();
             _this._doNotComputeProjectionMatrix = false;
-            _this._worldMatrix = BABYLON.Matrix.Identity();
             _this._postProcesses = new Array();
             _this._transformMatrix = BABYLON.Matrix.Zero();
             _this._activeMeshes = new BABYLON.SmartArray(256);
@@ -27504,6 +27493,26 @@ var BABYLON;
             this._activeMeshesFrozen = false;
             return this;
         };
+        Scene.prototype._computeAllWorldMatricesforBranch = function (node) {
+            node.computeWorldMatrix(false, true);
+            var children = node.getChildren();
+            if (children) {
+                for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
+                    var child = children_2[_i];
+                    this._computeAllWorldMatricesforBranch(child);
+                }
+            }
+            node._worldMatrixWasUpdated = false;
+        };
+        /**
+         * This function will traverse the scene graph and makes sure that all worldMatrix are up to date
+         */
+        Scene.prototype.computeAllWorldMatrices = function () {
+            for (var _i = 0, _a = this.rootNodes; _i < _a.length; _i++) {
+                var node = _a[_i];
+                this._computeAllWorldMatricesforBranch(node);
+            }
+        };
         Scene.prototype._evaluateActiveMeshes = function () {
             if (this._activeMeshesFrozen && this._activeMeshes.length) {
                 return;
@@ -27523,6 +27532,8 @@ var BABYLON;
                 var step = _a[_i];
                 step.action();
             }
+            // World matrices
+            this.computeAllWorldMatrices();
             // Determine mesh candidates
             var meshes = this.getActiveMeshCandidates();
             // Check each mesh
@@ -27536,7 +27547,6 @@ var BABYLON;
                 if (!mesh.isReady() || !mesh.isEnabled()) {
                     continue;
                 }
-                mesh.computeWorldMatrix();
                 // Intersections
                 if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger)) {
                     this._meshesForIntersections.pushNoDuplicate(mesh);
@@ -34108,7 +34118,7 @@ var BABYLON;
         };
         Object.defineProperty(SubMesh.prototype, "IsGlobal", {
             get: function () {
-                return (this.verticesStart === 0 && this.verticesCount == this._mesh.getTotalVertices());
+                return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());
             },
             enumerable: true,
             configurable: true
@@ -48682,9 +48692,12 @@ var BABYLON;
             return this;
         };
         /**
-         * @hidden internal use only.
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        HemisphericLight.prototype._getWorldMatrix = function () {
+        HemisphericLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
@@ -48895,15 +48908,41 @@ var BABYLON;
         ShadowLight.prototype.forceProjectionMatrixCompute = function () {
             this._needProjectionMatrixCompute = true;
         };
+        /** @hidden */
+        ShadowLight.prototype._initCache = function () {
+            _super.prototype._initCache.call(this);
+            this._cache.position = BABYLON.Vector3.Zero();
+        };
+        /** @hidden */
+        ShadowLight.prototype._isSynchronized = function () {
+            if (!this._cache.position.equals(this.position))
+                return false;
+            return true;
+        };
         /**
-         * Get the world matrix of the sahdow lights.
-         * @hidden Internal Use Only
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        ShadowLight.prototype._getWorldMatrix = function () {
+        ShadowLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+                this._currentRenderId = this.getScene().getRenderId();
+                return this._worldMatrix;
+            }
+            this._updateCache();
+            this._cache.position.copyFrom(this.position);
+            this._worldMatrixWasUpdated = true;
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
             BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
+            if (this.parent && this.parent.getWorldMatrix) {
+                this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
+                this._markSyncedWithParent();
+            }
+            // Cache the determinant
+            this._worldMatrixDeterminant = this._worldMatrix.determinant();
             return this._worldMatrix;
         };
         /**
@@ -93398,7 +93437,7 @@ var BABYLON;
             var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);
             if (pickedPoint) {
                 this.dragging = true;
-                this.currentDraggingPointerID = 1;
+                this.currentDraggingPointerID = pointerId;
                 this.lastDragPosition.copyFrom(pickedPoint);
                 this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });
                 this._targetPosition.copyFrom((this._attachedNode).absolutePosition);
@@ -93716,6 +93755,7 @@ var BABYLON;
                         _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
                         // Attach the virtual drag mesh to the virtual origin mesh so it can be dragged
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
+                        pickedMesh.computeWorldMatrix();
                         _this._virtualDragMesh.position.copyFrom(pickedMesh.absolutePosition);
                         if (!pickedMesh.rotationQuaternion) {
                             pickedMesh.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(pickedMesh.rotation.y, pickedMesh.rotation.x, pickedMesh.rotation.z);
@@ -97702,7 +97742,7 @@ var BABYLON;
                                     }
                                     var activateLightOnSubMeshes_1 = function (mesh, light) {
                                         var children = mesh.getChildren();
-                                        if (children.length !== 0) {
+                                        if (children && children.length !== 0) {
                                             children.forEach(function (mesh) {
                                                 light.includedOnlyMeshes.push(mesh);
                                                 activateLightOnSubMeshes_1(mesh, light);
@@ -109783,12 +109823,16 @@ var BABYLON;
     };
     // We also need to update AbstractMesh as there is a portion of the code there
     BABYLON.AbstractMesh.prototype._checkOcclusionQuery = function () {
+        if (this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
+            this._isOccluded = false;
+            return;
+        }
         var engine = this.getEngine();
-        if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
+        if (engine.webGLVersion < 2) {
             this._isOccluded = false;
             return;
         }
-        if (engine.webGLVersion < 2 || this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
+        if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
             this._isOccluded = false;
             return;
         }

+ 151 - 107
dist/preview release/babylon.no-module.max.js

@@ -17618,6 +17618,12 @@ var BABYLON;
             this._currentRenderId = -1;
             this._parentRenderId = -1;
             this._childRenderId = -1;
+            /** @hidden */
+            this._worldMatrixWasUpdated = false;
+            /** @hidden */
+            this._worldMatrix = BABYLON.Matrix.Zero();
+            /** @hidden */
+            this._worldMatrixDeterminant = 0;
             this._animationPropertiesOverride = null;
             /**
             * An event triggered when the mesh is disposed
@@ -17822,16 +17828,30 @@ var BABYLON;
             return null;
         };
         /**
-         * Returns the world matrix of the node
-         * @returns a matrix containing the node's world matrix
+         * Returns the latest update of the World matrix
+         * @returns a Matrix
          */
         Node.prototype.getWorldMatrix = function () {
-            return BABYLON.Matrix.Identity();
+            if (this._currentRenderId !== this.getScene().getRenderId()) {
+                this.computeWorldMatrix();
+            }
+            return this._worldMatrix;
         };
         /** @hidden */
         Node.prototype._getWorldMatrixDeterminant = function () {
-            return 1;
+            return this._worldMatrixDeterminant;
         };
+        Object.defineProperty(Node.prototype, "worldMatrixFromCache", {
+            /**
+             * Returns directly the latest state of the mesh World matrix.
+             * A Matrix is returned.
+             */
+            get: function () {
+                return this._worldMatrix;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // override it in derived class if you add new variables to the cache
         // and call the parent class method
         /** @hidden */
@@ -17858,34 +17878,37 @@ var BABYLON;
         };
         /** @hidden */
         Node.prototype._markSyncedWithParent = function () {
-            if (this.parent) {
-                this._parentRenderId = this.parent._childRenderId;
+            if (this._parentNode) {
+                this._parentRenderId = this._parentNode._childRenderId;
             }
         };
         /** @hidden */
         Node.prototype.isSynchronizedWithParent = function () {
-            if (!this.parent) {
+            if (!this._parentNode) {
                 return true;
             }
-            if (this._parentRenderId !== this.parent._childRenderId) {
+            if (this._parentRenderId !== this._parentNode._childRenderId) {
                 return false;
             }
-            return this.parent.isSynchronized();
+            return this._parentNode.isSynchronized();
         };
         /** @hidden */
-        Node.prototype.isSynchronized = function (updateCache) {
+        Node.prototype.isSynchronized = function (useWasUpdatedFlag) {
             var check = this.hasNewParent();
-            check = check || !this.isSynchronizedWithParent();
+            if (!useWasUpdatedFlag) {
+                check = check || !this.isSynchronizedWithParent();
+            }
+            else if (this._parentNode) {
+                check = this._parentNode._worldMatrixWasUpdated;
+            }
             check = check || !this._isSynchronized();
-            if (updateCache)
-                this.updateCache(true);
             return !check;
         };
         /** @hidden */
         Node.prototype.hasNewParent = function () {
-            if (this._cache.parent === this.parent)
+            if (this._cache.parent === this._parentNode)
                 return false;
-            this._cache.parent = this.parent;
+            this._cache.parent = this._parentNode;
             return true;
         };
         /**
@@ -17911,8 +17934,8 @@ var BABYLON;
             if (this._isEnabled === false) {
                 return false;
             }
-            if (this.parent !== undefined && this.parent !== null) {
-                return this.parent.isEnabled(checkAncestors);
+            if (this._parentNode !== undefined && this._parentNode !== null) {
+                return this._parentNode.isEnabled(checkAncestors);
             }
             return true;
         };
@@ -18106,10 +18129,14 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        Node.prototype.computeWorldMatrix = function (force) {
-            return BABYLON.Matrix.Identity();
+        Node.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+            if (!this._worldMatrix) {
+                this._worldMatrix = BABYLON.Matrix.Identity();
+            }
+            return this._worldMatrix;
         };
         /**
          * Releases resources associated with this node.
@@ -18638,6 +18665,7 @@ var BABYLON;
             _this._right = new BABYLON.Vector3(1, 0, 0);
             _this._rightInverted = new BABYLON.Vector3(-1, 0, 0);
             // Properties
+            _this._position = BABYLON.Vector3.Zero();
             _this._rotation = BABYLON.Vector3.Zero();
             _this._scaling = BABYLON.Vector3.One();
             _this._isDirty = false;
@@ -18661,12 +18689,7 @@ var BABYLON;
              * By default the system will update normals to compensate
              */
             _this.ignoreNonUniformScaling = false;
-            _this.position = BABYLON.Vector3.Zero();
             _this._localWorld = BABYLON.Matrix.Zero();
-            /** @hidden */
-            _this._worldMatrix = BABYLON.Matrix.Zero();
-            /** @hidden */
-            _this._worldMatrixDeterminant = 0;
             _this._absolutePosition = BABYLON.Vector3.Zero();
             _this._pivotMatrix = BABYLON.Matrix.Identity();
             _this._postMultiplyPivotMatrix = false;
@@ -18688,44 +18711,53 @@ var BABYLON;
         TransformNode.prototype.getClassName = function () {
             return "TransformNode";
         };
+        Object.defineProperty(TransformNode.prototype, "position", {
+            /**
+              * Gets or set the node position (default is (0.0, 0.0, 0.0))
+              */
+            get: function () {
+                return this._position;
+            },
+            set: function (newPosition) {
+                this._position = newPosition;
+                this._isDirty = true;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(TransformNode.prototype, "rotation", {
             /**
-              * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
-              * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
-              * Default : (0.0, 0.0, 0.0)
+              * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z  (default is (0.0, 0.0, 0.0)).
+              * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion
               */
             get: function () {
                 return this._rotation;
             },
             set: function (newRotation) {
                 this._rotation = newRotation;
+                this._isDirty = true;
             },
             enumerable: true,
             configurable: true
         });
         Object.defineProperty(TransformNode.prototype, "scaling", {
             /**
-             * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
-             * Default : (1.0, 1.0, 1.0)
+             * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).
              */
             get: function () {
                 return this._scaling;
             },
-            /**
-             * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
-             * Default : (1.0, 1.0, 1.0)
-            */
             set: function (newScaling) {
                 this._scaling = newScaling;
+                this._isDirty = true;
             },
             enumerable: true,
             configurable: true
         });
         Object.defineProperty(TransformNode.prototype, "rotationQuaternion", {
             /**
-             * Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
-             * It's null by default.
-             * If set, only the rotationQuaternion is then used to compute the mesh rotation and its property `.rotation\ is then ignored and set to (0.0, 0.0, 0.0)
+             * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (null by default).
+             * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)
              */
             get: function () {
                 return this._rotationQuaternion;
@@ -18771,31 +18803,6 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Returns the latest update of the World matrix
-         * Returns a Matrix.
-         */
-        TransformNode.prototype.getWorldMatrix = function () {
-            if (this._currentRenderId !== this.getScene().getRenderId()) {
-                this.computeWorldMatrix();
-            }
-            return this._worldMatrix;
-        };
-        /** @hidden */
-        TransformNode.prototype._getWorldMatrixDeterminant = function () {
-            return this._worldMatrixDeterminant;
-        };
-        Object.defineProperty(TransformNode.prototype, "worldMatrixFromCache", {
-            /**
-             * Returns directly the latest state of the mesh World matrix.
-             * A Matrix is returned.
-             */
-            get: function () {
-                return this._worldMatrix;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
          * Copies the parameter passed Matrix into the mesh Pose matrix.
          * Returns the TransformNode.
          */
@@ -18823,15 +18830,15 @@ var BABYLON;
             if (this.infiniteDistance) {
                 return false;
             }
-            if (!this._cache.position.equals(this.position))
+            if (!this._cache.position.equals(this._position))
                 return false;
             if (this._rotationQuaternion) {
                 if (!this._cache.rotationQuaternion.equals(this._rotationQuaternion))
                     return false;
             }
-            if (!this._cache.rotation.equals(this.rotation))
+            if (!this._cache.rotation.equals(this._rotation))
                 return false;
-            if (!this._cache.scaling.equals(this.scaling))
+            if (!this._cache.scaling.equals(this._scaling))
                 return false;
             return true;
         };
@@ -19308,20 +19315,20 @@ var BABYLON;
             return this;
         };
         /**
-         * Computes the mesh World matrix and returns it.
-         * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
-         * If the parameter `force` is let to `false` (default), the current cached World matrix is returned.
-         * If the parameter `force`is set to `true`, the actual computation is done.
-         * Returns the mesh World Matrix.
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        TransformNode.prototype.computeWorldMatrix = function (force) {
+        TransformNode.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
             if (this._isWorldMatrixFrozen) {
                 return this._worldMatrix;
             }
-            if (!force && this.isSynchronized(true)) {
+            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
+            this._updateCache();
             this._cache.position.copyFrom(this.position);
             this._cache.scaling.copyFrom(this.scaling);
             this._cache.pivotMatrixUpdated = false;
@@ -19329,6 +19336,7 @@ var BABYLON;
             this._currentRenderId = this.getScene().getRenderId();
             this._childRenderId = this.getScene().getRenderId();
             this._isDirty = false;
+            this._worldMatrixWasUpdated = true;
             // Scaling
             BABYLON.Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, BABYLON.Tmp.Matrix[1]);
             // Rotation
@@ -19573,13 +19581,16 @@ var BABYLON;
         TransformNode._lookAtVectorCache = new BABYLON.Vector3(0, 0, 0);
         TransformNode._rotationAxisCache = new BABYLON.Quaternion();
         __decorate([
-            BABYLON.serializeAsVector3()
+            BABYLON.serializeAsVector3("position")
+        ], TransformNode.prototype, "_position", void 0);
+        __decorate([
+            BABYLON.serializeAsVector3("rotation")
         ], TransformNode.prototype, "_rotation", void 0);
         __decorate([
-            BABYLON.serializeAsQuaternion()
+            BABYLON.serializeAsQuaternion("rotationQuaternion")
         ], TransformNode.prototype, "_rotationQuaternion", void 0);
         __decorate([
-            BABYLON.serializeAsVector3()
+            BABYLON.serializeAsVector3("scaling")
         ], TransformNode.prototype, "_scaling", void 0);
         __decorate([
             BABYLON.serialize()
@@ -19593,9 +19604,6 @@ var BABYLON;
         __decorate([
             BABYLON.serialize()
         ], TransformNode.prototype, "ignoreNonUniformScaling", void 0);
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], TransformNode.prototype, "position", void 0);
         return TransformNode;
     }(BABYLON.Node));
     BABYLON.TransformNode = TransformNode;
@@ -21793,24 +21801,6 @@ var BABYLON;
             return true;
         };
         /**
-         * Computes and Returns the light World matrix.
-         * @returns the world matrix
-         */
-        Light.prototype.getWorldMatrix = function () {
-            this._currentRenderId = this.getScene().getRenderId();
-            this._childRenderId = this._currentRenderId;
-            var worldMatrix = this._getWorldMatrix();
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._parentedWorldMatrix) {
-                    this._parentedWorldMatrix = BABYLON.Matrix.Identity();
-                }
-                worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._parentedWorldMatrix);
-                this._markSyncedWithParent();
-                return this._parentedWorldMatrix;
-            }
-            return worldMatrix;
-        };
-        /**
          * Sort function to order lights for rendering.
          * @param a First Light object to compare to second.
          * @param b Second Light object to compare first.
@@ -22278,7 +22268,6 @@ var BABYLON;
             _this._computedViewMatrix = BABYLON.Matrix.Identity();
             _this._projectionMatrix = new BABYLON.Matrix();
             _this._doNotComputeProjectionMatrix = false;
-            _this._worldMatrix = BABYLON.Matrix.Identity();
             _this._postProcesses = new Array();
             _this._transformMatrix = BABYLON.Matrix.Zero();
             _this._activeMeshes = new BABYLON.SmartArray(256);
@@ -27471,6 +27460,26 @@ var BABYLON;
             this._activeMeshesFrozen = false;
             return this;
         };
+        Scene.prototype._computeAllWorldMatricesforBranch = function (node) {
+            node.computeWorldMatrix(false, true);
+            var children = node.getChildren();
+            if (children) {
+                for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
+                    var child = children_2[_i];
+                    this._computeAllWorldMatricesforBranch(child);
+                }
+            }
+            node._worldMatrixWasUpdated = false;
+        };
+        /**
+         * This function will traverse the scene graph and makes sure that all worldMatrix are up to date
+         */
+        Scene.prototype.computeAllWorldMatrices = function () {
+            for (var _i = 0, _a = this.rootNodes; _i < _a.length; _i++) {
+                var node = _a[_i];
+                this._computeAllWorldMatricesforBranch(node);
+            }
+        };
         Scene.prototype._evaluateActiveMeshes = function () {
             if (this._activeMeshesFrozen && this._activeMeshes.length) {
                 return;
@@ -27490,6 +27499,8 @@ var BABYLON;
                 var step = _a[_i];
                 step.action();
             }
+            // World matrices
+            this.computeAllWorldMatrices();
             // Determine mesh candidates
             var meshes = this.getActiveMeshCandidates();
             // Check each mesh
@@ -27503,7 +27514,6 @@ var BABYLON;
                 if (!mesh.isReady() || !mesh.isEnabled()) {
                     continue;
                 }
-                mesh.computeWorldMatrix();
                 // Intersections
                 if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger)) {
                     this._meshesForIntersections.pushNoDuplicate(mesh);
@@ -34075,7 +34085,7 @@ var BABYLON;
         };
         Object.defineProperty(SubMesh.prototype, "IsGlobal", {
             get: function () {
-                return (this.verticesStart === 0 && this.verticesCount == this._mesh.getTotalVertices());
+                return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());
             },
             enumerable: true,
             configurable: true
@@ -48649,9 +48659,12 @@ var BABYLON;
             return this;
         };
         /**
-         * @hidden internal use only.
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        HemisphericLight.prototype._getWorldMatrix = function () {
+        HemisphericLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
@@ -48862,15 +48875,41 @@ var BABYLON;
         ShadowLight.prototype.forceProjectionMatrixCompute = function () {
             this._needProjectionMatrixCompute = true;
         };
+        /** @hidden */
+        ShadowLight.prototype._initCache = function () {
+            _super.prototype._initCache.call(this);
+            this._cache.position = BABYLON.Vector3.Zero();
+        };
+        /** @hidden */
+        ShadowLight.prototype._isSynchronized = function () {
+            if (!this._cache.position.equals(this.position))
+                return false;
+            return true;
+        };
         /**
-         * Get the world matrix of the sahdow lights.
-         * @hidden Internal Use Only
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        ShadowLight.prototype._getWorldMatrix = function () {
+        ShadowLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+                this._currentRenderId = this.getScene().getRenderId();
+                return this._worldMatrix;
+            }
+            this._updateCache();
+            this._cache.position.copyFrom(this.position);
+            this._worldMatrixWasUpdated = true;
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
             BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
+            if (this.parent && this.parent.getWorldMatrix) {
+                this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
+                this._markSyncedWithParent();
+            }
+            // Cache the determinant
+            this._worldMatrixDeterminant = this._worldMatrix.determinant();
             return this._worldMatrix;
         };
         /**
@@ -93365,7 +93404,7 @@ var BABYLON;
             var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);
             if (pickedPoint) {
                 this.dragging = true;
-                this.currentDraggingPointerID = 1;
+                this.currentDraggingPointerID = pointerId;
                 this.lastDragPosition.copyFrom(pickedPoint);
                 this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });
                 this._targetPosition.copyFrom((this._attachedNode).absolutePosition);
@@ -93683,6 +93722,7 @@ var BABYLON;
                         _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
                         // Attach the virtual drag mesh to the virtual origin mesh so it can be dragged
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
+                        pickedMesh.computeWorldMatrix();
                         _this._virtualDragMesh.position.copyFrom(pickedMesh.absolutePosition);
                         if (!pickedMesh.rotationQuaternion) {
                             pickedMesh.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(pickedMesh.rotation.y, pickedMesh.rotation.x, pickedMesh.rotation.z);
@@ -97669,7 +97709,7 @@ var BABYLON;
                                     }
                                     var activateLightOnSubMeshes_1 = function (mesh, light) {
                                         var children = mesh.getChildren();
-                                        if (children.length !== 0) {
+                                        if (children && children.length !== 0) {
                                             children.forEach(function (mesh) {
                                                 light.includedOnlyMeshes.push(mesh);
                                                 activateLightOnSubMeshes_1(mesh, light);
@@ -109750,12 +109790,16 @@ var BABYLON;
     };
     // We also need to update AbstractMesh as there is a portion of the code there
     BABYLON.AbstractMesh.prototype._checkOcclusionQuery = function () {
+        if (this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
+            this._isOccluded = false;
+            return;
+        }
         var engine = this.getEngine();
-        if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
+        if (engine.webGLVersion < 2) {
             this._isOccluded = false;
             return;
         }
-        if (engine.webGLVersion < 2 || this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
+        if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
             this._isOccluded = false;
             return;
         }

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


+ 151 - 107
dist/preview release/es6.js

@@ -17618,6 +17618,12 @@ var BABYLON;
             this._currentRenderId = -1;
             this._parentRenderId = -1;
             this._childRenderId = -1;
+            /** @hidden */
+            this._worldMatrixWasUpdated = false;
+            /** @hidden */
+            this._worldMatrix = BABYLON.Matrix.Zero();
+            /** @hidden */
+            this._worldMatrixDeterminant = 0;
             this._animationPropertiesOverride = null;
             /**
             * An event triggered when the mesh is disposed
@@ -17822,16 +17828,30 @@ var BABYLON;
             return null;
         };
         /**
-         * Returns the world matrix of the node
-         * @returns a matrix containing the node's world matrix
+         * Returns the latest update of the World matrix
+         * @returns a Matrix
          */
         Node.prototype.getWorldMatrix = function () {
-            return BABYLON.Matrix.Identity();
+            if (this._currentRenderId !== this.getScene().getRenderId()) {
+                this.computeWorldMatrix();
+            }
+            return this._worldMatrix;
         };
         /** @hidden */
         Node.prototype._getWorldMatrixDeterminant = function () {
-            return 1;
+            return this._worldMatrixDeterminant;
         };
+        Object.defineProperty(Node.prototype, "worldMatrixFromCache", {
+            /**
+             * Returns directly the latest state of the mesh World matrix.
+             * A Matrix is returned.
+             */
+            get: function () {
+                return this._worldMatrix;
+            },
+            enumerable: true,
+            configurable: true
+        });
         // override it in derived class if you add new variables to the cache
         // and call the parent class method
         /** @hidden */
@@ -17858,34 +17878,37 @@ var BABYLON;
         };
         /** @hidden */
         Node.prototype._markSyncedWithParent = function () {
-            if (this.parent) {
-                this._parentRenderId = this.parent._childRenderId;
+            if (this._parentNode) {
+                this._parentRenderId = this._parentNode._childRenderId;
             }
         };
         /** @hidden */
         Node.prototype.isSynchronizedWithParent = function () {
-            if (!this.parent) {
+            if (!this._parentNode) {
                 return true;
             }
-            if (this._parentRenderId !== this.parent._childRenderId) {
+            if (this._parentRenderId !== this._parentNode._childRenderId) {
                 return false;
             }
-            return this.parent.isSynchronized();
+            return this._parentNode.isSynchronized();
         };
         /** @hidden */
-        Node.prototype.isSynchronized = function (updateCache) {
+        Node.prototype.isSynchronized = function (useWasUpdatedFlag) {
             var check = this.hasNewParent();
-            check = check || !this.isSynchronizedWithParent();
+            if (!useWasUpdatedFlag) {
+                check = check || !this.isSynchronizedWithParent();
+            }
+            else if (this._parentNode) {
+                check = this._parentNode._worldMatrixWasUpdated;
+            }
             check = check || !this._isSynchronized();
-            if (updateCache)
-                this.updateCache(true);
             return !check;
         };
         /** @hidden */
         Node.prototype.hasNewParent = function () {
-            if (this._cache.parent === this.parent)
+            if (this._cache.parent === this._parentNode)
                 return false;
-            this._cache.parent = this.parent;
+            this._cache.parent = this._parentNode;
             return true;
         };
         /**
@@ -17911,8 +17934,8 @@ var BABYLON;
             if (this._isEnabled === false) {
                 return false;
             }
-            if (this.parent !== undefined && this.parent !== null) {
-                return this.parent.isEnabled(checkAncestors);
+            if (this._parentNode !== undefined && this._parentNode !== null) {
+                return this._parentNode.isEnabled(checkAncestors);
             }
             return true;
         };
@@ -18106,10 +18129,14 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        Node.prototype.computeWorldMatrix = function (force) {
-            return BABYLON.Matrix.Identity();
+        Node.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+            if (!this._worldMatrix) {
+                this._worldMatrix = BABYLON.Matrix.Identity();
+            }
+            return this._worldMatrix;
         };
         /**
          * Releases resources associated with this node.
@@ -18638,6 +18665,7 @@ var BABYLON;
             _this._right = new BABYLON.Vector3(1, 0, 0);
             _this._rightInverted = new BABYLON.Vector3(-1, 0, 0);
             // Properties
+            _this._position = BABYLON.Vector3.Zero();
             _this._rotation = BABYLON.Vector3.Zero();
             _this._scaling = BABYLON.Vector3.One();
             _this._isDirty = false;
@@ -18661,12 +18689,7 @@ var BABYLON;
              * By default the system will update normals to compensate
              */
             _this.ignoreNonUniformScaling = false;
-            _this.position = BABYLON.Vector3.Zero();
             _this._localWorld = BABYLON.Matrix.Zero();
-            /** @hidden */
-            _this._worldMatrix = BABYLON.Matrix.Zero();
-            /** @hidden */
-            _this._worldMatrixDeterminant = 0;
             _this._absolutePosition = BABYLON.Vector3.Zero();
             _this._pivotMatrix = BABYLON.Matrix.Identity();
             _this._postMultiplyPivotMatrix = false;
@@ -18688,44 +18711,53 @@ var BABYLON;
         TransformNode.prototype.getClassName = function () {
             return "TransformNode";
         };
+        Object.defineProperty(TransformNode.prototype, "position", {
+            /**
+              * Gets or set the node position (default is (0.0, 0.0, 0.0))
+              */
+            get: function () {
+                return this._position;
+            },
+            set: function (newPosition) {
+                this._position = newPosition;
+                this._isDirty = true;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(TransformNode.prototype, "rotation", {
             /**
-              * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
-              * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
-              * Default : (0.0, 0.0, 0.0)
+              * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z  (default is (0.0, 0.0, 0.0)).
+              * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion
               */
             get: function () {
                 return this._rotation;
             },
             set: function (newRotation) {
                 this._rotation = newRotation;
+                this._isDirty = true;
             },
             enumerable: true,
             configurable: true
         });
         Object.defineProperty(TransformNode.prototype, "scaling", {
             /**
-             * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
-             * Default : (1.0, 1.0, 1.0)
+             * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).
              */
             get: function () {
                 return this._scaling;
             },
-            /**
-             * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
-             * Default : (1.0, 1.0, 1.0)
-            */
             set: function (newScaling) {
                 this._scaling = newScaling;
+                this._isDirty = true;
             },
             enumerable: true,
             configurable: true
         });
         Object.defineProperty(TransformNode.prototype, "rotationQuaternion", {
             /**
-             * Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
-             * It's null by default.
-             * If set, only the rotationQuaternion is then used to compute the mesh rotation and its property `.rotation\ is then ignored and set to (0.0, 0.0, 0.0)
+             * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (null by default).
+             * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)
              */
             get: function () {
                 return this._rotationQuaternion;
@@ -18771,31 +18803,6 @@ var BABYLON;
             configurable: true
         });
         /**
-         * Returns the latest update of the World matrix
-         * Returns a Matrix.
-         */
-        TransformNode.prototype.getWorldMatrix = function () {
-            if (this._currentRenderId !== this.getScene().getRenderId()) {
-                this.computeWorldMatrix();
-            }
-            return this._worldMatrix;
-        };
-        /** @hidden */
-        TransformNode.prototype._getWorldMatrixDeterminant = function () {
-            return this._worldMatrixDeterminant;
-        };
-        Object.defineProperty(TransformNode.prototype, "worldMatrixFromCache", {
-            /**
-             * Returns directly the latest state of the mesh World matrix.
-             * A Matrix is returned.
-             */
-            get: function () {
-                return this._worldMatrix;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
          * Copies the parameter passed Matrix into the mesh Pose matrix.
          * Returns the TransformNode.
          */
@@ -18823,15 +18830,15 @@ var BABYLON;
             if (this.infiniteDistance) {
                 return false;
             }
-            if (!this._cache.position.equals(this.position))
+            if (!this._cache.position.equals(this._position))
                 return false;
             if (this._rotationQuaternion) {
                 if (!this._cache.rotationQuaternion.equals(this._rotationQuaternion))
                     return false;
             }
-            if (!this._cache.rotation.equals(this.rotation))
+            if (!this._cache.rotation.equals(this._rotation))
                 return false;
-            if (!this._cache.scaling.equals(this.scaling))
+            if (!this._cache.scaling.equals(this._scaling))
                 return false;
             return true;
         };
@@ -19308,20 +19315,20 @@ var BABYLON;
             return this;
         };
         /**
-         * Computes the mesh World matrix and returns it.
-         * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
-         * If the parameter `force` is let to `false` (default), the current cached World matrix is returned.
-         * If the parameter `force`is set to `true`, the actual computation is done.
-         * Returns the mesh World Matrix.
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        TransformNode.prototype.computeWorldMatrix = function (force) {
+        TransformNode.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
             if (this._isWorldMatrixFrozen) {
                 return this._worldMatrix;
             }
-            if (!force && this.isSynchronized(true)) {
+            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
+            this._updateCache();
             this._cache.position.copyFrom(this.position);
             this._cache.scaling.copyFrom(this.scaling);
             this._cache.pivotMatrixUpdated = false;
@@ -19329,6 +19336,7 @@ var BABYLON;
             this._currentRenderId = this.getScene().getRenderId();
             this._childRenderId = this.getScene().getRenderId();
             this._isDirty = false;
+            this._worldMatrixWasUpdated = true;
             // Scaling
             BABYLON.Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, BABYLON.Tmp.Matrix[1]);
             // Rotation
@@ -19573,13 +19581,16 @@ var BABYLON;
         TransformNode._lookAtVectorCache = new BABYLON.Vector3(0, 0, 0);
         TransformNode._rotationAxisCache = new BABYLON.Quaternion();
         __decorate([
-            BABYLON.serializeAsVector3()
+            BABYLON.serializeAsVector3("position")
+        ], TransformNode.prototype, "_position", void 0);
+        __decorate([
+            BABYLON.serializeAsVector3("rotation")
         ], TransformNode.prototype, "_rotation", void 0);
         __decorate([
-            BABYLON.serializeAsQuaternion()
+            BABYLON.serializeAsQuaternion("rotationQuaternion")
         ], TransformNode.prototype, "_rotationQuaternion", void 0);
         __decorate([
-            BABYLON.serializeAsVector3()
+            BABYLON.serializeAsVector3("scaling")
         ], TransformNode.prototype, "_scaling", void 0);
         __decorate([
             BABYLON.serialize()
@@ -19593,9 +19604,6 @@ var BABYLON;
         __decorate([
             BABYLON.serialize()
         ], TransformNode.prototype, "ignoreNonUniformScaling", void 0);
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], TransformNode.prototype, "position", void 0);
         return TransformNode;
     }(BABYLON.Node));
     BABYLON.TransformNode = TransformNode;
@@ -21793,24 +21801,6 @@ var BABYLON;
             return true;
         };
         /**
-         * Computes and Returns the light World matrix.
-         * @returns the world matrix
-         */
-        Light.prototype.getWorldMatrix = function () {
-            this._currentRenderId = this.getScene().getRenderId();
-            this._childRenderId = this._currentRenderId;
-            var worldMatrix = this._getWorldMatrix();
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._parentedWorldMatrix) {
-                    this._parentedWorldMatrix = BABYLON.Matrix.Identity();
-                }
-                worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._parentedWorldMatrix);
-                this._markSyncedWithParent();
-                return this._parentedWorldMatrix;
-            }
-            return worldMatrix;
-        };
-        /**
          * Sort function to order lights for rendering.
          * @param a First Light object to compare to second.
          * @param b Second Light object to compare first.
@@ -22278,7 +22268,6 @@ var BABYLON;
             _this._computedViewMatrix = BABYLON.Matrix.Identity();
             _this._projectionMatrix = new BABYLON.Matrix();
             _this._doNotComputeProjectionMatrix = false;
-            _this._worldMatrix = BABYLON.Matrix.Identity();
             _this._postProcesses = new Array();
             _this._transformMatrix = BABYLON.Matrix.Zero();
             _this._activeMeshes = new BABYLON.SmartArray(256);
@@ -27471,6 +27460,26 @@ var BABYLON;
             this._activeMeshesFrozen = false;
             return this;
         };
+        Scene.prototype._computeAllWorldMatricesforBranch = function (node) {
+            node.computeWorldMatrix(false, true);
+            var children = node.getChildren();
+            if (children) {
+                for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
+                    var child = children_2[_i];
+                    this._computeAllWorldMatricesforBranch(child);
+                }
+            }
+            node._worldMatrixWasUpdated = false;
+        };
+        /**
+         * This function will traverse the scene graph and makes sure that all worldMatrix are up to date
+         */
+        Scene.prototype.computeAllWorldMatrices = function () {
+            for (var _i = 0, _a = this.rootNodes; _i < _a.length; _i++) {
+                var node = _a[_i];
+                this._computeAllWorldMatricesforBranch(node);
+            }
+        };
         Scene.prototype._evaluateActiveMeshes = function () {
             if (this._activeMeshesFrozen && this._activeMeshes.length) {
                 return;
@@ -27490,6 +27499,8 @@ var BABYLON;
                 var step = _a[_i];
                 step.action();
             }
+            // World matrices
+            this.computeAllWorldMatrices();
             // Determine mesh candidates
             var meshes = this.getActiveMeshCandidates();
             // Check each mesh
@@ -27503,7 +27514,6 @@ var BABYLON;
                 if (!mesh.isReady() || !mesh.isEnabled()) {
                     continue;
                 }
-                mesh.computeWorldMatrix();
                 // Intersections
                 if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger)) {
                     this._meshesForIntersections.pushNoDuplicate(mesh);
@@ -34075,7 +34085,7 @@ var BABYLON;
         };
         Object.defineProperty(SubMesh.prototype, "IsGlobal", {
             get: function () {
-                return (this.verticesStart === 0 && this.verticesCount == this._mesh.getTotalVertices());
+                return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());
             },
             enumerable: true,
             configurable: true
@@ -48649,9 +48659,12 @@ var BABYLON;
             return this;
         };
         /**
-         * @hidden internal use only.
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        HemisphericLight.prototype._getWorldMatrix = function () {
+        HemisphericLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
@@ -48862,15 +48875,41 @@ var BABYLON;
         ShadowLight.prototype.forceProjectionMatrixCompute = function () {
             this._needProjectionMatrixCompute = true;
         };
+        /** @hidden */
+        ShadowLight.prototype._initCache = function () {
+            _super.prototype._initCache.call(this);
+            this._cache.position = BABYLON.Vector3.Zero();
+        };
+        /** @hidden */
+        ShadowLight.prototype._isSynchronized = function () {
+            if (!this._cache.position.equals(this.position))
+                return false;
+            return true;
+        };
         /**
-         * Get the world matrix of the sahdow lights.
-         * @hidden Internal Use Only
+         * Computes the world matrix of the node
+         * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
+         * @param useWasUpdatedFlag defines a reserved property
+         * @returns the world matrix
          */
-        ShadowLight.prototype._getWorldMatrix = function () {
+        ShadowLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+                this._currentRenderId = this.getScene().getRenderId();
+                return this._worldMatrix;
+            }
+            this._updateCache();
+            this._cache.position.copyFrom(this.position);
+            this._worldMatrixWasUpdated = true;
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
             BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
+            if (this.parent && this.parent.getWorldMatrix) {
+                this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
+                this._markSyncedWithParent();
+            }
+            // Cache the determinant
+            this._worldMatrixDeterminant = this._worldMatrix.determinant();
             return this._worldMatrix;
         };
         /**
@@ -93365,7 +93404,7 @@ var BABYLON;
             var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);
             if (pickedPoint) {
                 this.dragging = true;
-                this.currentDraggingPointerID = 1;
+                this.currentDraggingPointerID = pointerId;
                 this.lastDragPosition.copyFrom(pickedPoint);
                 this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });
                 this._targetPosition.copyFrom((this._attachedNode).absolutePosition);
@@ -93683,6 +93722,7 @@ var BABYLON;
                         _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
                         // Attach the virtual drag mesh to the virtual origin mesh so it can be dragged
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
+                        pickedMesh.computeWorldMatrix();
                         _this._virtualDragMesh.position.copyFrom(pickedMesh.absolutePosition);
                         if (!pickedMesh.rotationQuaternion) {
                             pickedMesh.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(pickedMesh.rotation.y, pickedMesh.rotation.x, pickedMesh.rotation.z);
@@ -97669,7 +97709,7 @@ var BABYLON;
                                     }
                                     var activateLightOnSubMeshes_1 = function (mesh, light) {
                                         var children = mesh.getChildren();
-                                        if (children.length !== 0) {
+                                        if (children && children.length !== 0) {
                                             children.forEach(function (mesh) {
                                                 light.includedOnlyMeshes.push(mesh);
                                                 activateLightOnSubMeshes_1(mesh, light);
@@ -109750,12 +109790,16 @@ var BABYLON;
     };
     // We also need to update AbstractMesh as there is a portion of the code there
     BABYLON.AbstractMesh.prototype._checkOcclusionQuery = function () {
+        if (this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
+            this._isOccluded = false;
+            return;
+        }
         var engine = this.getEngine();
-        if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
+        if (engine.webGLVersion < 2) {
             this._isOccluded = false;
             return;
         }
-        if (engine.webGLVersion < 2 || this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
+        if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
             this._isOccluded = false;
             return;
         }

+ 7 - 1
dist/preview release/gui/babylon.gui.d.ts

@@ -1702,7 +1702,9 @@ declare module BABYLON.GUI {
             /** @hidden */
             _setSelectorButtonBackground(selectorNb: number, color: string): void;
     }
-    /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
+    /** Class used to hold the controls for the checkboxes, radio buttons and sliders
+        * @see http://doc.babylonjs.com/how_to/selector
+     */
     export class SelectionPanel extends Rectangle {
             /** name of SelectionPanel */
             name: string;
@@ -1729,6 +1731,10 @@ declare module BABYLON.GUI {
             buttonBackground: string;
             /** Gets or sets the color of separator bar */
             barColor: string;
+            /** Gets or sets the height of separator bar */
+            barHeight: string;
+            /** Gets or sets the height of spacers*/
+            spacerHeight: string;
             /** Add a group to the selection panel
                 * @param group is the selector group to add
                 */

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


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


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


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

@@ -1844,7 +1844,9 @@ declare module 'babylonjs-gui/2D/controls/selector' {
             /** @hidden */
             _setSelectorButtonBackground(selectorNb: number, color: string): void;
     }
-    /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
+    /** Class used to hold the controls for the checkboxes, radio buttons and sliders
+        * @see http://doc.babylonjs.com/how_to/selector
+     */
     export class SelectionPanel extends Rectangle {
             /** name of SelectionPanel */
             name: string;
@@ -1871,6 +1873,10 @@ declare module 'babylonjs-gui/2D/controls/selector' {
             buttonBackground: string;
             /** Gets or sets the color of separator bar */
             barColor: string;
+            /** Gets or sets the height of separator bar */
+            barHeight: string;
+            /** Gets or sets the height of spacers*/
+            spacerHeight: string;
             /** Add a group to the selection panel
                 * @param group is the selector group to add
                 */
@@ -4508,7 +4514,9 @@ declare module BABYLON.GUI {
             /** @hidden */
             _setSelectorButtonBackground(selectorNb: number, color: string): void;
     }
-    /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
+    /** Class used to hold the controls for the checkboxes, radio buttons and sliders
+        * @see http://doc.babylonjs.com/how_to/selector
+     */
     export class SelectionPanel extends Rectangle {
             /** name of SelectionPanel */
             name: string;
@@ -4535,6 +4543,10 @@ declare module BABYLON.GUI {
             buttonBackground: string;
             /** Gets or sets the color of separator bar */
             barColor: string;
+            /** Gets or sets the height of separator bar */
+            barHeight: string;
+            /** Gets or sets the height of spacers*/
+            spacerHeight: string;
             /** Add a group to the selection panel
                 * @param group is the selector group to add
                 */

+ 9 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -1865,11 +1865,18 @@ var BABYLON;
                         return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
                     });
                 }
+                // HACK: If byte offset is not a multiple of component type byte length then load as a float array instead of using Babylon buffers.
+                else if (accessor.byteOffset && accessor.byteOffset % BABYLON.VertexBuffer.GetTypeByteLength(accessor.componentType) !== 0) {
+                    BABYLON.Tools.Warn("Accessor byte offset is not a multiple of component type byte length");
+                    accessor._babylonVertexBuffer = this._loadFloatAccessorAsync("#/accessors/" + accessor.index, accessor).then(function (data) {
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
+                    });
+                }
                 else {
                     var bufferView_1 = ArrayItem.Get(context + "/bufferView", this.gltf.bufferViews, accessor.bufferView);
-                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (buffer) {
+                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (babylonBuffer) {
                         var size = GLTFLoader._GetNumComponents(context, accessor.type);
-                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), buffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
                     });
                 }
                 return accessor._babylonVertexBuffer;

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


+ 9 - 2
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -4072,11 +4072,18 @@ var BABYLON;
                         return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
                     });
                 }
+                // HACK: If byte offset is not a multiple of component type byte length then load as a float array instead of using Babylon buffers.
+                else if (accessor.byteOffset && accessor.byteOffset % BABYLON.VertexBuffer.GetTypeByteLength(accessor.componentType) !== 0) {
+                    BABYLON.Tools.Warn("Accessor byte offset is not a multiple of component type byte length");
+                    accessor._babylonVertexBuffer = this._loadFloatAccessorAsync("#/accessors/" + accessor.index, accessor).then(function (data) {
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
+                    });
+                }
                 else {
                     var bufferView_1 = ArrayItem.Get(context + "/bufferView", this.gltf.bufferViews, accessor.bufferView);
-                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (buffer) {
+                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (babylonBuffer) {
                         var size = GLTFLoader._GetNumComponents(context, accessor.type);
-                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), buffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
                     });
                 }
                 return accessor._babylonVertexBuffer;

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


+ 9 - 2
dist/preview release/loaders/babylonjs.loaders.js

@@ -5131,11 +5131,18 @@ var BABYLON;
                         return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
                     });
                 }
+                // HACK: If byte offset is not a multiple of component type byte length then load as a float array instead of using Babylon buffers.
+                else if (accessor.byteOffset && accessor.byteOffset % BABYLON.VertexBuffer.GetTypeByteLength(accessor.componentType) !== 0) {
+                    BABYLON.Tools.Warn("Accessor byte offset is not a multiple of component type byte length");
+                    accessor._babylonVertexBuffer = this._loadFloatAccessorAsync("#/accessors/" + accessor.index, accessor).then(function (data) {
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
+                    });
+                }
                 else {
                     var bufferView_1 = ArrayItem.Get(context + "/bufferView", this.gltf.bufferViews, accessor.bufferView);
-                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (buffer) {
+                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (babylonBuffer) {
                         var size = GLTFLoader._GetNumComponents(context, accessor.type);
-                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), buffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
                     });
                 }
                 return accessor._babylonVertexBuffer;

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


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

@@ -1,7 +1,7 @@
 {
-  "errors": 3875,
+  "errors": 3874,
   "babylon.typedoc.json": {
-    "errors": 3875,
+    "errors": 3874,
     "AnimationGroup": {
       "Constructor": {
         "new AnimationGroup": {
@@ -18226,11 +18226,6 @@
             "MissingText": true
           }
         },
-        "position": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
         "scalingDeterminant": {
           "Comments": {
             "MissingText": true

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


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


+ 57 - 7
gui/src/2D/controls/selector.ts

@@ -5,6 +5,7 @@ import {TextBlock} from "./textBlock";
 import {Checkbox} from "./checkbox";
 import {RadioButton} from "./radioButton";
 import {Slider} from "./slider";
+import { Container } from "./container";
 
 /** Class used to create a RadioGroup 
  * which contains groups of radio buttons
@@ -287,11 +288,12 @@ export class SelectionPanel extends Rectangle {
     private _buttonBackground: string = "#CCCCCC"; 
     private _headerColor: string = "black";
     private _barColor: string = "white";
+    private _barHeight: string = "2px";
+    private _spacerHeight: string = "20px";
     private _labelColor: string;
     private _groups: SelectorGroup[];
     private _bars: any[] = new Array();
 
-
     /**
     * Creates a new SelectionPanel
     * @param name of SelectionPanel
@@ -304,7 +306,7 @@ export class SelectionPanel extends Rectangle {
         public groups: SelectorGroup[] = []) {
         super(name);
         this._groups = groups;
-        this.thickness = 4;
+        this.thickness = 2;
         this._panel = new StackPanel();
         this._panel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
         this._panel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
@@ -428,18 +430,66 @@ export class SelectionPanel extends Rectangle {
 
     private _setBarColor() {
         for(var i = 0; i < this._bars.length; i++) {
-            this._bars[i].background = this._barColor;
+            this._bars[i].children[0].background = this._barColor;
+        }
+    }
+
+    /** Gets or sets the height of separator bar */
+    public get barHeight(): string {
+        return this._barHeight;
+    }
+
+    public set barHeight(value: string) {
+        if(this._barHeight === value) {
+            return;
+        }
+        
+        this._barHeight = value;
+        this._setBarHeight();
+    }
+
+    private _setBarHeight() {
+        for(var i = 0; i < this._bars.length; i++) {
+            this._bars[i].children[0].height = this._barHeight;
+        }
+    }
+
+    /** Gets or sets the height of spacers*/
+    public get spacerHeight(): string {
+        return this._spacerHeight;
+    }
+
+    public set spacerHeight(value: string) {
+        if(this._spacerHeight === value) {
+            return;
+        }
+        
+        this._spacerHeight = value;
+        this._setSpacerHeight();
+    }
+
+    private _setSpacerHeight() {
+        for(var i = 0; i < this._bars.length; i++) {
+            this._bars[i].height = this._spacerHeight;
         }
     }
 
     /** Adds a bar between groups */
     private _addSpacer(): void {
-        var separator = new Rectangle();
+        var separator = new Container();
         separator.width = 1;
-        separator.height = "5px";
+        separator.height = this._spacerHeight;
         separator.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
-        separator.background = this._barColor;
-        separator.color = "transparent";
+
+        var bar = new Rectangle();
+        bar.width = 1;
+        bar.height = this._barHeight;
+        bar.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
+        bar.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
+        bar.background = this._barColor;
+        bar.color = "transparent";
+        separator.addControl(bar);
+
         this._panel.addControl(separator);
         this._bars.push(separator);
     }

+ 7 - 2
src/Engine/Extensions/babylon.engine.occlusionQuery.ts

@@ -250,14 +250,19 @@ module BABYLON {
 
     // We also need to update AbstractMesh as there is a portion of the code there
     AbstractMesh.prototype._checkOcclusionQuery = function() {
+        if (this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+            this._isOccluded = false;
+            return;
+        }
+
         var engine = this.getEngine();
 
-        if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
+        if (engine.webGLVersion < 2) {
             this._isOccluded = false;
             return;
         }
 
-        if (engine.webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+        if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
             this._isOccluded = false;
             return;
         }