Browse Source

Port to typescript launched - expect some crashs :)
So far the following files are done:
- animatable.js
- animation.js
- math.js
- boundingBox.js
- boundingSphere.js
- boundingInfo.js
- octree.js
- octreeBlock.js
- smartArray.js

David Catuhe 11 năm trước cách đây
mục cha
commit
23c4dec3d8
82 tập tin đã thay đổi với 5368 bổ sung5655 xóa
  1. 1 0
      .gitignore
  2. 41 40
      Babylon/Animations/babylon.animatable.js
  3. 31 0
      Babylon/Animations/babylon.animatable.ts
  4. 204 189
      Babylon/Animations/babylon.animation.js
  5. 225 0
      Babylon/Animations/babylon.animation.ts
  6. 1 1
      Babylon/Bones/babylon.skeleton.js
  7. 3 3
      Babylon/Collisions/babylon.pickingInfo.js
  8. 44 45
      Babylon/Culling/Octrees/babylon.octree.js
  9. 60 0
      Babylon/Culling/Octrees/babylon.octree.ts
  10. 68 68
      Babylon/Culling/Octrees/babylon.octreeBlock.js
  11. 88 0
      Babylon/Culling/Octrees/babylon.octreeBlock.ts
  12. 149 0
      Babylon/Culling/babylon.BoundingBox.ts
  13. 126 129
      Babylon/Culling/babylon.boundingBox.js
  14. 92 76
      Babylon/Culling/babylon.boundingInfo.js
  15. 106 0
      Babylon/Culling/babylon.boundingInfo.ts
  16. 56 55
      Babylon/Culling/babylon.boundingSphere.js
  17. 61 0
      Babylon/Culling/babylon.boundingSphere.ts
  18. 1 1
      Babylon/Materials/babylon.standardMaterial.js
  19. 1822 1832
      Babylon/Math/babylon.math.js
  20. 1998 0
      Babylon/Math/babylon.math.ts
  21. 1 1
      Babylon/Mesh/babylon.mesh.js
  22. 1 1
      Babylon/PostProcess/babylon.postProcess.js
  23. 1 1
      Babylon/Rendering/babylon.boundingBoxRenderer.js
  24. 3 3
      Babylon/Rendering/babylon.renderingGroup.js
  25. 75 0
      Babylon/Tools/babylon.smartArray.js
  26. 74 0
      Babylon/Tools/babylon.smartArray.ts
  27. 0 70
      Babylon/Tools/babylon.tools.js
  28. 7 7
      Babylon/babylon.scene.js
  29. 1 1
      Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/babylonJS.xml
  30. 0 19
      Typescript/Animations/babylon.animatable.d.ts
  31. 0 31
      Typescript/Animations/babylon.animation.d.ts
  32. 0 24
      Typescript/Bones/babylon.bone.d.ts
  33. 0 18
      Typescript/Bones/babylon.skeleton.d.ts
  34. 0 29
      Typescript/Cameras/babylon.arcRotateCamera.d.ts
  35. 0 31
      Typescript/Cameras/babylon.camera.d.ts
  36. 0 17
      Typescript/Cameras/babylon.deviceOrientationCamera.d.ts
  37. 0 29
      Typescript/Cameras/babylon.freeCamera.d.ts
  38. 0 14
      Typescript/Cameras/babylon.touchCamera.d.ts
  39. 0 28
      Typescript/Collisions/babylon.collider.d.ts
  40. 0 16
      Typescript/Collisions/babylon.collisionPlane.d.ts
  41. 0 17
      Typescript/Culling/Octrees/babylon.octree.d.ts
  42. 0 18
      Typescript/Culling/Octrees/babylon.octreeBlock.d.ts
  43. 0 26
      Typescript/Culling/babylon.bounding.d.ts
  44. 0 21
      Typescript/Culling/babylon.boundingInfo.d.ts
  45. 0 20
      Typescript/Culling/babylon.boundingSphere.d.ts
  46. 0 21
      Typescript/Layer/babylon.layer.d.ts
  47. 0 22
      Typescript/Lights/Shadows/babylon.shadowGenerator.d.ts
  48. 0 13
      Typescript/Lights/babylon.directionalLight.d.ts
  49. 0 15
      Typescript/Lights/babylon.hemisphericLight.d.ts
  50. 0 17
      Typescript/Lights/babylon.light.d.ts
  51. 0 12
      Typescript/Lights/babylon.pointLight.d.ts
  52. 0 15
      Typescript/Lights/babylon.spotLight.d.ts
  53. 0 34
      Typescript/Materials/babylon.effect.d.ts
  54. 0 30
      Typescript/Materials/babylon.material.d.ts
  55. 0 11
      Typescript/Materials/babylon.multiMaterial.d.ts
  56. 0 23
      Typescript/Materials/babylon.standardMaterial.d.ts
  57. 0 23
      Typescript/Materials/textures/babylon.baseTexture.d.ts
  58. 0 10
      Typescript/Materials/textures/babylon.cubeTexture.d.ts
  59. 0 14
      Typescript/Materials/textures/babylon.dynamicTexture.d.ts
  60. 0 12
      Typescript/Materials/textures/babylon.mirrorTexture.d.ts
  61. 0 18
      Typescript/Materials/textures/babylon.renderTargetTexture.d.ts
  62. 0 39
      Typescript/Materials/textures/babylon.texture.d.ts
  63. 0 13
      Typescript/Materials/textures/babylon.videoTexture.d.ts
  64. 0 99
      Typescript/Mesh/babylon.mesh.d.ts
  65. 0 26
      Typescript/Mesh/babylon.subMesh.d.ts
  66. 0 21
      Typescript/Mesh/babylon.vertexBuffer.d.ts
  67. 0 18
      Typescript/Particles/babylon.particle.d.ts
  68. 0 60
      Typescript/Particles/babylon.particleSystem.d.ts
  69. 0 6
      Typescript/PostProcess/babylon.postProcess.d.ts
  70. 0 8
      Typescript/PostProcess/babylon.postProcessManager.d.ts
  71. 0 22
      Typescript/Sprites/Babylon.Sprite.d.ts
  72. 0 20
      Typescript/Sprites/Babylon.spriteManager.d.ts
  73. 0 31
      Typescript/Tools/babylon.database.d.ts
  74. 0 310
      Typescript/Tools/babylon.math.d.ts
  75. 0 21
      Typescript/Tools/babylon.sceneLoader.d.ts
  76. 0 35
      Typescript/Tools/babylon.tools.d.ts
  77. 0 4
      Typescript/Tools/babylon.tools.dds.d.ts
  78. 0 49
      Typescript/babylon.d.ts
  79. 0 130
      Typescript/babylon.engine.d.ts
  80. 0 1478
      Typescript/babylon.min.d.ts
  81. 0 94
      Typescript/babylon.scene.d.ts
  82. 28 0
      babylon.1.12-beta.js

+ 1 - 0
.gitignore

@@ -12,6 +12,7 @@ TestResults
 *.suo
 *.user
 *.sln.docstates
+*.map
 
 # Build results
 [Dd]ebug/

+ 41 - 40
Babylon/Animations/babylon.animatable.js

