瀏覽代碼

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js into davrous

# Conflicts:
#	Playground/babylon.d.txt
#	dist/preview release/babylon.d.ts
#	dist/preview release/babylon.js
#	dist/preview release/babylon.max.js
#	dist/preview release/babylon.worker.js
#	dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
#	dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
#	dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
David Rousset 7 年之前
父節點
當前提交
1981492648
共有 32 個文件被更改,包括 15096 次插入15158 次删除
  1. 1 0
      .gitignore
  2. 3353 3353
      Playground/babylon.d.txt
  3. 1 1
      Tools/Gulp/gulpfile.js
  4. 4089 4088
      dist/preview release/babylon.d.ts
  5. 42 42
      dist/preview release/babylon.js
  6. 68 74
      dist/preview release/babylon.max.js
  7. 42 42
      dist/preview release/babylon.worker.js
  8. 7221 7221
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  9. 17 17
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  10. 36 73
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  11. 1 0
      dist/preview release/what's new.md
  12. 0 13
      package-lock.json
  13. 8 4
      src/Audio/babylon.sound.ts
  14. 1 1
      src/Behaviors/Cameras/babylon.bouncingBehavior.ts
  15. 1 1
      src/Behaviors/Cameras/babylon.framingBehavior.ts
  16. 3 3
      src/Cameras/VR/babylon.vrExperienceHelper.ts
  17. 1 1
      src/Cameras/babylon.arcRotateCamera.ts
  18. 2 2
      src/Collisions/babylon.collisionCoordinator.ts
  19. 8 8
      src/Engine/babylon.engine.ts
  20. 1 1
      src/LensFlare/babylon.lensFlareSystem.ts
  21. 6 1
      src/Materials/Textures/babylon.colorGradingTexture.ts
  22. 1 1
      src/Materials/Textures/babylon.texture.ts
  23. 4 4
      src/Mesh/babylon.mesh.ts
  24. 1 1
      src/Mesh/babylon.meshBuilder.ts
  25. 74 62
      src/Mesh/babylon.transformNode.ts
  26. 35 76
      src/Physics/babylon.physicsHelper.ts
  27. 43 38
      src/Tools/babylon.assetsManager.ts
  28. 14 9
      src/Tools/babylon.decorators.ts
  29. 2 2
      src/Tools/babylon.observable.ts
  30. 6 6
      src/Tools/babylon.tools.ts
  31. 12 12
      src/babylon.scene.ts
  32. 2 1
      src/tsconfig.json

+ 1 - 0
.gitignore

