Browse Source

Nightly + Fix #5599

David Catuhe 6 years ago
parent
commit
2727392390

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


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


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


+ 16 - 23
dist/preview release/babylon.max.js

@@ -20611,9 +20611,9 @@ var BABYLON;
             if (yawCor === void 0) { yawCor = 0; }
             if (pitchCor === void 0) { pitchCor = 0; }
             if (rollCor === void 0) { rollCor = 0; }
-            var yaw = Math.atan2(localAxis.z, localAxis.x) + 3 * Math.PI / 2;
+            var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
             var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
-            var pitch = Math.atan2(localAxis.y, len);
+            var pitch = -Math.atan2(localAxis.y, len);
             if (this.rotationQuaternion) {
                 BABYLON.Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
             }
@@ -66654,7 +66654,6 @@ var BABYLON;
             function AxesViewer(scene, scaleLines, renderingGroupId, xAxis, yAxis, zAxis) {
                 if (scaleLines === void 0) { scaleLines = 1; }
                 if (renderingGroupId === void 0) { renderingGroupId = 2; }
-                this._tmpVector = new BABYLON.Vector3();
                 this._scaleLinesFactor = 4;
                 this._instanced = false;
                 /**
@@ -66681,13 +66680,10 @@ var BABYLON;
                     zAxis = BABYLON.AxisDragGizmo._CreateArrow(scene, blueColoredMaterial);
                 }
                 this._xAxis = xAxis;
-                this._xAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._yAxis = yAxis;
-                this._yAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._zAxis = zAxis;
-                this._zAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 if (renderingGroupId != null) {
                     AxesViewer._SetRenderingGroupId(this._xAxis, renderingGroupId);
@@ -66730,16 +66726,13 @@ var BABYLON;
              */
             AxesViewer.prototype.update = function (position, xaxis, yaxis, zaxis) {
                 this._xAxis.position.copyFrom(position);
-                xaxis.scaleToRef(-1, this._tmpVector);
-                this._xAxis.setDirection(this._tmpVector);
+                this._xAxis.setDirection(xaxis);
                 this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._yAxis.position.copyFrom(position);
-                yaxis.scaleToRef(-1, this._tmpVector);
-                this._yAxis.setDirection(this._tmpVector);
+                this._yAxis.setDirection(yaxis);
                 this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._zAxis.position.copyFrom(position);
-                zaxis.scaleToRef(-1, this._tmpVector);
-                this._zAxis.setDirection(this._tmpVector);
+                this._zAxis.setDirection(zaxis);
                 this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
             };
             /**
@@ -70766,7 +70759,7 @@ var BABYLON;
             vertexData.applyToMesh(plane, options.updatable);
             if (options.sourcePlane) {
                 plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);
-                plane.setDirection(options.sourcePlane.normal);
+                plane.setDirection(options.sourcePlane.normal.scale(-1));
             }
             return plane;
         };
@@ -103555,13 +103548,13 @@ var BABYLON;
                 BABYLON.Vector3.CrossToRef(this._lineA, this._lookAt, this._lookAt);
                 this._lookAt.normalize();
                 this._dragPlane.position.copyFrom(this._pointA);
-                this._pointA.subtractToRef(this._lookAt, this._lookAt);
+                this._pointA.addToRef(this._lookAt, this._lookAt);
                 this._dragPlane.lookAt(this._lookAt);
             }
             else if (this._options.dragPlaneNormal) {
                 this.useObjectOrienationForDragging ? BABYLON.Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this._attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal);
                 this._dragPlane.position.copyFrom(this._pointA);
-                this._pointA.subtractToRef(this._localAxis, this._lookAt);
+                this._pointA.addToRef(this._localAxis, this._lookAt);
                 this._dragPlane.lookAt(this._lookAt);
             }
             else {
@@ -103791,7 +103784,7 @@ var BABYLON;
                         lastSixDofOriginPosition.copyFrom(pointerInfo.pickInfo.ray.origin);
                         // Set position and orientation of the controller
                         _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);
-                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
+                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(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();
@@ -103855,7 +103848,7 @@ var BABYLON;
                         }
                         // Update the controller position
                         _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);
-                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
+                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(pointerInfo.pickInfo.ray.direction));
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
                         // Move the virtualObjectsPosition into the picked mesh's space if needed
                         _this._targetPosition.copyFrom(_this._virtualDragMesh.absolutePosition);
@@ -104361,7 +104354,7 @@ var BABYLON;
             hoverMaterial.emissiveColor = color.add(new BABYLON.Color3(0.3, 0.3, 0.3));
             // Build mesh on root node
             var arrow = AxisDragGizmo._CreateArrow(gizmoLayer.utilityLayerScene, coloredMaterial);
-            arrow.lookAt(_this._rootMesh.position.subtract(dragAxis));
+            arrow.lookAt(_this._rootMesh.position.add(dragAxis));
             arrow.scaling.scaleInPlace(1 / 3);
             arrow.parent = _this._rootMesh;
             var currentSnapDragDistance = 0;
@@ -104520,7 +104513,7 @@ var BABYLON;
             arrowTail.scaling.scaleInPlace(0.26);
             arrowTail.rotation.x = Math.PI / 2;
             arrowTail.material = _this._coloredMaterial;
-            arrow.lookAt(_this._rootMesh.position.subtract(dragAxis));
+            arrow.lookAt(_this._rootMesh.position.add(dragAxis));
             _this._rootMesh.addChild(arrow);
             arrow.scaling.scaleInPlace(1 / 3);
             // Add drag behavior to handle events when the gizmo is dragged
@@ -104674,7 +104667,7 @@ var BABYLON;
             rotationMesh.material = coloredMaterial;
             rotationMesh.rotation.x = Math.PI / 2;
             parentMesh.addChild(rotationMesh);
-            parentMesh.lookAt(_this._rootMesh.position.subtract(planeNormal));
+            parentMesh.lookAt(_this._rootMesh.position.add(planeNormal));
             _this._rootMesh.addChild(parentMesh);
             parentMesh.scaling.scaleInPlace(1 / 3);
             // Add drag behavior to handle events when the gizmo is dragged
@@ -105539,17 +105532,17 @@ var BABYLON;
                         if (i == 0) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Right(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Right()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (i == 1) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Up(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Up()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (i == 2) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Forward()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                             rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);

+ 16 - 23
dist/preview release/babylon.no-module.max.js

@@ -20578,9 +20578,9 @@ var BABYLON;
             if (yawCor === void 0) { yawCor = 0; }
             if (pitchCor === void 0) { pitchCor = 0; }
             if (rollCor === void 0) { rollCor = 0; }
-            var yaw = Math.atan2(localAxis.z, localAxis.x) + 3 * Math.PI / 2;
+            var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
             var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
-            var pitch = Math.atan2(localAxis.y, len);
+            var pitch = -Math.atan2(localAxis.y, len);
             if (this.rotationQuaternion) {
                 BABYLON.Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
             }
@@ -66621,7 +66621,6 @@ var BABYLON;
             function AxesViewer(scene, scaleLines, renderingGroupId, xAxis, yAxis, zAxis) {
                 if (scaleLines === void 0) { scaleLines = 1; }
                 if (renderingGroupId === void 0) { renderingGroupId = 2; }
-                this._tmpVector = new BABYLON.Vector3();
                 this._scaleLinesFactor = 4;
                 this._instanced = false;
                 /**
@@ -66648,13 +66647,10 @@ var BABYLON;
                     zAxis = BABYLON.AxisDragGizmo._CreateArrow(scene, blueColoredMaterial);
                 }
                 this._xAxis = xAxis;
-                this._xAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._yAxis = yAxis;
-                this._yAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._zAxis = zAxis;
-                this._zAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 if (renderingGroupId != null) {
                     AxesViewer._SetRenderingGroupId(this._xAxis, renderingGroupId);
@@ -66697,16 +66693,13 @@ var BABYLON;
              */
             AxesViewer.prototype.update = function (position, xaxis, yaxis, zaxis) {
                 this._xAxis.position.copyFrom(position);
-                xaxis.scaleToRef(-1, this._tmpVector);
-                this._xAxis.setDirection(this._tmpVector);
+                this._xAxis.setDirection(xaxis);
                 this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._yAxis.position.copyFrom(position);
-                yaxis.scaleToRef(-1, this._tmpVector);
-                this._yAxis.setDirection(this._tmpVector);
+                this._yAxis.setDirection(yaxis);
                 this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._zAxis.position.copyFrom(position);
-                zaxis.scaleToRef(-1, this._tmpVector);
-                this._zAxis.setDirection(this._tmpVector);
+                this._zAxis.setDirection(zaxis);
                 this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
             };
             /**
@@ -70733,7 +70726,7 @@ var BABYLON;
             vertexData.applyToMesh(plane, options.updatable);
             if (options.sourcePlane) {
                 plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);
-                plane.setDirection(options.sourcePlane.normal);
+                plane.setDirection(options.sourcePlane.normal.scale(-1));
             }
             return plane;
         };
@@ -103522,13 +103515,13 @@ var BABYLON;
                 BABYLON.Vector3.CrossToRef(this._lineA, this._lookAt, this._lookAt);
                 this._lookAt.normalize();
                 this._dragPlane.position.copyFrom(this._pointA);
-                this._pointA.subtractToRef(this._lookAt, this._lookAt);
+                this._pointA.addToRef(this._lookAt, this._lookAt);
                 this._dragPlane.lookAt(this._lookAt);
             }
             else if (this._options.dragPlaneNormal) {
                 this.useObjectOrienationForDragging ? BABYLON.Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this._attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal);
                 this._dragPlane.position.copyFrom(this._pointA);
-                this._pointA.subtractToRef(this._localAxis, this._lookAt);
+                this._pointA.addToRef(this._localAxis, this._lookAt);
                 this._dragPlane.lookAt(this._lookAt);
             }
             else {
@@ -103758,7 +103751,7 @@ var BABYLON;
                         lastSixDofOriginPosition.copyFrom(pointerInfo.pickInfo.ray.origin);
                         // Set position and orientation of the controller
                         _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);
-                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
+                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(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();
@@ -103822,7 +103815,7 @@ var BABYLON;
                         }
                         // Update the controller position
                         _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);
-                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
+                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(pointerInfo.pickInfo.ray.direction));
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
                         // Move the virtualObjectsPosition into the picked mesh's space if needed
                         _this._targetPosition.copyFrom(_this._virtualDragMesh.absolutePosition);
@@ -104328,7 +104321,7 @@ var BABYLON;
             hoverMaterial.emissiveColor = color.add(new BABYLON.Color3(0.3, 0.3, 0.3));
             // Build mesh on root node
             var arrow = AxisDragGizmo._CreateArrow(gizmoLayer.utilityLayerScene, coloredMaterial);
-            arrow.lookAt(_this._rootMesh.position.subtract(dragAxis));
+            arrow.lookAt(_this._rootMesh.position.add(dragAxis));
             arrow.scaling.scaleInPlace(1 / 3);
             arrow.parent = _this._rootMesh;
             var currentSnapDragDistance = 0;
@@ -104487,7 +104480,7 @@ var BABYLON;
             arrowTail.scaling.scaleInPlace(0.26);
             arrowTail.rotation.x = Math.PI / 2;
             arrowTail.material = _this._coloredMaterial;
-            arrow.lookAt(_this._rootMesh.position.subtract(dragAxis));
+            arrow.lookAt(_this._rootMesh.position.add(dragAxis));
             _this._rootMesh.addChild(arrow);
             arrow.scaling.scaleInPlace(1 / 3);
             // Add drag behavior to handle events when the gizmo is dragged
@@ -104641,7 +104634,7 @@ var BABYLON;
             rotationMesh.material = coloredMaterial;
             rotationMesh.rotation.x = Math.PI / 2;
             parentMesh.addChild(rotationMesh);
-            parentMesh.lookAt(_this._rootMesh.position.subtract(planeNormal));
+            parentMesh.lookAt(_this._rootMesh.position.add(planeNormal));
             _this._rootMesh.addChild(parentMesh);
             parentMesh.scaling.scaleInPlace(1 / 3);
             // Add drag behavior to handle events when the gizmo is dragged
@@ -105506,17 +105499,17 @@ var BABYLON;
                         if (i == 0) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Right(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Right()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (i == 1) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Up(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Up()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (i == 2) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Forward()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                             rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);

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


+ 16 - 23
dist/preview release/es6.js

@@ -20578,9 +20578,9 @@ var BABYLON;
             if (yawCor === void 0) { yawCor = 0; }
             if (pitchCor === void 0) { pitchCor = 0; }
             if (rollCor === void 0) { rollCor = 0; }
-            var yaw = Math.atan2(localAxis.z, localAxis.x) + 3 * Math.PI / 2;
+            var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
             var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
-            var pitch = Math.atan2(localAxis.y, len);
+            var pitch = -Math.atan2(localAxis.y, len);
             if (this.rotationQuaternion) {
                 BABYLON.Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
             }
@@ -66621,7 +66621,6 @@ var BABYLON;
             function AxesViewer(scene, scaleLines, renderingGroupId, xAxis, yAxis, zAxis) {
                 if (scaleLines === void 0) { scaleLines = 1; }
                 if (renderingGroupId === void 0) { renderingGroupId = 2; }
-                this._tmpVector = new BABYLON.Vector3();
                 this._scaleLinesFactor = 4;
                 this._instanced = false;
                 /**
@@ -66648,13 +66647,10 @@ var BABYLON;
                     zAxis = BABYLON.AxisDragGizmo._CreateArrow(scene, blueColoredMaterial);
                 }
                 this._xAxis = xAxis;
-                this._xAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._yAxis = yAxis;
-                this._yAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._zAxis = zAxis;
-                this._zAxis.rotationQuaternion = new BABYLON.Quaternion();
                 this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 if (renderingGroupId != null) {
                     AxesViewer._SetRenderingGroupId(this._xAxis, renderingGroupId);
@@ -66697,16 +66693,13 @@ var BABYLON;
              */
             AxesViewer.prototype.update = function (position, xaxis, yaxis, zaxis) {
                 this._xAxis.position.copyFrom(position);
-                xaxis.scaleToRef(-1, this._tmpVector);
-                this._xAxis.setDirection(this._tmpVector);
+                this._xAxis.setDirection(xaxis);
                 this._xAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._yAxis.position.copyFrom(position);
-                yaxis.scaleToRef(-1, this._tmpVector);
-                this._yAxis.setDirection(this._tmpVector);
+                this._yAxis.setDirection(yaxis);
                 this._yAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
                 this._zAxis.position.copyFrom(position);
-                zaxis.scaleToRef(-1, this._tmpVector);
-                this._zAxis.setDirection(this._tmpVector);
+                this._zAxis.setDirection(zaxis);
                 this._zAxis.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
             };
             /**
@@ -70733,7 +70726,7 @@ var BABYLON;
             vertexData.applyToMesh(plane, options.updatable);
             if (options.sourcePlane) {
                 plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);
-                plane.setDirection(options.sourcePlane.normal);
+                plane.setDirection(options.sourcePlane.normal.scale(-1));
             }
             return plane;
         };
@@ -103522,13 +103515,13 @@ var BABYLON;
                 BABYLON.Vector3.CrossToRef(this._lineA, this._lookAt, this._lookAt);
                 this._lookAt.normalize();
                 this._dragPlane.position.copyFrom(this._pointA);
-                this._pointA.subtractToRef(this._lookAt, this._lookAt);
+                this._pointA.addToRef(this._lookAt, this._lookAt);
                 this._dragPlane.lookAt(this._lookAt);
             }
             else if (this._options.dragPlaneNormal) {
                 this.useObjectOrienationForDragging ? BABYLON.Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this._attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis) : this._localAxis.copyFrom(this._options.dragPlaneNormal);
                 this._dragPlane.position.copyFrom(this._pointA);
-                this._pointA.subtractToRef(this._localAxis, this._lookAt);
+                this._pointA.addToRef(this._localAxis, this._lookAt);
                 this._dragPlane.lookAt(this._lookAt);
             }
             else {
@@ -103758,7 +103751,7 @@ var BABYLON;
                         lastSixDofOriginPosition.copyFrom(pointerInfo.pickInfo.ray.origin);
                         // Set position and orientation of the controller
                         _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);
-                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
+                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(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();
@@ -103822,7 +103815,7 @@ var BABYLON;
                         }
                         // Update the controller position
                         _this._virtualOriginMesh.position.copyFrom(pointerInfo.pickInfo.ray.origin);
-                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
+                        _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.add(pointerInfo.pickInfo.ray.direction));
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
                         // Move the virtualObjectsPosition into the picked mesh's space if needed
                         _this._targetPosition.copyFrom(_this._virtualDragMesh.absolutePosition);
@@ -104328,7 +104321,7 @@ var BABYLON;
             hoverMaterial.emissiveColor = color.add(new BABYLON.Color3(0.3, 0.3, 0.3));
             // Build mesh on root node
             var arrow = AxisDragGizmo._CreateArrow(gizmoLayer.utilityLayerScene, coloredMaterial);
-            arrow.lookAt(_this._rootMesh.position.subtract(dragAxis));
+            arrow.lookAt(_this._rootMesh.position.add(dragAxis));
             arrow.scaling.scaleInPlace(1 / 3);
             arrow.parent = _this._rootMesh;
             var currentSnapDragDistance = 0;
@@ -104487,7 +104480,7 @@ var BABYLON;
             arrowTail.scaling.scaleInPlace(0.26);
             arrowTail.rotation.x = Math.PI / 2;
             arrowTail.material = _this._coloredMaterial;
-            arrow.lookAt(_this._rootMesh.position.subtract(dragAxis));
+            arrow.lookAt(_this._rootMesh.position.add(dragAxis));
             _this._rootMesh.addChild(arrow);
             arrow.scaling.scaleInPlace(1 / 3);
             // Add drag behavior to handle events when the gizmo is dragged
@@ -104641,7 +104634,7 @@ var BABYLON;
             rotationMesh.material = coloredMaterial;
             rotationMesh.rotation.x = Math.PI / 2;
             parentMesh.addChild(rotationMesh);
-            parentMesh.lookAt(_this._rootMesh.position.subtract(planeNormal));
+            parentMesh.lookAt(_this._rootMesh.position.add(planeNormal));
             _this._rootMesh.addChild(parentMesh);
             parentMesh.scaling.scaleInPlace(1 / 3);
             // Add drag behavior to handle events when the gizmo is dragged
@@ -105506,17 +105499,17 @@ var BABYLON;
                         if (i == 0) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Right(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Right()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (i == 1) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Up(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Up()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (i == 2) {
                             rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);
                             rotateSpheres[index].position.addInPlace(new BABYLON.Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));
-                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), rotateSpheres[index].position.normalizeToNew()).normalizeToNew().add(rotateSpheres[index].position));
+                            rotateSpheres[index].lookAt(BABYLON.Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), BABYLON.Vector3.Forward()).normalizeToNew().add(rotateSpheres[index].position));
                         }
                         if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {
                             rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);

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

@@ -1,7 +1,7 @@
 /*Babylon.js GUI*/
 // Dependencies for this module:
-//   ../../../../Tools/gulp/babylonjs
-//   ../../../../Tools/gulp/2D
+//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/Gulp/2D
 declare module BABYLON.GUI {
 }
 declare module BABYLON.GUI {

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


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

@@ -1,7 +1,7 @@
 /*Babylon.js GUI*/
 // Dependencies for this module:
-//   ../../../../Tools/gulp/babylonjs
-//   ../../../../Tools/gulp/2D
+//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/Gulp/2D
 
 declare module 'babylonjs-gui' {
     export * from "babylonjs-gui/2D";
@@ -3164,8 +3164,8 @@ declare module 'babylonjs-gui/3D/materials/fluentMaterial' {
 
 /*Babylon.js GUI*/
 // Dependencies for this module:
-//   ../../../../Tools/gulp/babylonjs
-//   ../../../../Tools/gulp/2D
+//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/Gulp/2D
 declare module BABYLON.GUI {
 }
 declare module BABYLON.GUI {

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


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


+ 1 - 1
dist/preview release/inspector/babylon.inspector.d.ts

@@ -1,6 +1,6 @@
 /*Babylon.js Inspector*/
 // Dependencies for this module:
-//   ../../../../Tools/gulp/babylonjs
+//   ../../../../Tools/Gulp/babylonjs
 declare module INSPECTOR {
 }
 declare module INSPECTOR {

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

@@ -1,6 +1,6 @@
 /*Babylon.js Inspector*/
 // Dependencies for this module:
-//   ../../../../Tools/gulp/babylonjs
+//   ../../../../Tools/Gulp/babylonjs
 
 declare module 'babylonjs-inspector' {
     export * from "babylonjs-inspector/inspector";
@@ -31,7 +31,7 @@ declare module 'babylonjs-inspector/components/propertyChangedEvent' {
 
 /*Babylon.js Inspector*/
 // Dependencies for this module:
-//   ../../../../Tools/gulp/babylonjs
+//   ../../../../Tools/Gulp/babylonjs
 declare module INSPECTOR {
 }
 declare module INSPECTOR {

+ 215 - 275
dist/preview release/viewer/babylon.viewer.d.ts

@@ -4,8 +4,8 @@
 declare module "babylonjs-loaders"{ export=BABYLON;}
 // Generated by dts-bundle v0.7.3
 // Dependencies for this module:
-//   ../../../../../Tools/gulp/babylonjs
-//   ../../../../../Tools/gulp/babylonjs-loaders
+//   ../../../../../Tools/Gulp/babylonjs
+//   ../../../../../Tools/Gulp/babylonjs-loaders
 declare module BabylonViewer {
     /**
         * BabylonJS Viewer
@@ -123,80 +123,6 @@ declare module BabylonViewer {
     export let viewerManager: ViewerManager;
 }
 declare module BabylonViewer {
-    /**
-        * The Default viewer is the default implementation of the AbstractViewer.
-        * It uses the templating system to render a new canvas and controls.
-        */
-    export class DefaultViewer extends AbstractViewer {
-            containerElement: Element;
-            fullscreenElement?: Element;
-            /**
-                * Create a new default viewer
-                * @param containerElement the element in which the templates will be rendered
-                * @param initialConfiguration the initial configuration. Defaults to extending the default configuration
-                */
-            constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
-            registerTemplatePlugin(plugin: IViewerTemplatePlugin): void;
-            /**
-                * This will be executed when the templates initialize.
-                */
-            protected _onTemplatesLoaded(): Promise<AbstractViewer>;
-            protected _initVR(): void;
-            /**
-                * Toggle fullscreen of the entire viewer
-                */
-            toggleFullscreen: () => void;
-            /**
-                * Preparing the container element to present the viewer
-                */
-            protected _prepareContainerElement(): void;
-            /**
-                * This function will configure the templates and update them after a model was loaded
-                * It is mainly responsible to changing the title and subtitle etc'.
-                * @param model the model to be used to configure the templates by
-                */
-            protected _configureTemplate(model?: ViewerModel): void;
-            /**
-                * This will load a new model to the default viewer
-                * overriding the AbstractViewer's loadModel.
-                * The scene will automatically be cleared of the old models, if exist.
-                * @param model the configuration object (or URL) to load.
-                */
-            loadModel(model?: string | File | IModelConfiguration): Promise<ViewerModel>;
-            /**
-                * Show the overlay and the defined sub-screen.
-                * Mainly used for help and errors
-                * @param subScreen the name of the subScreen. Those can be defined in the configuration object
-                */
-            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
-            /**
-                * Hide the overlay screen.
-                */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
-            /**
-                * show the viewer (in case it was hidden)
-                *
-                * @param visibilityFunction an optional function to execute in order to show the container
-                */
-            show(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
-            /**
-                * hide the viewer (in case it is visible)
-                *
-                * @param visibilityFunction an optional function to execute in order to hide the container
-                */
-            hide(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
-            /**
-                * Show the loading screen.
-                * The loading screen can be configured using the configuration object
-                */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
-            /**
-                * Hide the loading screen
-                */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
-            dispose(): void;
-            protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
-    }
 }
 declare module BabylonViewer {
     /**
@@ -924,7 +850,7 @@ declare module BabylonViewer {
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
@@ -1038,171 +964,6 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
-    /**
-        * The object sent when an event is triggered
-        */
-    export interface EventCallback {
-            event: Event;
-            template: Template;
-            selector: string;
-            payload?: any;
-    }
-    /**
-        * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
-        * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
-        */
-    export class TemplateManager {
-            containerElement: Element;
-            /**
-                * Will be triggered when any template is initialized
-                */
-            onTemplateInit: BABYLON.Observable<Template>;
-            /**
-                * Will be triggered when any template is fully loaded
-                */
-            onTemplateLoaded: BABYLON.Observable<Template>;
-            /**
-                * Will be triggered when a template state changes
-                */
-            onTemplateStateChange: BABYLON.Observable<Template>;
-            /**
-                * Will be triggered when all templates finished loading
-                */
-            onAllLoaded: BABYLON.Observable<TemplateManager>;
-            /**
-                * Will be triggered when any event on any template is triggered.
-                */
-            onEventTriggered: BABYLON.Observable<EventCallback>;
-            /**
-                * This template manager's event manager. In charge of callback registrations to native event types
-                */
-            eventManager: EventManager;
-            constructor(containerElement: Element);
-            /**
-                * Initialize the template(s) for the viewer. Called bay the Viewer class
-                * @param templates the templates to be used to initialize the main template
-                */
-            initTemplate(templates: {
-                    [key: string]: ITemplateConfiguration;
-            }): Promise<void>;
-            /**
-                * Get the canvas in the template tree.
-                * There must be one and only one canvas inthe template.
-                */
-            getCanvas(): HTMLCanvasElement | null;
-            /**
-                * Get a specific template from the template tree
-                * @param name the name of the template to load
-                */
-            getTemplate(name: string): Template | undefined;
-            /**
-                * Dispose the template manager
-                */
-            dispose(): void;
-    }
-    /**
-        * This class represents a single template in the viewer's template tree.
-        * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
-        * A template is injected using the template manager in the correct position.
-        * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
-        *
-        * For further information please refer to the documentation page, https://doc.babylonjs.com
-        */
-    export class Template {
-            name: string;
-            /**
-                * Will be triggered when the template is loaded
-                */
-            onLoaded: BABYLON.Observable<Template>;
-            /**
-                * will be triggered when the template is appended to the tree
-                */
-            onAppended: BABYLON.Observable<Template>;
-            /**
-                * Will be triggered when the template's state changed (shown, hidden)
-                */
-            onStateChange: BABYLON.Observable<Template>;
-            /**
-                * Will be triggered when an event is triggered on ths template.
-                * The event is a native browser event (like mouse or pointer events)
-                */
-            onEventTriggered: BABYLON.Observable<EventCallback>;
-            onParamsUpdated: BABYLON.Observable<Template>;
-            onHTMLRendered: BABYLON.Observable<Template>;
-            /**
-                * is the template loaded?
-                */
-            isLoaded: boolean;
-            /**
-                * This is meant to be used to track the show and hide functions.
-                * This is NOT (!!) a flag to check if the element is actually visible to the user.
-                */
-            isShown: boolean;
-            /**
-                * Is this template a part of the HTML tree (the template manager injected it)
-                */
-            isInHtmlTree: boolean;
-            /**
-                * The HTML element containing this template
-                */
-            parent: HTMLElement;
-            /**
-                * A promise that is fulfilled when the template finished loading.
-                */
-            initPromise: Promise<Template>;
-            constructor(name: string, _configuration: ITemplateConfiguration);
-            /**
-                * Some templates have parameters (like background color for example).
-                * The parameters are provided to Handlebars which in turn generates the template.
-                * This function will update the template with the new parameters
-                *
-                * Note that when updating parameters the events will be registered again (after being cleared).
-                *
-                * @param params the new template parameters
-                */
-            updateParams(params: {
-                    [key: string]: string | number | boolean | object;
-            }, append?: boolean): void;
-            redraw(): void;
-            /**
-                * Get the template'S configuration
-                */
-            readonly configuration: ITemplateConfiguration;
-            /**
-                * A template can be a parent element for other templates or HTML elements.
-                * This function will deliver all child HTML elements of this template.
-                */
-            getChildElements(): Array<string>;
-            /**
-                * Appending the template to a parent HTML element.
-                * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
-                * @param parent the parent to which the template is added
-                * @param forceRemove if the parent already exists, shoud the template be removed from it?
-                */
-            appendTo(parent: HTMLElement, forceRemove?: boolean): void;
-            /**
-                * Show the template using the provided visibilityFunction, or natively using display: flex.
-                * The provided function returns a promise that should be fullfilled when the element is shown.
-                * Since it is a promise async operations are more than possible.
-                * See the default viewer for an opacity example.
-                * @param visibilityFunction The function to execute to show the template.
-                */
-            show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
-            /**
-                * Hide the template using the provided visibilityFunction, or natively using display: none.
-                * The provided function returns a promise that should be fullfilled when the element is hidden.
-                * Since it is a promise async operations are more than possible.
-                * See the default viewer for an opacity example.
-                * @param visibilityFunction The function to execute to show the template.
-                */
-            hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
-            /**
-                * Dispose this template
-                */
-            dispose(): void;
-    }
-}
-declare module BabylonViewer {
     export class ConfigurationContainer {
         configuration: ViewerConfiguration;
         viewerId: string;
@@ -1479,6 +1240,171 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
+    /**
+        * The object sent when an event is triggered
+        */
+    export interface EventCallback {
+            event: Event;
+            template: Template;
+            selector: string;
+            payload?: any;
+    }
+    /**
+        * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
+        * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
+        */
+    export class TemplateManager {
+            containerElement: Element;
+            /**
+                * Will be triggered when any template is initialized
+                */
+            onTemplateInit: BABYLON.Observable<Template>;
+            /**
+                * Will be triggered when any template is fully loaded
+                */
+            onTemplateLoaded: BABYLON.Observable<Template>;
+            /**
+                * Will be triggered when a template state changes
+                */
+            onTemplateStateChange: BABYLON.Observable<Template>;
+            /**
+                * Will be triggered when all templates finished loading
+                */
+            onAllLoaded: BABYLON.Observable<TemplateManager>;
+            /**
+                * Will be triggered when any event on any template is triggered.
+                */
+            onEventTriggered: BABYLON.Observable<EventCallback>;
+            /**
+                * This template manager's event manager. In charge of callback registrations to native event types
+                */
+            eventManager: EventManager;
+            constructor(containerElement: Element);
+            /**
+                * Initialize the template(s) for the viewer. Called bay the Viewer class
+                * @param templates the templates to be used to initialize the main template
+                */
+            initTemplate(templates: {
+                    [key: string]: ITemplateConfiguration;
+            }): Promise<void>;
+            /**
+                * Get the canvas in the template tree.
+                * There must be one and only one canvas inthe template.
+                */
+            getCanvas(): HTMLCanvasElement | null;
+            /**
+                * Get a specific template from the template tree
+                * @param name the name of the template to load
+                */
+            getTemplate(name: string): Template | undefined;
+            /**
+                * Dispose the template manager
+                */
+            dispose(): void;
+    }
+    /**
+        * This class represents a single template in the viewer's template tree.
+        * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
+        * A template is injected using the template manager in the correct position.
+        * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
+        *
+        * For further information please refer to the documentation page, https://doc.babylonjs.com
+        */
+    export class Template {
+            name: string;
+            /**
+                * Will be triggered when the template is loaded
+                */
+            onLoaded: BABYLON.Observable<Template>;
+            /**
+                * will be triggered when the template is appended to the tree
+                */
+            onAppended: BABYLON.Observable<Template>;
+            /**
+                * Will be triggered when the template's state changed (shown, hidden)
+                */
+            onStateChange: BABYLON.Observable<Template>;
+            /**
+                * Will be triggered when an event is triggered on ths template.
+                * The event is a native browser event (like mouse or pointer events)
+                */
+            onEventTriggered: BABYLON.Observable<EventCallback>;
+            onParamsUpdated: BABYLON.Observable<Template>;
+            onHTMLRendered: BABYLON.Observable<Template>;
+            /**
+                * is the template loaded?
+                */
+            isLoaded: boolean;
+            /**
+                * This is meant to be used to track the show and hide functions.
+                * This is NOT (!!) a flag to check if the element is actually visible to the user.
+                */
+            isShown: boolean;
+            /**
+                * Is this template a part of the HTML tree (the template manager injected it)
+                */
+            isInHtmlTree: boolean;
+            /**
+                * The HTML element containing this template
+                */
+            parent: HTMLElement;
+            /**
+                * A promise that is fulfilled when the template finished loading.
+                */
+            initPromise: Promise<Template>;
+            constructor(name: string, _configuration: ITemplateConfiguration);
+            /**
+                * Some templates have parameters (like background color for example).
+                * The parameters are provided to Handlebars which in turn generates the template.
+                * This function will update the template with the new parameters
+                *
+                * Note that when updating parameters the events will be registered again (after being cleared).
+                *
+                * @param params the new template parameters
+                */
+            updateParams(params: {
+                    [key: string]: string | number | boolean | object;
+            }, append?: boolean): void;
+            redraw(): void;
+            /**
+                * Get the template'S configuration
+                */
+            readonly configuration: ITemplateConfiguration;
+            /**
+                * A template can be a parent element for other templates or HTML elements.
+                * This function will deliver all child HTML elements of this template.
+                */
+            getChildElements(): Array<string>;
+            /**
+                * Appending the template to a parent HTML element.
+                * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
+                * @param parent the parent to which the template is added
+                * @param forceRemove if the parent already exists, shoud the template be removed from it?
+                */
+            appendTo(parent: HTMLElement, forceRemove?: boolean): void;
+            /**
+                * Show the template using the provided visibilityFunction, or natively using display: flex.
+                * The provided function returns a promise that should be fullfilled when the element is shown.
+                * Since it is a promise async operations are more than possible.
+                * See the default viewer for an opacity example.
+                * @param visibilityFunction The function to execute to show the template.
+                */
+            show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
+            /**
+                * Hide the template using the provided visibilityFunction, or natively using display: none.
+                * The provided function returns a promise that should be fullfilled when the element is hidden.
+                * Since it is a promise async operations are more than possible.
+                * See the default viewer for an opacity example.
+                * @param visibilityFunction The function to execute to show the template.
+                */
+            hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
+            /**
+                * Dispose this template
+                */
+            dispose(): void;
+    }
+}
+declare module BabylonViewer {
     export interface IModelConfiguration {
             id?: string;
             url?: string;
@@ -1558,6 +1484,20 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 declare module BabylonViewer {
+    /**
+        * A custom upgrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedUpgrade(sceneManager: SceneManager): boolean;
+    /**
+        * A custom degrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedDegrade(sceneManager: SceneManager): boolean;
+}
+declare module BabylonViewer {
 }
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {
@@ -1585,39 +1525,6 @@ declare module BabylonViewer {
 }
 declare module BabylonViewer {
     /**
-        * The EventManager is in charge of registering user interctions with the viewer.
-        * It is used in the TemplateManager
-        */
-    export class EventManager {
-            constructor(_templateManager: TemplateManager);
-            /**
-                * Register a new callback to a specific template.
-                * The best example for the usage can be found in the DefaultViewer
-                *
-                * @param templateName the templateName to register the event to
-                * @param callback The callback to be executed
-                * @param eventType the type of event to register
-                * @param selector an optional selector. if not defined the parent object in the template will be selected
-                */
-            registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
-            /**
-                * This will remove a registered event from the defined template.
-                * Each one of the variables apart from the template name are optional, but one must be provided.
-                *
-                * @param templateName the templateName
-                * @param callback the callback to remove (optional)
-                * @param eventType the event type to remove (optional)
-                * @param selector the selector from which to remove the event (optional)
-                */
-            unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
-            /**
-                * Dispose the event manager
-                */
-            dispose(): void;
-    }
-}
-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.
         * Once stable, lab features will be moved to the publis API and configuration object.
@@ -1666,6 +1573,39 @@ declare module BabylonViewer {
 }
 declare module BabylonViewer {
     /**
+        * The EventManager is in charge of registering user interctions with the viewer.
+        * It is used in the TemplateManager
+        */
+    export class EventManager {
+            constructor(_templateManager: TemplateManager);
+            /**
+                * Register a new callback to a specific template.
+                * The best example for the usage can be found in the DefaultViewer
+                *
+                * @param templateName the templateName to register the event to
+                * @param callback The callback to be executed
+                * @param eventType the type of event to register
+                * @param selector an optional selector. if not defined the parent object in the template will be selected
+                */
+            registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
+            /**
+                * This will remove a registered event from the defined template.
+                * Each one of the variables apart from the template name are optional, but one must be provided.
+                *
+                * @param templateName the templateName
+                * @param callback the callback to remove (optional)
+                * @param eventType the event type to remove (optional)
+                * @param selector the selector from which to remove the event (optional)
+                */
+            unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
+            /**
+                * Dispose the event manager
+                */
+            dispose(): void;
+    }
+}
+declare module BabylonViewer {
+    /**
         * Defines an animation to be applied to a model (translation, scale or rotation).
         */
     export interface IModelAnimationConfiguration {

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
+ 4 - 4
dist/preview release/viewer/babylon.viewer.max.js


+ 225 - 286
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -5,8 +5,8 @@ declare module "babylonjs-loaders"{ export=BABYLON;}
 
 // Generated by dts-bundle v0.7.3
 // Dependencies for this module:
-//   ../../../../../Tools/gulp/babylonjs
-//   ../../../../../Tools/gulp/babylonjs-loaders
+//   ../../../../../Tools/Gulp/babylonjs
+//   ../../../../../Tools/Gulp/babylonjs-loaders
 
 declare module 'babylonjs-viewer' {
     import { mapperManager } from 'babylonjs-viewer/configuration/mappers';
@@ -150,85 +150,7 @@ declare module 'babylonjs-viewer/viewer/viewerManager' {
 }
 
 declare module 'babylonjs-viewer/viewer/defaultViewer' {
-    import { ViewerConfiguration, IModelConfiguration } from 'babylonjs-viewer/configuration';
-    import { Template } from 'babylonjs-viewer/templating/templateManager';
-    import { AbstractViewer } from 'babylonjs-viewer/viewer/viewer';
-    import { ViewerModel } from 'babylonjs-viewer/model/viewerModel';
-    import { IViewerTemplatePlugin } from 'babylonjs-viewer/templating/viewerTemplatePlugin';
-    /**
-        * The Default viewer is the default implementation of the AbstractViewer.
-        * It uses the templating system to render a new canvas and controls.
-        */
-    export class DefaultViewer extends AbstractViewer {
-            containerElement: Element;
-            fullscreenElement?: Element;
-            /**
-                * Create a new default viewer
-                * @param containerElement the element in which the templates will be rendered
-                * @param initialConfiguration the initial configuration. Defaults to extending the default configuration
-                */
-            constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
-            registerTemplatePlugin(plugin: IViewerTemplatePlugin): void;
-            /**
-                * This will be executed when the templates initialize.
-                */
-            protected _onTemplatesLoaded(): Promise<AbstractViewer>;
-            protected _initVR(): void;
-            /**
-                * Toggle fullscreen of the entire viewer
-                */
-            toggleFullscreen: () => void;
-            /**
-                * Preparing the container element to present the viewer
-                */
-            protected _prepareContainerElement(): void;
-            /**
-                * This function will configure the templates and update them after a model was loaded
-                * It is mainly responsible to changing the title and subtitle etc'.
-                * @param model the model to be used to configure the templates by
-                */
-            protected _configureTemplate(model?: ViewerModel): void;
-            /**
-                * This will load a new model to the default viewer
-                * overriding the AbstractViewer's loadModel.
-                * The scene will automatically be cleared of the old models, if exist.
-                * @param model the configuration object (or URL) to load.
-                */
-            loadModel(model?: string | File | IModelConfiguration): Promise<ViewerModel>;
-            /**
-                * Show the overlay and the defined sub-screen.
-                * Mainly used for help and errors
-                * @param subScreen the name of the subScreen. Those can be defined in the configuration object
-                */
-            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
-            /**
-                * Hide the overlay screen.
-                */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
-            /**
-                * show the viewer (in case it was hidden)
-                *
-                * @param visibilityFunction an optional function to execute in order to show the container
-                */
-            show(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
-            /**
-                * hide the viewer (in case it is visible)
-                *
-                * @param visibilityFunction an optional function to execute in order to hide the container
-                */
-            hide(visibilityFunction?: ((template: Template) => Promise<Template>)): Promise<Template>;
-            /**
-                * Show the loading screen.
-                * The loading screen can be configured using the configuration object
-                */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
-            /**
-                * Hide the loading screen
-                */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
-            dispose(): void;
-            protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
-    }
+    
 }
 
 declare module 'babylonjs-viewer/viewer/viewer' {
@@ -985,13 +907,14 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 
 declare module 'babylonjs-viewer/optimizer/custom' {
+    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     /**
       *
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
@@ -1113,175 +1036,6 @@ declare module 'babylonjs-viewer/configuration/configuration' {
     }
 }
 
-declare module 'babylonjs-viewer/templating/templateManager' {
-    import { Observable } from 'babylonjs';
-    import { EventManager } from 'babylonjs-viewer/templating/eventManager';
-    import { ITemplateConfiguration } from 'babylonjs-viewer/configuration/interfaces';
-    /**
-        * The object sent when an event is triggered
-        */
-    export interface EventCallback {
-            event: Event;
-            template: Template;
-            selector: string;
-            payload?: any;
-    }
-    /**
-        * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
-        * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
-        */
-    export class TemplateManager {
-            containerElement: Element;
-            /**
-                * Will be triggered when any template is initialized
-                */
-            onTemplateInit: Observable<Template>;
-            /**
-                * Will be triggered when any template is fully loaded
-                */
-            onTemplateLoaded: Observable<Template>;
-            /**
-                * Will be triggered when a template state changes
-                */
-            onTemplateStateChange: Observable<Template>;
-            /**
-                * Will be triggered when all templates finished loading
-                */
-            onAllLoaded: Observable<TemplateManager>;
-            /**
-                * Will be triggered when any event on any template is triggered.
-                */
-            onEventTriggered: Observable<EventCallback>;
-            /**
-                * This template manager's event manager. In charge of callback registrations to native event types
-                */
-            eventManager: EventManager;
-            constructor(containerElement: Element);
-            /**
-                * Initialize the template(s) for the viewer. Called bay the Viewer class
-                * @param templates the templates to be used to initialize the main template
-                */
-            initTemplate(templates: {
-                    [key: string]: ITemplateConfiguration;
-            }): Promise<void>;
-            /**
-                * Get the canvas in the template tree.
-                * There must be one and only one canvas inthe template.
-                */
-            getCanvas(): HTMLCanvasElement | null;
-            /**
-                * Get a specific template from the template tree
-                * @param name the name of the template to load
-                */
-            getTemplate(name: string): Template | undefined;
-            /**
-                * Dispose the template manager
-                */
-            dispose(): void;
-    }
-    /**
-        * This class represents a single template in the viewer's template tree.
-        * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
-        * A template is injected using the template manager in the correct position.
-        * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
-        *
-        * For further information please refer to the documentation page, https://doc.babylonjs.com
-        */
-    export class Template {
-            name: string;
-            /**
-                * Will be triggered when the template is loaded
-                */
-            onLoaded: Observable<Template>;
-            /**
-                * will be triggered when the template is appended to the tree
-                */
-            onAppended: Observable<Template>;
-            /**
-                * Will be triggered when the template's state changed (shown, hidden)
-                */
-            onStateChange: Observable<Template>;
-            /**
-                * Will be triggered when an event is triggered on ths template.
-                * The event is a native browser event (like mouse or pointer events)
-                */
-            onEventTriggered: Observable<EventCallback>;
-            onParamsUpdated: Observable<Template>;
-            onHTMLRendered: Observable<Template>;
-            /**
-                * is the template loaded?
-                */
-            isLoaded: boolean;
-            /**
-                * This is meant to be used to track the show and hide functions.
-                * This is NOT (!!) a flag to check if the element is actually visible to the user.
-                */
-            isShown: boolean;
-            /**
-                * Is this template a part of the HTML tree (the template manager injected it)
-                */
-            isInHtmlTree: boolean;
-            /**
-                * The HTML element containing this template
-                */
-            parent: HTMLElement;
-            /**
-                * A promise that is fulfilled when the template finished loading.
-                */
-            initPromise: Promise<Template>;
-            constructor(name: string, _configuration: ITemplateConfiguration);
-            /**
-                * Some templates have parameters (like background color for example).
-                * The parameters are provided to Handlebars which in turn generates the template.
-                * This function will update the template with the new parameters
-                *
-                * Note that when updating parameters the events will be registered again (after being cleared).
-                *
-                * @param params the new template parameters
-                */
-            updateParams(params: {
-                    [key: string]: string | number | boolean | object;
-            }, append?: boolean): void;
-            redraw(): void;
-            /**
-                * Get the template'S configuration
-                */
-            readonly configuration: ITemplateConfiguration;
-            /**
-                * A template can be a parent element for other templates or HTML elements.
-                * This function will deliver all child HTML elements of this template.
-                */
-            getChildElements(): Array<string>;
-            /**
-                * Appending the template to a parent HTML element.
-                * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
-                * @param parent the parent to which the template is added
-                * @param forceRemove if the parent already exists, shoud the template be removed from it?
-                */
-            appendTo(parent: HTMLElement, forceRemove?: boolean): void;
-            /**
-                * Show the template using the provided visibilityFunction, or natively using display: flex.
-                * The provided function returns a promise that should be fullfilled when the element is shown.
-                * Since it is a promise async operations are more than possible.
-                * See the default viewer for an opacity example.
-                * @param visibilityFunction The function to execute to show the template.
-                */
-            show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
-            /**
-                * Hide the template using the provided visibilityFunction, or natively using display: none.
-                * The provided function returns a promise that should be fullfilled when the element is hidden.
-                * Since it is a promise async operations are more than possible.
-                * See the default viewer for an opacity example.
-                * @param visibilityFunction The function to execute to show the template.
-                */
-            hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
-            /**
-                * Dispose this template
-                */
-            dispose(): void;
-    }
-}
-
 declare module 'babylonjs-viewer/configuration/configurationContainer' {
     import { ViewerConfiguration } from 'babylonjs-viewer/configuration/configuration';
     import { Color3, Scene } from 'babylonjs';
@@ -1574,6 +1328,175 @@ declare module 'babylonjs-viewer/managers/sceneManager' {
     }
 }
 
+declare module 'babylonjs-viewer/templating/templateManager' {
+    import { Observable } from 'babylonjs';
+    import { EventManager } from 'babylonjs-viewer/templating/eventManager';
+    import { ITemplateConfiguration } from 'babylonjs-viewer/configuration/interfaces';
+    /**
+        * The object sent when an event is triggered
+        */
+    export interface EventCallback {
+            event: Event;
+            template: Template;
+            selector: string;
+            payload?: any;
+    }
+    /**
+        * The template manager, a member of the viewer class, will manage the viewer's templates and generate the HTML.
+        * The template manager managers a single viewer and can be seen as the collection of all sub-templates of the viewer.
+        */
+    export class TemplateManager {
+            containerElement: Element;
+            /**
+                * Will be triggered when any template is initialized
+                */
+            onTemplateInit: Observable<Template>;
+            /**
+                * Will be triggered when any template is fully loaded
+                */
+            onTemplateLoaded: Observable<Template>;
+            /**
+                * Will be triggered when a template state changes
+                */
+            onTemplateStateChange: Observable<Template>;
+            /**
+                * Will be triggered when all templates finished loading
+                */
+            onAllLoaded: Observable<TemplateManager>;
+            /**
+                * Will be triggered when any event on any template is triggered.
+                */
+            onEventTriggered: Observable<EventCallback>;
+            /**
+                * This template manager's event manager. In charge of callback registrations to native event types
+                */
+            eventManager: EventManager;
+            constructor(containerElement: Element);
+            /**
+                * Initialize the template(s) for the viewer. Called bay the Viewer class
+                * @param templates the templates to be used to initialize the main template
+                */
+            initTemplate(templates: {
+                    [key: string]: ITemplateConfiguration;
+            }): Promise<void>;
+            /**
+                * Get the canvas in the template tree.
+                * There must be one and only one canvas inthe template.
+                */
+            getCanvas(): HTMLCanvasElement | null;
+            /**
+                * Get a specific template from the template tree
+                * @param name the name of the template to load
+                */
+            getTemplate(name: string): Template | undefined;
+            /**
+                * Dispose the template manager
+                */
+            dispose(): void;
+    }
+    /**
+        * This class represents a single template in the viewer's template tree.
+        * An example for a template is a single canvas, an overlay (containing sub-templates) or the navigation bar.
+        * A template is injected using the template manager in the correct position.
+        * The template is rendered using Handlebars and can use Handlebars' features (such as parameter injection)
+        *
+        * For further information please refer to the documentation page, https://doc.babylonjs.com
+        */
+    export class Template {
+            name: string;
+            /**
+                * Will be triggered when the template is loaded
+                */
+            onLoaded: Observable<Template>;
+            /**
+                * will be triggered when the template is appended to the tree
+                */
+            onAppended: Observable<Template>;
+            /**
+                * Will be triggered when the template's state changed (shown, hidden)
+                */
+            onStateChange: Observable<Template>;
+            /**
+                * Will be triggered when an event is triggered on ths template.
+                * The event is a native browser event (like mouse or pointer events)
+                */
+            onEventTriggered: Observable<EventCallback>;
+            onParamsUpdated: Observable<Template>;
+            onHTMLRendered: Observable<Template>;
+            /**
+                * is the template loaded?
+                */
+            isLoaded: boolean;
+            /**
+                * This is meant to be used to track the show and hide functions.
+                * This is NOT (!!) a flag to check if the element is actually visible to the user.
+                */
+            isShown: boolean;
+            /**
+                * Is this template a part of the HTML tree (the template manager injected it)
+                */
+            isInHtmlTree: boolean;
+            /**
+                * The HTML element containing this template
+                */
+            parent: HTMLElement;
+            /**
+                * A promise that is fulfilled when the template finished loading.
+                */
+            initPromise: Promise<Template>;
+            constructor(name: string, _configuration: ITemplateConfiguration);
+            /**
+                * Some templates have parameters (like background color for example).
+                * The parameters are provided to Handlebars which in turn generates the template.
+                * This function will update the template with the new parameters
+                *
+                * Note that when updating parameters the events will be registered again (after being cleared).
+                *
+                * @param params the new template parameters
+                */
+            updateParams(params: {
+                    [key: string]: string | number | boolean | object;
+            }, append?: boolean): void;
+            redraw(): void;
+            /**
+                * Get the template'S configuration
+                */
+            readonly configuration: ITemplateConfiguration;
+            /**
+                * A template can be a parent element for other templates or HTML elements.
+                * This function will deliver all child HTML elements of this template.
+                */
+            getChildElements(): Array<string>;
+            /**
+                * Appending the template to a parent HTML element.
+                * If a parent is already set and you wish to replace the old HTML with new one, forceRemove should be true.
+                * @param parent the parent to which the template is added
+                * @param forceRemove if the parent already exists, shoud the template be removed from it?
+                */
+            appendTo(parent: HTMLElement, forceRemove?: boolean): void;
+            /**
+                * Show the template using the provided visibilityFunction, or natively using display: flex.
+                * The provided function returns a promise that should be fullfilled when the element is shown.
+                * Since it is a promise async operations are more than possible.
+                * See the default viewer for an opacity example.
+                * @param visibilityFunction The function to execute to show the template.
+                */
+            show(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
+            /**
+                * Hide the template using the provided visibilityFunction, or natively using display: none.
+                * The provided function returns a promise that should be fullfilled when the element is hidden.
+                * Since it is a promise async operations are more than possible.
+                * See the default viewer for an opacity example.
+                * @param visibilityFunction The function to execute to show the template.
+                */
+            hide(visibilityFunction?: (template: Template) => Promise<Template>): Promise<Template>;
+            /**
+                * Dispose this template
+                */
+            dispose(): void;
+    }
+}
+
 declare module 'babylonjs-viewer/configuration/interfaces/modelConfiguration' {
     import { IModelAnimationConfiguration } from "babylonjs-viewer/configuration/interfaces/modelAnimationConfiguration";
     export interface IModelConfiguration {
@@ -1662,6 +1585,22 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 
+declare module 'babylonjs-viewer/optimizer/custom/extended' {
+    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
+    /**
+        * A custom upgrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedUpgrade(sceneManager: SceneManager): boolean;
+    /**
+        * A custom degrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedDegrade(sceneManager: SceneManager): boolean;
+}
+
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';
@@ -1705,41 +1644,6 @@ declare module 'babylonjs-viewer/configuration/interfaces/environmentMapConfigur
     }
 }
 
-declare module 'babylonjs-viewer/templating/eventManager' {
-    import { EventCallback, TemplateManager } from "babylonjs-viewer/templating/templateManager";
-    /**
-        * The EventManager is in charge of registering user interctions with the viewer.
-        * It is used in the TemplateManager
-        */
-    export class EventManager {
-            constructor(_templateManager: TemplateManager);
-            /**
-                * Register a new callback to a specific template.
-                * The best example for the usage can be found in the DefaultViewer
-                *
-                * @param templateName the templateName to register the event to
-                * @param callback The callback to be executed
-                * @param eventType the type of event to register
-                * @param selector an optional selector. if not defined the parent object in the template will be selected
-                */
-            registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
-            /**
-                * This will remove a registered event from the defined template.
-                * Each one of the variables apart from the template name are optional, but one must be provided.
-                *
-                * @param templateName the templateName
-                * @param callback the callback to remove (optional)
-                * @param eventType the event type to remove (optional)
-                * @param selector the selector from which to remove the event (optional)
-                */
-            unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
-            /**
-                * Dispose the event manager
-                */
-            dispose(): void;
-    }
-}
-
 declare module 'babylonjs-viewer/labs/viewerLabs' {
     import { PBREnvironment } from "babylonjs-viewer/labs/environmentSerializer";
     import { ShadowLight, Vector3, Scene } from 'babylonjs';
@@ -1791,6 +1695,41 @@ declare module 'babylonjs-viewer/labs/viewerLabs' {
     }
 }
 
+declare module 'babylonjs-viewer/templating/eventManager' {
+    import { EventCallback, TemplateManager } from "babylonjs-viewer/templating/templateManager";
+    /**
+        * The EventManager is in charge of registering user interctions with the viewer.
+        * It is used in the TemplateManager
+        */
+    export class EventManager {
+            constructor(_templateManager: TemplateManager);
+            /**
+                * Register a new callback to a specific template.
+                * The best example for the usage can be found in the DefaultViewer
+                *
+                * @param templateName the templateName to register the event to
+                * @param callback The callback to be executed
+                * @param eventType the type of event to register
+                * @param selector an optional selector. if not defined the parent object in the template will be selected
+                */
+            registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
+            /**
+                * This will remove a registered event from the defined template.
+                * Each one of the variables apart from the template name are optional, but one must be provided.
+                *
+                * @param templateName the templateName
+                * @param callback the callback to remove (optional)
+                * @param eventType the event type to remove (optional)
+                * @param selector the selector from which to remove the event (optional)
+                */
+            unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
+            /**
+                * Dispose the event manager
+                */
+            dispose(): void;
+    }
+}
+
 declare module 'babylonjs-viewer/configuration/interfaces/modelAnimationConfiguration' {
     /**
         * Defines an animation to be applied to a model (translation, scale or rotation).

+ 10 - 2
inspector/src/components/actionTabs/tabs/propertyGridTabComponent.tsx

@@ -19,7 +19,7 @@ import { TextBlockPropertyGridComponent } from "./propertyGrids/gui/textBlockPro
 import { TextBlock } from "babylonjs-gui/2D/controls/textBlock";
 import { InputText } from "babylonjs-gui/2D/controls/inputText";
 import { InputTextPropertyGridComponent } from "./propertyGrids/gui/inputTextPropertyGridComponent";
-import { ColorPicker, Image, Slider, ImageBasedSlider, Rectangle, Ellipse, Checkbox, RadioButton, Line, ScrollViewer } from "babylonjs-gui";
+import { ColorPicker, Image, Slider, ImageBasedSlider, Rectangle, Ellipse, Checkbox, RadioButton, Line, ScrollViewer, Grid } from "babylonjs-gui";
 import { ColorPickerPropertyGridComponent } from "./propertyGrids/gui/colorPickerPropertyGridComponent";
 import { AnimationGroupGridComponent } from "./propertyGrids/animationGroupPropertyGridComponent";
 import { LockObject } from "./propertyGrids/lockObject";
@@ -32,6 +32,7 @@ import { CheckboxPropertyGridComponent } from "./propertyGrids/gui/checkboxPrope
 import { RadioButtonPropertyGridComponent } from "./propertyGrids/gui/radioButtonPropertyGridComponent";
 import { LinePropertyGridComponent } from "./propertyGrids/gui/linePropertyGridComponent";
 import { ScrollViewerPropertyGridComponent } from "./propertyGrids/gui/scrollViewerPropertyGridComponent";
+import { GridPropertyGridComponent } from "./propertyGrids/gui/gridPropertyGridComponent";
 
 export class PropertyGridTabComponent extends PaneComponent {
     private _timerIntervalId: number;
@@ -215,12 +216,19 @@ export class PropertyGridTabComponent extends PaneComponent {
                     onPropertyChangedObservable={this.props.onPropertyChangedObservable} />);
             }
 
+            if (className === "Grid") {
+                const grid = entity as Grid;
+                return (<GridPropertyGridComponent grid={grid}
+                    lockObject={this._lockObject}
+                    onPropertyChangedObservable={this.props.onPropertyChangedObservable} />);
+            }
+
             if (className === "ScrollViewer") {
                 const scrollViewer = entity as ScrollViewer;
                 return (<ScrollViewerPropertyGridComponent scrollViewer={scrollViewer}
                     lockObject={this._lockObject}
                     onPropertyChangedObservable={this.props.onPropertyChangedObservable} />);
-            }            
+            }
 
             if (className === "Ellipse") {
                 const ellipse = entity as Ellipse;

+ 1 - 1
inspector/src/components/actionTabs/tabs/propertyGrids/animationGroupPropertyGridComponent.tsx

@@ -127,7 +127,7 @@ export class AnimationGroupGridComponent extends React.Component<IAnimationGroup
                 <LineContainerComponent title="CONTROLS">
                     <ButtonLineComponent label={playButtonText} onClick={() => this.playOrPause()} />
                     <SliderLineComponent label="Speed ratio" minimum={0} maximum={10} step={0.1} target={animationGroup} propertyName="speedRatio" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
-                    <SliderLineComponent ref="timeline" label="Current frame" minimum={animationGroup.from} maximum={animationGroup.to} step={(animationGroup.to - animationGroup.from) / 100.0} directValue={this.state.currentFrame} onInput={value => this.onCurrentFrameChange(value)} />
+                    <SliderLineComponent ref="timeline" label="Current frame" minimum={animationGroup.from} maximum={animationGroup.to} step={(animationGroup.to - animationGroup.from) / 1000.0} directValue={this.state.currentFrame} onInput={value => this.onCurrentFrameChange(value)} />
                 </LineContainerComponent>
                 <LineContainerComponent title="INFOS">
                     <TextLineComponent label="Animation count" value={animationGroup.targetedAnimations.length.toString()} />

+ 18 - 18
inspector/src/components/actionTabs/tabs/propertyGrids/gui/gridPropertyGridComponent.tsx

@@ -4,8 +4,8 @@ import { PropertyChangedEvent } from "../../../../propertyChangedEvent";
 import { CommonControlPropertyGridComponent } from "./commonControlPropertyGridComponent";
 import { LockObject } from "../lockObject";
 import { Grid } from "babylonjs-gui/2D/controls/grid";
-import { LineContainerComponent } from "components/actionTabs/lineContainerComponent";
-import { TextLineComponent } from "components/actionTabs/lines/textLineComponent";
+import { LineContainerComponent } from "../../../lineContainerComponent";
+import { TextLineComponent } from "../../../lines/textLineComponent";
 
 interface IGridPropertyGridComponentProps {
     grid: Grid,
@@ -13,27 +13,27 @@ interface IGridPropertyGridComponentProps {
     onPropertyChangedObservable?: Observable<PropertyChangedEvent>
 }
 
-export class ControlPropertyGridComponent extends React.Component<IGridPropertyGridComponentProps> {
+export class GridPropertyGridComponent extends React.Component<IGridPropertyGridComponentProps> {
     constructor(props: IGridPropertyGridComponentProps) {
         super(props);
     }
 
-    // renderRows() {
-    //     const grid = this.props.grid;
-    //     const rows = [];
+    renderRows() {
+        const grid = this.props.grid;
+        const rows = [];
 
-    //     for (var index = 0; index < grid.rowCount; index++) {
-    //         rows.push(grid.getRowDefinition(index)!);
-    //     }
+        for (var index = 0; index < grid.rowCount; index++) {
+            rows.push(grid.getRowDefinition(index)!);
+        }
 
-    //     return (
-    //         rows.map((rd, i) => {
-    //             return (
-    //                 <TextLineComponent label={`Row #${i}`} value={rd.internalValue} />
-    //             )
-    //         })
-    //     );
-    // }
+        return (
+            rows.map((rd, i) => {
+                return (
+                    <TextLineComponent label={`Row #${i}`} value={rd.toString(grid.host)} />
+                )
+            })
+        );
+    }
 
     render() {
         const grid = this.props.grid;
@@ -51,7 +51,7 @@ export class ControlPropertyGridComponent extends React.Component<IGridPropertyG
                 <CommonControlPropertyGridComponent lockObject={this.props.lockObject} control={grid} onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
                 <LineContainerComponent title="GRID">
                     {
-                        //     this.renderRows()
+                        this.renderRows()
                     }
                 </LineContainerComponent>
             </div>