@@ -1,43 +1,44 @@
-"use strict";
+var BABYLON;
+(function (BABYLON) {
+    (function (Internals) {
+        var Animatable = (function () {
+            function Animatable(target, fromFrame, toFrame, loopAnimation, speedRatio, onAnimationEnd) {
+                if (typeof fromFrame === "undefined") { fromFrame = 0; }
+                if (typeof toFrame === "undefined") { toFrame = 100; }
+                if (typeof loopAnimation === "undefined") { loopAnimation = false; }
+                if (typeof speedRatio === "undefined") { speedRatio = 1.0; }
+                this.target = target;
+                this.fromFrame = fromFrame;
+                this.toFrame = toFrame;
+                this.loopAnimation = loopAnimation;
+                this.speedRatio = speedRatio;
+                this.onAnimationEnd = onAnimationEnd;
+                this.animationStarted = false;
+            }
+            // Methods
+            Animatable.prototype._animate = function (delay) {
+                if (!this._localDelayOffset) {
+                    this._localDelayOffset = delay;
+                }
 
-var BABYLON = BABYLON || {};
+                // Animating
+                var running = false;
+                var animations = this.target.animations;
+                for (var index = 0; index < animations.length; index++) {
+                    var isRunning = animations[index].animate(this.target, delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
+                    running = running || isRunning;
+                }
 
-(function () {
-    BABYLON._Animatable = function (target, from, to, loop, speedRatio, onAnimationEnd) {
-        this.target = target;
-        this.fromFrame = from;
-        this.toFrame = to;
-        this.loopAnimation = loop;
-        this.speedRatio = speedRatio ? speedRatio : 1.0;
-        this.onAnimationEnd = onAnimationEnd;
-    };
-    
-    // Members
-    BABYLON._Animatable.prototype.target = null;
-    BABYLON._Animatable.prototype.animationStarted = false;
-    BABYLON._Animatable.prototype.loopAnimation = false;
-    BABYLON._Animatable.prototype.fromFrame = 0;
-    BABYLON._Animatable.prototype.toFrame = 100;
-    BABYLON._Animatable.prototype.speedRatio = 1.0;
-    
-    // Methods
-    BABYLON._Animatable.prototype._animate = function (delay) {
-        if (!this._localDelayOffset) {
-            this._localDelayOffset = delay;
-        }
+                if (!running && this.onAnimationEnd) {
+                    this.onAnimationEnd();
+                }
 
-        // Animating
-        var running = false;
-        var animations = this.target.animations;
-        for (var index = 0; index < animations.length; index++) {
-            var isRunning = animations[index].animate(this.target, delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
-            running = running || isRunning;            
-        }
-
-        if (!running && this.onAnimationEnd) {
-            this.onAnimationEnd();
-        }
-
-        return running;
-    };
-})();
+                return running;
+            };
+            return Animatable;
+        })();
+        Internals.Animatable = Animatable;
+    })(BABYLON.Internals || (BABYLON.Internals = {}));
+    var Internals = BABYLON.Internals;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.animatable.js.map

+ 31 - 0
Babylon/Animations/babylon.animatable.ts

@@ -0,0 +1,31 @@
+module BABYLON.Internals {
+    export class Animatable {
+        private _localDelayOffset: number;
+
+        public animationStarted = false;
+
+        constructor(public target, public fromFrame: number = 0, public toFrame: number = 100, public loopAnimation: boolean = false, public speedRatio: number = 1.0, public onAnimationEnd?) {
+        }
+
+        // Methods
+        public _animate(delay: number): boolean {
+            if (!this._localDelayOffset) {
+                this._localDelayOffset = delay;
+            }
+
+            // Animating
+            var running = false;
+            var animations = this.target.animations;
+            for (var index = 0; index < animations.length; index++) {
+                var isRunning = animations[index].animate(this.target, delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
+                running = running || isRunning;
+            }
+
+            if (!running && this.onAnimationEnd) {
+                this.onAnimationEnd();
+            }
+
+            return running;
+        }
+    }
+} 

+ 204 - 189
Babylon/Animations/babylon.animation.js

@@ -1,210 +1,225 @@
-"use strict";
-
-var BABYLON = BABYLON || {};
-
-(function () {
-    BABYLON.Animation = function (name, targetProperty, framePerSecond, dataType, loopMode) {
-        this.name = name;
-        this.targetProperty = targetProperty;
-        this.targetPropertyPath = targetProperty.split(".");
-        this.framePerSecond = framePerSecond;
-        this.dataType = dataType;
-        this.loopMode = loopMode === undefined ? BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;
-
-        this._keys = [];
-        
-        // Cache
-        this._offsetsCache = {};
-        this._highLimitsCache = {};
-    };
-
-    // Methods   
-    BABYLON.Animation.prototype.floatInterpolateFunction = function (startValue, endValue, gradient) {
-        return startValue + (endValue - startValue) * gradient;
-    };
-    
-    BABYLON.Animation.prototype.quaternionInterpolateFunction = function (startValue, endValue, gradient) {
-        return BABYLON.Quaternion.Slerp(startValue, endValue, gradient);
-    };
-    
-    BABYLON.Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {
-        return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
-    };
-
-    BABYLON.Animation.prototype.clone = function() {
-        var clone = new BABYLON.Animation(this.name, this.targetPropertyPath.join("."), this.framePerSecond, this.dataType, this.loopMode);
-
-        clone.setKeys(this._keys);
-
-        return clone;
-    };
-
-    BABYLON.Animation.prototype.setKeys = function(values) {
-        this._keys = values.slice(0);
-        this._offsetsCache = {};
-        this._highLimitsCache = {};
-    };
-
-    BABYLON.Animation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
-        if (loopMode === BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT && repeatCount > 0) {
-            return highLimitValue.clone ? highLimitValue.clone() : highLimitValue;
+var BABYLON;
+(function (BABYLON) {
+    var Animation = (function () {
+        function Animation(name, targetProperty, framePerSecond, dataType, loopMode) {
+            this.name = name;
+            this.targetProperty = targetProperty;
+            this.framePerSecond = framePerSecond;
+            this.dataType = dataType;
+            this.loopMode = loopMode;
+            this._offsetsCache = {};
+            this._highLimitsCache = {};
+            this.targetPropertyPath = targetProperty.split(".");
+            this.dataType = dataType;
+            this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;
         }
+        // Methods
+        Animation.prototype.floatInterpolateFunction = function (startValue, endValue, gradient) {
+            return startValue + (endValue - startValue) * gradient;
+        };
 
-        this.currentFrame = currentFrame;
-        
-        for (var key = 0; key < this._keys.length; key++) {
-            if (this._keys[key + 1].frame >= currentFrame) {
-                var startValue = this._keys[key].value;
-                var endValue = this._keys[key + 1].value;
-                var gradient = (currentFrame - this._keys[key].frame) / (this._keys[key + 1].frame - this._keys[key].frame);
-
-                switch (this.dataType) {
-                    // Float
-                    case BABYLON.Animation.ANIMATIONTYPE_FLOAT:
-                        switch (loopMode) {
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE:
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT:
-                                return this.floatInterpolateFunction(startValue, endValue, gradient);                                
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_RELATIVE:
-                                return offsetValue * repeatCount + this.floatInterpolateFunction(startValue, endValue, gradient);
-                        }
-                        break;
-                    // Quaternion
-                    case BABYLON.Animation.ANIMATIONTYPE_QUATERNION:
-                        var quaternion = null;
-                        switch (loopMode) {
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE:
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT:
-                                quaternion = this.quaternionInterpolateFunction(startValue, endValue, gradient);
-                                break;
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_RELATIVE:
-                                quaternion = this.quaternionInterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
-                                break;
-                        }
+        Animation.prototype.quaternionInterpolateFunction = function (startValue, endValue, gradient) {
+            return BABYLON.Quaternion.Slerp(startValue, endValue, gradient);
+        };
 
-                        return quaternion;
-                    // Vector3
-                    case BABYLON.Animation.ANIMATIONTYPE_VECTOR3:
-                        switch (loopMode) {
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE:
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT:
-                                return this.vector3InterpolateFunction(startValue, endValue, gradient);
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_RELATIVE:
-                                return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
-                        }
-                    // Matrix
-                    case BABYLON.Animation.ANIMATIONTYPE_MATRIX:
-                        switch (loopMode) {
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE:
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT:
-                            case BABYLON.Animation.ANIMATIONLOOPMODE_RELATIVE:
-                                return startValue;
-                        }
-                    default:
-                        break;
-                }
-                break;
-            }
-        }
-        return this._keys[this._keys.length - 1].value;
-    };
+        Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {
+            return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
+        };
 
-    BABYLON.Animation.prototype.animate = function (target, delay, from, to, loop, speedRatio) {
-        if (!this.targetPropertyPath || this.targetPropertyPath.length < 1) {
-            return false;
-        }
+        Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {
+            return BABYLON.Color3.Lerp(startValue, endValue, gradient);
+        };
 
-        var returnValue = true;
-        // Adding a start key at frame 0 if missing
-        if (this._keys[0].frame != 0) {
-            var newKey = {
-                frame: 0,
-                value: this._keys[0].value
-            };
+        Animation.prototype.clone = function () {
+            var clone = new Animation(this.name, this.targetPropertyPath.join("."), this.framePerSecond, this.dataType, this.loopMode);
 
-            this._keys.splice(0, 0, newKey);
-        }
+            clone.setKeys(this._keys);
 
-        // Check limits
-        if (from < this._keys[0].frame || from > this._keys[this._keys.length - 1].frame) {
-            from = this._keys[0].frame;
-        }
-        if (to < this._keys[0].frame || to > this._keys[this._keys.length - 1].frame) {
-            to = this._keys[this._keys.length - 1].frame;
-        }
+            return clone;
+        };
+
+        Animation.prototype.setKeys = function (values) {
+            this._keys = values.slice(0);
+            this._offsetsCache = {};
+            this._highLimitsCache = {};
+        };
+
+        Animation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
+            if (loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && repeatCount > 0) {
+                return highLimitValue.clone ? highLimitValue.clone() : highLimitValue;
+            }
+
+            this.currentFrame = currentFrame;
+
+            for (var key = 0; key < this._keys.length; key++) {
+                if (this._keys[key + 1].frame >= currentFrame) {
+                    var startValue = this._keys[key].value;
+                    var endValue = this._keys[key + 1].value;
+                    var gradient = (currentFrame - this._keys[key].frame) / (this._keys[key + 1].frame - this._keys[key].frame);
 
-        // Compute ratio
-        var range = to - from;
-        var ratio = delay * (this.framePerSecond * speedRatio) / 1000.0;
-
-        if (ratio > range && !loop) { // If we are out of range and not looping get back to caller
-            offsetValue = 0;
-            returnValue = false;
-        } else {
-            // Get max value if required
-            var offsetValue = 0;
-            var highLimitValue = 0;
-            if (this.loopMode != BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE) {
-                var keyOffset = to.toString() + from.toString();
-                if (!this._offsetsCache[keyOffset]) {
-                    var fromValue = this._interpolate(from, 0, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
-                    var toValue = this._interpolate(to, 0, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);
                     switch (this.dataType) {
-                    // Float
-                    case BABYLON.Animation.ANIMATIONTYPE_FLOAT:
-                        this._offsetsCache[keyOffset] = toValue - fromValue;
-                        break;
-                    // Quaternion
-                    case BABYLON.Animation.ANIMATIONTYPE_QUATERNION:
-                        this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
-                        break;
-                    // Vector3
-                    case BABYLON.Animation.ANIMATIONTYPE_VECTOR3:
-                        this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
-                    default:
-                        break;
+                        case Animation.ANIMATIONTYPE_FLOAT:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    return this.floatInterpolateFunction(startValue, endValue, gradient);
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return offsetValue * repeatCount + this.floatInterpolateFunction(startValue, endValue, gradient);
+                            }
+                            break;
+
+                        case Animation.ANIMATIONTYPE_QUATERNION:
+                            var quaternion = null;
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    quaternion = this.quaternionInterpolateFunction(startValue, endValue, gradient);
+                                    break;
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    quaternion = this.quaternionInterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
+                                    break;
+                            }
+
+                            return quaternion;
+
+                        case Animation.ANIMATIONTYPE_VECTOR3:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    return this.vector3InterpolateFunction(startValue, endValue, gradient);
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
+                            }
+
+                        case Animation.ANIMATIONTYPE_COLOR3:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    return this.color3InterpolateFunction(startValue, endValue, gradient);
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return this.color3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
+                            }
+
+                        case Animation.ANIMATIONTYPE_MATRIX:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return startValue;
+                            }
+                        default:
+                            break;
                     }
-
-                    this._highLimitsCache[keyOffset] = toValue;
+                    break;
                 }
+            }
+            return this._keys[this._keys.length - 1].value;
+        };
 
-                highLimitValue = this._highLimitsCache[keyOffset];
-                offsetValue = this._offsetsCache[keyOffset];
+        Animation.prototype.animate = function (target, delay, from, to, loop, speedRatio) {
+            if (!this.targetPropertyPath || this.targetPropertyPath.length < 1) {
+                return false;
             }
-        }
 
-        // Compute value
-        var repeatCount = (ratio / range) >> 0;
-        var currentFrame = returnValue ? from + ratio % range : to;
-        var currentValue = this._interpolate(currentFrame, repeatCount, this.loopMode, offsetValue, highLimitValue);
+            var returnValue = true;
 
-        // Set value
-        if (this.targetPropertyPath.length > 1) {
-            var property = target[this.targetPropertyPath[0]];
+            // Adding a start key at frame 0 if missing
+            if (this._keys[0].frame != 0) {
+                var newKey = {
+                    frame: 0,
+                    value: this._keys[0].value
+                };
 
-            for (var index = 1; index < this.targetPropertyPath.length - 1; index++) {
-                property = property[this.targetPropertyPath[index]];
+                this._keys.splice(0, 0, newKey);
             }
 
-            property[this.targetPropertyPath[this.targetPropertyPath.length - 1]] = currentValue;
-        } else {
-            target[this.targetPropertyPath[0]] = currentValue;
-        }
-        
-        if (target.markAsDirty) {
-            target.markAsDirty(this.targetProperty);
-        }
+            // Check limits
+            if (from < this._keys[0].frame || from > this._keys[this._keys.length - 1].frame) {
+                from = this._keys[0].frame;
+            }
+            if (to < this._keys[0].frame || to > this._keys[this._keys.length - 1].frame) {
+                to = this._keys[this._keys.length - 1].frame;
+            }
+
+            // Compute ratio
+            var range = to - from;
+            var ratio = delay * (this.framePerSecond * speedRatio) / 1000.0;
+
+            if (ratio > range && !loop) {
+                offsetValue = 0;
+                returnValue = false;
+                highLimitValue = this._keys[this._keys.length - 1].value;
+            } else {
+                // Get max value if required
+                var offsetValue = 0;
+                var highLimitValue = 0;
+                if (this.loopMode != Animation.ANIMATIONLOOPMODE_CYCLE) {
+                    var keyOffset = to.toString() + from.toString();
+                    if (!this._offsetsCache[keyOffset]) {
+                        var fromValue = this._interpolate(from, 0, Animation.ANIMATIONLOOPMODE_CYCLE);
+                        var toValue = this._interpolate(to, 0, Animation.ANIMATIONLOOPMODE_CYCLE);
+                        switch (this.dataType) {
+                            case Animation.ANIMATIONTYPE_FLOAT:
+                                this._offsetsCache[keyOffset] = toValue - fromValue;
+                                break;
+
+                            case Animation.ANIMATIONTYPE_QUATERNION:
+                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
+                                break;
+
+                            case Animation.ANIMATIONTYPE_VECTOR3:
+                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
+
+                            case Animation.ANIMATIONTYPE_COLOR3:
+                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
+                            default:
+                                break;
+                        }
 
-        return returnValue;
-    };
+                        this._highLimitsCache[keyOffset] = toValue;
+                    }
+
+                    highLimitValue = this._highLimitsCache[keyOffset];
+                    offsetValue = this._offsetsCache[keyOffset];
+                }
+            }
+
+            // Compute value
+            var repeatCount = (ratio / range) >> 0;
+            var currentFrame = returnValue ? from + ratio % range : to;
+            var currentValue = this._interpolate(currentFrame, repeatCount, this.loopMode, offsetValue, highLimitValue);
+
+            // Set value
+            if (this.targetPropertyPath.length > 1) {
+                var property = target[this.targetPropertyPath[0]];
 
-    // Statics
-    BABYLON.Animation.ANIMATIONTYPE_FLOAT = 0;
-    BABYLON.Animation.ANIMATIONTYPE_VECTOR3 = 1;
-    BABYLON.Animation.ANIMATIONTYPE_QUATERNION = 2;
-    BABYLON.Animation.ANIMATIONTYPE_MATRIX = 3;
+                for (var index = 1; index < this.targetPropertyPath.length - 1; index++) {
+                    property = property[this.targetPropertyPath[index]];
+                }
+
+                property[this.targetPropertyPath[this.targetPropertyPath.length - 1]] = currentValue;
+            } else {
+                target[this.targetPropertyPath[0]] = currentValue;
+            }
+
+            if (target.markAsDirty) {
+                target.markAsDirty(this.targetProperty);
+            }
 
-    BABYLON.Animation.ANIMATIONLOOPMODE_RELATIVE = 0;
-    BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE = 1;
-    BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT = 2;
-})();
+            return returnValue;
+        };
+
+        Animation.ANIMATIONTYPE_FLOAT = 0;
+        Animation.ANIMATIONTYPE_VECTOR3 = 1;
+        Animation.ANIMATIONTYPE_QUATERNION = 2;
+        Animation.ANIMATIONTYPE_MATRIX = 3;
+        Animation.ANIMATIONTYPE_COLOR3 = 4;
+
+        Animation.ANIMATIONLOOPMODE_RELATIVE = 0;
+        Animation.ANIMATIONLOOPMODE_CYCLE = 1;
+        Animation.ANIMATIONLOOPMODE_CONSTANT = 2;
+        return Animation;
+    })();
+    BABYLON.Animation = Animation;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.animation.js.map

+ 225 - 0
Babylon/Animations/babylon.animation.ts

@@ -0,0 +1,225 @@
+module BABYLON {
+    export class Animation {
+        private _keys: Array<any>;
+        private _offsetsCache = {};
+        private _highLimitsCache = {};
+
+        public targetPropertyPath: string[];
+        public currentFrame: number;
+
+        constructor(public name: string, public targetProperty: string, public framePerSecond: number, public dataType: number, public loopMode?: number) {
+            this.targetPropertyPath = targetProperty.split(".");
+            this.dataType = dataType;
+            this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;
+        }
+
+        // Methods   
+        public floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number {
+            return startValue + (endValue - startValue) * gradient;
+        }
+
+        public quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion {
+            return BABYLON.Quaternion.Slerp(startValue, endValue, gradient);
+        }
+
+        public vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3 {
+            return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
+        }
+
+        public color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3 {
+            return BABYLON.Color3.Lerp(startValue, endValue, gradient);
+        }
+
+        public clone(): Animation {
+            var clone = new Animation(this.name, this.targetPropertyPath.join("."), this.framePerSecond, this.dataType, this.loopMode);
+
+            clone.setKeys(this._keys);
+
+            return clone;
+        }
+
+        public setKeys(values: Array<any>): void {
+            this._keys = values.slice(0);
+            this._offsetsCache = {};
+            this._highLimitsCache = {};
+        }
+
+        private _interpolate(currentFrame: number, repeatCount: number, loopMode: number, offsetValue? , highLimitValue?) {
+            if (loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && repeatCount > 0) {
+                return highLimitValue.clone ? highLimitValue.clone() : highLimitValue;
+            }
+
+            this.currentFrame = currentFrame;
+
+            for (var key = 0; key < this._keys.length; key++) {
+                if (this._keys[key + 1].frame >= currentFrame) {
+                    var startValue = this._keys[key].value;
+                    var endValue = this._keys[key + 1].value;
+                    var gradient = (currentFrame - this._keys[key].frame) / (this._keys[key + 1].frame - this._keys[key].frame);
+
+                    switch (this.dataType) {
+                        // Float
+                        case Animation.ANIMATIONTYPE_FLOAT:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    return this.floatInterpolateFunction(startValue, endValue, gradient);
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return offsetValue * repeatCount + this.floatInterpolateFunction(startValue, endValue, gradient);
+                            }
+                            break;
+                        // Quaternion
+                        case Animation.ANIMATIONTYPE_QUATERNION:
+                            var quaternion = null;
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    quaternion = this.quaternionInterpolateFunction(startValue, endValue, gradient);
+                                    break;
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    quaternion = this.quaternionInterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
+                                    break;
+                            }
+
+                            return quaternion;
+                        // Vector3
+                        case Animation.ANIMATIONTYPE_VECTOR3:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    return this.vector3InterpolateFunction(startValue, endValue, gradient);
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
+                            }
+                        // Color3
+                        case Animation.ANIMATIONTYPE_COLOR3:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    return this.color3InterpolateFunction(startValue, endValue, gradient);
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return this.color3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
+                            }
+                        // Matrix
+                        case Animation.ANIMATIONTYPE_MATRIX:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return startValue;
+                            }
+                        default:
+                            break;
+                    }
+                    break;
+                }
+            }
+            return this._keys[this._keys.length - 1].value;
+        }
+
+        public animate(target, delay: number, from, to, loop: boolean, speedRatio: number): boolean {
+            if (!this.targetPropertyPath || this.targetPropertyPath.length < 1) {
+                return false;
+            }
+
+            var returnValue = true;
+            // Adding a start key at frame 0 if missing
+            if (this._keys[0].frame != 0) {
+                var newKey = {
+                    frame: 0,
+                    value: this._keys[0].value
+                };
+
+                this._keys.splice(0, 0, newKey);
+            }
+
+            // Check limits
+            if (from < this._keys[0].frame || from > this._keys[this._keys.length - 1].frame) {
+                from = this._keys[0].frame;
+            }
+            if (to < this._keys[0].frame || to > this._keys[this._keys.length - 1].frame) {
+                to = this._keys[this._keys.length - 1].frame;
+            }
+
+            // Compute ratio
+            var range = to - from;
+            var ratio = delay * (this.framePerSecond * speedRatio) / 1000.0;
+
+            if (ratio > range && !loop) { // If we are out of range and not looping get back to caller
+                offsetValue = 0;
+                returnValue = false;
+                highLimitValue = this._keys[this._keys.length - 1].value;
+            } else {
+                // Get max value if required
+                var offsetValue = 0;
+                var highLimitValue = 0;
+                if (this.loopMode != Animation.ANIMATIONLOOPMODE_CYCLE) {
+                    var keyOffset = to.toString() + from.toString();
+                    if (!this._offsetsCache[keyOffset]) {
+                        var fromValue = this._interpolate(from, 0, Animation.ANIMATIONLOOPMODE_CYCLE);
+                        var toValue = this._interpolate(to, 0, Animation.ANIMATIONLOOPMODE_CYCLE);
+                        switch (this.dataType) {
+                            // Float
+                            case Animation.ANIMATIONTYPE_FLOAT:
+                                this._offsetsCache[keyOffset] = toValue - fromValue;
+                                break;
+                            // Quaternion
+                            case Animation.ANIMATIONTYPE_QUATERNION:
+                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
+                                break;
+                            // Vector3
+                            case Animation.ANIMATIONTYPE_VECTOR3:
+                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
+                            // Color3
+                            case Animation.ANIMATIONTYPE_COLOR3:
+                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
+                            default:
+                                break;
+                        }
+
+                        this._highLimitsCache[keyOffset] = toValue;
+                    }
+
+                    highLimitValue = this._highLimitsCache[keyOffset];
+                    offsetValue = this._offsetsCache[keyOffset];
+                }
+            }
+
+            // Compute value
+            var repeatCount = (ratio / range) >> 0;
+            var currentFrame = returnValue ? from + ratio % range : to;
+            var currentValue = this._interpolate(currentFrame, repeatCount, this.loopMode, offsetValue, highLimitValue);
+
+            // Set value
+            if (this.targetPropertyPath.length > 1) {
+                var property = target[this.targetPropertyPath[0]];
+
+                for (var index = 1; index < this.targetPropertyPath.length - 1; index++) {
+                    property = property[this.targetPropertyPath[index]];
+                }
+
+                property[this.targetPropertyPath[this.targetPropertyPath.length - 1]] = currentValue;
+            } else {
+                target[this.targetPropertyPath[0]] = currentValue;
+            }
+
+            if (target.markAsDirty) {
+                target.markAsDirty(this.targetProperty);
+            }
+
+            return returnValue;
+        }
+
+        // Statics
+        public static ANIMATIONTYPE_FLOAT = 0;
+        public static ANIMATIONTYPE_VECTOR3 = 1;
+        public static ANIMATIONTYPE_QUATERNION = 2;
+        public static ANIMATIONTYPE_MATRIX = 3;
+        public static ANIMATIONTYPE_COLOR3 = 4;
+
+        public static ANIMATIONLOOPMODE_RELATIVE = 0;
+        public static ANIMATIONLOOPMODE_CYCLE = 1;
+        public static ANIMATIONLOOPMODE_CONSTANT = 2;
+
+    }
+} 

+ 1 - 1
Babylon/Bones/babylon.skeleton.js

@@ -31,7 +31,7 @@ var BABYLON = BABYLON || {};
         }
 
         if (!this._transformMatrices || this._transformMatrices.length !== 16 * this.bones.length) {
-            this._transformMatrices = new BABYLON.MatrixType(16 * this.bones.length);
+            this._transformMatrices = new Float32Array(16 * this.bones.length);
         }
 
         for (var index = 0; index < this.bones.length; index++) {

+ 3 - 3
Babylon/Collisions/babylon.pickingInfo.js

@@ -24,9 +24,9 @@ var BABYLON = BABYLON || {};
         var indices = this.pickedMesh.getIndices();
         var normals = this.pickedMesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
 
-        var normal0 = BABYLON.Vector3.FromArray(normals , indices[this.faceId]);
-        var normal1 = BABYLON.Vector3.FromArray(normals, indices[this.faceId + 1]);
-        var normal2 = BABYLON.Vector3.FromArray(normals, indices[this.faceId + 2]);
+        var normal0 = BABYLON.Vector3.FromArray(normals , indices[this.faceId * 3] * 3);
+        var normal1 = BABYLON.Vector3.FromArray(normals, indices[this.faceId * 3 + 1] * 3);
+        var normal2 = BABYLON.Vector3.FromArray(normals, indices[this.faceId * 3 + 2] * 3);
 
         normal0 = normal0.scale(this.bu);
         normal1 = normal1.scale(this.bv);

+ 44 - 45
Babylon/Culling/Octrees/babylon.octree.js

@@ -1,54 +1,53 @@
-"use strict";
-
-var BABYLON = BABYLON || {};
-
-(function() {
-    BABYLON.Octree = function(maxBlockCapacity) {
-        this.blocks = [];
-        this._maxBlockCapacity = maxBlockCapacity || 64;
-        this._selection = new BABYLON.Tools.SmartArray(256);
-    };
-
-    // Methods
-    BABYLON.Octree.prototype.update = function(worldMin, worldMax, meshes) {
-        BABYLON.Octree._CreateBlocks(worldMin, worldMax, meshes, this._maxBlockCapacity, this);
-    };
-    
-    BABYLON.Octree.prototype.addMesh = function (mesh) {
-        for (var index = 0; index < this.blocks.length; index++) {
-            var block = this.blocks[index];
-            block.addMesh(mesh);
+var BABYLON;
+(function (BABYLON) {
+    var Octree = (function () {
+        function Octree(maxBlockCapacity) {
+            this._maxBlockCapacity = maxBlockCapacity || 64;
+            this._selection = new BABYLON.SmartArray(256);
         }
-    };
+        // Methods
+        Octree.prototype.update = function (worldMin, worldMax, meshes) {
+            Octree._CreateBlocks(worldMin, worldMax, meshes, this._maxBlockCapacity, this);
+        };
+
+        Octree.prototype.addMesh = function (mesh) {
+            for (var index = 0; index < this.blocks.length; index++) {
+                var block = this.blocks[index];
+                block.addMesh(mesh);
+            }
+        };
 
-    BABYLON.Octree.prototype.select = function(frustumPlanes) {
-        this._selection.reset();
+        Octree.prototype.select = function (frustumPlanes) {
+            this._selection.reset();
 
-        for (var index = 0; index < this.blocks.length; index++) {
-            var block = this.blocks[index];
-            block.select(frustumPlanes, this._selection);
-        }
+            for (var index = 0; index < this.blocks.length; index++) {
+                var block = this.blocks[index];
+                block.select(frustumPlanes, this._selection);
+            }
 
-        return this._selection;
-    };
+            return this._selection;
+        };
 
-    // Statics
-    BABYLON.Octree._CreateBlocks = function (worldMin, worldMax, meshes, maxBlockCapacity, target) {
-        target.blocks = [];
-        var blockSize = new BABYLON.Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);
+        // Statics
+        Octree._CreateBlocks = function (worldMin, worldMax, meshes, maxBlockCapacity, target) {
+            target.blocks = [];
+            var blockSize = new BABYLON.Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);
 
-        // Segmenting space
-        for (var x = 0; x < 2; x++) {
-            for (var y = 0; y < 2; y++) {
-                for (var z = 0; z < 2; z++) {
-                    var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));
-                    var localMax = worldMin.add(blockSize.multiplyByFloats(x + 1, y + 1, z + 1));
+            for (var x = 0; x < 2; x++) {
+                for (var y = 0; y < 2; y++) {
+                    for (var z = 0; z < 2; z++) {
+                        var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));
+                        var localMax = worldMin.add(blockSize.multiplyByFloats(x + 1, y + 1, z + 1));
 
-                    var block = new BABYLON.OctreeBlock(localMin, localMax, maxBlockCapacity);
-                    block.addEntries(meshes);
-                    target.blocks.push(block);
+                        var block = new BABYLON.OctreeBlock(localMin, localMax, maxBlockCapacity);
+                        block.addEntries(meshes);
+                        target.blocks.push(block);
+                    }
                 }
             }
-        }
-    };
-})();
+        };
+        return Octree;
+    })();
+    BABYLON.Octree = Octree;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.octree.js.map

+ 60 - 0
Babylon/Culling/Octrees/babylon.octree.ts