@@ -166,3 +166,4 @@ localDev/src/*
 /dist/preview release/babylon.custom.js
 /dist/preview release/babylon.custom.max.js
 /localDev/src/index.js
+package-lock.json

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


+ 1 - 1
Tools/Gulp/gulpfile.js

@@ -49,7 +49,7 @@ var tsConfig = {
     noImplicitThis: true,
     noUnusedLocals: true,
     strictNullChecks: true,
-    strictFunctionTypes: false
+    strictFunctionTypes: true
 };
 var tsProject = typescript.createProject(tsConfig);
 

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


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


+ 68 - 74
dist/preview release/babylon.max.js

@@ -5178,7 +5178,8 @@ var BABYLON;
                     case 3: // FresnelParameters
                     case 4: // Vector2
                     case 5: // Vector3
-                    case 7:// Color Curves
+                    case 7: // Color Curves
+                    case 10:// Quaternion
                         destination[property] = instanciate ? sourceProperty : sourceProperty.clone();
                         break;
                 }
@@ -5305,6 +5306,10 @@ var BABYLON;
         return generateSerializableMember(9, sourceName); // image processing
     }
     BABYLON.serializeAsImageProcessingConfiguration = serializeAsImageProcessingConfiguration;
+    function serializeAsQuaternion(sourceName) {
+        return generateSerializableMember(10, sourceName); // quaternion member
+    }
+    BABYLON.serializeAsQuaternion = serializeAsQuaternion;
     var SerializationHelper = /** @class */ (function () {
         function SerializationHelper() {
         }
@@ -7863,7 +7868,7 @@ var BABYLON;
             }
         };
         var onerror = function (request, exception) {
-            if (onErrorCallBack) {
+            if (onErrorCallBack && request) {
                 onErrorCallBack(request.status + " " + request.statusText, exception);
             }
         };
@@ -11042,7 +11047,7 @@ var BABYLON;
                 isDDS = (extension === ".dds");
             }
             var onerror = function (request, exception) {
-                if (onError) {
+                if (onError && request) {
                     onError(request.status + " " + request.statusText, exception);
                 }
             };
@@ -11268,7 +11273,7 @@ var BABYLON;
             this._internalTexturesCache.push(texture);
             var onerror = function (request, exception) {
                 scene._removePendingData(texture);
-                if (onError) {
+                if (onError && request) {
                     onError(request.status + " " + request.statusText, exception);
                 }
             };
@@ -13047,6 +13052,7 @@ var BABYLON;
 //# sourceMappingURL=babylon.boundingInfo.js.map
 
 
+
 var BABYLON;
 (function (BABYLON) {
     var TransformNode = /** @class */ (function (_super) {
@@ -13917,6 +13923,27 @@ var BABYLON;
         TransformNode.BILLBOARDMODE_ALL = 7;
         TransformNode._lookAtVectorCache = new BABYLON.Vector3(0, 0, 0);
         TransformNode._rotationAxisCache = new BABYLON.Quaternion();
+        __decorate([
+            BABYLON.serializeAsVector3()
+        ], TransformNode.prototype, "_rotation", void 0);
+        __decorate([
+            BABYLON.serializeAsQuaternion()
+        ], TransformNode.prototype, "_rotationQuaternion", void 0);
+        __decorate([
+            BABYLON.serializeAsVector3()
+        ], TransformNode.prototype, "_scaling", void 0);
+        __decorate([
+            BABYLON.serialize()
+        ], TransformNode.prototype, "billboardMode", void 0);
+        __decorate([
+            BABYLON.serialize()
+        ], TransformNode.prototype, "scalingDeterminant", void 0);
+        __decorate([
+            BABYLON.serialize()
+        ], TransformNode.prototype, "infiniteDistance", void 0);
+        __decorate([
+            BABYLON.serializeAsVector3()
+        ], TransformNode.prototype, "position", void 0);
         return TransformNode;
     }(BABYLON.Node));
     BABYLON.TransformNode = TransformNode;
@@ -15635,6 +15662,10 @@ var BABYLON;
 
 
 
+
+
+
+
 var BABYLON;
 (function (BABYLON) {
     var Light = /** @class */ (function (_super) {
@@ -24193,10 +24224,9 @@ var BABYLON;
             return this;
         };
         Mesh.prototype._onBeforeDraw = function (isInstance, world, effectiveMaterial) {
-            if (isInstance) {
+            if (isInstance && effectiveMaterial) {
                 effectiveMaterial.bindOnlyWorldMatrix(world);
             }
-            return this;
         };
         /**
          * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
@@ -24417,7 +24447,8 @@ var BABYLON;
             }
             // Sources
             var meshes = this.getScene().meshes;
-            meshes.forEach(function (mesh) {
+            meshes.forEach(function (abstractMesh) {
+                var mesh = abstractMesh;
                 if (mesh._source && mesh._source === _this) {
                     mesh._source = null;
                 }
@@ -33285,6 +33316,9 @@ var BABYLON;
             }
             this._texture = texture;
             var callback = function (text) {
+                if (typeof text !== "string") {
+                    return;
+                }
                 var data = null;
                 var tempData = null;
                 var line;
@@ -44550,8 +44584,8 @@ var BABYLON;
             var _this = this;
             this._scaledPosition = BABYLON.Vector3.Zero();
             this._scaledVelocity = BABYLON.Vector3.Zero();
-            this.onMeshUpdated = function (mesh) {
-                _this._addUpdateMeshesList[mesh.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(mesh);
+            this.onMeshUpdated = function (transformNode) {
+                _this._addUpdateMeshesList[transformNode.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(transformNode);
             };
             this.onGeometryUpdated = function (geometry) {
                 _this._addUpdateGeometriesList[geometry.id] = CollisionCoordinatorWorker.SerializeGeometry(geometry);
@@ -49874,8 +49908,12 @@ var BABYLON;
                 this._connectedMesh = null;
             }
         };
-        Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (connectedMesh) {
-            var boundingInfo = connectedMesh.getBoundingInfo();
+        Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (node) {
+            if (!node.getBoundingInfo) {
+                return;
+            }
+            var mesh = node;
+            var boundingInfo = mesh.getBoundingInfo();
             this.setPosition(boundingInfo.boundingSphere.centerWorld);
             if (BABYLON.Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {
                 this._updateDirection();
@@ -67356,14 +67394,13 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsRadialExplosionEvent(this._scene);
-            for (var i = 0; i < impostors.length; ++i) {
-                var impostor = impostors[i];
+            impostors.forEach(function (impostor) {
                 var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
-                if (impostorForceAndContactPoint === null) {
-                    continue;
+                if (!impostorForceAndContactPoint) {
+                    return;
                 }
                 impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
-            }
+            });
             event.cleanup(false);
             return event;
         };
@@ -67384,14 +67421,13 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsRadialExplosionEvent(this._scene);
-            for (var i = 0; i < impostors.length; ++i) {
-                var impostor = impostors[i];
+            impostors.forEach(function (impostor) {
                 var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
-                if (impostorForceAndContactPoint === null) {
-                    continue;
+                if (!impostorForceAndContactPoint) {
+                    return;
                 }
                 impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
-            }
+            });
             event.cleanup(false);
             return event;
         };
@@ -67493,7 +67529,7 @@ var BABYLON;
         /*** Helpers ***/
         PhysicsRadialExplosionEvent.prototype._prepareRadialSphere = function () {
             if (!this._radialSphere) {
-                this._radialSphere = BABYLON.Mesh.CreateSphere("radialSphere", 32, 1, this._scene);
+                this._radialSphere = BABYLON.MeshBuilder.CreateSphere("radialSphere", { segments: 32, diameter: 1 }, this._scene);
                 this._radialSphere.isVisible = false;
             }
         };
@@ -67570,7 +67606,9 @@ var BABYLON;
             }
             else {
                 var radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._radius, this._strength * -1, this._falloff);
-                this._radialSphere = radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                if (radialExplosionEvent) {
+                    this._radialSphere = radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                }
             }
         };
         return PhysicsGravitationalFieldEvent;
@@ -71978,12 +72016,9 @@ var BABYLON;
             this._scene.imageProcessingConfiguration.vignetteColor = new BABYLON.Color4(0, 0, 0, 0);
             this._scene.imageProcessingConfiguration.vignetteEnabled = true;
             this._scene.imageProcessingConfiguration.isEnabled = false;
-            this._createGazeTracker();
             this._createTeleportationCircles();
             this.meshSelectionPredicate = function (mesh) {
-                if (mesh.isVisible && mesh.name.indexOf("gazeTracker") === -1
-                    && mesh.name.indexOf("teleportationCircle") === -1
-                    && mesh.name.indexOf("torusTeleportation") === -1) {
+                if (mesh.name.indexOf(_this._floorMeshName) !== -1) {
                     return true;
                 }
                 return false;
@@ -72065,18 +72100,6 @@ var BABYLON;
                 });
             }
         };
-        // Little white circle attached to the camera
-        // That will act as the target to look on the floor where to teleport
-        VRExperienceHelper.prototype._createGazeTracker = function () {
-            this._gazeTracker = BABYLON.Mesh.CreateTorus("gazeTracker", 0.0050, 0.0020, 25, this._scene, false);
-            this._gazeTracker.bakeCurrentTransformIntoVertices();
-            this._gazeTracker.isPickable = false;
-            var targetMat = new BABYLON.StandardMaterial("targetMat", this._scene);
-            targetMat.specularColor = BABYLON.Color3.Black();
-            targetMat.emissiveColor = BABYLON.Color3.White();
-            targetMat.backFaceCulling = false;
-            this._gazeTracker.material = targetMat;
-        };
         VRExperienceHelper.prototype._createTeleportationCircles = function () {
             this._teleportationCircle = BABYLON.Mesh.CreateGround("teleportationCircle", 2, 2, 2, this._scene);
             var length = 512;
@@ -72098,7 +72121,7 @@ var BABYLON;
             var teleportationCircleMaterial = new BABYLON.StandardMaterial("TextPlaneMaterial", this._scene);
             teleportationCircleMaterial.diffuseTexture = dynamicTexture;
             this._teleportationCircle.material = teleportationCircleMaterial;
-            var torus = BABYLON.Mesh.CreateTorus("torusTeleportation", 0.75, 0.1, 25, this._scene, false);
+            var torus = BABYLON.Mesh.CreateTorus("torus", 0.75, 0.1, 25, this._scene, false);
             torus.parent = this._teleportationCircle;
             var animationInnerCircle = new BABYLON.Animation("animationInnerCircle", "position.y", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
             var keys = [];
@@ -72292,40 +72315,11 @@ var BABYLON;
                 ray = this.currentVRCamera.rightController.getForwardRay();
             }
             var hit = this._scene.pickWithRay(ray, this.meshSelectionPredicate);
-            if (hit && hit.pickedPoint) {
-                this._gazeTracker.scaling.x = hit.distance;
-                this._gazeTracker.scaling.y = hit.distance;
-                this._gazeTracker.scaling.z = hit.distance;
-                var pickNormal = hit.getNormal();
-                if (pickNormal) {
-                    var axis1 = BABYLON.Vector3.Cross(BABYLON.Axis.Y, pickNormal);
-                    var axis2 = BABYLON.Vector3.Cross(pickNormal, axis1);
-                    BABYLON.Vector3.RotationFromAxisToRef(axis2, pickNormal, axis1, this._gazeTracker.rotation);
-                }
-                this._gazeTracker.position.copyFrom(hit.pickedPoint);
-                if (this._gazeTracker.position.x < 0) {
-                    this._gazeTracker.position.x += 0.002;
-                }
-                else {
-                    this._gazeTracker.position.x -= 0.002;
-                }
-                if (this._gazeTracker.position.y < 0) {
-                    this._gazeTracker.position.y += 0.002;
-                }
-                else {
-                    this._gazeTracker.position.y -= 0.002;
-                }
-                if (this._gazeTracker.position.z < 0) {
-                    this._gazeTracker.position.z += 0.002;
-                }
-                else {
-                    this._gazeTracker.position.z -= 0.002;
-                }
-            }
             if (this._rayHelper) {
                 this._rayHelper.dispose();
             }
             if (this.currentVRCamera.rightController) {
+                //if (target) target.isVisible = false;
                 this._rayHelper = BABYLON.RayHelper.CreateAndShow(ray, this._scene, new BABYLON.Color3(0.7, 0.7, 0.7));
             }
             if (hit && hit.pickedMesh) {
@@ -75010,8 +75004,8 @@ var BABYLON;
             var onload = function () {
                 onSuccess();
             };
-            var onerror = function (msg, exception) {
-                onError(msg, exception);
+            var onerror = function (message, exception) {
+                onError(message, exception);
             };
             this.texture = new BABYLON.Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);
         };
@@ -75033,8 +75027,8 @@ var BABYLON;
             var onload = function () {
                 onSuccess();
             };
-            var onerror = function (msg, exception) {
-                onError(msg, exception);
+            var onerror = function (message, exception) {
+                onError(message, exception);
             };
             this.texture = new BABYLON.CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror);
         };

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


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


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


+ 36 - 73
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -7863,7 +7863,7 @@ var BABYLON;
             }
         };
         var onerror = function (request, exception) {
-            if (onErrorCallBack) {
+            if (onErrorCallBack && request) {
                 onErrorCallBack(request.status + " " + request.statusText, exception);
             }
         };
@@ -11042,7 +11042,7 @@ var BABYLON;
                 isDDS = (extension === ".dds");
             }
             var onerror = function (request, exception) {
-                if (onError) {
+                if (onError && request) {
                     onError(request.status + " " + request.statusText, exception);
                 }
             };
@@ -11268,7 +11268,7 @@ var BABYLON;
             this._internalTexturesCache.push(texture);
             var onerror = function (request, exception) {
                 scene._removePendingData(texture);
-                if (onError) {
+                if (onError && request) {
                     onError(request.status + " " + request.statusText, exception);
                 }
             };
@@ -24193,10 +24193,9 @@ var BABYLON;
             return this;
         };
         Mesh.prototype._onBeforeDraw = function (isInstance, world, effectiveMaterial) {
-            if (isInstance) {
+            if (isInstance && effectiveMaterial) {
                 effectiveMaterial.bindOnlyWorldMatrix(world);
             }
-            return this;
         };
         /**
          * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
@@ -24417,7 +24416,8 @@ var BABYLON;
             }
             // Sources
             var meshes = this.getScene().meshes;
-            meshes.forEach(function (mesh) {
+            meshes.forEach(function (abstractMesh) {
+                var mesh = abstractMesh;
                 if (mesh._source && mesh._source === _this) {
                     mesh._source = null;
                 }
@@ -33285,6 +33285,9 @@ var BABYLON;
             }
             this._texture = texture;
             var callback = function (text) {
+                if (typeof text !== "string") {
+                    return;
+                }
                 var data = null;
                 var tempData = null;
                 var line;
@@ -44550,8 +44553,8 @@ var BABYLON;
             var _this = this;
             this._scaledPosition = BABYLON.Vector3.Zero();
             this._scaledVelocity = BABYLON.Vector3.Zero();
-            this.onMeshUpdated = function (mesh) {
-                _this._addUpdateMeshesList[mesh.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(mesh);
+            this.onMeshUpdated = function (transformNode) {
+                _this._addUpdateMeshesList[transformNode.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(transformNode);
             };
             this.onGeometryUpdated = function (geometry) {
                 _this._addUpdateGeometriesList[geometry.id] = CollisionCoordinatorWorker.SerializeGeometry(geometry);
@@ -49720,8 +49723,12 @@ var BABYLON;
                 this._connectedMesh = null;
             }
         };
-        Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (connectedMesh) {
-            var boundingInfo = connectedMesh.getBoundingInfo();
+        Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (node) {
+            if (!node.getBoundingInfo) {
+                return;
+            }
+            var mesh = node;
+            var boundingInfo = mesh.getBoundingInfo();
             this.setPosition(boundingInfo.boundingSphere.centerWorld);
             if (BABYLON.Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {
                 this._updateDirection();
@@ -67202,14 +67209,13 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsRadialExplosionEvent(this._scene);
-            for (var i = 0; i < impostors.length; ++i) {
-                var impostor = impostors[i];
+            impostors.forEach(function (impostor) {
                 var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
-                if (impostorForceAndContactPoint === null) {
-                    continue;
+                if (!impostorForceAndContactPoint) {
+                    return;
                 }
                 impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
-            }
+            });
             event.cleanup(false);
             return event;
         };
@@ -67230,14 +67236,13 @@ var BABYLON;
                 return null;
             }
             var event = new PhysicsRadialExplosionEvent(this._scene);
-            for (var i = 0; i < impostors.length; ++i) {
-                var impostor = impostors[i];
+            impostors.forEach(function (impostor) {
                 var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
-                if (impostorForceAndContactPoint === null) {
-                    continue;
+                if (!impostorForceAndContactPoint) {
+                    return;
                 }
                 impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
-            }
+            });
             event.cleanup(false);
             return event;
         };
@@ -67339,7 +67344,7 @@ var BABYLON;
         /*** Helpers ***/
         PhysicsRadialExplosionEvent.prototype._prepareRadialSphere = function () {
             if (!this._radialSphere) {
-                this._radialSphere = BABYLON.Mesh.CreateSphere("radialSphere", 32, 1, this._scene);
+                this._radialSphere = BABYLON.MeshBuilder.CreateSphere("radialSphere", { segments: 32, diameter: 1 }, this._scene);
                 this._radialSphere.isVisible = false;
             }
         };
@@ -67416,7 +67421,9 @@ var BABYLON;
             }
             else {
                 var radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._radius, this._strength * -1, this._falloff);
-                this._radialSphere = radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                if (radialExplosionEvent) {
+                    this._radialSphere = radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                }
             }
         };
         return PhysicsGravitationalFieldEvent;
@@ -71824,12 +71831,9 @@ var BABYLON;
             this._scene.imageProcessingConfiguration.vignetteColor = new BABYLON.Color4(0, 0, 0, 0);
             this._scene.imageProcessingConfiguration.vignetteEnabled = true;
             this._scene.imageProcessingConfiguration.isEnabled = false;
-            this._createGazeTracker();
             this._createTeleportationCircles();
             this.meshSelectionPredicate = function (mesh) {
-                if (mesh.isVisible && mesh.name.indexOf("gazeTracker") === -1
-                    && mesh.name.indexOf("teleportationCircle") === -1
-                    && mesh.name.indexOf("torusTeleportation") === -1) {
+                if (mesh.name.indexOf(_this._floorMeshName) !== -1) {
                     return true;
                 }
                 return false;
@@ -71911,18 +71915,6 @@ var BABYLON;
                 });
             }
         };
-        // Little white circle attached to the camera
-        // That will act as the target to look on the floor where to teleport
-        VRExperienceHelper.prototype._createGazeTracker = function () {
-            this._gazeTracker = BABYLON.Mesh.CreateTorus("gazeTracker", 0.0050, 0.0020, 25, this._scene, false);
-            this._gazeTracker.bakeCurrentTransformIntoVertices();
-            this._gazeTracker.isPickable = false;
-            var targetMat = new BABYLON.StandardMaterial("targetMat", this._scene);
-            targetMat.specularColor = BABYLON.Color3.Black();
-            targetMat.emissiveColor = BABYLON.Color3.White();
-            targetMat.backFaceCulling = false;
-            this._gazeTracker.material = targetMat;
-        };
         VRExperienceHelper.prototype._createTeleportationCircles = function () {
             this._teleportationCircle = BABYLON.Mesh.CreateGround("teleportationCircle", 2, 2, 2, this._scene);
             var length = 512;
@@ -71944,7 +71936,7 @@ var BABYLON;
             var teleportationCircleMaterial = new BABYLON.StandardMaterial("TextPlaneMaterial", this._scene);
             teleportationCircleMaterial.diffuseTexture = dynamicTexture;
             this._teleportationCircle.material = teleportationCircleMaterial;
-            var torus = BABYLON.Mesh.CreateTorus("torusTeleportation", 0.75, 0.1, 25, this._scene, false);
+            var torus = BABYLON.Mesh.CreateTorus("torus", 0.75, 0.1, 25, this._scene, false);
             torus.parent = this._teleportationCircle;
             var animationInnerCircle = new BABYLON.Animation("animationInnerCircle", "position.y", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
             var keys = [];
@@ -72138,40 +72130,11 @@ var BABYLON;
                 ray = this.currentVRCamera.rightController.getForwardRay();
             }
             var hit = this._scene.pickWithRay(ray, this.meshSelectionPredicate);
-            if (hit && hit.pickedPoint) {
-                this._gazeTracker.scaling.x = hit.distance;
-                this._gazeTracker.scaling.y = hit.distance;
-                this._gazeTracker.scaling.z = hit.distance;
-                var pickNormal = hit.getNormal();
-                if (pickNormal) {
-                    var axis1 = BABYLON.Vector3.Cross(BABYLON.Axis.Y, pickNormal);
-                    var axis2 = BABYLON.Vector3.Cross(pickNormal, axis1);
-                    BABYLON.Vector3.RotationFromAxisToRef(axis2, pickNormal, axis1, this._gazeTracker.rotation);
-                }
-                this._gazeTracker.position.copyFrom(hit.pickedPoint);
-                if (this._gazeTracker.position.x < 0) {
-                    this._gazeTracker.position.x += 0.002;
-                }
-                else {
-                    this._gazeTracker.position.x -= 0.002;
-                }
-                if (this._gazeTracker.position.y < 0) {
-                    this._gazeTracker.position.y += 0.002;
-                }
-                else {
-                    this._gazeTracker.position.y -= 0.002;
-                }
-                if (this._gazeTracker.position.z < 0) {
-                    this._gazeTracker.position.z += 0.002;
-                }
-                else {
-                    this._gazeTracker.position.z -= 0.002;
-                }
-            }
             if (this._rayHelper) {
                 this._rayHelper.dispose();
             }
             if (this.currentVRCamera.rightController) {
+                //if (target) target.isVisible = false;
                 this._rayHelper = BABYLON.RayHelper.CreateAndShow(ray, this._scene, new BABYLON.Color3(0.7, 0.7, 0.7));
             }
             if (hit && hit.pickedMesh) {
@@ -74856,8 +74819,8 @@ var BABYLON;
             var onload = function () {
                 onSuccess();
             };
-            var onerror = function (msg, exception) {
-                onError(msg, exception);
+            var onerror = function (message, exception) {
+                onError(message, exception);
             };
             this.texture = new BABYLON.Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);
         };
@@ -74879,8 +74842,8 @@ var BABYLON;
             var onload = function () {
                 onSuccess();
             };
-            var onerror = function (msg, exception) {
-                onError(msg, exception);
+            var onerror = function (message, exception) {
+                onError(message, exception);
             };
             this.texture = new BABYLON.CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror);
         };

+ 1 - 0
dist/preview release/what's new.md

@@ -57,3 +57,4 @@
 ## Breaking changes
 - `Gamepads` was removed in favor of `scene.gamepadManager`
 - `DynamicFloatArray`, `MapTexture` and `RectPakingMap` were removed because there were not used anymore