@@ -0,0 +1,60 @@
+module BABYLON {
+    export interface IOctreeContainer {
+        blocks: Array<OctreeBlock>;
+    }
+
+    export class Octree {
+        public blocks: Array<OctreeBlock>;
+        private _maxBlockCapacity: number;
+        private _selection;
+
+
+        constructor(maxBlockCapacity: number) {
+            this._maxBlockCapacity = maxBlockCapacity || 64;
+            this._selection = new BABYLON.SmartArray(256);
+        }
+
+        // Methods
+        public update(worldMin: Vector3, worldMax: Vector3, meshes): void {
+            Octree._CreateBlocks(worldMin, worldMax, meshes, this._maxBlockCapacity, this);
+        }
+
+        public addMesh(mesh): void {
+            for (var index = 0; index < this.blocks.length; index++) {
+                var block = this.blocks[index];
+                block.addMesh(mesh);
+            }
+        }
+
+        public select(frustumPlanes: Plane[]) {
+            this._selection.reset();
+
+            for (var index = 0; index < this.blocks.length; index++) {
+                var block = this.blocks[index];
+                block.select(frustumPlanes, this._selection);
+            }
+
+            return this._selection;
+        }
+
+        // Statics
+        static _CreateBlocks(worldMin: Vector3, worldMax: Vector3, meshes, maxBlockCapacity: number, target: IOctreeContainer): void {
+            target.blocks = [];
+            var blockSize = new BABYLON.Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);
+
+            // Segmenting space
+            for (var x = 0; x < 2; x++) {
+                for (var y = 0; y < 2; y++) {
+                    for (var z = 0; z < 2; z++) {
+                        var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));
+                        var localMax = worldMin.add(blockSize.multiplyByFloats(x + 1, y + 1, z + 1));
+
+                        var block = new BABYLON.OctreeBlock(localMin, localMax, maxBlockCapacity);
+                        block.addEntries(meshes);
+                        target.blocks.push(block);
+                    }
+                }
+            }
+        }
+    }
+} 

+ 68 - 68
Babylon/Culling/Octrees/babylon.octreeBlock.js

@@ -1,85 +1,85 @@
-"use strict";
+var BABYLON;
+(function (BABYLON) {
+    var OctreeBlock = (function () {
+        function OctreeBlock(minPoint, maxPoint, capacity) {
+            this.meshes = [];
+            this.subMeshes = [];
+            this._boundingVectors = new Array();
+            this._capacity = capacity;
 
-var BABYLON = BABYLON || {};
+            this._minPoint = minPoint;
+            this._maxPoint = maxPoint;
 
-(function () {
-    BABYLON.OctreeBlock = function (minPoint, maxPoint, capacity) {
-        this.subMeshes = [];
-        this.meshes = [];
-        this._capacity = capacity;
+            this._boundingVectors.push(minPoint.clone());
+            this._boundingVectors.push(maxPoint.clone());
 
-        this._minPoint = minPoint;
-        this._maxPoint = maxPoint;
-        
-        this._boundingVectors = [];
+            this._boundingVectors.push(minPoint.clone());
+            this._boundingVectors[2].x = maxPoint.x;
 
-        this._boundingVectors.push(minPoint.clone());
-        this._boundingVectors.push(maxPoint.clone());
+            this._boundingVectors.push(minPoint.clone());
+            this._boundingVectors[3].y = maxPoint.y;
 
-        this._boundingVectors.push(minPoint.clone());
-        this._boundingVectors[2].x = maxPoint.x;
+            this._boundingVectors.push(minPoint.clone());
+            this._boundingVectors[4].z = maxPoint.z;
 
-        this._boundingVectors.push(minPoint.clone());
-        this._boundingVectors[3].y = maxPoint.y;
+            this._boundingVectors.push(maxPoint.clone());
+            this._boundingVectors[5].z = minPoint.z;
 
-        this._boundingVectors.push(minPoint.clone());
-        this._boundingVectors[4].z = maxPoint.z;
+            this._boundingVectors.push(maxPoint.clone());
+            this._boundingVectors[6].x = minPoint.x;
 
-        this._boundingVectors.push(maxPoint.clone());
-        this._boundingVectors[5].z = minPoint.z;
+            this._boundingVectors.push(maxPoint.clone());
+            this._boundingVectors[7].y = minPoint.y;
+        }
+        // Methods
+        OctreeBlock.prototype.addMesh = function (mesh) {
+            if (this.blocks) {
+                for (var index = 0; index < this.blocks.length; index++) {
+                    var block = this.blocks[index];
+                    block.addMesh(mesh);
+                }
+                return;
+            }
 
-        this._boundingVectors.push(maxPoint.clone());
-        this._boundingVectors[6].x = minPoint.x;
+            if (mesh.getBoundingInfo().boundingBox.intersectsMinMax(this._minPoint, this._maxPoint)) {
+                var localMeshIndex = this.meshes.length;
+                this.meshes.push(mesh);
 
-        this._boundingVectors.push(maxPoint.clone());
-        this._boundingVectors[7].y = minPoint.y;
-    };
+                this.subMeshes[localMeshIndex] = [];
+                for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
+                    var subMesh = mesh.subMeshes[subIndex];
+                    if (mesh.subMeshes.length === 1 || subMesh.getBoundingInfo().boundingBox.intersectsMinMax(this._minPoint, this._maxPoint)) {
+                        this.subMeshes[localMeshIndex].push(subMesh);
+                    }
+                }
+            }
 
-    // Methods
-    BABYLON.OctreeBlock.prototype.addMesh = function (mesh) {
-        if (this.blocks) {
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.addMesh(mesh);
+            if (this.subMeshes.length > this._capacity) {
+                BABYLON.Octree._CreateBlocks(this._minPoint, this._maxPoint, this.meshes, this._capacity, this);
             }
-            return;
-        }
+        };
 
-        if (mesh.getBoundingInfo().boundingBox.intersectsMinMax(this._minPoint, this._maxPoint)) {
-            var localMeshIndex = this.meshes.length;
-            this.meshes.push(mesh);
+        OctreeBlock.prototype.addEntries = function (meshes) {
+            for (var index = 0; index < meshes.length; index++) {
+                var mesh = meshes[index];
+                this.addMesh(mesh);
+            }
+        };
 
-            this.subMeshes[localMeshIndex] = [];
-            for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
-                var subMesh = mesh.subMeshes[subIndex];
-                if (mesh.subMeshes.length === 1 || subMesh.getBoundingInfo().boundingBox.intersectsMinMax(this._minPoint, this._maxPoint)) {
-                    this.subMeshes[localMeshIndex].push(subMesh);
+        OctreeBlock.prototype.select = function (frustumPlanes, selection) {
+            if (this.blocks) {
+                for (var index = 0; index < this.blocks.length; index++) {
+                    var block = this.blocks[index];
+                    block.select(frustumPlanes, selection);
                 }
+                return;
             }
-        }
-        
-        if (this.subMeshes.length > this._capacity) {
-            BABYLON.Octree._CreateBlocks(this._minPoint, this._maxPoint, this.meshes, this._capacity, this);
-        }
-    };
-
-    BABYLON.OctreeBlock.prototype.addEntries = function (meshes) {
-        for (var index = 0; index < meshes.length; index++) {
-            var mesh = meshes[index];
-            this.addMesh(mesh);
-        }       
-    };
-
-    BABYLON.OctreeBlock.prototype.select = function (frustumPlanes, selection) {
-        if (this.blocks) {
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.select(frustumPlanes, selection);
+            if (BABYLON.BoundingBox.IsInFrustum(this._boundingVectors, frustumPlanes)) {
+                selection.push(this);
             }
-            return;
-        }
-        if (BABYLON.BoundingBox.IsInFrustum(this._boundingVectors, frustumPlanes)) {
-            selection.push(this);
-        }
-    };
-})();
+        };
+        return OctreeBlock;
+    })();
+    BABYLON.OctreeBlock = OctreeBlock;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.octreeBlock.js.map

+ 88 - 0
Babylon/Culling/Octrees/babylon.octreeBlock.ts

@@ -0,0 +1,88 @@
+module BABYLON {
+    export class OctreeBlock {
+        public meshes = [];
+        public subMeshes = [];
+        public blocks: Array<OctreeBlock>;
+
+        private _capacity: number;
+        private _minPoint: Vector3;
+        private _maxPoint: Vector3;
+        private _boundingVectors = new Array<Vector3>();
+
+        constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number) {
+            this._capacity = capacity;
+
+            this._minPoint = minPoint;
+            this._maxPoint = maxPoint;
+
+            this._boundingVectors.push(minPoint.clone());
+            this._boundingVectors.push(maxPoint.clone());
+
+            this._boundingVectors.push(minPoint.clone());
+            this._boundingVectors[2].x = maxPoint.x;
+
+            this._boundingVectors.push(minPoint.clone());
+            this._boundingVectors[3].y = maxPoint.y;
+
+            this._boundingVectors.push(minPoint.clone());
+            this._boundingVectors[4].z = maxPoint.z;
+
+            this._boundingVectors.push(maxPoint.clone());
+            this._boundingVectors[5].z = minPoint.z;
+
+            this._boundingVectors.push(maxPoint.clone());
+            this._boundingVectors[6].x = minPoint.x;
+
+            this._boundingVectors.push(maxPoint.clone());
+            this._boundingVectors[7].y = minPoint.y;
+        }
+
+        // Methods
+        public addMesh(mesh): void {
+            if (this.blocks) {
+                for (var index = 0; index < this.blocks.length; index++) {
+                    var block = this.blocks[index];
+                    block.addMesh(mesh);
+                }
+                return;
+            }
+
+            if (mesh.getBoundingInfo().boundingBox.intersectsMinMax(this._minPoint, this._maxPoint)) {
+                var localMeshIndex = this.meshes.length;
+                this.meshes.push(mesh);
+
+                this.subMeshes[localMeshIndex] = [];
+                for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
+                    var subMesh = mesh.subMeshes[subIndex];
+                    if (mesh.subMeshes.length === 1 || subMesh.getBoundingInfo().boundingBox.intersectsMinMax(this._minPoint, this._maxPoint)) {
+                        this.subMeshes[localMeshIndex].push(subMesh);
+                    }
+                }
+            }
+
+            if (this.subMeshes.length > this._capacity) {
+                Octree._CreateBlocks(this._minPoint, this._maxPoint, this.meshes, this._capacity, this);
+            }
+        }
+
+        public addEntries(meshes): void {
+            for (var index = 0; index < meshes.length; index++) {
+                var mesh = meshes[index];
+                this.addMesh(mesh);
+            }
+        }
+
+        public select(frustumPlanes: Plane[], selection): void {
+            if (this.blocks) {
+                for (var index = 0; index < this.blocks.length; index++) {
+                    var block = this.blocks[index];
+                    block.select(frustumPlanes, selection);
+                }
+                return;
+            }
+            if (BABYLON.BoundingBox.IsInFrustum(this._boundingVectors, frustumPlanes)) {
+                selection.push(this);
+            }
+        }
+    }
+} 

+ 149 - 0
Babylon/Culling/babylon.BoundingBox.ts

@@ -0,0 +1,149 @@
+module BABYLON {
+    export class BoundingBox {
+        public vectors: Vector3[] = new Array<Vector3>();
+        public center: Vector3;
+        public extends: Vector3;
+        public directions: Vector3[];
+        public vectorsWorld: Vector3[] = new Array<Vector3>();
+        public minimumWorld: Vector3;
+        public maximumWorld: Vector3;
+
+        constructor(public minimum: Vector3, public maximum: Vector3) {
+            // Bounding vectors            
+            this.vectors.push(this.minimum.clone());
+            this.vectors.push(this.maximum.clone());
+
+            this.vectors.push(this.minimum.clone());
+            this.vectors[2].x = this.maximum.x;
+
+            this.vectors.push(this.minimum.clone());
+            this.vectors[3].y = this.maximum.y;
+
+            this.vectors.push(this.minimum.clone());
+            this.vectors[4].z = this.maximum.z;
+
+            this.vectors.push(this.maximum.clone());
+            this.vectors[5].z = this.minimum.z;
+
+            this.vectors.push(this.maximum.clone());
+            this.vectors[6].x = this.minimum.x;
+
+            this.vectors.push(this.maximum.clone());
+            this.vectors[7].y = this.minimum.y;
+
+            // OBB
+            this.center = this.maximum.add(this.minimum).scale(0.5);
+            this.extends = this.maximum.subtract(this.minimum).scale(0.5);
+            this.directions = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
+
+            // World
+            for (var index = 0; index < this.vectors.length; index++) {
+                this.vectorsWorld[index] = BABYLON.Vector3.Zero();
+            }
+            this.minimumWorld = BABYLON.Vector3.Zero();
+            this.maximumWorld = BABYLON.Vector3.Zero();
+
+            this._update(BABYLON.Matrix.Identity());
+        }
+
+        // Methods
+        public _update(world: Matrix): void {
+            Vector3.FromFloatsToRef(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, this.minimumWorld);
+            Vector3.FromFloatsToRef(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE, this.maximumWorld);
+
+            for (var index = 0; index < this.vectors.length; index++) {
+                var v = this.vectorsWorld[index];
+                BABYLON.Vector3.TransformCoordinatesToRef(this.vectors[index], world, v);
+
+                if (v.x < this.minimumWorld.x)
+                    this.minimumWorld.x = v.x;
+                if (v.y < this.minimumWorld.y)
+                    this.minimumWorld.y = v.y;
+                if (v.z < this.minimumWorld.z)
+                    this.minimumWorld.z = v.z;
+
+                if (v.x > this.maximumWorld.x)
+                    this.maximumWorld.x = v.x;
+                if (v.y > this.maximumWorld.y)
+                    this.maximumWorld.y = v.y;
+                if (v.z > this.maximumWorld.z)
+                    this.maximumWorld.z = v.z;
+            }
+
+            // OBB
+            this.maximumWorld.addToRef(this.minimumWorld, this.center);
+            this.center.scaleInPlace(0.5);
+
+            Vector3.FromFloatArrayToRef(world.m, 0, this.directions[0]);
+            Vector3.FromFloatArrayToRef(world.m, 4, this.directions[1]);
+            Vector3.FromFloatArrayToRef(world.m, 8, this.directions[2]);
+        }
+
+        public isInFrustum(frustumPlanes: Plane[]): boolean {
+            return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);
+        }
+
+        public intersectsPoint(point: Vector3): boolean {
+            if (this.maximumWorld.x < point.x || this.minimumWorld.x > point.x)
+                return false;
+
+            if (this.maximumWorld.y < point.y || this.minimumWorld.y > point.y)
+                return false;
+
+            if (this.maximumWorld.z < point.z || this.minimumWorld.z > point.z)
+                return false;
+
+            return true;
+        }
+
+        public intersectsSphere(sphere: BoundingSphere): boolean {
+            var vector = BABYLON.Vector3.Clamp(sphere.centerWorld, this.minimumWorld, this.maximumWorld);
+            var num = BABYLON.Vector3.DistanceSquared(sphere.centerWorld, vector);
+            return (num <= (sphere.radiusWorld * sphere.radiusWorld));
+        }
+
+        public intersectsMinMax(min: Vector3, max: Vector3): boolean {
+            if (this.maximumWorld.x < min.x || this.minimumWorld.x > max.x)
+                return false;
+
+            if (this.maximumWorld.y < min.y || this.minimumWorld.y > max.y)
+                return false;
+
+            if (this.maximumWorld.z < min.z || this.minimumWorld.z > max.z)
+                return false;
+
+            return true;
+        }
+
+        // Statics
+        public static Intersects(box0: BoundingBox, box1: BoundingBox): boolean {
+            if (box0.maximumWorld.x < box1.minimumWorld.x || box0.minimumWorld.x > box1.maximumWorld.x)
+                return false;
+
+            if (box0.maximumWorld.y < box1.minimumWorld.y || box0.minimumWorld.y > box1.maximumWorld.y)
+                return false;
+
+            if (box0.maximumWorld.z < box1.minimumWorld.z || box0.minimumWorld.z > box1.maximumWorld.z)
+                return false;
+
+            return true;
+        }
+
+        public static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean {
+            for (var p = 0; p < 6; p++) {
+                var inCount = 8;
+
+                for (var i = 0; i < 8; i++) {
+                    if (frustumPlanes[p].dotCoordinate(boundingVectors[i]) < 0) {
+                        --inCount;
+                    } else {
+                        break;
+                    }
+                }
+                if (inCount == 0)
+                    return false;
+            }
+            return true;
+        }
+    }
+} 

+ 126 - 129
Babylon/Culling/babylon.boundingBox.js

@@ -1,150 +1,147 @@
-"use strict";
-
-var BABYLON = BABYLON || {};
-
-(function () {
-    BABYLON.BoundingBox = function (minimum, maximum) {
-        this.minimum = minimum;
-        this.maximum = maximum;
-        
-        // Bounding vectors
-        this.vectors = [];
-
-        this.vectors.push(this.minimum.clone());
-        this.vectors.push(this.maximum.clone());
-
-        this.vectors.push(this.minimum.clone());
-        this.vectors[2].x = this.maximum.x;
-
-        this.vectors.push(this.minimum.clone());
-        this.vectors[3].y = this.maximum.y;
-
-        this.vectors.push(this.minimum.clone());
-        this.vectors[4].z = this.maximum.z;
-
-        this.vectors.push(this.maximum.clone());
-        this.vectors[5].z = this.minimum.z;
-
-        this.vectors.push(this.maximum.clone());
-        this.vectors[6].x = this.minimum.x;
-
-        this.vectors.push(this.maximum.clone());
-        this.vectors[7].y = this.minimum.y;
-
-        // OBB
-        this.center = this.maximum.add(this.minimum).scale(0.5);
-        this.extends = this.maximum.subtract(this.minimum).scale(0.5);
-        this.directions = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
+var BABYLON;
+(function (BABYLON) {
+    var BoundingBox = (function () {
+        function BoundingBox(minimum, maximum) {
+            this.minimum = minimum;
+            this.maximum = maximum;
+            this.vectors = new Array();
+            this.vectorsWorld = new Array();
+            // Bounding vectors
+            this.vectors.push(this.minimum.clone());
+            this.vectors.push(this.maximum.clone());
+
+            this.vectors.push(this.minimum.clone());
+            this.vectors[2].x = this.maximum.x;
+
+            this.vectors.push(this.minimum.clone());
+            this.vectors[3].y = this.maximum.y;
+
+            this.vectors.push(this.minimum.clone());
+            this.vectors[4].z = this.maximum.z;
+
+            this.vectors.push(this.maximum.clone());
+            this.vectors[5].z = this.minimum.z;
+
+            this.vectors.push(this.maximum.clone());
+            this.vectors[6].x = this.minimum.x;
+
+            this.vectors.push(this.maximum.clone());
+            this.vectors[7].y = this.minimum.y;
+
+            // OBB
+            this.center = this.maximum.add(this.minimum).scale(0.5);
+            this.extends = this.maximum.subtract(this.minimum).scale(0.5);
+            this.directions = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
+
+            for (var index = 0; index < this.vectors.length; index++) {
+                this.vectorsWorld[index] = BABYLON.Vector3.Zero();
+            }
+            this.minimumWorld = BABYLON.Vector3.Zero();
+            this.maximumWorld = BABYLON.Vector3.Zero();
 
-        // World
-        this.vectorsWorld = [];
-        for (var index = 0; index < this.vectors.length; index++) {
-            this.vectorsWorld[index] = BABYLON.Vector3.Zero();
-        }
-        this.minimumWorld = BABYLON.Vector3.Zero();
-        this.maximumWorld = BABYLON.Vector3.Zero();
-
-        this._update(BABYLON.Matrix.Identity());
-    };
-
-    // Methods
-    BABYLON.BoundingBox.prototype._update = function (world) {
-        BABYLON.Vector3.FromFloatsToRef(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, this.minimumWorld);
-        BABYLON.Vector3.FromFloatsToRef(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE, this.maximumWorld);
-
-        for (var index = 0; index < this.vectors.length; index++) {
-            var v = this.vectorsWorld[index];
-            BABYLON.Vector3.TransformCoordinatesToRef(this.vectors[index], world, v);
-
-            if (v.x < this.minimumWorld.x)
-                this.minimumWorld.x = v.x;
-            if (v.y < this.minimumWorld.y)
-                this.minimumWorld.y = v.y;
-            if (v.z < this.minimumWorld.z)
-                this.minimumWorld.z = v.z;
-
-            if (v.x > this.maximumWorld.x)
-                this.maximumWorld.x = v.x;
-            if (v.y > this.maximumWorld.y)
-                this.maximumWorld.y = v.y;
-            if (v.z > this.maximumWorld.z)
-                this.maximumWorld.z = v.z;
+            this._update(BABYLON.Matrix.Identity());
         }
+        // Methods
+        BoundingBox.prototype._update = function (world) {
+            BABYLON.Vector3.FromFloatsToRef(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, this.minimumWorld);
+            BABYLON.Vector3.FromFloatsToRef(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE, this.maximumWorld);
+
+            for (var index = 0; index < this.vectors.length; index++) {
+                var v = this.vectorsWorld[index];
+                BABYLON.Vector3.TransformCoordinatesToRef(this.vectors[index], world, v);
+
+                if (v.x < this.minimumWorld.x)
+                    this.minimumWorld.x = v.x;
+                if (v.y < this.minimumWorld.y)
+                    this.minimumWorld.y = v.y;
+                if (v.z < this.minimumWorld.z)
+                    this.minimumWorld.z = v.z;
+
+                if (v.x > this.maximumWorld.x)
+                    this.maximumWorld.x = v.x;
+                if (v.y > this.maximumWorld.y)
+                    this.maximumWorld.y = v.y;
+                if (v.z > this.maximumWorld.z)
+                    this.maximumWorld.z = v.z;
+            }
 
-        // OBB
-        this.maximumWorld.addToRef(this.minimumWorld, this.center);
-        this.center.scaleInPlace(0.5);
+            // OBB
+            this.maximumWorld.addToRef(this.minimumWorld, this.center);
+            this.center.scaleInPlace(0.5);
 
-        BABYLON.Vector3.FromArrayToRef(world.m, 0, this.directions[0]);
-        BABYLON.Vector3.FromArrayToRef(world.m, 4, this.directions[1]);
-        BABYLON.Vector3.FromArrayToRef(world.m, 8, this.directions[2]);
-    };
+            BABYLON.Vector3.FromFloatArrayToRef(world.m, 0, this.directions[0]);
+            BABYLON.Vector3.FromFloatArrayToRef(world.m, 4, this.directions[1]);
+            BABYLON.Vector3.FromFloatArrayToRef(world.m, 8, this.directions[2]);
+        };
 
-    BABYLON.BoundingBox.prototype.isInFrustum = function (frustumPlanes) {
-        return BABYLON.BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);
-    };
+        BoundingBox.prototype.isInFrustum = function (frustumPlanes) {
+            return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);
+        };
 
-    BABYLON.BoundingBox.prototype.intersectsPoint = function (point) {
-        if (this.maximumWorld.x < point.x || this.minimumWorld.x > point.x)
-            return false;
+        BoundingBox.prototype.intersectsPoint = function (point) {
+            if (this.maximumWorld.x < point.x || this.minimumWorld.x > point.x)
+                return false;
 
-        if (this.maximumWorld.y < point.y || this.minimumWorld.y > point.y)
-            return false;
+            if (this.maximumWorld.y < point.y || this.minimumWorld.y > point.y)
+                return false;
 
-        if (this.maximumWorld.z < point.z || this.minimumWorld.z > point.z)
-            return false;
+            if (this.maximumWorld.z < point.z || this.minimumWorld.z > point.z)
+                return false;
 
-        return true;
-    };
+            return true;
+        };
 
-    BABYLON.BoundingBox.prototype.intersectsSphere = function (sphere) {
-        var vector = BABYLON.Vector3.Clamp(sphere.centerWorld, this.minimumWorld, this.maximumWorld);
-        var num = BABYLON.Vector3.DistanceSquared(sphere.centerWorld, vector);
-        return (num <= (sphere.radiusWorld * sphere.radiusWorld));
-    };
+        BoundingBox.prototype.intersectsSphere = function (sphere) {
+            var vector = BABYLON.Vector3.Clamp(sphere.centerWorld, this.minimumWorld, this.maximumWorld);
+            var num = BABYLON.Vector3.DistanceSquared(sphere.centerWorld, vector);
+            return (num <= (sphere.radiusWorld * sphere.radiusWorld));
+        };
 
-    BABYLON.BoundingBox.prototype.intersectsMinMax = function (min, max) {
-        if (this.maximumWorld.x < min.x || this.minimumWorld.x > max.x)
-            return false;
+        BoundingBox.prototype.intersectsMinMax = function (min, max) {
+            if (this.maximumWorld.x < min.x || this.minimumWorld.x > max.x)
+                return false;
 
-        if (this.maximumWorld.y < min.y || this.minimumWorld.y > max.y)
-            return false;
+            if (this.maximumWorld.y < min.y || this.minimumWorld.y > max.y)
+                return false;
 
-        if (this.maximumWorld.z < min.z || this.minimumWorld.z > max.z)
-            return false;
+            if (this.maximumWorld.z < min.z || this.minimumWorld.z > max.z)
+                return false;
 
-        return true;
-    };
+            return true;
+        };
 
-    // Statics
-    BABYLON.BoundingBox.intersects = function (box0, box1) {
-        if (box0.maximumWorld.x < box1.minimumWorld.x || box0.minimumWorld.x > box1.maximumWorld.x)
-            return false;
+        // Statics
+        BoundingBox.Intersects = function (box0, box1) {
+            if (box0.maximumWorld.x < box1.minimumWorld.x || box0.minimumWorld.x > box1.maximumWorld.x)
+                return false;
 
-        if (box0.maximumWorld.y < box1.minimumWorld.y || box0.minimumWorld.y > box1.maximumWorld.y)
-            return false;
+            if (box0.maximumWorld.y < box1.minimumWorld.y || box0.minimumWorld.y > box1.maximumWorld.y)
+                return false;
+
+            if (box0.maximumWorld.z < box1.minimumWorld.z || box0.minimumWorld.z > box1.maximumWorld.z)
+                return false;
 
-        if (box0.maximumWorld.z < box1.minimumWorld.z || box0.minimumWorld.z > box1.maximumWorld.z)
-            return false;
+            return true;
+        };
 
-        return true;
-    };
-    
-    BABYLON.BoundingBox.IsInFrustum = function (boundingVectors, frustumPlanes) {
-        for (var p = 0; p < 6; p++) {
-            var inCount = 8;
+        BoundingBox.IsInFrustum = function (boundingVectors, frustumPlanes) {
+            for (var p = 0; p < 6; p++) {
+                var inCount = 8;
 
-            for (var i = 0; i < 8; i++) {
-                if (frustumPlanes[p].dotCoordinate(boundingVectors[i]) < 0) {
-                    --inCount;
-                } else {
-                    break;
+                for (var i = 0; i < 8; i++) {
+                    if (frustumPlanes[p].dotCoordinate(boundingVectors[i]) < 0) {
+                        --inCount;
+                    } else {
+                        break;
+                    }
                 }
+                if (inCount == 0)
+                    return false;
             }
-            if (inCount == 0)
-                return false;
-        }
-        return true;
-    };
-
-})();
+            return true;
+        };
+        return BoundingBox;
+    })();
+    BABYLON.BoundingBox = BoundingBox;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.BoundingBox.js.map

+ 92 - 76
Babylon/Culling/babylon.boundingInfo.js

@@ -1,23 +1,5 @@
-"use strict";
-
-var BABYLON = BABYLON || {};
-
-(function () {
-    BABYLON.BoundingInfo = function (minimum, maximum) {
-        this.boundingBox = new BABYLON.BoundingBox(minimum, maximum);
-        this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum);
-    };
-
-    // Methods
-    BABYLON.BoundingInfo.prototype._update = function (world, scale) {
-        this.boundingBox._update(world);
-        this.boundingSphere._update(world, scale);
-    };
-
-    var extentsOverlap = function (min0, max0, min1, max1) {
-        return !(min0 > max1 || min1 > max0);
-    };
-
+var BABYLON;
+(function (BABYLON) {
     var computeBoxExtents = function (axis, box) {
         var p = BABYLON.Vector3.Dot(box.center, axis);
 
@@ -32,6 +14,10 @@ var BABYLON = BABYLON || {};
         };
     };
 
+    var extentsOverlap = function (min0, max0, min1, max1) {
+        return !(min0 > max1 || min1 > max0);
+    };
+
     var axisOverlap = function (axis, box0, box1) {
         var result0 = computeBoxExtents(axis, box0);
         var result1 = computeBoxExtents(axis, box1);
@@ -39,70 +25,100 @@ var BABYLON = BABYLON || {};
         return extentsOverlap(result0.min, result0.max, result1.min, result1.max);
     };
 
-    BABYLON.BoundingInfo.prototype.isInFrustum = function (frustumPlanes) {
-        if (!this.boundingSphere.isInFrustum(frustumPlanes))
-            return false;
-
-        return this.boundingBox.isInFrustum(frustumPlanes);
-    };
-
-    BABYLON.BoundingInfo.prototype._checkCollision = function (collider) {
-        return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);
-    };
-
-    BABYLON.BoundingInfo.prototype.intersectsPoint = function(point) {
-        if (!this.boundingSphere.centerWorld) {
-            return false;
+    var BoundingInfo = (function () {
+        function BoundingInfo(minimum, maximum) {
+            this.boundingBox = new BABYLON.BoundingBox(minimum, maximum);
+            this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum);
         }
+        // Methods
+        BoundingInfo.prototype._update = function (world, scale) {
+            if (typeof scale === "undefined") { scale = 1.0; }
+            this.boundingBox._update(world);
+            this.boundingSphere._update(world, scale);
+        };
 
-        if (!this.boundingSphere.intersectsPoint(point)) {
-            return false;
-        }
+        BoundingInfo.prototype.isInFrustum = function (frustumPlanes) {
+            if (!this.boundingSphere.isInFrustum(frustumPlanes))
+                return false;
 
-        if (!this.boundingBox.intersectsPoint(point)) {
-            return false;
-        }
+            return this.boundingBox.isInFrustum(frustumPlanes);
+        };
 
-        return true;
-    };
+        BoundingInfo.prototype._checkCollision = function (collider) {
+            return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);
+        };
 
-    BABYLON.BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
-        if (!this.boundingSphere.centerWorld || !boundingInfo.boundingSphere.centerWorld) {
-            return false;
-        }
+        BoundingInfo.prototype.intersectsPoint = function (point) {
+            if (!this.boundingSphere.centerWorld) {
+                return false;
+            }
 
-        if (!BABYLON.BoundingSphere.intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
-            return false;
-        }
+            if (!this.boundingSphere.intersectsPoint(point)) {
+                return false;
+            }
 
-        if (!BABYLON.BoundingBox.intersects(this.boundingBox, boundingInfo.boundingBox)) {
-            return false;
-        }
+            if (!this.boundingBox.intersectsPoint(point)) {
+                return false;
+            }
 
-        if (!precise) {
             return true;
-        }
+        };
 
-        var box0 = this.boundingBox;
-        var box1 = boundingInfo.boundingBox;
-
-        if (!axisOverlap(box0.directions[0], box0, box1)) return false;
-        if (!axisOverlap(box0.directions[1], box0, box1)) return false;
-        if (!axisOverlap(box0.directions[2], box0, box1)) return false;
-        if (!axisOverlap(box1.directions[0], box0, box1)) return false;
-        if (!axisOverlap(box1.directions[1], box0, box1)) return false;
-        if (!axisOverlap(box1.directions[2], box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) return false;
-        if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) return false;
-
-        return true;
-    };
+        BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
+            if (!this.boundingSphere.centerWorld || !boundingInfo.boundingSphere.centerWorld) {
+                return false;
+            }
+
+            if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
+                return false;
+            }
+
+            if (!BABYLON.BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) {
+                return false;
+            }
+
+            if (!precise) {
+                return true;
+            }
+
+            var box0 = this.boundingBox;
+            var box1 = boundingInfo.boundingBox;
+
+            if (!axisOverlap(box0.directions[0], box0, box1))
+                return false;
+            if (!axisOverlap(box0.directions[1], box0, box1))
+                return false;
+            if (!axisOverlap(box0.directions[2], box0, box1))
+                return false;
+            if (!axisOverlap(box1.directions[0], box0, box1))
+                return false;
+            if (!axisOverlap(box1.directions[1], box0, box1))
+                return false;
+            if (!axisOverlap(box1.directions[2], box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1))
+                return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1))
+                return false;
 
-})();
+            return true;
+        };
+        return BoundingInfo;
+    })();
+    BABYLON.BoundingInfo = BoundingInfo;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.boundingInfo.js.map

+ 106 - 0
Babylon/Culling/babylon.boundingInfo.ts

@@ -0,0 +1,106 @@
+module BABYLON {
+    var computeBoxExtents = (axis: Vector3, box: BoundingBox) => {
+        var p = Vector3.Dot(box.center, axis);
+
+        var r0 = Math.abs(Vector3.Dot(box.directions[0], axis)) * box.extends.x;
+        var r1 = Math.abs(Vector3.Dot(box.directions[1], axis)) * box.extends.y;
+        var r2 = Math.abs(Vector3.Dot(box.directions[2], axis)) * box.extends.z;
+
+        var r = r0 + r1 + r2;
+        return {
+            min: p - r,
+            max: p + r
+        };
+    }
+
+    var extentsOverlap = (min0: number, max0: number, min1: number, max1: number): boolean => !(min0 > max1 || min1 > max0);
+
+    var axisOverlap = (axis: Vector3, box0: BoundingBox, box1: BoundingBox): boolean => {
+        var result0 = computeBoxExtents(axis, box0);
+        var result1 = computeBoxExtents(axis, box1);
+
+        return extentsOverlap(result0.min, result0.max, result1.min, result1.max);
+    }
+
+    export class BoundingInfo {
+        public boundingBox: BoundingBox;
+        public boundingSphere: BoundingSphere;
+
+        constructor(minimum: Vector3, maximum: Vector3) {
+            this.boundingBox = new BABYLON.BoundingBox(minimum, maximum);
+            this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum);
+        }
+
+        // Methods
+        public _update(world: Matrix, scale: number = 1.0) {
+            this.boundingBox._update(world);
+            this.boundingSphere._update(world, scale);
+        }
+
+        public isInFrustum(frustumPlanes: Plane[]): boolean {
+            if (!this.boundingSphere.isInFrustum(frustumPlanes))
+                return false;
+
+            return this.boundingBox.isInFrustum(frustumPlanes);
+        }
+
+        public _checkCollision(collider): boolean {
+            return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);
+        }
+
+        public intersectsPoint(point: Vector3): boolean {
+            if (!this.boundingSphere.centerWorld) {
+                return false;
+            }
+
+            if (!this.boundingSphere.intersectsPoint(point)) {
+                return false;
+            }
+
+            if (!this.boundingBox.intersectsPoint(point)) {
+                return false;
+            }
+
+            return true;
+        }
+
+        public intersects(boundingInfo: BoundingInfo, precise: boolean): boolean {
+            if (!this.boundingSphere.centerWorld || !boundingInfo.boundingSphere.centerWorld) {
+                return false;
+            }
+
+            if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
+                return false;
+            }
+
+            if (!BABYLON.BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) {
+                return false;
+            }
+
+            if (!precise) {
+                return true;
+            }
+
+            var box0 = this.boundingBox;
+            var box1 = boundingInfo.boundingBox;
+
+            if (!axisOverlap(box0.directions[0], box0, box1)) return false;
+            if (!axisOverlap(box0.directions[1], box0, box1)) return false;
+            if (!axisOverlap(box0.directions[2], box0, box1)) return false;
+            if (!axisOverlap(box1.directions[0], box0, box1)) return false;
+            if (!axisOverlap(box1.directions[1], box0, box1)) return false;
+            if (!axisOverlap(box1.directions[2], box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) return false;
+            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) return false;
+
+            return true;
+        }
+    }
+} 

+ 56 - 55
Babylon/Culling/babylon.boundingSphere.js