+- `IAssetTask` was removed in favor of `AbstractAssetTask` class

+ 0 - 13
package-lock.json

@@ -1,13 +0,0 @@
-{
-    "name": "babylonjs",
-    "version": "3.1.0-beta5",
-    "lockfileVersion": 1,
-    "requires": true,
-    "dependencies": {
-        "cannon": {
-            "version": "0.6.2",
-            "resolved": "https://registry.npmjs.org/cannon/-/cannon-0.6.2.tgz",
-            "integrity": "sha1-HnvHLdWEGYLzwQTCvFeL+k+xxXI="
-        }
-    }
-}

+ 8 - 4
src/Audio/babylon.sound.ts

@@ -39,7 +39,7 @@ module BABYLON {
         private _scene: Scene;
         private _connectedMesh: Nullable<AbstractMesh>;
         private _customAttenuationFunction: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number;
-        private _registerFunc: Nullable<(connectedMesh: AbstractMesh) => any>;
+        private _registerFunc: Nullable<(connectedMesh: TransformNode) => void>;
         private _isOutputConnected = false;
         private _htmlAudioElement: HTMLAudioElement;
         private _urlType: string = "Unknown";
@@ -547,7 +547,7 @@ module BABYLON {
                 }
             }
             this._onRegisterAfterWorldMatrixUpdate(this._connectedMesh);
-            this._registerFunc = (connectedMesh: AbstractMesh) => this._onRegisterAfterWorldMatrixUpdate(connectedMesh);
+            this._registerFunc = (connectedMesh: TransformNode) => this._onRegisterAfterWorldMatrixUpdate(connectedMesh);
             meshToConnectTo.registerAfterWorldMatrixUpdate(this._registerFunc);
         }
 
@@ -559,8 +559,12 @@ module BABYLON {
             }
         }
 