@@ -1,61 +1,62 @@
-"use strict";
-
-var BABYLON = BABYLON || {};
-
-(function () {
-    BABYLON.BoundingSphere = function (minimum, maximum) {
-        this.minimum = minimum;
-        this.maximum = maximum;
-        
-        var distance = BABYLON.Vector3.Distance(minimum, maximum);
-        
-        this.center = BABYLON.Vector3.Lerp(minimum, maximum, 0.5);;
-        this.radius = distance * 0.5;
-
-        this.centerWorld = BABYLON.Vector3.Zero();
-        this._update(BABYLON.Matrix.Identity());
-    };
-    
-    // Methods
-    BABYLON.BoundingSphere.prototype._update = function (world, scale) {
-        BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
-        this.radiusWorld = this.radius * scale;
-    };
-    
-    BABYLON.BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {
-        for (var i = 0; i < 6; i++) {
-            if (frustumPlanes[i].dotCoordinate(this.centerWorld) <= -this.radiusWorld)
-                return false;
+var BABYLON;
+(function (BABYLON) {
+    var BoundingSphere = (function () {
+        function BoundingSphere(minimum, maximum) {
+            this.minimum = minimum;
+            this.maximum = maximum;
+            var distance = BABYLON.Vector3.Distance(minimum, maximum);
+
+            this.center = BABYLON.Vector3.Lerp(minimum, maximum, 0.5);
+            ;
+            this.radius = distance * 0.5;
+
+            this.centerWorld = BABYLON.Vector3.Zero();
+            this._update(BABYLON.Matrix.Identity());
         }
+        // Methods
+        BoundingSphere.prototype._update = function (world, scale) {
+            if (typeof scale === "undefined") { scale = 1.0; }
+            BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
+            this.radiusWorld = this.radius * scale;
+        };
+
+        BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {
+            for (var i = 0; i < 6; i++) {
+                if (frustumPlanes[i].dotCoordinate(this.centerWorld) <= -this.radiusWorld)
+                    return false;
+            }
+
+            return true;
+        };
+
+        BoundingSphere.prototype.intersectsPoint = function (point) {
+            var x = this.centerWorld.x - point.x;
+            var y = this.centerWorld.y - point.y;
+            var z = this.centerWorld.z - point.z;
+
+            var distance = Math.sqrt((x * x) + (y * y) + (z * z));
+
+            if (this.radiusWorld < distance)
+                return false;
 
-        return true;
-    };
-
-    BABYLON.BoundingSphere.prototype.intersectsPoint = function(point) {
-        var x = this.centerWorld.x - point.x;
-        var y = this.centerWorld.y - point.y;
-        var z = this.centerWorld.z - point.z;
-
-        var distance = Math.sqrt((x * x) + (y * y) + (z * z));
-
-        if (this.radiusWorld < distance)
-            return false;
-
-        return true;
-    };
-
-    // Statics
-    BABYLON.BoundingSphere.intersects = function (sphere0, sphere1) {
-        var x = sphere0.centerWorld.x - sphere1.centerWorld.x;
-        var y = sphere0.centerWorld.y - sphere1.centerWorld.y;
-        var z = sphere0.centerWorld.z - sphere1.centerWorld.z;
+            return true;
+        };
 
-        var distance = Math.sqrt((x * x) + (y * y) + (z * z));
+        // Statics
+        BoundingSphere.Intersects = function (sphere0, sphere1) {
+            var x = sphere0.centerWorld.x - sphere1.centerWorld.x;
+            var y = sphere0.centerWorld.y - sphere1.centerWorld.y;
+            var z = sphere0.centerWorld.z - sphere1.centerWorld.z;
 
-        if (sphere0.radiusWorld + sphere1.radiusWorld < distance)
-            return false;
+            var distance = Math.sqrt((x * x) + (y * y) + (z * z));
 
-        return true;
-    };
+            if (sphere0.radiusWorld + sphere1.radiusWorld < distance)
+                return false;
 
-})();
+            return true;
+        };
+        return BoundingSphere;
+    })();
+    BABYLON.BoundingSphere = BoundingSphere;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.boundingSphere.js.map

+ 61 - 0
Babylon/Culling/babylon.boundingSphere.ts

@@ -0,0 +1,61 @@
+module BABYLON {
+    export class BoundingSphere {
+        public center: Vector3;
+        public radius: number;
+        public centerWorld: Vector3;
+        public radiusWorld: number;
+
+        constructor(public minimum: Vector3, public maximum: Vector3) {
+            var distance = BABYLON.Vector3.Distance(minimum, maximum);
+
+            this.center = BABYLON.Vector3.Lerp(minimum, maximum, 0.5);;
+            this.radius = distance * 0.5;
+
+            this.centerWorld = BABYLON.Vector3.Zero();
+            this._update(BABYLON.Matrix.Identity());
+        }
+
+        // Methods
+        public _update(world: Matrix, scale: number = 1.0): void {
+            BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
+            this.radiusWorld = this.radius * scale;
+        }
+
+        public isInFrustum(frustumPlanes: Plane[]): boolean {
+            for (var i = 0; i < 6; i++) {
+                if (frustumPlanes[i].dotCoordinate(this.centerWorld) <= -this.radiusWorld)
+                    return false;
+            }
+
+            return true;
+        }
+
+        public intersectsPoint(point: Vector3): boolean {
+            var x = this.centerWorld.x - point.x;
+            var y = this.centerWorld.y - point.y;
+            var z = this.centerWorld.z - point.z;
+
+            var distance = Math.sqrt((x * x) + (y * y) + (z * z));
+
+            if (this.radiusWorld < distance)
+                return false;
+
+            return true;
+        }
+
+        // Statics
+        public static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean {
+            var x = sphere0.centerWorld.x - sphere1.centerWorld.x;
+            var y = sphere0.centerWorld.y - sphere1.centerWorld.y;
+            var z = sphere0.centerWorld.z - sphere1.centerWorld.z;
+
+            var distance = Math.sqrt((x * x) + (y * y) + (z * z));
+
+            if (sphere0.radiusWorld + sphere1.radiusWorld < distance)
+                return false;
+
+            return true;
+        }
+
+    }
+} 

+ 1 - 1
Babylon/Materials/babylon.standardMaterial.js

@@ -22,7 +22,7 @@ var BABYLON = BABYLON || {};
 
         this._cachedDefines = null;
 
-        this._renderTargets = new BABYLON.Tools.SmartArray(16);
+        this._renderTargets = new BABYLON.SmartArray(16);
 
         // Internals
         this._worldViewProjectionMatrix = BABYLON.Matrix.Zero();

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1822 - 1832
Babylon/Math/babylon.math.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1998 - 0
Babylon/Math/babylon.math.ts


+ 1 - 1
Babylon/Mesh/babylon.mesh.js

@@ -673,7 +673,7 @@ var BABYLON = BABYLON || {};
         this._resetPointsArrayCache();
 
         var data = this._vertexBuffers[BABYLON.VertexBuffer.PositionKind].getData();
-        var temp = new BABYLON.MatrixType(data.length);
+        var temp = new Float32Array(data.length);
         for (var index = 0; index < data.length; index += 3) {
             BABYLON.Vector3.TransformCoordinates(BABYLON.Vector3.FromArray(data, index), transform).toArray(temp, index);
         }

+ 1 - 1
Babylon/PostProcess/babylon.postProcess.js

@@ -22,7 +22,7 @@ var BABYLON = BABYLON || {};
         this.renderTargetSamplingMode = samplingMode ? samplingMode : BABYLON.Texture.NEAREST_SAMPLINGMODE;
         this._reusable = reusable || false;
 
-        this._textures = new BABYLON.Tools.SmartArray(2);
+        this._textures = new BABYLON.SmartArray(2);
         this._currentRenderTextureInd = 0;
 
         samplers = samplers || [];

+ 1 - 1
Babylon/Rendering/babylon.boundingBoxRenderer.js

@@ -18,7 +18,7 @@ var BABYLON = BABYLON || {};
         this._vb = new BABYLON.VertexBuffer(null, boxdata.positions, BABYLON.VertexBuffer.PositionKind, false, engine);
         this._ib = engine.createIndexBuffer([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 7, 1, 6, 2, 5, 3, 4]);
 
-        this.renderList = new BABYLON.Tools.SmartArray(32);
+        this.renderList = new BABYLON.SmartArray(32);
     };
 
     // Members

+ 3 - 3
Babylon/Rendering/babylon.renderingGroup.js

@@ -7,9 +7,9 @@ var BABYLON = BABYLON || {};
         this.index = index;
         this._scene = scene;
 
-        this._opaqueSubMeshes = new BABYLON.Tools.SmartArray(256);
-        this._transparentSubMeshes = new BABYLON.Tools.SmartArray(256);
-        this._alphaTestSubMeshes = new BABYLON.Tools.SmartArray(256);
+        this._opaqueSubMeshes = new BABYLON.SmartArray(256);
+        this._transparentSubMeshes = new BABYLON.SmartArray(256);
+        this._alphaTestSubMeshes = new BABYLON.SmartArray(256);
     };
 
     // Methods

+ 75 - 0
Babylon/Tools/babylon.smartArray.js

@@ -0,0 +1,75 @@
+var BABYLON;
+(function (BABYLON) {
+    var SmartArray = (function () {
+        function SmartArray(capacity) {
+            this.length = 0;
+            this.data = new Array(capacity);
+        }
+        SmartArray.prototype.push = function (value) {
+            this.data[this.length++] = value;
+
+            if (this.length > this.data.length) {
+                this.data.length *= 2;
+            }
+        };
+
+        SmartArray.prototype.pushNoDuplicate = function (value) {
+            if (this.indexOf(value) > -1) {
+                return;
+            }
+            this.push(value);
+        };
+
+        SmartArray.prototype.sort = function (compareFn) {
+            this.data.sort(compareFn);
+        };
+
+        SmartArray.prototype.reset = function () {
+            this.length = 0;
+        };
+
+        SmartArray.prototype.concat = function (array) {
+            if (array.length === 0) {
+                return;
+            }
+            if (this.length + array.length > this.data.length) {
+                this.data.length = (this.length + array.length) * 2;
+            }
+
+            for (var index = 0; index < array.length; index++) {
+                this.data[this.length++] = (array.data || array)[index];
+            }
+        };
+
+        SmartArray.prototype.concatWithNoDuplicate = function (array) {
+            if (array.length === 0) {
+                return;
+            }
+            if (this.length + array.length > this.data.length) {
+                this.data.length = (this.length + array.length) * 2;
+            }
+
+            for (var index = 0; index < array.length; index++) {
+                var item = (array.data || array)[index];
+                var pos = this.data.indexOf(item);
+
+                if (pos === -1 || pos >= this.length) {
+                    this.data[this.length++] = item;
+                }
+            }
+        };
+
+        SmartArray.prototype.indexOf = function (value) {
+            var position = this.data.indexOf(value);
+
+            if (position >= this.length) {
+                return -1;
+            }
+
+            return position;
+        };
+        return SmartArray;
+    })();
+    BABYLON.SmartArray = SmartArray;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.smartArray.js.map

+ 74 - 0
Babylon/Tools/babylon.smartArray.ts

@@ -0,0 +1,74 @@
+module BABYLON {
+    export class SmartArray {
+        public data: Array<any>;
+        public length: number = 0;
+
+        constructor(capacity: number) {
+            this.data = new Array(capacity);
+        }
+
+        public push(value): void {
+            this.data[this.length++] = value;
+
+            if (this.length > this.data.length) {
+                this.data.length *= 2;
+            }
+        }
+
+        public pushNoDuplicate(value): void {
+            if (this.indexOf(value) > -1) {
+                return;
+            }
+            this.push(value);
+        }
+
+        public sort(compareFn): void {
+            this.data.sort(compareFn);
+        }
+
+        public reset(): void {
+            this.length = 0;
+        }
+
+        public concat(array: SmartArray): void {
+            if (array.length === 0) {
+                return;
+            }
+            if (this.length + array.length > this.data.length) {
+                this.data.length = (this.length + array.length) * 2;
+            }
+
+            for (var index = 0; index < array.length; index++) {
+                this.data[this.length++] = (array.data || array)[index];
+            }
+        }
+
+        public concatWithNoDuplicate(array: SmartArray): void {
+            if (array.length === 0) {
+                return;
+            }
+            if (this.length + array.length > this.data.length) {
+                this.data.length = (this.length + array.length) * 2;
+            }
+
+            for (var index = 0; index < array.length; index++) {
+                var item = (array.data || array)[index];
+                var pos = this.data.indexOf(item);
+
+                if (pos === -1 || pos >= this.length) {
+                    this.data[this.length++] = item;
+                }
+            }
+        }
+
+        public indexOf(value): number {
+            var position = this.data.indexOf(value);
+
+            if (position >= this.length) {
+                return -1;
+            }
+
+            return position;
+        }
+    }
+} 

+ 0 - 70
Babylon/Tools/babylon.tools.js

@@ -59,76 +59,6 @@ var BABYLON = BABYLON || {};
 		return Array.isArray(obj) ? obj : [obj];
     };
 
-    // Smart array
-    BABYLON.Tools.SmartArray = function(capacity) {
-        this.data = new Array(capacity);
-        this.length = 0;
-    };
-
-    BABYLON.Tools.SmartArray.prototype.push = function(value) {
-        this.data[this.length++] = value;
-        
-        if (this.length > this.data.length) {
-            this.data.length *= 2;
-        }
-    };
-
-    BABYLON.Tools.SmartArray.prototype.pushNoDuplicate = function(value) {
-        if (this.indexOf(value) > -1) {
-            return;
-        }
-        this.push(value);
-    };
-    
-    BABYLON.Tools.SmartArray.prototype.sort = function (compareFn) {
-        this.data.sort(compareFn);
-    };
-
-    BABYLON.Tools.SmartArray.prototype.reset = function() {
-        this.length = 0;
-    };
-    
-    BABYLON.Tools.SmartArray.prototype.concat = function (array) {
-        if (array.length === 0) {
-            return;
-        }
-        if (this.length + array.length > this.data.length) {
-            this.data.length = (this.length + array.length) * 2;
-        }
-
-        for (var index = 0; index < array.length; index++) {
-            this.data[this.length++] = (array.data || array)[index];
-        }
-    };
-    
-    BABYLON.Tools.SmartArray.prototype.concatWithNoDuplicate = function (array) {
-        if (array.length === 0) {
-            return;
-        }
-        if (this.length + array.length > this.data.length) {
-            this.data.length = (this.length + array.length) * 2;
-        }
-
-        for (var index = 0; index < array.length; index++) {
-            var item = (array.data || array)[index];
-            var pos = this.data.indexOf(item);
-
-            if (pos === -1 ||pos >= this.length) {
-                this.data[this.length++] = item;
-            }
-        }
-    };
-    
-    BABYLON.Tools.SmartArray.prototype.indexOf = function (value) {
-        var position = this.data.indexOf(value);
-        
-        if (position >= this.length) {
-            return -1;
-        }
-
-        return position;
-    };
-
     // Misc.
     BABYLON.Tools.GetPointerPrefix = function() {
         var eventPrefix = "pointer";

+ 7 - 7
Babylon/babylon.scene.js

@@ -22,7 +22,7 @@ var BABYLON = BABYLON || {};
         this._renderId = 0;
         this._executeWhenReadyTimeoutId = -1;
 
-        this._toBeDisposed = new BABYLON.Tools.SmartArray(256);
+        this._toBeDisposed = new BABYLON.SmartArray(256);
 
         this._onReadyCallbacks = [];
         this._pendingData = [];
@@ -48,11 +48,11 @@ var BABYLON = BABYLON || {};
         this.meshes = [];
 
         // Internal smart arrays
-        this._activeMeshes = new BABYLON.Tools.SmartArray(256);
-        this._processedMaterials = new BABYLON.Tools.SmartArray(256);
-        this._renderTargets = new BABYLON.Tools.SmartArray(256);
-        this._activeParticleSystems = new BABYLON.Tools.SmartArray(256);
-        this._activeSkeletons = new BABYLON.Tools.SmartArray(32);
+        this._activeMeshes = new BABYLON.SmartArray(256);
+        this._processedMaterials = new BABYLON.SmartArray(256);
+        this._renderTargets = new BABYLON.SmartArray(256);
+        this._activeParticleSystems = new BABYLON.SmartArray(256);
+        this._activeSkeletons = new BABYLON.SmartArray(32);
 
         // Rendering groups
         this._renderingManager = new BABYLON.RenderingManager(this);
@@ -261,7 +261,7 @@ var BABYLON = BABYLON || {};
         if (target.animations) {
             this.stopAnimation(target);
 
-            var animatable = new BABYLON._Animatable(target, from, to, loop, speedRatio, onAnimationEnd);
+            var animatable = new BABYLON.Internals.Animatable(target, from, to, loop, speedRatio, onAnimationEnd);
 
             this._activeAnimatables.push(animatable);
         }

+ 1 - 1
Tools/BuildOurOwnBabylonJS/BuildOurOwnBabylonJS/babylonJS.xml

@@ -80,10 +80,10 @@
   <script src="Babylon/Culling/babylon.boundingBox.js"></script>
   <script src="Babylon/Culling/babylon.boundingSphere.js"></script>
   <script src="Babylon/babylon.engine.js"></script>
-  <script src="Babylon/Math/babylon.axis.js"></script>
   <script src="Babylon/Math/babylon.math.js"></script>
   <script src="Babylon/Tools/babylon.tags.js"></script>
   <script src="Babylon/Tools/babylon.andOrNotEvaluator.js"></script>
+  <script src="Babylon/Tools/babylon.smartArray.js"></script>
   <script src="Babylon/Tools/babylon.tools.js"></script>
   <script src="Babylon/babylon.node.js"></script>
 </files>

+ 0 - 19
Typescript/Animations/babylon.animatable.d.ts

@@ -1,19 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class _Animatable {
-        target: Object;
-        fromFrame: number;
-        toFrame: number;
-        loopAnimation: boolean;
-        animationStartDate: Date;
-        speedRatio: number;
-        onAnimationEnd: Function;
-
-        constructor(target: Object, from: number, to: number, loop: boolean, speedRatio: number, onAnimationEnd: Function);
-
-        animationStarted: boolean;
-
-        _animate(delay: number): boolean;
-    }
-}

+ 0 - 31
Typescript/Animations/babylon.animation.d.ts

@@ -1,31 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Animation {
-        name: string;
-        targetProperty: string;
-        targetPropertyPath: string[];
-        framePerSecond: number;
-        dataType: number;
-        loopMode: number;
-        _keys: number[];
-        _offsetCache: Object;
-        _highLimitsCache: Object;
-
-        constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode: number);
-
-        clone(): Animation;
-        setKeys(values: any[]);
-        _interpolate(currentFrame: number, repeatCount: number, loopMode: number, offsetValue: number, highLimitValue: number);
-        animate(target: Object, delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean;
-        
-        static ANIMATIONTYPE_FLOAT: number;
-        static ANIMATIONTYPE_VECTOR3: number;
-        static ANIMATIONTYPE_QUATERNION: number;
-        static ANIMATIONTYPE_MATRIX: number;
-
-        static ANIMATIONLOOPMODE_RELATIVE: number;
-        static ANIMATIONLOOPMODE_CYCLE: number;
-        static ANIMATIONLOOPMODE_CONSTANT: number;
-    }
-}   

+ 0 - 24
Typescript/Bones/babylon.bone.d.ts

@@ -1,24 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Bone {
-        name: string;
-        _skeleton: Skeleton;
-        _matrix: Matrix;
-        _baseMatrix: Matrix;
-        _worldTransform: Matrix;
-        _absoluteTransform: Matrix;
-        _invertedAbsoluteTransform: Matrix;
-        children: Bone[];
-        animation: Animation[];
-
-        constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix);
-
-        getParent(): Bone;
-        getLocalMatrix: Matrix;
-        getAbsoluteMatrix: Matrix;
-        _updateDifferenceMatrix(): void ;
-        updateMatrix(matrix: Matrix): void;
-        markAsDirty(): void;
-    }
-}

+ 0 - 18
Typescript/Bones/babylon.skeleton.d.ts

@@ -1,18 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Skeleton {
-        id: number;
-        name: string;
-        bones: Bone[];
-        _scene: Scene;
-        _isDirty: boolean;
-
-        constructor(name: string, id: number, scene: Scene);
-
-        getTransformMatrices(): Matrix[];
-        prepare(): void;
-        getAnimatables(): Animation[];
-        clone(name: string, id: number): Skeleton;
-    }
-}

+ 0 - 29
Typescript/Cameras/babylon.arcRotateCamera.d.ts

@@ -1,29 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class ArcRotateCamera extends Camera {
-        alpha: number;
-        beta: number;
-        radius: number;
-        target: Vector3;
-
-        _keys: number[];
-        keysUp: number[];
-        keysDown: number[];
-        keysLeft: number[];
-        keysRight: number[];
-        _viewMatrix: Matrix;
-
-        constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene);
-
-        inertialAlphaOffset: number;
-        interialBetaOffset: number;
-        lowerAlphaLimit: number;
-        upperAlphaLimit: number;
-        lowerBetaLimit: number;
-        upperBetaLimit: number;
-        lowerRadiusLimit: number;
-        upperRadiusLimit: number;
-        setPosition(position: Vector3): void;
-    }
-}

+ 0 - 31
Typescript/Cameras/babylon.camera.d.ts

@@ -1,31 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Camera {
-        name: string;
-        id: string;
-        position: Vector3;
-        _scene: Scene;
-
-        constructor(name: string, position: Vector3, scene: Scene);
-
-        static PERSPECTIVE_CAMERA: number;
-        static ORTHOGRAPHIC_CAMERA: number;
-
-        fov: number;
-        orthoLeft: number;
-        orthoRight: number;
-        orthoBottom: number;
-        orthoTop: number;
-        minZ: number;
-        maxZ: number;
-        intertia: number;
-        mode: number;
-
-        attachControl(canvas: HTMLCanvasElement): void;
-        detachControl(canvas: HTMLCanvasElement): void;
-        _update();
-        getViewMatrix(): Matrix;
-        getProjectionMatrix(): Matrix;
-    }
-}

+ 0 - 17
Typescript/Cameras/babylon.deviceOrientationCamera.d.ts

@@ -1,17 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class DeviceOrientationCamera extends FreeCamera {
-        angularSensibility: number;
-        moveSensibility: number;
-
-        constructor(name: string, position: Vector3, scene: Scene);
-
-        _offsetX: number;
-        _offsetY: number;
-        _orientationGamma: number;
-        _orientationBeta: number;
-        _initialOrientationGamma: number;
-        _initialOrientationBeta: number;
-    }
-}

+ 0 - 29
Typescript/Cameras/babylon.freeCamera.d.ts

@@ -1,29 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class FreeCamera extends Camera {
-        cameraDirection: Vector3;
-        cameraRotation: Vector2;
-        rotation: Vector3;
-        ellipsoid: Vector3;
-        _keys: number[];
-        keysUp: number[];
-        keysDown: number[];
-        keysLeft: number[];
-        keysRight: number[];
-        _collider: Collider;
-        _needsMoveForGravity: boolean;
-        animations: Animation[];
-
-        constructor(name: string, position: Vector3, scene: Scene);
-
-        speed: number;
-        checkCollisions: boolean;
-        applyGravity: boolean;
-
-        _computeLocalCameraSpeed(): number;
-        setTarget(target: Vector3): void;
-        _collideWithWorld(velocity: Vector3): void;
-        _checkInputs();
-    }
-}

+ 0 - 14
Typescript/Cameras/babylon.touchCamera.d.ts

@@ -1,14 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class TouchCamera extends FreeCamera {
-        _offsetX: number;
-        _offsetY: number;
-        _pointerCount: number;
-        _pointerPressed: number[];
-        angularSensibility: number;
-        moveSensibility: number;
-
-        constructor(name: string, position: Vector3, scene: Scene);
-    }
-}

+ 0 - 28
Typescript/Collisions/babylon.collider.d.ts

@@ -1,28 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    interface CollisionResponse {
-        position: Vector3;
-        velocity: Vector3;
-    }
-
-    class Collider {
-        radius: Vector3;
-        retry: number;
-
-        basePointWorld: Vector3;
-        velocityWorld: Vector3;
-        normalizedVelocity: Vector3;
-
-        constructor();
-
-        _initialize(source: Vector3, dir: Vector3, e: number): void;
-        _checkPontInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean;
-        intersectBoxAASphere(boxMin: Vector3, boxMax: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean;
-        getLowestRoot(a: number, b: number, c: number, maxR: number): Object;
-        _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean;
-        _testTriangle(subMesh: SubMesh, p1: Vector3, p2: Vector3, p3: Vector3): void;
-        _collide(subMesh: SubMesh, pts: VertexBuffer, indices: IndexBuffer, indexStart: number, indexEnd: number, decal: number);
-        _getResponse(pos: Vector3, vel: Vector3): CollisionResponse;
-    }
-}

+ 0 - 16
Typescript/Collisions/babylon.collisionPlane.d.ts

@@ -1,16 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class CollisionPlane {
-        normal: Vector3;
-        origin: Vector3;
-        equation: number[];
-
-        constructor(origin: Vector3, normal: Vector3);
-
-        isFrontFactingTo(direction: Vector3, epsilon: number): boolean;
-        signedDistanceTo(point: Vector3): number;
-
-        static CreateFromPoints(p1: Vector3, p2: Vector3, p3: Vector3): CollisionPlane;
-    }
-}

+ 0 - 17
Typescript/Culling/Octrees/babylon.octree.d.ts

@@ -1,17 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class Octree {
-        blocks: OctreeBlock[];
-        _maxBlockCapacity: number;
-        _selection: Tools.SmartArray;
-
-        constructor(maxBlockCapacity: number);
-
-        update(worldMin: Vector3, worldMax: Vector3, meshes: Mesh[]): void;
-        addMesh(mesh: Mesh): void;
-        select(frustrumPlanes: Plane[]): void;
-
-        static _CreateBlocks(worldMin: Vector3, worldMax: Vector3, meshes: Mesh[], maxBlockCapacity: number, target: OctreeBlock): void;
-    }
-}

+ 0 - 18
Typescript/Culling/Octrees/babylon.octreeBlock.d.ts

@@ -1,18 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class OctreeBlock {
-        subMeshes: Mesh[];
-        meshes: Mesh[];
-        _capacity: number;
-        _minPoint: Vector3;
-        _maxPoint: Vector3;
-        _boundingVector: Vector3[];
-
-        constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number)
-
-        addMesh(mesh: Mesh): void;
-        addEntries(meshes: Mesh[]): void;
-        select(frustrumPlanes: Plane[], selection: Tools.SmartArray): void;
-    }
-}

+ 0 - 26
Typescript/Culling/babylon.bounding.d.ts

@@ -1,26 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class BoundingBox {
-        minimum: Vector3;
-        maximum: Vector3;
-        vectors: Vector3[];
-        center: Vector3;
-        extends: Vector3;
-        directions: Vector3[];
-        vectorsWorld: Vector3[];
-        minimumWorld: Vector3;
-        maximumWorld: Vector3;
-
-        constructor(minimum: Vector3, maximum: Vector3);
-
-        _update(world: Matrix): void;
-        isInFrustrum(frustrumPlanes: Plane[]): boolean;
-        intersectsPoint(point: Vector3): boolean;
-        intersectsSphere(sphere: Sphere): boolean;
-        intersectsMinMax(min: Vector3, max: Vector3): boolean;
-        IsInFrustrum(boundingVectors: Vector3[], frustrumPlanes: Plane[]): boolean;
-
-        static intersects(box0: BoundingBox, box1: BoundingBox): boolean;
-    }
-}

+ 0 - 21
Typescript/Culling/babylon.boundingInfo.d.ts

@@ -1,21 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class BoundingInfo {
-        boundingBox: BoundingBox;
-        boundingSphere: BoundingSphere;
-
-        constructor(minimum: Vector3, maximum, Vector3);
-
-        _update(world: Matrix, scale: number): void;
-
-        extentsOverlap(min0, max0, min1, max1): boolean;
-        computeBoxExtents(axis: Vector3, box: BoundingBox): Object;
-        axisOverlap(axis: Vector3, box0: BoundingBox, box1: BoundingBox): boolean;
-        isInFrustrum(frustrumPlanes: Plane[]): boolean;
-        _checkCollision(collider: Collider): boolean;
-        intersectsPoint(point: Vector3): boolean;
-        intersects(boundingInfo: BoundingInfo, precise: boolean): boolean;
-
-    }
-}

+ 0 - 20
Typescript/Culling/babylon.boundingSphere.d.ts

@@ -1,20 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class BoundingSphere {
-        minimum: Vector3;
-        maximum: Vector3;
-        center: Vector3;
-        radius: number;
-        distance: number;
-        centerWorld: Vector3;
-
-        constructor(minimum: Vector3, maximum: Vector3);
-
-        _update(world: Matrix, scale: number): void;
-        isInFrustrum(frustrumPlanes: Plane[]): boolean;
-        intersectsPoint(point: Vector3): boolean;
-
-        static intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean;
-    }
-}

+ 0 - 21
Typescript/Layer/babylon.layer.d.ts

@@ -1,21 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Layer {
-        name: string;
-        texture: Texture;
-        isBackground: boolean;
-        color: Color4;
-        _scene: Scene;
-        vertices: number[];
-        indicies: number[];
-        _indexBuffer: IndexBuffer;
-        _effect: Effect;
-
-        constructor(name: string, imgUrl: string, scene: Scene, isBackground: boolean, color: Color4);
-
-        onDispose: () => void;
-        render(): void;
-        dispose(): void;
-    }
-}

+ 0 - 22
Typescript/Lights/Shadows/babylon.shadowGenerator.d.ts

@@ -1,22 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class ShadowGenerator {
-        _light: Light;
-        _scene: Scene;
-
-        _shadowMap: RenderTargetTexture;
-
-        constructor(mapSize: number, light: Light);
-
-        renderSubMesh(subMesh: Mesh): void;
-
-        useVarianceShadowMap: boolean;
-
-        isReady(mesh: Mesh): boolean;
-        getShadowMap(): RenderTargetTexture;
-        getLight(): Light;
-        getTransformMatrix(): Matrix;
-        dispose(): void;
-    }
-}

+ 0 - 13
Typescript/Lights/babylon.directionalLight.d.ts

@@ -1,13 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class DirectionalLight extends Light {
-        direction: Vector3;
-        animations: Animation[];
-        position: Vector3;
-        diffuse: Color3;
-        specular: Color3;
-
-        constructor(name: string, direction: Vector3, scene: Scene);
-    }
-}

+ 0 - 15
Typescript/Lights/babylon.hemisphericLight.d.ts

@@ -1,15 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class HemisphericLight {
-        direction: Vector3;
-        diffuse: Color3;
-        specular: Color3;
-        groundColor: Color3;
-        animations: Animation[];
-
-        constructor(name: string, direction: Vector3, scene: Scene);
-
-        getShadowGenerator(): void;
-    }
-}

+ 0 - 17
Typescript/Lights/babylon.light.d.ts

@@ -1,17 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Light {
-        name: string;
-        id: string;
-
-        constructor(name: string, scene: Scene);
-
-        intensity: number;
-        isEnabled: boolean;
-
-        getScene(): Scene;
-        getShadowGenerator: ShadowGenerator;
-        dispose(): void;
-    }
-}

+ 0 - 12
Typescript/Lights/babylon.pointLight.d.ts

@@ -1,12 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class PointLight extends Light {
-        position: Vector3;
-        diffuse: Color3;
-        specular: Color3;
-        animations: Animation[];
-
-        constructor(name: string, position: Vector3, scene: Scene)
-    }
-}

+ 0 - 15
Typescript/Lights/babylon.spotLight.d.ts

@@ -1,15 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class SpotLight {
-        position: Vector3;
-        direction: Vector3;
-        angle: number;
-        exponent: number;
-        diffuse: Color3;
-        specular: Color3;
-        animations: Animation[];
-
-        constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponsent: number, scene: Scene);
-    }
-}

+ 0 - 34
Typescript/Materials/babylon.effect.d.ts

@@ -1,34 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Effect {
-        name: string;
-        defines: string;
-
-        constructor(baseName: string, attributesNames: string[], uniformsNames: string[], samplers: WebGLUniformLocation[], engine: Engine, defines: string);
-
-        isReady(): boolean;
-        getProgram(): WebGLProgram;
-        getAttribute(index: number): string;
-        getAttributesNames(): string;
-        getAttributesCount(): number;
-        getUniformIndex(uniformName: string): number;
-        getUniform(uniformName: string): string;
-        getSamplers(): WebGLUniformLocation[];
-        getCompilationError(): string;
-
-        _prepareEffect(vertexSourceCode: string, fragmentSourceCode: string, attributeNames: string[], defines: string): void;
-        setTexture(channel: string, texture: Texture): void;
-        setMatrices(uniformName: string, matrices: Matrix[]): void;
-        setMatrix(uniformName: string, matrix: Matrix): void;
-        setBool(uniformName: string, val: boolean): void;
-        setVector3(uniformName: string, val: Vector3): void;
-        setFloat2(uniformName: string, x: number, y: number);
-        setFloat3(uniformName: string, x: number, y: number, z: number);
-        setFloat4(uniformName: string, x: number, y: number, z: number, w: number);
-        setColor3(uniformName: string, color: Color3): void;
-        setColor4(uniformName: string, color: Color4): void;
-
-        static ShadersStore: Object;
-    }
-}

+ 0 - 30
Typescript/Materials/babylon.material.d.ts

@@ -1,30 +0,0 @@
-//// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Material {
-        name: string;
-        id: string;
-
-        constructor(name: string, scene: Scene);
-
-        checkReadyOnEveryCall: boolean;
-        alpha: number;
-        wireframe: boolean;
-        backFaceCulling: boolean;
-        _effect: Effect;
-
-        onDispose: () => void;
-
-        isReady(): boolean;
-        getEffect(): Effect;
-        needAlphaBlending(): boolean;
-        needAlphaTesting(): boolean;
-
-        _preBind(): void;
-        bind(world: Matrix, mesh: Mesh): void;
-        unbind(): void;
-        baseDispose(): void;
-
-        dispose(): void;
-    }
-}

+ 0 - 11
Typescript/Materials/babylon.multiMaterial.d.ts

@@ -1,11 +0,0 @@
-//// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class MultiMaterial extends Material {
-        subMaterials: Material[];
-
-        constructor(name: string, scene: Scene);
-
-        getSubMaterial(index: number): Material;
-    }
-}

+ 0 - 23
Typescript/Materials/babylon.standardMaterial.d.ts

@@ -1,23 +0,0 @@
-//// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class StandardMaterial extends Material {
-        diffuseTexture: Texture;
-        ambientTexture: Texture;
-        opacityTexture: Texture;
-        reflectionTexture: Texture;
-        emissiveTexture: Texture;
-        specularTexture: Texture;
-        bumpTexture: Texture;
-
-        ambientColor: Color3;
-        diffuseColor: Color3;
-        specularColor: Color3;
-        specularPower: number;
-        emissiveColor: Color3;
-
-        getRenderTargetTextures(): Texture[];
-        getAnimatables(): Texture[];
-        clone(name: string): StandardMaterial;
-    }
-}

+ 0 - 23
Typescript/Materials/textures/babylon.baseTexture.d.ts

@@ -1,23 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class BaseTexture {
-        _scene: Scene;
-
-        constructor(url: string, scene: Scene);
-
-        delayLoadState: number;
-        hasAlpha: boolean;
-        level: number;
-        onDispose: () => void;
-
-        getInternalTexture(): BaseTexture;
-        isReady(): boolean;
-        getSize(): Size2D;
-        getBaseSize(): Size2D;
-        _getFromCache(url: string, noMipmap: boolean): BaseTexture;
-        delayLoad(): void;
-        releaseInternalTexture(): void;
-        dispose(): void;
-    }
-}

+ 0 - 10
Typescript/Materials/textures/babylon.cubeTexture.d.ts

@@ -1,10 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class CubeTexture extends BaseTexture {
-        constructor(rootUrl: string, scene: Scene);
-
-        isCube: boolean;
-        _computeReflectionTextureMatrix(): Matrix;
-    }
-}

+ 0 - 14
Typescript/Materials/textures/babylon.dynamicTexture.d.ts

@@ -1,14 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class DynamicTexture extends Texture {
-        _canvas: HTMLCanvasElement;
-        _context: CanvasRenderingContext2D;
-
-        constructor(name: string, size: Size2D, scene: Scene, generateMipMaps: boolean);
-
-        getContext(): CanvasRenderingContext2D;
-        drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY: boolean): void;
-        update(): void;
-    }
-}

+ 0 - 12
Typescript/Materials/textures/babylon.mirrorTexture.d.ts

@@ -1,12 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class MirrorTexture extends RenderTargetTexture {
-        constructor(name: string, size: Size2D, scene: Scene, generateMipMaps: boolean);
-
-        mirrorPlane: Plane;
-
-        onBeforeRender(): void;
-        onAfterRender(): void;
-    }
-}

+ 0 - 18
Typescript/Materials/textures/babylon.renderTargetTexture.d.ts

@@ -1,18 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-   class RenderTargetTexture extends Texture {
-       constructor(name: string, size: Size2D, scene: Scene, generateMipMaps: boolean);
-
-       renderList: any[];
-       isRenderTarget: boolean;
-       coordinatesMode: number;
-       renderParticles: boolean;
-
-       _onBeforeRender: () => void;
-       _onAfterRender: () => void;
-
-       resize(size: Size2D, generateMipMaps: boolean): void;
-       render(): void;
-    }
-}

+ 0 - 39
Typescript/Materials/textures/babylon.texture.d.ts

@@ -1,39 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class Texture extends BaseTexture {
-        name: string;
-        url: string
-        animations: Animation[];
-
-        constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean);
-
-        static EXPLICIT_MODE: number;
-        static SPHERICAL_MODE: number;
-        static PLANAR_MODE: number;
-        static CUBIC_MODE: number;
-        static PROJECTION_MODE: number;
-        static SKYBOX_MODE: number;
-
-        static CLAMP_ADDRESSMODE: number;
-        static WRAP_ADDRESSMODE: number;
-        static MIRROR_ADDRESSMODE: number;
-
-        uOffset: number;
-        vOffset: number;
-        uScale: number;
-        vScale: number;
-        uAng: number;
-        vAng: number;
-        wAng: number;
-        wrapU: number;
-        wrapV: number;
-        coordinatesIndex: number;
-        coordinatesMode: number;
-
-        _prepareRowForTextureGeneration(t: Vector3): Vector3;
-        _computeTextureMatrix(): Matrix;
-        _computeReflectionTextureMatrix: Matrix;
-        clone(): Texture;
-    }
-}