-        private _onRegisterAfterWorldMatrixUpdate(connectedMesh: AbstractMesh): void {
-            let boundingInfo = connectedMesh.getBoundingInfo();
+        private _onRegisterAfterWorldMatrixUpdate(node: TransformNode): void {
+            if (!(<any>node).getBoundingInfo) {
+                return;
+            }
+            let mesh = node as AbstractMesh;
+            let boundingInfo = mesh.getBoundingInfo();
             this.setPosition(boundingInfo.boundingSphere.centerWorld);
             if (Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {
                 this._updateDirection();

+ 1 - 1
src/Behaviors/Cameras/babylon.bouncingBehavior.ts

@@ -77,7 +77,7 @@ module BABYLON {
         // Connection
         private _attachedCamera: Nullable<ArcRotateCamera>;
 		private _onAfterCheckInputsObserver: Nullable<Observer<Camera>>;	
-		private _onMeshTargetChangedObserver: Nullable<Observer<AbstractMesh>>;
+		private _onMeshTargetChangedObserver: Nullable<Observer<Nullable<AbstractMesh>>>;
 
 		public init(): void {
 			// Do notihng

+ 1 - 1
src/Behaviors/Cameras/babylon.framingBehavior.ts

@@ -142,7 +142,7 @@ module BABYLON {
         // Default behavior functions
         private _onPrePointerObservableObserver: Nullable<Observer<PointerInfoPre>>;
 		private _onAfterCheckInputsObserver: Nullable<Observer<Camera>>;
-		private _onMeshTargetChangedObserver: Nullable<Observer<AbstractMesh>>;
+		private _onMeshTargetChangedObserver: Nullable<Observer<Nullable<AbstractMesh>>>;
         private _attachedCamera: Nullable<ArcRotateCamera>;
         private _isPointerDown = false;
 		private _lastInteractionTime = -Infinity;

+ 3 - 3
src/Cameras/VR/babylon.vrExperienceHelper.ts

@@ -48,17 +48,17 @@ module BABYLON {
         private _xboxGamepadTeleportationRequestInitiated = false;
         private _rotationRightAsked = false;
         private _rotationLeftAsked = false;
-        private _teleportationCircle: BABYLON.Mesh;
+        private _teleportationCircle: Mesh;
         private _postProcessMove: ImageProcessingPostProcess;
         private _passProcessMove: PassPostProcess;
         private _teleportationFillColor: string = "#444444";
         private _teleportationBorderColor: string = "#FFFFFF";
         private _rotationAngle: number = 0;
-        private _haloCenter = new BABYLON.Vector3(0, 0, 0);
+        private _haloCenter = new Vector3(0, 0, 0);
         private _rayHelper: RayHelper;
         private _gazeTracker: BABYLON.Mesh;
 
-        public meshSelectionPredicate: (mesh: BABYLON.Mesh) => boolean;
+        public meshSelectionPredicate: (mesh: AbstractMesh) => boolean;
 
         public get deviceOrientationCamera(): DeviceOrientationCamera {
             return this._deviceOrientationCamera;

+ 1 - 1
src/Cameras/babylon.arcRotateCamera.ts

@@ -320,7 +320,7 @@
             }
         }
 
-        public onMeshTargetChangedObservable = new Observable<AbstractMesh>();
+        public onMeshTargetChangedObservable = new Observable<Nullable<AbstractMesh>>();
 
         // Collisions
         public onCollide: (collidedMesh: AbstractMesh) => void;

+ 2 - 2
src/Collisions/babylon.collisionCoordinator.ts

@@ -240,8 +240,8 @@ module BABYLON {
             this.onMeshUpdated(mesh);
         }
 
-        public onMeshUpdated = (mesh: AbstractMesh) => {
-            this._addUpdateMeshesList[mesh.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(mesh);
+        public onMeshUpdated = (transformNode: TransformNode) => {
+            this._addUpdateMeshesList[transformNode.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(transformNode as AbstractMesh);
         }
 
         public onMeshRemoved(mesh: AbstractMesh) {

+ 8 - 8
src/Engine/babylon.engine.ts

@@ -173,8 +173,8 @@
             }
         };
 
-        const onerror = (request: XMLHttpRequest, exception: any) => {
-            if (onErrorCallBack) {
+        const onerror = (request?: XMLHttpRequest, exception?: any) => {
+            if (onErrorCallBack && request) {
                 onErrorCallBack(request.status + " " + request.statusText, exception);
             }
         };
@@ -3938,8 +3938,8 @@
                 isDDS = (extension === ".dds");
             }
 
-            let onerror = (request: XMLHttpRequest, exception: any) => {
-                if (onError) {
+            let onerror = (request?: XMLHttpRequest, exception?: any) => {
+                if (onError && request) {
                     onError(request.status + " " + request.statusText, exception);
                 }
             }
@@ -4226,9 +4226,9 @@
             texture.url = url;
             this._internalTexturesCache.push(texture);
 
-            var onerror = (request: XMLHttpRequest, exception: any) => {
+            var onerror = (request?: XMLHttpRequest, exception?: any) => {
                 scene._removePendingData(texture);
-                if (onError) {
+                if (onError && request) {
                     onError(request.status + " " + request.statusText, exception);
                 }
             };
@@ -5001,13 +5001,13 @@
 
         public attachContextLostEvent(callback: ((event: WebGLContextEvent) => void)): void {
             if (this._renderingCanvas) {
-                this._renderingCanvas.addEventListener("webglcontextlost", callback, false);
+                this._renderingCanvas.addEventListener("webglcontextlost", <any>callback, false);
             }
         }
 
         public attachContextRestoredEvent(callback: ((event: WebGLContextEvent) => void)): void {
             if (this._renderingCanvas) {
-                this._renderingCanvas.addEventListener("webglcontextrestored", callback, false);
+                this._renderingCanvas.addEventListener("webglcontextrestored", <any>callback, false);
             }
         }
 

+ 1 - 1
src/LensFlare/babylon.lensFlareSystem.ts

@@ -3,7 +3,7 @@
         public lensFlares = new Array<LensFlare>();
         public borderLimit = 300;
         public viewportBorder = 0;
-        public meshesSelectionPredicate: (mesh: Mesh) => boolean;
+        public meshesSelectionPredicate: (mesh: AbstractMesh) => boolean;
         public layerMask: number = 0x0FFFFFFF;
         public id: string;
 

+ 6 - 1
src/Materials/Textures/babylon.colorGradingTexture.ts

@@ -86,7 +86,12 @@ module BABYLON {
 
             this._texture = texture;
 
-            var callback = (text: string) => {
+            var callback = (text: string | ArrayBuffer) => {
+
+                if (typeof text !== "string") {
+                    return;
+                }
+
                 var data: Nullable<Uint8Array> = null;
                 var tempData: Nullable<Float32Array> = null;
 

+ 1 - 1
src/Materials/Textures/babylon.texture.ts

@@ -103,7 +103,7 @@
             return this._samplingMode;
         }
 
-        constructor(url: Nullable<string>, scene: Nullable<Scene>, noMipmap: boolean = false, invertY: boolean = true, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, esception?: any) => void> = null, buffer: any = null, deleteBuffer: boolean = false, format?: number) {
+        constructor(url: Nullable<string>, scene: Nullable<Scene>, noMipmap: boolean = false, invertY: boolean = true, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, buffer: any = null, deleteBuffer: boolean = false, format?: number) {
             super(scene);
 
             this.name = url || "";

+ 4 - 4
src/Mesh/babylon.mesh.ts

@@ -1338,11 +1338,10 @@
             return this;
         }
 
-        private _onBeforeDraw(isInstance: boolean, world: Matrix, effectiveMaterial: Material): Mesh {
-            if (isInstance) {
+        private _onBeforeDraw(isInstance: boolean, world: Matrix, effectiveMaterial?: Material): void {
+            if (isInstance && effectiveMaterial) {
                 effectiveMaterial.bindOnlyWorldMatrix(world);
             }
-            return this;
         }
 
         /**
@@ -1595,7 +1594,8 @@
 
             // Sources
             var meshes = this.getScene().meshes;
-            meshes.forEach((mesh: Mesh) => {
+            meshes.forEach((abstractMesh: AbstractMesh) => {
+                let mesh = abstractMesh as Mesh;
                 if (mesh._source && mesh._source === this) {
                     mesh._source = null;
                 }

+ 1 - 1
src/Mesh/babylon.meshBuilder.ts

@@ -448,7 +448,7 @@
             var dashSize = options.dashSize || 3;
 
             if (instance) {  //  dashed lines update
-                var positionFunction = (positions: number[]): void => {
+                var positionFunction = (positions: FloatArray): void => {
                     var curvect = Vector3.Zero();
                     var nbSeg = positions.length / 6;
                     var lg = 0;

+ 74 - 62
src/Mesh/babylon.transformNode.ts

@@ -6,19 +6,31 @@ module BABYLON {
         public static BILLBOARDMODE_Y = 2;
         public static BILLBOARDMODE_Z = 4;
         public static BILLBOARDMODE_ALL = 7;
-        
+
         // Properties
+        @serializeAsVector3()
         private _rotation = Vector3.Zero();
+
+        @serializeAsQuaternion()
         private _rotationQuaternion: Nullable<Quaternion>;
+
+        @serializeAsVector3()
         protected _scaling = Vector3.One();
         protected _isDirty = false;
         private _transformToBoneReferal: Nullable<TransformNode>;
-        
+
+        @serialize()
         public billboardMode = AbstractMesh.BILLBOARDMODE_NONE;
+
+        @serialize()
         public scalingDeterminant = 1;
+
+        @serialize()
         public infiniteDistance = false;
+
+        @serializeAsVector3()
         public position = Vector3.Zero();
-                        
+
         // Cache        
         public _poseMatrix: Matrix;
         private _localWorld = Matrix.Zero();
@@ -26,15 +38,15 @@ module BABYLON {
         private _absolutePosition = Vector3.Zero();
         private _pivotMatrix = Matrix.Identity();
         private _pivotMatrixInverse: Matrix;
-        private _postMultiplyPivotMatrix = false;        
-        
+        private _postMultiplyPivotMatrix = false;
+
         protected _isWorldMatrixFrozen = false;
 
         /**
         * An event triggered after the world matrix is updated
         * @type {BABYLON.Observable}
         */
-        public onAfterWorldMatrixUpdateObservable = new Observable<TransformNode>();        
+        public onAfterWorldMatrixUpdateObservable = new Observable<TransformNode>();
 
         constructor(name: string, scene: Nullable<Scene> = null, isPure = true) {
             super(name, scene);
@@ -42,13 +54,13 @@ module BABYLON {
             if (isPure) {
                 this.getScene().addTransformNode(this);
             }
-        }        
-                
-       /**
-         * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z. 
-         * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
-         * Default : (0.0, 0.0, 0.0)
-         */
+        }
+
+        /**
+          * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z. 
+          * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
+          * Default : (0.0, 0.0, 0.0)
+          */
         public get rotation(): Vector3 {
             return this._rotation;
         }
@@ -125,7 +137,7 @@ module BABYLON {
         public getPoseMatrix(): Matrix {
             return this._poseMatrix;
         }
-        
+
         public _isSynchronized(): boolean {
             if (this._isDirty) {
                 return false;
@@ -177,7 +189,7 @@ module BABYLON {
             this._currentRenderId = Number.MAX_VALUE;
             this._isDirty = true;
             return this;
-        }        
+        }
 
         /**
          * Returns the current mesh absolute position.
@@ -240,10 +252,10 @@ module BABYLON {
             return this._isWorldMatrixFrozen;
         }
 
-     /**
-         * Retuns the mesh absolute position in the World.  
-         * Returns a Vector3.
-         */
+        /**
+            * Retuns the mesh absolute position in the World.  
+            * Returns a Vector3.
+            */
         public getAbsolutePosition(): Vector3 {
             this.computeWorldMatrix();
             return this._absolutePosition;
@@ -284,12 +296,12 @@ module BABYLON {
                 this.position.z = absolutePositionZ;
             }
             return this;
-        }   
+        }
 
-      /**
-         * Sets the mesh position in its local space.  
-         * Returns the AbstractMesh.  
-         */
+        /**
+           * Sets the mesh position in its local space.  
+           * Returns the AbstractMesh.  
+           */
         public setPositionWithLocalVector(vector3: Vector3): TransformNode {
             this.computeWorldMatrix();
             this.position = Vector3.TransformNormal(vector3, this._localWorld);
@@ -336,12 +348,12 @@ module BABYLON {
             this.rotationQuaternion = this.rotationQuaternion || new Quaternion();
             Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
             return this;
-        }        
+        }
 
-       /**
-         * Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.  
-         * This Vector3 is expressed in the World space.  
-         */
+        /**
+          * Returns a new Vector3 what is the localAxis, expressed in the mesh local space, rotated like the mesh.  
+          * This Vector3 is expressed in the World space.  
+          */
         public getDirection(localAxis: Vector3): Vector3 {
             var result = Vector3.Zero();
 
@@ -422,23 +434,23 @@ module BABYLON {
             this.getPivotPointToRef(result);
             Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);
             return this;
-        }        
+        }
 
         /**
          * Defines the passed node as the parent of the current node.  
          * Returns the TransformNode.
          */
         public setParent(node: Nullable<TransformNode>): TransformNode {
-            
+
             if (node == null) {
                 var rotation = Tmp.Quaternion[0];
                 var position = Tmp.Vector3[0];
                 var scale = Tmp.Vector3[1];
-                
-                if(this.parent && (<TransformNode>this.parent).computeWorldMatrix){
+
+                if (this.parent && (<TransformNode>this.parent).computeWorldMatrix) {
                     (<TransformNode>this.parent).computeWorldMatrix(true);
                 }
-                this.computeWorldMatrix(true);              
+                this.computeWorldMatrix(true);
                 this.getWorldMatrix().decompose(scale, rotation, position);
 
                 if (this.rotationQuaternion) {
@@ -457,37 +469,37 @@ module BABYLON {
                 var m0 = Tmp.Matrix[0];
                 var m1 = Tmp.Matrix[1];
                 var invParentMatrix = Tmp.Matrix[2];
-                
+
                 node.computeWorldMatrix(true);
                 node.getWorldMatrix().decompose(scale, rotation, position);
-                
+
                 rotation.toRotationMatrix(m0);
-                m1.setTranslation(position);   
-                m1.multiplyToRef(m0, m0);     
+                m1.setTranslation(position);
+                m1.multiplyToRef(m0, m0);
                 m0.invertToRef(invParentMatrix);
-                
-                this.getWorldMatrix().multiplyToRef(invParentMatrix, m0);        
+
+                this.getWorldMatrix().multiplyToRef(invParentMatrix, m0);
                 m0.decompose(scale, rotation, position);
-                
+
                 if (this.rotationQuaternion) {
                     this.rotationQuaternion.copyFrom(rotation);
                 } else {
                     rotation.toEulerAnglesToRef(this.rotation);
                 }
-                
+
                 node.getWorldMatrix().invertToRef(invParentMatrix);
                 this.getWorldMatrix().multiplyToRef(invParentMatrix, m0);
                 m0.decompose(scale, rotation, position);
-                
+
                 this.position.x = position.x;
                 this.position.y = position.y;
                 this.position.z = position.z;
             }
-            
+
             this.parent = node;
             return this;
-        }       
-        
+        }
+
         private _nonUniformScaling = false;
         public get nonUniformScaling(): boolean {
             return this._nonUniformScaling;
@@ -500,7 +512,7 @@ module BABYLON {
 
             this._nonUniformScaling = true;
             return true;
-        }        
+        }
 
         /**
          * Attach the current TransformNode to another TransformNode associated with a bone
@@ -528,7 +540,7 @@ module BABYLON {
             this._transformToBoneReferal = null;
             this.parent = null;
             return this;
-        }        
+        }
 
         private static _rotationAxisCache = new Quaternion();
         /**
@@ -636,8 +648,8 @@ module BABYLON {
                 rotationQuaternion.toEulerAnglesToRef(this.rotation);
             }
             return this;
-        }        
-        
+        }
+
         /**
          * Computes the mesh World matrix and returns it.  
          * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.  
@@ -685,7 +697,7 @@ module BABYLON {
 
             // Translation
             let camera = (<Camera>this.getScene().activeCamera);
-            
+
             if (this.infiniteDistance && !this.parent && camera) {
 
                 var cameraWorldMatrix = camera.getWorldMatrix();
@@ -804,7 +816,7 @@ module BABYLON {
             }
 
             return this._worldMatrix;
-        }   
+        }
 
         protected _afterComputeWorldMatrix(): void {
         }
@@ -827,7 +839,7 @@ module BABYLON {
         public unregisterAfterWorldMatrixUpdate(func: (mesh: TransformNode) => void): TransformNode {
             this.onAfterWorldMatrixUpdateObservable.removeCallback(func);
             return this;
-        }        
+        }
 
         public clone(name: string, newParent: Node): Nullable<TransformNode> {
             var result = SerializationHelper.Clone(() => new TransformNode(name, this.getScene()), this);
@@ -840,7 +852,7 @@ module BABYLON {
             }
 
             return result;
-        }        
+        }
 
         public serialize(serializationObject: any = null): any {
             if (!serializationObject) {
@@ -928,15 +940,15 @@ module BABYLON {
             if (parsedTransformNode.parentId) {
                 transformNode._waitingParentId = parsedTransformNode.parentId;
             }
-         
+
             return transformNode;
-        }        
+        }
 
-    /**
-         * Disposes the TransformNode.  
-         * By default, all the children are also disposed unless the parameter `doNotRecurse` is set to `true`.  
-         * Returns nothing.  
-         */
+        /**
+             * Disposes the TransformNode.  
+             * By default, all the children are also disposed unless the parameter `doNotRecurse` is set to `true`.  
+             * Returns nothing.  
+             */
         public dispose(doNotRecurse?: boolean): void {
             // Animations
             this.getScene().stopAnimation(this);
@@ -965,6 +977,6 @@ module BABYLON {
 
             super.dispose();
         }
-        
+
     }
 }

+ 35 - 76
src/Physics/babylon.physicsHelper.ts

@@ -1,5 +1,5 @@
 module BABYLON {
-    
+
     /**
      * The strenght of the force in correspondence to the distance of the affected object
      */
@@ -7,33 +7,33 @@ module BABYLON {
         Constant, // impulse is constant in strength across it's whole radius
         Linear // impulse gets weaker if it's further from the origin
     }
-    
+
     export class PhysicsHelper {
-        
+
         private _scene: Scene;
         private _physicsEngine: Nullable<PhysicsEngine>;
 
         constructor(scene: Scene) {
             this._scene = scene;
             this._physicsEngine = this._scene.getPhysicsEngine();
-            
+
             if (!this._physicsEngine) {
                 Tools.Warn('Physics engine not enabled. Please enable the physics before you can use the methods.');
             }
         }
-        
+
         /**
          * @param {Vector3} origin the origin of the explosion
          * @param {number} radius the explosion radius
          * @param {number} strength the explosion strength
          * @param {PhysicsRadialImpulseFallof} falloff possible options: Constant & Linear. Defaults to Constant
          */
-        public applyRadialExplosionImpulse(origin: Vector3, radius: number, strength: number, falloff: PhysicsRadialImpulseFallof = PhysicsRadialImpulseFallof.Constant) {
+        public applyRadialExplosionImpulse(origin: Vector3, radius: number, strength: number, falloff: PhysicsRadialImpulseFallof = PhysicsRadialImpulseFallof.Constant): Nullable<PhysicsRadialExplosionEvent> {
             if (!this._physicsEngine) {
                 Tools.Warn('Physics engine not enabled. Please enable the physics before you call this method.');
                 return null;
             }
-            
+
             var impostors = this._physicsEngine.getImpostors();
             if (impostors.length === 0) {
                 return null;
@@ -41,24 +41,15 @@ module BABYLON {
 
             var event = new PhysicsRadialExplosionEvent(this._scene);
 
-            for (var i = 0; i < impostors.length; ++i) {
-                var impostor = impostors[i];
-                var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(
-                    impostor,
-                    origin,
-                    radius,
-                    strength,
-                    falloff
-                );
-                if (impostorForceAndContactPoint === null) {
-                    continue;
+            impostors.forEach(impostor => {
+
+                var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
+                if (!impostorForceAndContactPoint) {
+                    return;
                 }
 
-                impostor.applyImpulse(
-                    impostorForceAndContactPoint.force,
-                    impostorForceAndContactPoint.contactPoint
-                );
-            }
+                impostor.applyImpulse(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
+            });
 
             event.cleanup(false);
 
@@ -71,12 +62,12 @@ module BABYLON {
          * @param {number} strength the explosion strength
          * @param {PhysicsRadialImpulseFallof} falloff possible options: Constant & Linear. Defaults to Constant
          */
-        public applyRadialExplosionForce(origin: Vector3, radius: number, strength: number, falloff: PhysicsRadialImpulseFallof = PhysicsRadialImpulseFallof.Constant) {
+        public applyRadialExplosionForce(origin: Vector3, radius: number, strength: number, falloff: PhysicsRadialImpulseFallof = PhysicsRadialImpulseFallof.Constant): Nullable<PhysicsRadialExplosionEvent> {
             if (!this._physicsEngine) {
                 Tools.Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');
                 return null;
             }
-            
+
             var impostors = this._physicsEngine.getImpostors();
             if (impostors.length === 0) {
                 return null;
@@ -84,24 +75,15 @@ module BABYLON {
 
             var event = new PhysicsRadialExplosionEvent(this._scene);
 
-            for (var i = 0; i < impostors.length; ++i) {
-                var impostor = impostors[i];
-                var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(
-                    impostor,
-                    origin,
-                    radius,
-                    strength,
-                    falloff
-                );
-                if (impostorForceAndContactPoint === null) {
-                    continue;
+            impostors.forEach(impostor => {
+                var impostorForceAndContactPoint = event.getImpostorForceAndContactPoint(impostor, origin, radius, strength, falloff);
+
+                if (!impostorForceAndContactPoint) {
+                    return;
                 }
 
-                impostor.applyForce(
-                    impostorForceAndContactPoint.force,
-                    impostorForceAndContactPoint.contactPoint
-                );
-            }
+                impostor.applyForce(impostorForceAndContactPoint.force, impostorForceAndContactPoint.contactPoint);
+            })
 
             event.cleanup(false);
 
@@ -114,7 +96,7 @@ module BABYLON {
          * @param {number} strength the explosion strength
          * @param {PhysicsRadialImpulseFallof} falloff possible options: Constant & Linear. Defaults to Constant
          */
-        public gravitationalField(origin: Vector3, radius: number, strength: number, falloff: PhysicsRadialImpulseFallof = PhysicsRadialImpulseFallof.Constant) {
+        public gravitationalField(origin: Vector3, radius: number, strength: number, falloff: PhysicsRadialImpulseFallof = PhysicsRadialImpulseFallof.Constant): Nullable<PhysicsGravitationalFieldEvent> {
             if (!this._physicsEngine) {
                 Tools.Warn('Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.');
                 return null;
@@ -125,14 +107,7 @@ module BABYLON {
                 return null;
             }
 
-            var event = new PhysicsGravitationalFieldEvent(
-                this,
-                this._scene,
-                origin,
-                radius,
-                strength,
-                falloff
-            );
+            var event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radius, strength, falloff);
 
             event.cleanup(false);
 
@@ -143,7 +118,7 @@ module BABYLON {
     /***** Radial explosion *****/
 
     export class PhysicsRadialExplosionEvent {
-        
+
         private _scene: Scene;
         private _radialSphere: Mesh; // create a sphere, so we can get the intersecting meshes inside
         private _rays: Array<Ray> = [];
@@ -197,7 +172,7 @@ module BABYLON {
                 return null;
             }
 
-            var distanceFromOrigin = BABYLON.Vector3.Distance(origin, contactPoint);
+            var distanceFromOrigin = Vector3.Distance(origin, contactPoint);
             if (distanceFromOrigin > radius) {
                 return null;
             }
@@ -229,14 +204,9 @@ module BABYLON {
 
         /*** Helpers ***/
 
-        private _prepareRadialSphere() {
+        private _prepareRadialSphere(): void {
             if (!this._radialSphere) {
-                this._radialSphere = BABYLON.Mesh.CreateSphere(
-                    "radialSphere",
-                    32,
-                    1,
-                    this._scene
-                );
+                this._radialSphere = MeshBuilder.CreateSphere("radialSphere", { segments: 32, diameter: 1 }, this._scene);
                 this._radialSphere.isVisible = false;
             }
         }
@@ -251,10 +221,7 @@ module BABYLON {
             this._radialSphere._updateBoundingInfo();
             this._radialSphere.computeWorldMatrix(true);
 
-            return this._radialSphere.intersectsMesh(
-                impostorObject,
-                true
-            );
+            return this._radialSphere.intersectsMesh(impostorObject, true);
         }
 
     }
@@ -347,20 +314,12 @@ module BABYLON {
         private _tick() {
             // Since the params won't change, we fetch the event only once
             if (this._radialSphere) {
-                this._physicsHelper.applyRadialExplosionForce(
-                    this._origin,
-                    this._radius,
-                    this._strength * -1,
-                    this._falloff
-                );
+                this._physicsHelper.applyRadialExplosionForce(this._origin, this._radius, this._strength * -1, this._falloff);
             } else {
-                var radialExplosionEvent = <PhysicsRadialExplosionEvent>this._physicsHelper.applyRadialExplosionForce(
-                    this._origin,
-                    this._radius,
-                    this._strength * -1,
-                    this._falloff
-                );
-                this._radialSphere = <Mesh>radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                var radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._radius, this._strength * -1, this._falloff);
+                if (radialExplosionEvent) {
+                    this._radialSphere = <Mesh>radialExplosionEvent.getData().radialSphere.clone('radialSphereClone');
+                }
             }
         }
 

+ 43 - 38
src/Tools/babylon.assetsManager.ts

@@ -7,30 +7,14 @@ module BABYLON {
         ERROR
     }
 
-    export interface IAssetTask<T extends AbstractAssetTask> {
-        onSuccess: (task: T) => void;
-        onError: (task: T, message?: string, exception?: any) => void;
-        isCompleted: boolean;
-        name: string;
-
-        taskState: AssetTaskState;
-        errorObject: {
-            message?: string;
-            exception?: any;
-        }
-
-        runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void;
-    }
-
-    export abstract class AbstractAssetTask implements IAssetTask<AbstractAssetTask> {
+    export abstract class AbstractAssetTask  {
+        public onSuccess: (task: any) => void;
+        public onError: (task: any, message?: string, exception?: any) => void;
 
         constructor(public name: string) {
             this.taskState = AssetTaskState.INIT;
         }
 
-        onSuccess: (task: this) => void;
-        onError: (task: this, message?: string, exception?: any) => void;
-
         isCompleted: boolean = false;
         taskState: AssetTaskState;
         errorObject: { message?: string; exception?: any; };
@@ -98,11 +82,14 @@ module BABYLON {
         }
     }
 
-    export class MeshAssetTask extends AbstractAssetTask implements IAssetTask<MeshAssetTask> {
+    export class MeshAssetTask extends AbstractAssetTask {
         public loadedMeshes: Array<AbstractMesh>;
         public loadedParticleSystems: Array<ParticleSystem>;
         public loadedSkeletons: Array<Skeleton>;
 
+        public onSuccess: (task: MeshAssetTask) => void;
+        public onError: (task: MeshAssetTask, message?: string, exception?: any) => void;
+
         constructor(public name: string, public meshesNames: any, public rootUrl: string, public sceneFilename: string) {
             super(name);
         }
@@ -121,9 +108,12 @@ module BABYLON {
         }
     }
 
-    export class TextFileAssetTask extends AbstractAssetTask implements IAssetTask<TextFileAssetTask> {
+    export class TextFileAssetTask extends AbstractAssetTask {
         public text: string;
 
+        public onSuccess: (task: TextFileAssetTask) => void;
+        public onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;        
+
         constructor(public name: string, public url: string) {
             super(name);
         }
@@ -140,9 +130,12 @@ module BABYLON {
         }
     }
 
-    export class BinaryFileAssetTask extends AbstractAssetTask implements IAssetTask<BinaryFileAssetTask> {
+    export class BinaryFileAssetTask extends AbstractAssetTask {
         public data: ArrayBuffer;
 
+        public onSuccess: (task: BinaryFileAssetTask) => void;
+        public onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;               
+
         constructor(public name: string, public url: string) {
             super(name);
         }
@@ -160,9 +153,12 @@ module BABYLON {
         }
     }
 
-    export class ImageAssetTask extends AbstractAssetTask implements IAssetTask<ImageAssetTask> {
+    export class ImageAssetTask extends AbstractAssetTask {
         public image: HTMLImageElement;
 
+        public onSuccess: (task: ImageAssetTask) => void;
+        public onError: (task: ImageAssetTask, message?: string, exception?: any) => void;            
+
         constructor(public name: string, public url: string) {
             super(name);
         }
@@ -185,12 +181,15 @@ module BABYLON {
         }
     }
 
-    export interface ITextureAssetTask<TEX extends BaseTexture, T extends AbstractAssetTask> extends IAssetTask<T> {
+    export interface ITextureAssetTask<TEX extends BaseTexture> {
         texture: TEX;
     }
 
-    export class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture, TextureAssetTask> {
+    export class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture> {
         public texture: Texture;
+        
+        public onSuccess: (task: TextureAssetTask) => void;
+        public onError: (task: TextureAssetTask, message?: string, exception?: any) => void;    
 
         constructor(public name: string, public url: string, public noMipmap?: boolean, public invertY?: boolean, public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
             super(name);
@@ -202,17 +201,20 @@ module BABYLON {
                 onSuccess();
             };
 
-            var onerror = (msg: string, exception: any) => {
-                onError(msg, exception);
+            var onerror = (message?: string, exception?: any) => {
+                onError(message, exception);
             };
 
             this.texture = new Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);
         }
     }
 
-    export class CubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<CubeTexture, CubeTextureAssetTask> {
+    export class CubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<CubeTexture> {
         public texture: CubeTexture;
 
+        public onSuccess: (task: CubeTextureAssetTask) => void;
+        public onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;            
+
         constructor(public name: string, public url: string, public extensions?: string[], public noMipmap?: boolean, public files?: string[]) {
             super(name);
         }
@@ -223,17 +225,20 @@ module BABYLON {
                 onSuccess();
             };
 
-            var onerror = (msg: string, exception: any) => {
-                onError(msg, exception);
+            var onerror = (message?: string, exception?: any) => {
+                onError(message, exception);
             };
 
             this.texture = new CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror);
         }
     }
 
-    export class HDRCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<HDRCubeTexture, HDRCubeTextureAssetTask> {
+    export class HDRCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<HDRCubeTexture> {
         public texture: HDRCubeTexture;
 
+        public onSuccess: (task: HDRCubeTextureAssetTask) => void;
+        public onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;               
+
         constructor(public name: string, public url: string, public size?: number, public noMipmap = false, public generateHarmonics = true, public useInGammaSpace = false, public usePMREMGenerator = false) {
             super(name);
         }
@@ -258,16 +263,16 @@ module BABYLON {
         protected tasks = new Array<AbstractAssetTask>();
         protected waitingTasksCount = 0;
 
-        public onFinish: (tasks: IAssetTask<AbstractAssetTask>[]) => void;
-        public onTaskSuccess: (task: IAssetTask<AbstractAssetTask>) => void;
-        public onTaskError: (task: IAssetTask<AbstractAssetTask>) => void;
-        public onProgress: (remainingCount: number, totalCount: number, task: IAssetTask<AbstractAssetTask>) => void;
+        public onFinish: (tasks: AbstractAssetTask[]) => void;
+        public onTaskSuccess: (task: AbstractAssetTask) => void;
+        public onTaskError: (task: AbstractAssetTask) => void;
+        public onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void;
 
         //Observables
 
-        public onTaskSuccessObservable = new Observable<IAssetTask<AbstractAssetTask>>();
-        public onTaskErrorObservable = new Observable<IAssetTask<AbstractAssetTask>>();
-        public onTasksDoneObservable = new Observable<IAssetTask<AbstractAssetTask>[]>();
+        public onTaskSuccessObservable = new Observable<AbstractAssetTask>();
+        public onTaskErrorObservable = new Observable<AbstractAssetTask>();
+        public onTasksDoneObservable = new Observable<AbstractAssetTask[]>();
         public onProgressObservable = new Observable<IAssetsProgressEvent>();
 
         public useDefaultLoadingScreen = true;

+ 14 - 9
src/Tools/babylon.decorators.ts

@@ -2,7 +2,7 @@
     var __decoratorInitialStore = {};
     var __mergedStore = {};
 
-    var _copySource = function<T>(creationFunction: () => T, source: T, instanciate: boolean): T {
+    var _copySource = function <T>(creationFunction: () => T, source: T, instanciate: boolean): T {
         var destination = creationFunction();
 
         // Tags
@@ -25,14 +25,15 @@
                         (<any>destination)[property] = sourceProperty;
                         break;
                     case 1:     // Texture
-                        (<any>destination)[property] = (instanciate||sourceProperty.isRenderTarget)?sourceProperty:sourceProperty.clone();
+                        (<any>destination)[property] = (instanciate || sourceProperty.isRenderTarget) ? sourceProperty : sourceProperty.clone();
                         break;
                     case 2:     // Color3
                     case 3:     // FresnelParameters
                     case 4:     // Vector2
                     case 5:     // Vector3
                     case 7:     // Color Curves
-                        (<any>destination)[property] = instanciate?sourceProperty:sourceProperty.clone();
+                    case 10:    // Quaternion
+                        (<any>destination)[property] = instanciate ? sourceProperty : sourceProperty.clone();
                         break;
                 }
             }
@@ -70,7 +71,7 @@
         while (currentKey) {
             let initialStore = (<any>__decoratorInitialStore)[currentKey];
             for (var property in initialStore) {
-                store[property] = initialStore[property];                
+                store[property] = initialStore[property];
             }
 
             let parent: any;
@@ -94,7 +95,7 @@
             if (done) {
                 break;
             }
-            
+
             currentKey = parent.getClassName();
             currentTarget = parent;
         }
@@ -116,15 +117,15 @@
         return (target: any, propertyKey: string) => {
             var key = targetKey || ("_" + propertyKey);
             Object.defineProperty(target, propertyKey, {
-                get: function () {
+                get: function (this: any) {
                     return this[key];
                 },
-                set: function (value) {
+                set: function (this: any, value) {
                     if (this[key] === value) {
                         return;
                     }
                     this[key] = value;
-                    
+
                     target[setCallback].apply(this);
                 },
                 enumerable: true,
@@ -164,7 +165,7 @@
     export function serializeAsMeshReference(sourceName?: string) {
         return generateSerializableMember(6, sourceName); // mesh reference member
     }
-    
+
     export function serializeAsColorCurves(sourceName?: string) {
         return generateSerializableMember(7, sourceName); // color curves
     }
@@ -177,6 +178,10 @@
         return generateSerializableMember(9, sourceName); // image processing
     }
 
+    export function serializeAsQuaternion(sourceName?: string) {
+        return generateSerializableMember(10, sourceName); // quaternion member
+    }
+
 
     export class SerializationHelper {
 

+ 2 - 2
src/Tools/babylon.observable.ts

@@ -45,7 +45,7 @@
      * Represent an Observer registered to a given Observable object.
      */
     export class Observer<T> {
-        constructor(public callback: (eventData: Nullable<T>, eventState: EventState) => void, public mask: number, public scope: any = null) {
+        constructor(public callback: (eventData: T, eventState: EventState) => void, public mask: number, public scope: any = null) {
         }
     }
 
@@ -176,7 +176,7 @@
          * @param eventData
          * @param mask
          */
-        public notifyObservers(eventData: Nullable<T>, mask: number = -1, target?: any, currentTarget?: any): boolean {
+        public notifyObservers(eventData: T, mask: number = -1, target?: any, currentTarget?: any): boolean {
             if (!this._observers.length) {
                 return true;
             }

+ 6 - 6
src/Tools/babylon.tools.ts

@@ -688,14 +688,14 @@
             return true;
         }
 
-        public static RegisterTopRootEvents(events: { name: string; handler: EventListener }[]): void {
+        public static RegisterTopRootEvents(events: { name: string; handler: Nullable<(e: FocusEvent) => any> }[]): void {
             for (var index = 0; index < events.length; index++) {
                 var event = events[index];
-                window.addEventListener(event.name, event.handler, false);
+                window.addEventListener(event.name, <any>event.handler, false);
 
                 try {
                     if (window.parent) {
-                        window.parent.addEventListener(event.name, event.handler, false);
+                        window.parent.addEventListener(event.name, <any>event.handler, false);
                     }
                 } catch (e) {
                     // Silently fails...
@@ -703,14 +703,14 @@
             }
         }
 
-        public static UnregisterTopRootEvents(events: { name: string; handler: EventListener }[]): void {
+        public static UnregisterTopRootEvents(events: { name: string; handler: Nullable<(e: FocusEvent) => any> }[]): void {
             for (var index = 0; index < events.length; index++) {
                 var event = events[index];
-                window.removeEventListener(event.name, event.handler);
+                window.removeEventListener(event.name, <any>event.handler);
 
                 try {
                     if (window.parent) {
-                        window.parent.removeEventListener(event.name, event.handler);
+                        window.parent.removeEventListener(event.name, <any>event.handler);
                     }
                 } catch (e) {
                     // Silently fails...

+ 12 - 12
src/babylon.scene.ts

@@ -558,8 +558,8 @@
          * Observable event triggered each time an keyboard event is received from the hosting window
          */
         public onKeyboardObservable = new Observable<KeyboardInfo>();
-        private _onKeyDown: (evt: Event) => void;
-        private _onKeyUp: (evt: Event) => void;
+        private _onKeyDown: (evt: KeyboardEvent) => void;
+        private _onKeyUp: (evt: KeyboardEvent) => void;
         private _onCanvasFocusObserver: Nullable<Observer<Engine>>;
         private _onCanvasBlurObserver: Nullable<Observer<Engine>>;
 
@@ -1786,18 +1786,18 @@
             }
 
             if (attachMove) {
-                canvas.addEventListener(eventPrefix + "move", this._onPointerMove, false);
+                canvas.addEventListener(eventPrefix + "move", <any>this._onPointerMove, false);
                 // Wheel
-                canvas.addEventListener('mousewheel', this._onPointerMove, false);
-                canvas.addEventListener('DOMMouseScroll', this._onPointerMove, false);
+                canvas.addEventListener('mousewheel', <any>this._onPointerMove, false);
+                canvas.addEventListener('DOMMouseScroll', <any>this._onPointerMove, false);
             }
 
             if (attachDown) {
-                canvas.addEventListener(eventPrefix + "down", this._onPointerDown, false);
+                canvas.addEventListener(eventPrefix + "down", <any>this._onPointerDown, false);
             }
 
             if (attachUp) {
-                window.addEventListener(eventPrefix + "up", this._onPointerUp, false);
+                window.addEventListener(eventPrefix + "up", <any>this._onPointerUp, false);
             }
 
             canvas.tabIndex = 1;
@@ -1812,9 +1812,9 @@
                 return;
             }
 
-            canvas.removeEventListener(eventPrefix + "move", this._onPointerMove);
-            canvas.removeEventListener(eventPrefix + "down", this._onPointerDown);
-            window.removeEventListener(eventPrefix + "up", this._onPointerUp);
+            canvas.removeEventListener(eventPrefix + "move", <any>this._onPointerMove);
+            canvas.removeEventListener(eventPrefix + "down", <any>this._onPointerDown);
+            window.removeEventListener(eventPrefix + "up", <any>this._onPointerUp);
 
             if (this._onCanvasBlurObserver) {
                 engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);
@@ -1825,8 +1825,8 @@
             }
 
             // Wheel
-            canvas.removeEventListener('mousewheel', this._onPointerMove);
-            canvas.removeEventListener('DOMMouseScroll', this._onPointerMove);
+            canvas.removeEventListener('mousewheel', <any>this._onPointerMove);
+            canvas.removeEventListener('DOMMouseScroll', <any>this._onPointerMove);
 
             // Keyboard
             canvas.removeEventListener("keydown", this._onKeyDown);

+ 2 - 1
src/tsconfig.json

@@ -10,6 +10,7 @@
     "noImplicitReturns": true,
     "noImplicitThis": true,
     "noUnusedLocals": true,    
-    "strictNullChecks": true
+    "strictNullChecks": true,
+    "strictFunctionTypes": true
   }
 }