+ 0 - 13
Typescript/Materials/textures/babylon.videoTexture.d.ts

@@ -1,13 +0,0 @@
-/// <reference path="../../babylon.d.ts" />
-
-declare module BABYLON {
-    class VideoTexture extends Texture {
-        constructor(name: string, urls: string[], size: Size2D, scene: Scene, generateMipMaps: boolean);
-
-        video: HTMLVideoElement;
-        _autoLaunch: boolean;
-        textureSize: Size2D;
-
-        _update(): boolean;
-    }
-}

+ 0 - 99
Typescript/Mesh/babylon.mesh.d.ts

@@ -1,99 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    interface MeshRayHitTest { hit: boolean; distance: number }
-
-    class Mesh {
-        name: string;
-        id: string;
-
-        position: Vector3;
-        rotation: Vector3;
-        scaling: Vector3;
-        rotationQuaternion: Quaternion;
-        subMeshes: SubMesh[];
-        animations: Animation[];
-
-        constructor(name: string, scene: Scene);
-
-        static BILLBOARDMODE_NONE: number;
-        static BILLBOARDMODE_X: number;
-        static BILLBOARDMODE_Y: number;
-        static BILLBOARDMODE_Z: number;
-        static BILLBOARDMODE_ALL: number;
-
-        delayLoadState: boolean;
-        material: Material;
-        parent: Mesh;
-        _isReady: boolean;
-        _isEnabled: boolean;
-        isVisible: boolean;
-        isPickable: boolean;
-        visibility: number;
-        billboardMode: number;
-        checkCollisions: boolean;
-        receiveShadows: boolean;
-
-        isDisposed: boolean;
-        onDispose: () => void;
-        skeleton: Skeleton;
-        renderingGroupId: number;
-
-        getBoundingInfo(): BoundingInfo;
-        getScene(): Scene;
-        getWorldMatrix: Matrix;
-        getTotalVertices: number;
-        getVerticesData(kind: string): any[];
-        isVerticesDataPresent(kind: string): boolean;
-        getTotalIndicies(): number;
-        getIndices(): number[];
-        getVertexStrideSize(): number;
-        _needToSynchronizeChildren(): boolean;
-        setPivotMatrix(matrix: Matrix): void;
-        getPivotMatrix(): Matrix;
-        isSynchronized(): boolean;
-        isReady(): boolean;
-        isEnabled(): boolean;
-        setEnabled(value: boolean): void;
-        isAnimated(): boolean;
-        markAsDirty(property: string): void;
-        refreshBoudningInfo(): void;
-        computeWorldMatrix(): Matrix;
-        _createGlobalSubMesh(): SubMesh;
-        subdivide(count: number): void;
-        setVerticesData(data: any[], kind: string, updatable: boolean): void;
-        updateVerticesData(kind: string, data: any[]);
-        setIndices(indices: number[]): void;
-        bindAndDraw(subMesh: SubMesh, effect: Effect, wireframe: boolean): void;
-        registerBeforeRender(func: Function): void;
-        unregisterBeforeRender(func: Function): void;
-        render(subMesh: SubMesh): void;
-        isDescendantOf(ancestor: Mesh): boolean;
-        getDescendants(): Mesh[];
-        getEmittedParticleSystems(): ParticleSystem[];
-        getHierarchyEmittedParticleSystems(): ParticleSystem[];
-        getChildren(): Mesh[];
-        isInFrustrum(frustumPlanes: Plane[]): boolean;
-        setMaterialByID(id: string);
-        getAnimatables(): Material;
-        setLocalTranslation(vector3: Vector3): void;
-        getLocalTranslation(): Vector3;
-        bakeTransformIntoVertices(transform: Matrix): void;
-
-        intersectsMesh(mesh: Mesh, precise: boolean): boolean;
-        intersectsPoint(point: Vector3): boolean;
-        intersects(ray: Ray): MeshRayHitTest;
-        clone(name: string, newParent: Mesh): Mesh;
-
-        dispose(): void;
-
-        static CreateBox(name: string, size: number, scene: Scene): Mesh;
-        static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, scene: Scene, updatable: boolean): Mesh;
-        static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable: boolean): Mesh;
-        static CreateSphere(name: string, segments: number, diameter: number, scene: Scene): Mesh;
-        static CreatePlane(name: string, size: number, scene: Scene): Mesh;
-        static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable: boolean): Mesh;
-        static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable: boolean): Mesh;
-        static ComputeNormal(positions: number[], normals: number[], indices: number[]);
-    }
-}

+ 0 - 26
Typescript/Mesh/babylon.subMesh.d.ts

@@ -1,26 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class SubMesh {
-        materialIndex: number;
-        verticesStart: number;
-        verticesCount: number;
-        indexStart: number;
-        indexCount: number;
-
-        constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: number, indexCount: number, mesh: Mesh);
-
-        getBoundingInfo(): BoundingInfo;
-        getMaterial(): Material;
-        refreshBoundingInfo(): void;
-        updateBoundingInfo(world: Matrix, scale: Vector3): void;
-        isInFrustrum(frustumPlanes: Plane[]): boolean;
-        render(): void;
-        getLinesIndexBuffer(indices: number[], engine: Engine): IndexBuffer;
-        canIntersects(ray: Ray): boolean;
-        intersects(ray: Ray, positions: Vector3[], indices: number[]): MeshRayHitTest;
-        clone(newMesh: Mesh): SubMesh;
-
-        static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: Mesh): SubMesh;
-    }
-}

+ 0 - 21
Typescript/Mesh/babylon.vertexBuffer.d.ts

@@ -1,21 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class VertexBuffer {
-        constructor(mesh: Mesh, data: any[], kind: string, updatable: boolean);
-
-        isUpdatable(): boolean;
-        getData(): any[];
-        getStrideSize(): number;
-        update(data: any[]): void;
-        dispose(): void;
-
-        static PositionKind: string;
-        static NormalKind: string;
-        static UVKind: string;
-        static UV2Kind: string;
-        static ColorKind: string;
-        static MatricesIndicesKind: string;
-        static MatricesWeightsKind: string;
-    }
-}

+ 0 - 18
Typescript/Particles/babylon.particle.d.ts

@@ -1,18 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Particle {
-        position: Vector3;
-        direction: Vector3;
-        lifetime: number;
-        age: number;
-        size: number;
-        angle: number;
-        angularSpeed: number;
-        color: Color4;
-        colorStep: Color4;
-
-        constructor();
-
-    }
-}

+ 0 - 60
Typescript/Particles/babylon.particleSystem.d.ts

@@ -1,60 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class ParticleSystem {
-        name: string;
-        id: string;
-
-        gravity: Vector3;
-        direction1: Vector3;
-        direction2: Vector3;
-        minEmitBox: Vector3;
-        maxEmitBox: Vector3;
-        color1: Color4;
-        color2: Color4;
-        colorDead: Color4;
-        deadAlpha: number;
-        textureMask: Color4;
-
-        particles: Particle[];
-        indices: number[];
-
-        renderingGroupId: number;
-        emitter: any; // needs update
-        emitRate: number;
-        manualEmitCount: number;
-        updateSpeed: number;
-        targetStopDuration: number;
-        disposeOnStop: boolean;
-
-        minEmitPower: number;
-        maxEmitPower: number;
-
-        minLifeTime: number;
-        maxLifeTime: number;
-
-        minSize: number;
-        maxSize: number;
-        minAngularSpeed: number;
-        maxAngularSpeed: number;
-
-        particleTexture: Texture;
-
-        onDispose: () => void;
-
-        blendMode: number;
-
-        constructor(name: string, capacity: number, scene: Scene);
-
-        isAlive(): boolean;
-        start(): void;
-        stop(): void;
-        animate(): void;
-        render(): number;
-        dispose(): void;
-        clone(name: string, newEmitter: any): ParticleSystem; // needs update (newEmitter)
-
-        static BLENDMODE_ONEONE: number;
-        static BLENDMODE_STANDARD: number;
-    }
-}

+ 0 - 6
Typescript/PostProcess/babylon.postProcess.d.ts

@@ -1,6 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class PostProcess {
-    }
-}

+ 0 - 8
Typescript/PostProcess/babylon.postProcessManager.d.ts

@@ -1,8 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class PostProcessManager {
-        constructor();
-        postProcesses: any[];
-    }
-}

+ 0 - 22
Typescript/Sprites/Babylon.Sprite.d.ts

@@ -1,22 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Sprite {
-        name: string;
-        color: Color4;
-
-        position: Vector3;
-        size: number;
-        angle: number;
-        cellIndex: number;
-        invertU: number;
-        invertV: number;
-        disposeWhenFinishedAnimating: boolean;
-
-        constructor(name: string, manager: SpriteManager);
-
-        playAnimation(from: number, to: number, loop: boolean, delay: number);
-        stopAnimation(): void;
-        dispose(): void;
-    }
-}

+ 0 - 20
Typescript/Sprites/Babylon.spriteManager.d.ts

@@ -1,20 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class SpriteManager {
-        name: string;
-        cellSize: number;
-
-        constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon: number);
-
-        indicies: number[];
-        index: number;
-        sprites: Sprite[];
-
-        onDispose: () => void;
-
-        render(): void;
-        dispose(): void;
-
-    }
-}

+ 0 - 31
Typescript/Tools/babylon.database.d.ts

@@ -1,31 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    class Database {
-        currentSceneUrl: string;
-        db: Database;
-        enableSceneOffline: boolean;
-        enableTexturesOffline: boolean;
-        manifestVersionFound: number;
-        mustUpdateRessources: boolean;
-        hasReachedQuota: boolean;
-
-        constructor(urlToScene: string);
-
-        isUASupportingBlobStorage: boolean;
-
-        parseURL(url: string): string;
-        ReturnFullUrlLocation(url: string): string;
-        checkManifestFile(): void;
-        openAsync(successCallback: Function, errorCallback: Function): void;
-        loadImageFromDB(url: string, image: HTMLImageElement): void;
-        _loadImageFromDBAsync(url: string, image: HTMLImageElement, notInDBCallback: Function);
-        _saveImageIntoDBAsync(url: string, image: HTMLImageElement): void;
-        _checkVersionFromDB(url: string, versionLoaded: number): void;
-        _loadVersionFromDBAsync(url: string, callback, updateInDBCallback: Function): void;
-        _saveVersionIntoDBAsync(url: string, callback: Function): void;
-        loadSceneFromDB(url: string, sceneLoaded: Scene, progressCallBack: Function): void;
-        _loadSceneFromDBAsync(url: string, callback: Function, notInDBCallback: Function): void;
-        _saveSceneFromDBAsync(url: string, callback: Function, progressCallback: Function): void;
-    }
-}

+ 0 - 310
Typescript/Tools/babylon.math.d.ts

@@ -1,310 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON {
-    interface RayTriangleIntersection {
-        hit: boolean;
-        distance: number;
-        bu: number;
-        bv: number;
-    }
-
-    interface IColor3 {
-        r: number;
-        g: number;
-        b: number;
-    }
-
-    interface Size2D 
-    {
-        width: number;
-        height: number;
-    }
-
-    interface Sphere {
-        center: Vector3;
-        radius: number;
-    }
-
-    class Ray {
-        origin: Vector3;
-        direction: Vector3;
-
-        constructor(origin: Vector3, direction: Vector3);
-
-        intersectsBox(box: BoundingBox): boolean;
-        intersectsSphere(sphere: Sphere): boolean;
-        intersectsTriangle(vertex0: Vector3,
-            vertex1: Vector3,
-            vertex2: Vector3): RayTriangleIntersection;
-
-        static CreateNew(x: number,
-            y: number,
-            viewportWidth: number,
-            viewportHeight: number,
-            world: Matrix,
-            view: Matrix,
-            projection: Matrix): Ray;
-
-    }
-
-    class Color3 implements IColor3 {
-        r: number;
-        g: number;
-        b: number;
-
-        constructor(intialR: number, initialG: number, initialB: number);
-
-        equals(otherColor: Color3): boolean;
-        equals(otherColor: Color4): boolean;
-        toString(): string;
-        clone(): Color3;
-
-        multiply(otherColor: Color3): Color3;
-        mutilplyToRef(otherColor: Color3, result: Color3): void;
-        scale(scale: number): Color3;
-        scaleToRef(scale: number, result: Color3): void;
-        copyFrom(source: Color3): void;
-        copyFromFloats(r: number, g: number, b: number): void;
-        
-        static FromArray(array: number[]): Color3;
-    }
-
-    class Color4 implements IColor3 {
-        r: number;
-        g: number;
-        b: number;
-        a: number;
-
-        constructor(initialR: number, initialG: number, initialB: number, initialA: number);
-
-        addInPlace(right: Color4): void;
-        add(right: Color4): Color4;
-        subtract(right: Color4): Color4;
-        subtractToRef(right: Color4, result: Color4): void;
-        scale(factor: number): Color4;
-        scale(factor: number, result: Color4): void;
-
-        toString(): string;
-        clone(): Color4;
-
-        static Lerp(left: number, right: number, amount: number): Color4;
-        static FromArray(array: number[]): Color4;
-
-    }
-
-    class Vector2 {
-        x: number;
-        y: number;
-
-        constructor(x: number, y: number);
-
-        toString(): string;
-
-        add(other: Vector2): Vector2;
-        subtract(other: Vector2): Vector2;
-        negate(): Vector2;
-        scaleInPlace(scale: number): void;
-        scale(scale: number): Vector2;
-        equals(other: Vector2): boolean;
-        length(): number;
-        lengthSquared(): number;
-        normalize();
-        clone(): Vector2;
-
-        static Zero(): Vector2;
-        static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2;
-        static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2;
-        static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2;
-        static Lerp(start: Vector2, end: Vector2, amount: number): Vector2;
-        static Dot(left: Vector2, right: Vector2): number;
-        static Normalize(vector: Vector2): Vector2;
-        static Minimize(left: Vector2, right: Vector2): Vector2;
-        static Maximize(left: Vector2, right: Vector2): Vector2;
-        static Transform(vector: Vector2, transformation: number[]): Vector2;
-        static Distance(value1: Vector2, value2: Vector2): number;
-        static DistanceSquared(value1: Vector2, value2: Vector2): number;
-    }
-
-    class Vector3 {
-        x: number;
-        y: number;
-        z: number;
-
-        constructor(x: number, y: number, z: number);
-
-        toString(): string;
-
-        addInPlace(otherVector: Vector3): void;
-        add(other: Vector3): Vector3;
-        addToRef(otherVector: Vector3, result: Vector3): void;
-        suntractInPlace(otherVector: Vector3): void;
-        subtract(other: Vector3): Vector3;
-        subtractToRef(otherVector: Vector3, result: Vector3): void;
-        subtractFromFloatsTo(x: number, y: number, z: number): Vector3;
-        subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
-        negate(): Vector3;
-        scaleInPlace(scale: number): void;
-        scale(scale: number): Vector3;
-        scaleToRef(scale: number, result: Vector3): void;
-        equals(other: Vector3): boolean;
-        equalsToFloats(x: number, y: number, z: number): boolean;
-        multiplyInPlace(other: Vector3): void;
-        multiply(other: Vector3): Vector3;
-        multiplyToRef(otherVector: Vector3, result: Vector3): void
-        multiplyByFloats(x: number, y: number, z: number): Vector3;
-        divide(other: Vector3): Vector3;
-        divideToRef(otherVector: Vector3, result: Vector3): void; 
-        length(): number;
-        lengthSquared(): number;
-        normalize();
-        clone(): Vector3;
-        copyFrom(source: Vector3): void;
-        copyFromFloats(x: number, y: number, z: number): void;
-
-        static FromArray(array: number[], offset: number);
-        static FromArrayToRef(array: number[], offset: number, result: Vector3): void;
-        static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void;
-        static Zero(): Vector3;
-        static Up(): Vector3;
-        static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3;
-        static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
-        static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
-        static TransformNormal(vector: Vector3, transformation: Matrix): Vector3;
-        static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void;
-        static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void;
-
-        static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3;
-        static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3;
-        static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3;
-        static Lerp(start: Vector3, end: Vector3, amount: number): Vector3;
-        static Dot(left: Vector3, right: Vector3): number;
-        static Cross(left: Vector3, right: Vector3): Vector3;
-        static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
-        static Normalize(vector: Vector3): Vector3;
-        static NormalizeToRef(vector: Vector3, result: Vector3): void;
-        static Unproject(source: Vector3,
-            viewportWidth: number,
-            viewportHeight: number,
-            world: Matrix,
-            view: Matrix,
-            projection: Matrix): Vector3;
-
-        static Minimize(left: Vector3, right: Vector3): Vector3;
-        static Maximize(left: Vector3, right: Vector3): Vector3;
-        static Distance(value1: Vector3, value2: Vector3): number;
-        static DistanceSquared(value1: Vector3, value2: Vector3): number;
-    }
-
-    class Quaternion {
-        x: number;
-        y: number;
-        z: number;
-        w: number;
-
-        toString(): string;
-
-        constructor(x: number, y: number, z: number, w: number);
-
-        equals(otherQuaternion: Quaternion): boolean;
-        clone(): Quaternion;
-        copyFrom(other: Quaternion): void;
-        add(other: Quaternion): Quaternion;
-        scale(factor: number): Quaternion;
-        multiply(q1: Quaternion): Quaternion;
-        multiplyToRef(q1: Quaternion, result: Quaternion): void;
-        length(): number;
-        normalize(): void;
-        toEulerAngles(): Vector3;
-        toRotationMatrix(result: Quaternion): void;
-
-        static FromArray(array: number[], offset: number): Quaternion;
-        static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
-        static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void;
-        static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
-    }
-
-    class Matrix {
-        m: number[];
-
-        constructor();
-
-        isIdentity(): boolean;
-        determinant(): number;
-        toArray(): number[];
-        invert(): void;
-        invertToRef(other: Matrix): void;
-        setTranslations(vector3: Vector3): void;
-        multiply(other: Matrix): Matrix;
-        copyFrom(other: Matrix): void;
-        multiplyToRef(other: Matrix, result: Matrix): void;
-        multiplyToArray(other: Matrix, result: number[], offset: number): void;
-        equals(other: Matrix): boolean;
-        clone(): Matrix;
-
-        static FromArray(array: number[], offset: number): Matrix;
-        static FromArrayToRef(array: number[], offset: number, result: Matrix): void;
-        static FromValues(m11: number, m12: number, m13: number, m14: number,
-            m21: number, m22: number, m23: number, m24: number,
-            m31: number, m32: number, m33: number, m34: number,
-            m41: number, m42: number, m43: number, m44: number): Matrix;
-        static FromValuesToRef(m11: number, m12: number, m13: number, m14: number,
-            m21: number, m22: number, m23: number, m24: number,
-            m31: number, m32: number, m33: number, m34: number,
-            m41: number, m42: number, m43: number, m44: number, result: Matrix): void;
-        static Identity(): Matrix;
-        static IdentityToRef(result: Matrix): void;
-        static Zero(): Matrix;
-        static RotationX(angle: number): Matrix;
-        static RotationXToRef(angle: number, result: Matrix): void;
-        static RotationY(angle: number): Matrix;
-        static RotationYToRef(angle: number, result: Matrix): void;
-        static RotationZ(angle: number): Matrix;
-        static RotationZToRef(angle: number, result: Matrix): void;
-        static RotationAxis(axis: Vector3, angle: number): Matrix;
-        static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix;
-        static Scaling(scaleX: number, scaleY: number, scaleZ: number): Matrix;
-        static ScalingToRef(scaleX: number, scaleY: number, scaleZ: number, result: Matrix): void;
-        static Translation(x: number, y: number, z: number): Matrix;
-        static TranslationToRef(x: number, y: number, z: number, result: Matrix): void;
-        static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix;
-        static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void;
-        static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix;
-        static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix;
-        static OrthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void;
-        static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix;
-        static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix;
-        static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix): void;
-        static AffineTransformation(scaling: number, rotationCenter: Vector3, rotation: Quaternion, translation: Vector3): Matrix;
-        static GetFinalMatrix(viewport: Size2D, world: Matrix, view: Matrix, projection: Matrix): Matrix;
-        static Transpose(matrix: Matrix): Matrix;
-        static Reflection(plane: Plane): Matrix;
-        static ReflectionToRef(plane: Plane, result: Matrix): void;
-    }
-
-    class Plane {
-        normal: Vector3;
-        d: number;
-
-        constructor(a: number, b: number, c: number, d: number);
-
-        normalize(): void;
-        transform(transformation: Matrix): Plane;
-        dotCoordinate(point: Vector3): number;
-        copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): void;
-        isFrontFacingTo(direction: Vector3, epsilon: Vector3): boolean;
-        signedDistanceTo(point: Vector3): number;
-
-        static FromArray(array: number[]): Plane;
-        static FromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane;
-        static FromPositionAndNormal(origin: Vector3, normal: Vector2): Plane;
-        static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point): number;
-    }
-
-    class Frustum {
-        frustrumPlanes: Plane[];
-
-        constructor(transform: Matrix);
-
-        static GetPlanes(transform: Matrix): Plane[];
-    }
-}

+ 0 - 21
Typescript/Tools/babylon.sceneLoader.d.ts

@@ -1,21 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-declare module BABYLON {
-    function loadCubeTexture(rootUrl: string, parsedTexture: JSON, scene: Scene): CubeTexture;
-    function loadTexture(rootUrl: string, parsedTexture: JSON, scene: Scene): Texture;
-    function parseSkeleton(parsedSkeleton: JSON, scene: Scene): Skeleton;
-    function parseMaterial(parsedMaterial: JSON, scene: Scene, rootUrl: string): Material;
-    function parseMaterialById(id: number, parsedData: JSON, scene: Scene, rootUrl: string): Material;
-    function parseMultiMaterial(parsedMultiMaterial: JSON, scene: Scene): MultiMaterial;
-    function parseParticleSystem(parsedParticleSystem: JSON, scene: Scene, rootUrl: string): ParticleSystem;
-    function parseShadowGenerator(parsedShadowGenerator: JSON, scene: Scene): ShadowGenerator;
-    function parseAnimation(parsedAnimation: JSON): Animation;
-    function parseLight(parsedLight: JSON, scene: Scene): Light;
-    function parseMesh(parsedMesh: JSON, scene: Scene, rootUrl: string): Mesh;
-    function isDescendantOf(mesh: Mesh, name: string, hierarchyIds: number[]): boolean;
-
-    class SceneLoader {
-        _ImportGeometry(parsedGeometry, mesh): void;
-        ImportMesh(meshName: string, rootUrl: string, sceneFilename: string, scene: Scene, then: Function): void;
-        Load(rootUrl: string, sceneFilename: string, engine: Engine, then: Function, progressCallback: Function): void;
-    }
-}

+ 0 - 35
Typescript/Tools/babylon.tools.d.ts

@@ -1,35 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-
-declare module BABYLON.Tools {
-    function ExtractMinAndMax(positions: number[], start: number, count: number): Object;
-    function GetPointerPrefix(): string;
-    function QueueNewFrame(func: Function): void;
-    function RequestFullscreen(element: HTMLElement): void;
-    function ExitFullscreen(): void;
-    var BaseUrl: string;
-    function LoadImage(url: string, onload: Function, onerror: Function, database: Database): HTMLImageElement;
-    function LoadFile(url: string, callback: Function, progressCallback: Function): void;
-    function isIE(): boolean;
-    function WithinEpsilon(a: number, b: number);
-    function cloneValue(source: Object, destinationObject: Object): void;
-    function DeepCopy(source: Object, destination: Object, doNotCopyList: string[], mustCopyList: string[]);
-    var fpsRange: number;
-    var previousFramesDuration: number[];
-    function GetFps(): number;
-    function GetDeltaTime(): number;
-    function _MeasureFps(): void;
-
-    class SmartArray {
-        data: any[];
-        length: number;
-
-        constructor(capacity: number);
-
-        push(value: Object): void;
-        pushNoDuplicate(value: Object): void;
-        reset(): void;
-        concat(array: SmartArray): void;
-        concatWithNoDuplicate(array: SmartArray): void;
-        indexOf(value: Object): number;
-    }
-}

+ 0 - 4
Typescript/Tools/babylon.tools.dds.d.ts

@@ -1,4 +0,0 @@
-/// <reference path="../babylon.d.ts" />
-declare module BABYLON.Tools {
-    function LoadDDSTexture(gl: WebGLRenderingContext, ext: any, data: ArrayBuffer): number;
-}

+ 0 - 49
Typescript/babylon.d.ts

@@ -1,49 +0,0 @@
-/// <reference path="babylon.engine.d.ts" />
-/// <reference path="babylon.scene.d.ts" />
-/// <reference path="Tools/babylon.math.d.ts" />
-/// <reference path="Tools/babylon.sceneLoader.d.ts" />
-/// <reference path="Tools/babylon.tools.d.ts" />
-/// <reference path="Tools/babylon.database.d.ts" />
-/// <reference path="Sprites/Babylon.Sprite.d.ts" />
-/// <reference path="Sprites/Babylon.spriteManager.d.ts" />
-/// <reference path="PostProcess/babylon.postProcess.d.ts" />
-/// <reference path="PostProcess/babylon.postProcessManager.d.ts" />
-/// <reference path="Particles/babylon.particle.d.ts" />
-/// <reference path="Particles/babylon.particleSystem.d.ts" />
-/// <reference path="Mesh/babylon.mesh.d.ts" />
-/// <reference path="Mesh/babylon.subMesh.d.ts" />
-/// <reference path="Mesh/babylon.vertexBuffer.d.ts" />
-/// <reference path="Materials/babylon.effect.d.ts" />
-/// <reference path="Materials/babylon.material.d.ts" />
-/// <reference path="Materials/babylon.multiMaterial.d.ts" />
-/// <reference path="Materials/babylon.standardMaterial.d.ts" />
-/// <reference path="Materials/textures/babylon.baseTexture.d.ts" />
-/// <reference path="Materials/textures/babylon.texture.d.ts" />
-/// <reference path="Materials/textures/babylon.cubeTexture.d.ts" />
-/// <reference path="Materials/textures/babylon.renderTargetTexture.d.ts" />
-/// <reference path="Materials/textures/babylon.dynamicTexture.d.ts" />
-/// <reference path="Materials/textures/babylon.mirrorTexture.d.ts" />
-/// <reference path="Materials/textures/babylon.videoTexture.d.ts" />
-/// <reference path="Lights/babylon.light.d.ts" />
-/// <reference path="Lights/babylon.pointLight.d.ts" />
-/// <reference path="Lights/babylon.spotLight.d.ts" />
-/// <reference path="Lights/babylon.directionalLight.d.ts" />
-/// <reference path="Lights/babylon.hemisphericLight.d.ts" />
-/// <reference path="Lights/Shadows/babylon.shadowGenerator.d.ts" />
-/// <reference path="Layer/babylon.layer.d.ts" />
-/// <reference path="Culling/babylon.bounding.d.ts" />
-/// <reference path="Culling/babylon.boundingInfo.d.ts" />
-/// <reference path="Culling/babylon.boundingSphere.d.ts" />
-/// <reference path="Culling/Octrees/babylon.octree.d.ts" />
-/// <reference path="Culling/Octrees/babylon.octreeBlock.d.ts" />
-/// <reference path="Collisions/babylon.collider.d.ts" />
-/// <reference path="Collisions/babylon.collisionPlane.d.ts" />
-/// <reference path="Cameras/babylon.camera.d.ts" />
-/// <reference path="Cameras/babylon.freeCamera.d.ts" />
-/// <reference path="Cameras/babylon.arcRotateCamera.d.ts" />
-/// <reference path="Cameras/babylon.deviceOrientationCamera.d.ts" />
-/// <reference path="Cameras/babylon.touchCamera.d.ts" />
-/// <reference path="Bones/babylon.bone.d.ts" />
-/// <reference path="Bones/babylon.skeleton.d.ts" />
-/// <reference path="Animations/babylon.animation.d.ts" />
-/// <reference path="Animations/babylon.animatable.d.ts" />

+ 0 - 130
Typescript/babylon.engine.d.ts

@@ -1,130 +0,0 @@
-/// <reference path="babylon.d.ts" />
-
-interface WebGLProgram {
-
-}
-
-interface WebGLShader {
-
-}
-
-interface WebGLUniformLocation {
-
-}
-
-interface WebGLRenderingContext {
-
-}
-
-interface VertexBuffer {
-    [index: number]: number;
-}
-
-interface IndexBuffer {
-    [index: number]: number;
-}
-
-declare module BABYLON {
-    interface Capabilities {
-        maxTexturesImageUnits: number;
-        maxTextureSize: number;
-        maxCubemapTextureSize: number;
-        maxRenderTextureSize: number;
-    }
-
-    class Engine {
-        constructor(canvas: HTMLCanvasElement, antialias: boolean);
-
-        forceWireframe: boolean;
-        cullBackFaces: boolean;
-        scenes: Scene[];
-        isPointerLock: boolean;
-
-        getAspectRatio(): number; 
-        getRenderWidth(): number;
-        getRenderHeight(): number;
-        getRenderingCanvas(): HTMLCanvasElement;
-        setHardwareScalingLevel(level: number): void;
-        getLoadedTexturesCache(): Texture[]; 
-        getCaps(): Capabilities;
-
-        stopRenderLoop(): void;
-        runRenderLoop(renderFunction: Function): void;
-
-        switchFullscreen(element: HTMLElement);
-        clear(color: IColor3, backBuffer: boolean, depthStencil: boolean);
-
-        beginFrame(): void;
-        endFrame(): void;
-        resize(): void;
-        bindFramebuffer(texture: Texture);
-        unBindFramebuffer(texture: Texture);
-        flushFramebuffer(): void;
-        restoreDefaultFramebuffer(): void;
-
-        createVertexBuffer(vertices: number[]): VertexBuffer;
-        createVertexBuffer(vertices: ArrayBuffer): VertexBuffer;
-        createVertexBuffer(vertices: ArrayBufferView): VertexBuffer;
-        createDynamicVertexBuffer(capacity: number): VertexBuffer;
-        updateDynamicVertexBuffer(vertexBuffer: VertexBuffer, vertices: number[]): void; 
-        updateDynamicVertexBuffer(vertexBuffer: VertexBuffer, vertices: ArrayBuffer): void; 
-        updateDynamicVertexBuffer(vertexBuffer: VertexBuffer, vertices: ArrayBufferView): void; 
-        createIndexBuffer(indices, is32Bits): IndexBuffer;
-        bindBuffers(vb: VertexBuffer, ib: IndexBuffer, vdecl: number[], strideSize: number, effect: Effect);
-        bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: IndexBuffer, effect: Effect): void;
-        _releaseBuffer(vb: VertexBuffer);
-        draw(useTriangles: boolean, indexStart: number, indexCount: number);
-        createEffect(baseName: string, attributesNames: string, uniformsNames: string[],
-            samplers: WebGLUniformLocation[],
-            defines: string): Effect; 
-        createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram;
-        getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[];
-        getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[]; 
-        enableEffect(effect: Effect): void;
-        setMatrices(uniform: string, matrices: Matrix[]): void;
-        setMatrix(uniform: string, matrix: Matrix): void; 
-        setVector2(uniform: string, x: number, y: number): void;  
-        setVector3(uniform: string, v: Vector3): void; 
-        setFloat2(uniform: string, x: number, y: number): void;
-        setFloat3(uniform: string, x: number, y: number, z: number): void;
-        setBool(uniform: string, val: boolean): void;
-        setFloat4(uniform: string, x: number, y: number, z: number, w: number): void;
-        setColor3(uniform: string, color: Color3): void; 
-        setColor4(uniform: string, color: Color3, alpha: number): void; 
-        setState(cullingMode: number): void;
-        setDepthBuffer(enable: boolean): void;
-        setDepthWrite(enable: boolean): void;
-        setColorWrite(enable: boolean): void;
-        setAlphaMode(mode: number): void;
-        setAlphaTesting(enable: boolean): void;
-        getAlphaTesting(): boolean;
-        wipeCaches(): void;
-        getExponantOfTwo(value: number, max: number): number;
-        createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene): Texture;
-        createDynamicTexture(size: number, noMipmap: boolean): Texture;
-        updateDynamicTexture(texture: Texture, canvas: HTMLCanvasElement, invertY: boolean): void;
-        updateVideoTexture(texture: Texture, video: HTMLVideoElement): void;
-        createRenderTargetTexture(size: number, generateMipMaps: boolean): Texture;
-        createCubeTexture(rootUrl: string, scene: Scene): Texture;
-        _releaseTexture(tex: Texture): void;
-        bindSamplers(effect: Effect): void;
-        setTexture(channel: number, texture: Texture): void; 
-        dispose(): void;
-
-        static ShadersRepository: string;
-
-        static ALPHA_DISABLE: number;
-        static ALPHA_ADD: number;
-        static ALPHA_COMBINE: number;
-
-        static DELAYLOADSTATE_NONE: number;
-        static DELAYLOADSTATE_LOADED: number;
-        static DELAYLOADSTATE_LOADING: number;
-        static DELAYLOADSTATE_NOTLOADED: number;
-
-        static epsilon: number;
-        static collisionEpsilon: number;
-
-        static isSupported(): boolean;
-    }
-}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 1478
Typescript/babylon.min.d.ts


+ 0 - 94
Typescript/babylon.scene.d.ts

@@ -1,94 +0,0 @@
-/// <reference path="babylon.d.ts" />
-
-declare module BABYLON {
-    interface ScenePickResult {
-        hit: boolean;
-        distance: number;
-        pickedMesh: Mesh;
-        pickedPoint: Vector3;
-    }
-
-    class Scene {
-        constructor(engine: Engine);
-
-        autoClear: boolean;
-        clearColor: Color3;
-        ambientColor: Color3;
-
-        fogMode: number;
-        fogColor: Color3;
-        fogDensity: number;
-        fogStart: number;
-        fogEnd: number;
-
-        lights: Light[];
-        cameras: Camera[];
-        activeCamera: Camera;
-        meshes: Mesh[];
-        materials: Material[];
-        multiMaterials: MultiMaterial[];
-        defaultMaterial: StandardMaterial;
-        textures: Texture[];
-        particlesEnabled: boolean;
-        particleSystems: ParticleSystem[];
-        spriteManagers: SpriteManager[];
-        layers: Layer[];
-        skeletons: Skeleton[];
-        collisionsEnabled: boolean;
-        gravity: Vector3;
-        postProcessManager: PostProcessManager;
-
-        getEngine(): Engine;
-        getTotalVertices(): number;
-        getActiveVertices(): number;
-        getActiveParticles(): number;
-        getLastFrameDuration(): number;
-        getEvaluateActiveMeshesDuration(): number;
-        getRenderTargetsDuration(): number;
-        getRenderDuration(): number;
-        getParticlesDuration(): number;
-        getSpritesDuration(): number;
-        getAnimationRatio(): number;
-        getRenderId: number;
-
-        isReady(): boolean;
-        registerBeforeRender(func: Function): void;
-        unregisterBeforeRender(func: Function): void;
-        executeWhenReady(func: Function): void;
-        getWaitingItemsCount(): number;
-
-        beginAnimation(target: Mesh, from: number, to: number, loop: boolean, speedRatio?: number, onAnimationEnd?: Function): void;
-        stopAnimation(target: Mesh);
-
-        getViewMatrix(): Matrix;
-        getProjectionMatrix(): Matrix;
-        getTransformMatrix(): Matrix;
-        setTransformMatrix(view: Matrix, projection: Matrix);
-        activeCameraByID(id: number): void;
-        getMaterialByID(id: number): Material;
-        getLightByID(id: number): Light;
-        getMeshByID(id: number): Mesh;
-        getLastMeshByID(id: number): Mesh;
-        getMeshByName(name: string): Mesh;
-        isActiveMesh(mesh: Mesh): boolean;
-        getLastSkeletonByID(id: number): Skeleton;
-        getSkeletonByID(id: number): Skeleton;
-        getSkeletonByName(name: string): Skeleton;
-
-        _evaluateActiveMeshes(): void;
-        _localRender(opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, activeMeshes);
-        render();
-        dispose();
-        _getNewPosition(position: Vector3, velocity: Vector3, collider: Sphere, maximumRetries: number): Vector3;
-        _collideWithWorld(position: Vector3, velocity: Vector3, collider: Sphere, maximumRetries: number): Vector3;
-
-        createOrUpdateSelectionOctree(): void;
-        createPickingRay(x: number, y: number, world: Matrix): Ray;
-        pick(x: number, y: number): ScenePickResult;
-
-        static FOGMODE_NONE: number;
-        static FOGMODE_EXP: number;
-        static FOGMODE_EXP2: number;
-        static FOGMODE_LINEAR: number;
-    }
-}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 28 - 0
babylon.1.12-beta.js