Преглед на файлове

Merge pull request #1 from BabylonJS/master

get from main repo
Etienne Margraff преди 9 години
родител
ревизия
c7a12e6c73
променени са 100 файла, в които са добавени 15 реда и са изтрити 17322 реда
  1. 7 0
      .gitignore
  2. 8 0
      .travis.yml
  3. 0 81
      Babylon/Actions/babylon.action.js
  4. 0 88
      Babylon/Actions/babylon.action.ts
  5. 0 251
      Babylon/Actions/babylon.actionManager.js
  6. 0 193
      Babylon/Actions/babylon.actionManager.ts
  7. 0 130
      Babylon/Actions/babylon.condition.js
  8. 0 196
      Babylon/Actions/babylon.directActions.js
  9. 0 174
      Babylon/Actions/babylon.directActions.ts
  10. 0 69
      Babylon/Actions/babylon.interpolateValueAction.js
  11. 0 57
      Babylon/Actions/babylon.interpolateValueAction.ts
  12. 0 105
      Babylon/Animations/babylon.animatable.js
  13. 0 97
      Babylon/Animations/babylon.animatable.ts
  14. 0 393
      Babylon/Animations/babylon.animation.js
  15. 0 371
      Babylon/Animations/babylon.animation.ts
  16. 0 270
      Babylon/Animations/babylon.easing.js
  17. 0 43
      Babylon/Audio/babylon.audioengine.js
  18. 0 46
      Babylon/Audio/babylon.audioengine.ts
  19. 0 93
      Babylon/Audio/babylon.sound.js
  20. 0 84
      Babylon/Audio/babylon.sound.ts
  21. 0 88
      Babylon/Bones/babylon.bone.js
  22. 0 90
      Babylon/Bones/babylon.bone.ts
  23. 0 87
      Babylon/Bones/babylon.skeleton.js
  24. 0 89
      Babylon/Bones/babylon.skeleton.ts
  25. 0 109
      Babylon/Cameras/babylon.anaglyphCamera.js
  26. 0 106
      Babylon/Cameras/babylon.anaglyphCamera.ts
  27. 0 537
      Babylon/Cameras/babylon.arcRotateCamera.js
  28. 0 560
      Babylon/Cameras/babylon.arcRotateCamera.ts
  29. 0 303
      Babylon/Cameras/babylon.camera.js
  30. 0 315
      Babylon/Cameras/babylon.camera.ts
  31. 0 83
      Babylon/Cameras/babylon.deviceOrientationCamera.js
  32. 0 76
      Babylon/Cameras/babylon.deviceOrientationCamera.ts
  33. 0 62
      Babylon/Cameras/babylon.followCamera.js
  34. 0 55
      Babylon/Cameras/babylon.followCamera.ts
  35. 0 240
      Babylon/Cameras/babylon.freeCamera.js
  36. 0 253
      Babylon/Cameras/babylon.freeCamera.ts
  37. 0 60
      Babylon/Cameras/babylon.gamepadCamera.js
  38. 0 49
      Babylon/Cameras/babylon.gamepadCamera.ts
  39. 0 141
      Babylon/Cameras/babylon.oculusCamera.js
  40. 0 142
      Babylon/Cameras/babylon.oculusCamera.ts
  41. 0 175
      Babylon/Cameras/babylon.oculusGamepadCamera.js
  42. 0 175
      Babylon/Cameras/babylon.oculusGamepadCamera.ts
  43. 0 203
      Babylon/Cameras/babylon.targetCamera.js
  44. 0 209
      Babylon/Cameras/babylon.targetCamera.ts
  45. 0 140
      Babylon/Cameras/babylon.touchCamera.js
  46. 0 137
      Babylon/Cameras/babylon.touchCamera.ts
  47. 0 46
      Babylon/Cameras/babylon.virtualJoysticksCamera.js
  48. 0 39
      Babylon/Cameras/babylon.virtualJoysticksCamera.ts
  49. 0 37
      Babylon/Cameras/babylon.vrDeviceOrientationCamera.js
  50. 0 29
      Babylon/Cameras/babylon.vrDeviceOrientationCamera.ts
  51. 0 80
      Babylon/Cameras/babylon.webVRCamera.js
  52. 0 76
      Babylon/Cameras/babylon.webVRCamera.ts
  53. 0 339
      Babylon/Collisions/babylon.collider.js
  54. 0 346
      Babylon/Collisions/babylon.collider.ts
  55. 0 66
      Babylon/Collisions/babylon.pickingInfo.js
  56. 0 57
      Babylon/Collisions/babylon.pickingInfo.ts
  57. 0 104
      Babylon/Culling/Octrees/babylon.octree.js
  58. 0 110
      Babylon/Culling/Octrees/babylon.octree.ts
  59. 0 141
      Babylon/Culling/Octrees/babylon.octreeBlock.js
  60. 0 135
      Babylon/Culling/Octrees/babylon.octreeBlock.ts
  61. 0 178
      Babylon/Culling/babylon.BoundingBox.ts
  62. 0 174
      Babylon/Culling/babylon.boundingBox.js
  63. 0 129
      Babylon/Culling/babylon.boundingInfo.js
  64. 0 110
      Babylon/Culling/babylon.boundingInfo.ts
  65. 0 62
      Babylon/Culling/babylon.boundingSphere.js
  66. 0 64
      Babylon/Culling/babylon.boundingSphere.ts
  67. 0 95
      Babylon/Layer/babylon.layer.js
  68. 0 104
      Babylon/Layer/babylon.layer.ts
  69. 0 26
      Babylon/LensFlare/babylon.lensFlare.js
  70. 0 26
      Babylon/LensFlare/babylon.lensFlare.ts
  71. 0 223
      Babylon/LensFlare/babylon.lensFlareSystem.js
  72. 0 232
      Babylon/LensFlare/babylon.lensFlareSystem.ts
  73. 0 267
      Babylon/Lights/Shadows/babylon.shadowGenerator.js
  74. 0 259
      Babylon/Lights/Shadows/babylon.shadowGenerator.ts
  75. 0 63
      Babylon/Lights/babylon.directionalLight.js
  76. 0 58
      Babylon/Lights/babylon.directionalLight.ts
  77. 0 42
      Babylon/Lights/babylon.hemisphericLight.js
  78. 0 34
      Babylon/Lights/babylon.hemisphericLight.ts
  79. 0 83
      Babylon/Lights/babylon.light.js
  80. 0 77
      Babylon/Lights/babylon.light.ts
  81. 0 47
      Babylon/Lights/babylon.pointLight.js
  82. 0 39
      Babylon/Lights/babylon.pointLight.ts
  83. 0 62
      Babylon/Lights/babylon.spotLight.js
  84. 0 53
      Babylon/Lights/babylon.spotLight.ts
  85. 0 1272
      Babylon/Loading/Plugins/babylon.babylonFileLoader.js
  86. 0 1286
      Babylon/Loading/Plugins/babylon.babylonFileLoader.ts
  87. 0 174
      Babylon/Loading/babylon.sceneLoader.js
  88. 0 172
      Babylon/Loading/babylon.sceneLoader.ts
  89. 0 418
      Babylon/Materials/babylon.effect.js
  90. 0 428
      Babylon/Materials/babylon.effect.ts
  91. 0 148
      Babylon/Materials/babylon.material.js
  92. 0 131
      Babylon/Materials/babylon.material.ts
  93. 0 43
      Babylon/Materials/babylon.multiMaterial.js
  94. 0 34
      Babylon/Materials/babylon.multiMaterial.ts
  95. 0 186
      Babylon/Materials/babylon.shaderMaterial.js
  96. 0 191
      Babylon/Materials/babylon.shaderMaterial.ts
  97. 0 679
      Babylon/Materials/babylon.standardMaterial.js
  98. 0 690
      Babylon/Materials/babylon.standardMaterial.ts
  99. 0 133
      Babylon/Materials/textures/Procedurals/babylon.customProceduralTexture.js
  100. 0 0
      Babylon/Materials/textures/Procedurals/babylon.customProceduralTexture.ts

+ 7 - 0
.gitignore

@@ -113,3 +113,10 @@ UpgradeLog*.XML
 .settings/
 .pydevproject
 
+/Exporters/3ds Max/Max2Babylon.sln.ide
+/Exporters/3ds Max/Max2Babylon.sln.ide
+/Exporters/ExportToBabylon.sln.ide
+
+# Do not ignore loaders/obj
+!loaders/*
+node_modules

+ 8 - 0
.travis.yml

@@ -0,0 +1,8 @@
+language: node_js
+node_js:
+  - "4.1"
+before_script:
+  - npm install -g gulp
+  - cd ./Tools/Gulp
+  - npm install
+script: gulp typescript

+ 0 - 81
Babylon/Actions/babylon.action.js

@@ -1,81 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Action = (function () {
-        function Action(triggerOptions, condition) {
-            this.triggerOptions = triggerOptions;
-            if (triggerOptions.parameter) {
-                this.trigger = triggerOptions.trigger;
-                this._triggerParameter = triggerOptions.parameter;
-            } else {
-                this.trigger = triggerOptions;
-            }
-
-            this._nextActiveAction = this;
-            this._condition = condition;
-        }
-        // Methods
-        Action.prototype._prepare = function () {
-        };
-
-        Action.prototype.getTriggerParameter = function () {
-            return this._triggerParameter;
-        };
-
-        Action.prototype._executeCurrent = function (evt) {
-            if (this._condition) {
-                var currentRenderId = this._actionManager.getScene().getRenderId();
-
-                // We cache the current evaluation for the current frame
-                if (this._condition._evaluationId === currentRenderId) {
-                    if (!this._condition._currentResult) {
-                        return;
-                    }
-                } else {
-                    this._condition._evaluationId = currentRenderId;
-
-                    if (!this._condition.isValid()) {
-                        this._condition._currentResult = false;
-                        return;
-                    }
-
-                    this._condition._currentResult = true;
-                }
-            }
-
-            this._nextActiveAction.execute(evt);
-
-            if (this._nextActiveAction._child) {
-                if (!this._nextActiveAction._child._actionManager) {
-                    this._nextActiveAction._child._actionManager = this._actionManager;
-                }
-
-                this._nextActiveAction = this._nextActiveAction._child;
-            } else {
-                this._nextActiveAction = this;
-            }
-        };
-
-        Action.prototype.execute = function (evt) {
-        };
-
-        Action.prototype.then = function (action) {
-            this._child = action;
-
-            action._actionManager = this._actionManager;
-            action._prepare();
-
-            return action;
-        };
-
-        Action.prototype._getProperty = function (propertyPath) {
-            return this._actionManager._getProperty(propertyPath);
-        };
-
-        Action.prototype._getEffectiveTarget = function (target, propertyPath) {
-            return this._actionManager._getEffectiveTarget(target, propertyPath);
-        };
-        return Action;
-    })();
-    BABYLON.Action = Action;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.action.js.map

+ 0 - 88
Babylon/Actions/babylon.action.ts

@@ -1,88 +0,0 @@
-module BABYLON {
-    export class Action {
-        public trigger: number;
-        public _actionManager: ActionManager;
-
-        private _nextActiveAction: Action;
-        private _child: Action;
-        private _condition: Condition;
-        private _triggerParameter: any;
-
-        constructor(public triggerOptions: any, condition?: Condition) {
-
-            if (triggerOptions.parameter) {
-                this.trigger = triggerOptions.trigger;
-                this._triggerParameter = triggerOptions.parameter;
-            } else {
-                this.trigger = triggerOptions;
-            }
-
-            this._nextActiveAction = this;
-            this._condition = condition;
-        }
-
-        // Methods
-        public _prepare(): void {
-        }
-
-        public getTriggerParameter(): any {
-            return this._triggerParameter;
-        }
-
-        public _executeCurrent(evt: ActionEvent): void {
-            if (this._condition) {
-                var currentRenderId = this._actionManager.getScene().getRenderId();
-
-                // We cache the current evaluation for the current frame
-                if (this._condition._evaluationId === currentRenderId) {
-                    if (!this._condition._currentResult) {
-                        return;
-                    }
-                } else {
-                    this._condition._evaluationId = currentRenderId;
-
-                    if (!this._condition.isValid()) {
-                        this._condition._currentResult = false;
-                        return;
-                    }
-
-                    this._condition._currentResult = true;
-                }
-            }
-
-            this._nextActiveAction.execute(evt);
-
-            if (this._nextActiveAction._child) {
-
-                if (!this._nextActiveAction._child._actionManager) {
-                    this._nextActiveAction._child._actionManager = this._actionManager;
-                }
-
-                this._nextActiveAction = this._nextActiveAction._child;
-            } else {
-                this._nextActiveAction = this;
-            }
-        }
-
-        public execute(evt: ActionEvent): void {
-
-        }
-
-        public then(action: Action): Action {
-            this._child = action;
-
-            action._actionManager = this._actionManager;
-            action._prepare();
-
-            return action;
-        }
-
-        public _getProperty(propertyPath: string): string {
-            return this._actionManager._getProperty(propertyPath);
-        }
-
-        public _getEffectiveTarget(target: any, propertyPath: string): any {
-            return this._actionManager._getEffectiveTarget(target, propertyPath);
-        }
-    }
-}

+ 0 - 251
Babylon/Actions/babylon.actionManager.js

@@ -1,251 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var ActionEvent = (function () {
-        function ActionEvent(source, pointerX, pointerY, meshUnderPointer, sourceEvent) {
-            this.source = source;
-            this.pointerX = pointerX;
-            this.pointerY = pointerY;
-            this.meshUnderPointer = meshUnderPointer;
-            this.sourceEvent = sourceEvent;
-        }
-        ActionEvent.CreateNew = function (source) {
-            var scene = source.getScene();
-            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer);
-        };
-
-        ActionEvent.CreateNewFromScene = function (scene, evt) {
-            return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
-        };
-        return ActionEvent;
-    })();
-    BABYLON.ActionEvent = ActionEvent;
-
-    var ActionManager = (function () {
-        function ActionManager(scene) {
-            // Members
-            this.actions = new Array();
-            this._scene = scene;
-
-            scene._actionManagers.push(this);
-        }
-        Object.defineProperty(ActionManager, "NothingTrigger", {
-            get: function () {
-                return ActionManager._NothingTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnPickTrigger", {
-            get: function () {
-                return ActionManager._OnPickTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnLeftPickTrigger", {
-            get: function () {
-                return ActionManager._OnLeftPickTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnRightPickTrigger", {
-            get: function () {
-                return ActionManager._OnRightPickTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnCenterPickTrigger", {
-            get: function () {
-                return ActionManager._OnCenterPickTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnPointerOverTrigger", {
-            get: function () {
-                return ActionManager._OnPointerOverTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnPointerOutTrigger", {
-            get: function () {
-                return ActionManager._OnPointerOutTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnEveryFrameTrigger", {
-            get: function () {
-                return ActionManager._OnEveryFrameTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnIntersectionEnterTrigger", {
-            get: function () {
-                return ActionManager._OnIntersectionEnterTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnIntersectionExitTrigger", {
-            get: function () {
-                return ActionManager._OnIntersectionExitTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnKeyDownTrigger", {
-            get: function () {
-                return ActionManager._OnKeyDownTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager, "OnKeyUpTrigger", {
-            get: function () {
-                return ActionManager._OnKeyUpTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        // Methods
-        ActionManager.prototype.dispose = function () {
-            var index = this._scene._actionManagers.indexOf(this);
-
-            if (index > -1) {
-                this._scene._actionManagers.splice(index, 1);
-            }
-        };
-
-        ActionManager.prototype.getScene = function () {
-            return this._scene;
-        };
-
-        ActionManager.prototype.hasSpecificTriggers = function (triggers) {
-            for (var index = 0; index < this.actions.length; index++) {
-                var action = this.actions[index];
-
-                if (triggers.indexOf(action.trigger) > -1) {
-                    return true;
-                }
-            }
-
-            return false;
-        };
-
-        Object.defineProperty(ActionManager.prototype, "hasPointerTriggers", {
-            get: function () {
-                for (var index = 0; index < this.actions.length; index++) {
-                    var action = this.actions[index];
-
-                    if (action.trigger >= ActionManager._OnPickTrigger && action.trigger <= ActionManager._OnPointerOutTrigger) {
-                        return true;
-                    }
-                }
-
-                return false;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ActionManager.prototype, "hasPickTriggers", {
-            get: function () {
-                for (var index = 0; index < this.actions.length; index++) {
-                    var action = this.actions[index];
-
-                    if (action.trigger >= ActionManager._OnPickTrigger && action.trigger <= ActionManager._OnCenterPickTrigger) {
-                        return true;
-                    }
-                }
-
-                return false;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        ActionManager.prototype.registerAction = function (action) {
-            if (action.trigger === ActionManager.OnEveryFrameTrigger) {
-                if (this.getScene().actionManager !== this) {
-                    BABYLON.Tools.Warn("OnEveryFrameTrigger can only be used with scene.actionManager");
-                    return null;
-                }
-            }
-
-            this.actions.push(action);
-
-            action._actionManager = this;
-            action._prepare();
-
-            return action;
-        };
-
-        ActionManager.prototype.processTrigger = function (trigger, evt) {
-            for (var index = 0; index < this.actions.length; index++) {
-                var action = this.actions[index];
-
-                if (action.trigger === trigger) {
-                    if (trigger == ActionManager.OnKeyUpTrigger || trigger == ActionManager.OnKeyDownTrigger) {
-                        var parameter = action.getTriggerParameter();
-
-                        if (parameter) {
-                            if (evt.sourceEvent.key !== parameter) {
-                                continue;
-                            }
-                        }
-                    }
-
-                    action._executeCurrent(evt);
-                }
-            }
-        };
-
-        ActionManager.prototype._getEffectiveTarget = function (target, propertyPath) {
-            var properties = propertyPath.split(".");
-
-            for (var index = 0; index < properties.length - 1; index++) {
-                target = target[properties[index]];
-            }
-
-            return target;
-        };
-
-        ActionManager.prototype._getProperty = function (propertyPath) {
-            var properties = propertyPath.split(".");
-
-            return properties[properties.length - 1];
-        };
-        ActionManager._NothingTrigger = 0;
-        ActionManager._OnPickTrigger = 1;
-        ActionManager._OnLeftPickTrigger = 2;
-        ActionManager._OnRightPickTrigger = 3;
-        ActionManager._OnCenterPickTrigger = 4;
-        ActionManager._OnPointerOverTrigger = 5;
-        ActionManager._OnPointerOutTrigger = 6;
-        ActionManager._OnEveryFrameTrigger = 7;
-        ActionManager._OnIntersectionEnterTrigger = 8;
-        ActionManager._OnIntersectionExitTrigger = 9;
-        ActionManager._OnKeyDownTrigger = 10;
-        ActionManager._OnKeyUpTrigger = 11;
-        return ActionManager;
-    })();
-    BABYLON.ActionManager = ActionManager;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.actionManager.js.map

+ 0 - 193
Babylon/Actions/babylon.actionManager.ts

@@ -1,193 +0,0 @@
-module BABYLON {
-
-    export class ActionEvent {
-        constructor(public source: AbstractMesh, public pointerX: number, public pointerY: number, public meshUnderPointer: AbstractMesh, public sourceEvent?: any) {
-            
-        }
-
-        public static CreateNew(source: AbstractMesh): ActionEvent {
-            var scene = source.getScene();
-            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer);
-        }
-
-        public static CreateNewFromScene(scene: Scene, evt:Event): ActionEvent {
-            return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
-        }
-    }
-
-    export class ActionManager {
-        // Statics
-        private static _NothingTrigger = 0;
-        private static _OnPickTrigger = 1;
-        private static _OnLeftPickTrigger = 2;
-        private static _OnRightPickTrigger = 3;
-        private static _OnCenterPickTrigger = 4;
-        private static _OnPointerOverTrigger = 5;
-        private static _OnPointerOutTrigger = 6;
-        private static _OnEveryFrameTrigger = 7;
-        private static _OnIntersectionEnterTrigger = 8;
-        private static _OnIntersectionExitTrigger = 9;
-        private static _OnKeyDownTrigger = 10;
-        private static _OnKeyUpTrigger = 11;
-
-        public static get NothingTrigger(): number {
-            return ActionManager._NothingTrigger;
-        }
-
-        public static get OnPickTrigger(): number {
-            return ActionManager._OnPickTrigger;
-        }
-
-        public static get OnLeftPickTrigger(): number {
-            return ActionManager._OnLeftPickTrigger;
-        }
-
-        public static get OnRightPickTrigger(): number {
-            return ActionManager._OnRightPickTrigger;
-        }
-
-        public static get OnCenterPickTrigger(): number {
-            return ActionManager._OnCenterPickTrigger;
-        }
-
-        public static get OnPointerOverTrigger(): number {
-            return ActionManager._OnPointerOverTrigger;
-        }
-
-        public static get OnPointerOutTrigger(): number {
-            return ActionManager._OnPointerOutTrigger;
-        }
-
-        public static get OnEveryFrameTrigger(): number {
-            return ActionManager._OnEveryFrameTrigger;
-        }
-
-        public static get OnIntersectionEnterTrigger(): number {
-            return ActionManager._OnIntersectionEnterTrigger;
-        }
-
-        public static get OnIntersectionExitTrigger(): number {
-            return ActionManager._OnIntersectionExitTrigger;
-        }
-
-        public static get OnKeyDownTrigger(): number {
-            return ActionManager._OnKeyDownTrigger;
-        }
-
-        public static get OnKeyUpTrigger(): number {
-            return ActionManager._OnKeyUpTrigger;
-        }
-        // Members
-        public actions = new Array<Action>();
-
-        private _scene: Scene;
-
-        constructor(scene: Scene) {
-            this._scene = scene;
-
-            scene._actionManagers.push(this);
-        }
-
-        // Methods
-        public dispose(): void {
-            var index = this._scene._actionManagers.indexOf(this);
-
-            if (index > -1) {
-                this._scene._actionManagers.splice(index, 1);
-            }
-        }
-
-        public getScene(): Scene {
-            return this._scene;
-        }
-
-        public hasSpecificTriggers(triggers: number[]): boolean {
-            for (var index = 0; index < this.actions.length; index++) {
-                var action = this.actions[index];
-
-                if (triggers.indexOf(action.trigger) > -1) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-
-        public get hasPointerTriggers(): boolean {
-            for (var index = 0; index < this.actions.length; index++) {
-                var action = this.actions[index];
-
-                if (action.trigger >= ActionManager._OnPickTrigger && action.trigger <= ActionManager._OnPointerOutTrigger) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-
-        public get hasPickTriggers(): boolean {
-            for (var index = 0; index < this.actions.length; index++) {
-                var action = this.actions[index];
-
-                if (action.trigger >= ActionManager._OnPickTrigger && action.trigger <= ActionManager._OnCenterPickTrigger) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-
-        public registerAction(action: Action): Action {
-            if (action.trigger === ActionManager.OnEveryFrameTrigger) {
-                if (this.getScene().actionManager !== this) {
-                    Tools.Warn("OnEveryFrameTrigger can only be used with scene.actionManager");
-                    return null;
-                }
-            }
-
-
-            this.actions.push(action);
-
-            action._actionManager = this;
-            action._prepare();
-
-            return action;
-        }
-
-        public processTrigger(trigger: number, evt: ActionEvent): void {
-            for (var index = 0; index < this.actions.length; index++) {
-                var action = this.actions[index];
-
-                if (action.trigger === trigger) {
-                    if (trigger == ActionManager.OnKeyUpTrigger || trigger == ActionManager.OnKeyDownTrigger) {
-                        var parameter = action.getTriggerParameter();
-
-                        if (parameter) {
-                            if (evt.sourceEvent.key !== parameter) {
-                                continue;
-                            }
-                        }
-                    }
-
-                    action._executeCurrent(evt);
-                }
-            }
-        }
-
-        public _getEffectiveTarget(target: any, propertyPath: string): any {
-            var properties = propertyPath.split(".");
-
-            for (var index = 0; index < properties.length - 1; index++) {
-                target = target[properties[index]];
-            }
-
-            return target;
-        }
-
-        public _getProperty(propertyPath: string): string {
-            var properties = propertyPath.split(".");
-
-            return properties[properties.length - 1];
-        }
-    }
-} 

+ 0 - 130
Babylon/Actions/babylon.condition.js

@@ -1,130 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var Condition = (function () {
-        function Condition(actionManager) {
-            this._actionManager = actionManager;
-        }
-        Condition.prototype.isValid = function () {
-            return true;
-        };
-
-        Condition.prototype._getProperty = function (propertyPath) {
-            return this._actionManager._getProperty(propertyPath);
-        };
-
-        Condition.prototype._getEffectiveTarget = function (target, propertyPath) {
-            return this._actionManager._getEffectiveTarget(target, propertyPath);
-        };
-        return Condition;
-    })();
-    BABYLON.Condition = Condition;
-
-    var ValueCondition = (function (_super) {
-        __extends(ValueCondition, _super);
-        function ValueCondition(actionManager, target, propertyPath, value, operator) {
-            if (typeof operator === "undefined") { operator = ValueCondition.IsEqual; }
-            _super.call(this, actionManager);
-            this.propertyPath = propertyPath;
-            this.value = value;
-            this.operator = operator;
-
-            this._target = this._getEffectiveTarget(target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        }
-        Object.defineProperty(ValueCondition, "IsEqual", {
-            get: function () {
-                return ValueCondition._IsEqual;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ValueCondition, "IsDifferent", {
-            get: function () {
-                return ValueCondition._IsDifferent;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ValueCondition, "IsGreater", {
-            get: function () {
-                return ValueCondition._IsGreater;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ValueCondition, "IsLesser", {
-            get: function () {
-                return ValueCondition._IsLesser;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        // Methods
-        ValueCondition.prototype.isValid = function () {
-            switch (this.operator) {
-                case ValueCondition.IsGreater:
-                    return this._target[this._property] > this.value;
-                case ValueCondition.IsLesser:
-                    return this._target[this._property] < this.value;
-                case ValueCondition.IsEqual:
-                case ValueCondition.IsDifferent:
-                    var check;
-
-                    if (this.value.equals) {
-                        check = this.value.equals(this._target[this._property]);
-                    } else {
-                        check = this.value === this._target[this._property];
-                    }
-                    return this.operator === ValueCondition.IsEqual ? check : !check;
-            }
-
-            return false;
-        };
-        ValueCondition._IsEqual = 0;
-        ValueCondition._IsDifferent = 1;
-        ValueCondition._IsGreater = 2;
-        ValueCondition._IsLesser = 3;
-        return ValueCondition;
-    })(Condition);
-    BABYLON.ValueCondition = ValueCondition;
-
-    var PredicateCondition = (function (_super) {
-        __extends(PredicateCondition, _super);
-        function PredicateCondition(actionManager, predicate) {
-            _super.call(this, actionManager);
-            this.predicate = predicate;
-        }
-        PredicateCondition.prototype.isValid = function () {
-            return this.predicate();
-        };
-        return PredicateCondition;
-    })(Condition);
-    BABYLON.PredicateCondition = PredicateCondition;
-
-    var StateCondition = (function (_super) {
-        __extends(StateCondition, _super);
-        function StateCondition(actionManager, target, value) {
-            _super.call(this, actionManager);
-            this.value = value;
-
-            this._target = target;
-        }
-        // Methods
-        StateCondition.prototype.isValid = function () {
-            return this._target.state === this.value;
-        };
-        return StateCondition;
-    })(Condition);
-    BABYLON.StateCondition = StateCondition;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.condition.js.map

+ 0 - 196
Babylon/Actions/babylon.directActions.js

@@ -1,196 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var SwitchBooleanAction = (function (_super) {
-        __extends(SwitchBooleanAction, _super);
-        function SwitchBooleanAction(triggerOptions, target, propertyPath, condition) {
-            _super.call(this, triggerOptions, condition);
-            this.propertyPath = propertyPath;
-            this._target = target;
-        }
-        SwitchBooleanAction.prototype._prepare = function () {
-            this._target = this._getEffectiveTarget(this._target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        };
-
-        SwitchBooleanAction.prototype.execute = function () {
-            this._target[this._property] = !this._target[this._property];
-        };
-        return SwitchBooleanAction;
-    })(BABYLON.Action);
-    BABYLON.SwitchBooleanAction = SwitchBooleanAction;
-
-    var SetStateAction = (function (_super) {
-        __extends(SetStateAction, _super);
-        function SetStateAction(triggerOptions, target, value, condition) {
-            _super.call(this, triggerOptions, condition);
-            this.value = value;
-            this._target = target;
-        }
-        SetStateAction.prototype.execute = function () {
-            this._target.state = this.value;
-        };
-        return SetStateAction;
-    })(BABYLON.Action);
-    BABYLON.SetStateAction = SetStateAction;
-
-    var SetValueAction = (function (_super) {
-        __extends(SetValueAction, _super);
-        function SetValueAction(triggerOptions, target, propertyPath, value, condition) {
-            _super.call(this, triggerOptions, condition);
-            this.propertyPath = propertyPath;
-            this.value = value;
-            this._target = target;
-        }
-        SetValueAction.prototype._prepare = function () {
-            this._target = this._getEffectiveTarget(this._target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        };
-
-        SetValueAction.prototype.execute = function () {
-            this._target[this._property] = this.value;
-        };
-        return SetValueAction;
-    })(BABYLON.Action);
-    BABYLON.SetValueAction = SetValueAction;
-
-    var IncrementValueAction = (function (_super) {
-        __extends(IncrementValueAction, _super);
-        function IncrementValueAction(triggerOptions, target, propertyPath, value, condition) {
-            _super.call(this, triggerOptions, condition);
-            this.propertyPath = propertyPath;
-            this.value = value;
-            this._target = target;
-        }
-        IncrementValueAction.prototype._prepare = function () {
-            this._target = this._getEffectiveTarget(this._target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-
-            if (typeof this._target[this._property] !== "number") {
-                BABYLON.Tools.Warn("Warning: IncrementValueAction can only be used with number values");
-            }
-        };
-
-        IncrementValueAction.prototype.execute = function () {
-            this._target[this._property] += this.value;
-        };
-        return IncrementValueAction;
-    })(BABYLON.Action);
-    BABYLON.IncrementValueAction = IncrementValueAction;
-
-    var PlayAnimationAction = (function (_super) {
-        __extends(PlayAnimationAction, _super);
-        function PlayAnimationAction(triggerOptions, target, from, to, loop, condition) {
-            _super.call(this, triggerOptions, condition);
-            this.from = from;
-            this.to = to;
-            this.loop = loop;
-            this._target = target;
-        }
-        PlayAnimationAction.prototype._prepare = function () {
-        };
-
-        PlayAnimationAction.prototype.execute = function () {
-            var scene = this._actionManager.getScene();
-            scene.beginAnimation(this._target, this.from, this.to, this.loop);
-        };
-        return PlayAnimationAction;
-    })(BABYLON.Action);
-    BABYLON.PlayAnimationAction = PlayAnimationAction;
-
-    var StopAnimationAction = (function (_super) {
-        __extends(StopAnimationAction, _super);
-        function StopAnimationAction(triggerOptions, target, condition) {
-            _super.call(this, triggerOptions, condition);
-            this._target = target;
-        }
-        StopAnimationAction.prototype._prepare = function () {
-        };
-
-        StopAnimationAction.prototype.execute = function () {
-            var scene = this._actionManager.getScene();
-            scene.stopAnimation(this._target);
-        };
-        return StopAnimationAction;
-    })(BABYLON.Action);
-    BABYLON.StopAnimationAction = StopAnimationAction;
-
-    var DoNothingAction = (function (_super) {
-        __extends(DoNothingAction, _super);
-        function DoNothingAction(triggerOptions, condition) {
-            if (typeof triggerOptions === "undefined") { triggerOptions = BABYLON.ActionManager.NothingTrigger; }
-            _super.call(this, triggerOptions, condition);
-        }
-        DoNothingAction.prototype.execute = function () {
-        };
-        return DoNothingAction;
-    })(BABYLON.Action);
-    BABYLON.DoNothingAction = DoNothingAction;
-
-    var CombineAction = (function (_super) {
-        __extends(CombineAction, _super);
-        function CombineAction(triggerOptions, children, condition) {
-            _super.call(this, triggerOptions, condition);
-            this.children = children;
-        }
-        CombineAction.prototype._prepare = function () {
-            for (var index = 0; index < this.children.length; index++) {
-                this.children[index]._actionManager = this._actionManager;
-                this.children[index]._prepare();
-            }
-        };
-
-        CombineAction.prototype.execute = function (evt) {
-            for (var index = 0; index < this.children.length; index++) {
-                this.children[index].execute(evt);
-            }
-        };
-        return CombineAction;
-    })(BABYLON.Action);
-    BABYLON.CombineAction = CombineAction;
-
-    var ExecuteCodeAction = (function (_super) {
-        __extends(ExecuteCodeAction, _super);
-        function ExecuteCodeAction(triggerOptions, func, condition) {
-            _super.call(this, triggerOptions, condition);
-            this.func = func;
-        }
-        ExecuteCodeAction.prototype.execute = function (evt) {
-            this.func(evt);
-        };
-        return ExecuteCodeAction;
-    })(BABYLON.Action);
-    BABYLON.ExecuteCodeAction = ExecuteCodeAction;
-
-    var SetParentAction = (function (_super) {
-        __extends(SetParentAction, _super);
-        function SetParentAction(triggerOptions, target, parent, condition) {
-            _super.call(this, triggerOptions, condition);
-            this._target = target;
-            this._parent = parent;
-        }
-        SetParentAction.prototype._prepare = function () {
-        };
-
-        SetParentAction.prototype.execute = function () {
-            if (this._target.parent === this._parent) {
-                return;
-            }
-
-            var invertParentWorldMatrix = this._parent.getWorldMatrix().clone();
-            invertParentWorldMatrix.invert();
-
-            this._target.position = BABYLON.Vector3.TransformCoordinates(this._target.position, invertParentWorldMatrix);
-
-            this._target.parent = this._parent;
-        };
-        return SetParentAction;
-    })(BABYLON.Action);
-    BABYLON.SetParentAction = SetParentAction;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.directActions.js.map

+ 0 - 174
Babylon/Actions/babylon.directActions.ts

@@ -1,174 +0,0 @@
-module BABYLON {
-    export class SwitchBooleanAction extends Action {
-        private _target: any;
-        private _property: string;
-
-        constructor(triggerOptions: any, target: any, public propertyPath: string, condition?: Condition) {
-            super(triggerOptions, condition);
-            this._target = target;
-        }
-
-        public _prepare(): void {
-            this._target = this._getEffectiveTarget(this._target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        }
-
-        public execute(): void {
-            this._target[this._property] = !this._target[this._property];
-        }
-    }
-
-    export class SetStateAction extends Action {
-        private _target: any;
-
-        constructor(triggerOptions: any, target: any, public value: string, condition?: Condition) {
-            super(triggerOptions, condition);
-            this._target = target;
-        }
-
-        public execute(): void {
-            this._target.state = this.value;
-        }
-    }
-
-    export class SetValueAction extends Action {
-        private _target: any;
-        private _property: string;
-
-        constructor(triggerOptions: any, target: any, public propertyPath: string, public value: any, condition?: Condition) {
-            super(triggerOptions, condition);
-            this._target = target;
-        }
-
-        public _prepare(): void {
-            this._target = this._getEffectiveTarget(this._target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        }
-
-        public execute(): void {
-            this._target[this._property] = this.value;
-        }
-    }
-
-    export class IncrementValueAction extends Action {
-        private _target: any;
-        private _property: string;
-
-        constructor(triggerOptions: any, target: any, public propertyPath: string, public value: any, condition?: Condition) {
-            super(triggerOptions, condition);
-            this._target = target;
-        }
-
-        public _prepare(): void {
-            this._target = this._getEffectiveTarget(this._target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-
-            if (typeof this._target[this._property] !== "number") {
-                Tools.Warn("Warning: IncrementValueAction can only be used with number values");
-            }
-        }
-
-        public execute(): void {
-            this._target[this._property] += this.value;
-        }
-    }
-
-    export class PlayAnimationAction extends Action {
-        private _target: any;
-
-        constructor(triggerOptions: any, target: any, public from: number, public to: number, public loop?: boolean, condition?: Condition) {
-            super(triggerOptions, condition);
-            this._target = target;
-        }
-
-        public _prepare(): void {
-        }
-
-        public execute(): void {
-            var scene = this._actionManager.getScene();
-            scene.beginAnimation(this._target, this.from, this.to, this.loop);
-        }
-    }
-
-    export class StopAnimationAction extends Action {
-        private _target: any;
-
-        constructor(triggerOptions: any, target: any, condition?: Condition) {
-            super(triggerOptions, condition);
-            this._target = target;
-        }
-
-        public _prepare(): void {           
-        }
-
-        public execute(): void {
-            var scene = this._actionManager.getScene();
-            scene.stopAnimation(this._target);
-        }
-    }
-
-    export class DoNothingAction extends Action {
-        constructor(triggerOptions: any = ActionManager.NothingTrigger, condition?: Condition) {
-            super(triggerOptions, condition);
-        }
-
-        public execute(): void {
-        }
-    }
-
-    export class CombineAction extends Action {
-        constructor(triggerOptions: any, public children: Action[], condition?: Condition) {
-            super(triggerOptions, condition);
-        }
-
-        public _prepare(): void {
-            for (var index = 0; index < this.children.length; index++) {
-                this.children[index]._actionManager = this._actionManager;
-                this.children[index]._prepare();
-            }
-        }
-
-        public execute(evt: ActionEvent): void {
-            for (var index = 0; index < this.children.length; index++) {
-                this.children[index].execute(evt);
-            }
-        }
-    }
-
-    export class ExecuteCodeAction extends Action {
-        constructor(triggerOptions: any, public func: (evt: ActionEvent) => void, condition?: Condition) {
-            super(triggerOptions, condition);
-        }
-
-        public execute(evt: ActionEvent): void {
-            this.func(evt);
-        }
-    }
-
-    export class SetParentAction extends Action {
-        private _parent: any;
-        private _target: any;
-
-        constructor(triggerOptions: any, target: any, parent: any, condition?: Condition) {
-            super(triggerOptions, condition);
-            this._target = target;
-            this._parent = parent;
-        }
-
-        public _prepare(): void {
-        }
-
-        public execute(): void {
-            if (this._target.parent === this._parent) {
-                return;
-            }
-
-            var invertParentWorldMatrix = this._parent.getWorldMatrix().clone();
-            invertParentWorldMatrix.invert();
-
-            this._target.position = BABYLON.Vector3.TransformCoordinates(this._target.position, invertParentWorldMatrix);
-
-            this._target.parent = this._parent;
-        }
-    }
-} 

+ 0 - 69
Babylon/Actions/babylon.interpolateValueAction.js

@@ -1,69 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var InterpolateValueAction = (function (_super) {
-        __extends(InterpolateValueAction, _super);
-        function InterpolateValueAction(triggerOptions, target, propertyPath, value, duration, condition, stopOtherAnimations) {
-            if (typeof duration === "undefined") { duration = 1000; }
-            _super.call(this, triggerOptions, condition);
-            this.propertyPath = propertyPath;
-            this.value = value;
-            this.duration = duration;
-            this.stopOtherAnimations = stopOtherAnimations;
-
-            this._target = target;
-        }
-        InterpolateValueAction.prototype._prepare = function () {
-            this._target = this._getEffectiveTarget(this._target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        };
-
-        InterpolateValueAction.prototype.execute = function () {
-            var scene = this._actionManager.getScene();
-            var keys = [
-                {
-                    frame: 0,
-                    value: this._target[this._property]
-                }, {
-                    frame: 100,
-                    value: this.value
-                }
-            ];
-
-            var dataType;
-
-            if (typeof this.value === "number") {
-                dataType = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
-            } else if (this.value instanceof BABYLON.Color3) {
-                dataType = BABYLON.Animation.ANIMATIONTYPE_COLOR3;
-            } else if (this.value instanceof BABYLON.Vector3) {
-                dataType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
-            } else if (this.value instanceof BABYLON.Matrix) {
-                dataType = BABYLON.Animation.ANIMATIONTYPE_MATRIX;
-            } else if (this.value instanceof BABYLON.Quaternion) {
-                dataType = BABYLON.Animation.ANIMATIONTYPE_QUATERNION;
-            } else {
-                BABYLON.Tools.Warn("InterpolateValueAction: Unsupported type (" + typeof this.value + ")");
-                return;
-            }
-
-            var animation = new BABYLON.Animation("InterpolateValueAction", this._property, 100 * (1000.0 / this.duration), dataType, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT);
-
-            animation.setKeys(keys);
-
-            if (this.stopOtherAnimations) {
-                scene.stopAnimation(this._target);
-            }
-
-            scene.beginDirectAnimation(this._target, [animation], 0, 100);
-        };
-        return InterpolateValueAction;
-    })(BABYLON.Action);
-    BABYLON.InterpolateValueAction = InterpolateValueAction;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.interpolateValueAction.js.map

+ 0 - 57
Babylon/Actions/babylon.interpolateValueAction.ts

@@ -1,57 +0,0 @@
-module BABYLON {
-    export class InterpolateValueAction extends Action {
-        private _target: any;
-        private _property: string;
-
-        constructor(triggerOptions: any, target: any, public propertyPath: string, public value: any, public duration: number = 1000, condition?: Condition, public stopOtherAnimations?: boolean) {
-            super(triggerOptions, condition);
-
-            this._target = target;
-        }
-
-        public _prepare(): void {
-            this._target = this._getEffectiveTarget(this._target, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        }
-
-        public execute(): void {
-            var scene = this._actionManager.getScene();
-            var keys = [
-                {
-                    frame: 0,
-                    value: this._target[this._property]
-                }, {
-                    frame: 100,
-                    value: this.value
-                }
-            ];
-
-            var dataType: number;
-
-            if (typeof this.value === "number") {
-                dataType = Animation.ANIMATIONTYPE_FLOAT;
-            } else if (this.value instanceof Color3) {
-                dataType = Animation.ANIMATIONTYPE_COLOR3;
-            } else if (this.value instanceof Vector3) {
-                dataType = Animation.ANIMATIONTYPE_VECTOR3;
-            } else if (this.value instanceof Matrix) {
-                dataType = Animation.ANIMATIONTYPE_MATRIX;
-            } else if (this.value instanceof Quaternion) {
-                dataType = Animation.ANIMATIONTYPE_QUATERNION;
-            } else {
-                Tools.Warn("InterpolateValueAction: Unsupported type (" + typeof this.value + ")");
-                return;
-            }
-
-            var animation = new BABYLON.Animation("InterpolateValueAction", this._property, 100 * (1000.0 / this.duration), dataType, Animation.ANIMATIONLOOPMODE_CONSTANT);
-
-            animation.setKeys(keys);
-
-            if (this.stopOtherAnimations) {
-                scene.stopAnimation(this._target);
-            }
-
-            scene.beginDirectAnimation(this._target, [animation], 0, 100);
-        }
-    }
-} 

+ 0 - 105
Babylon/Animations/babylon.animatable.js

@@ -1,105 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Animatable = (function () {
-        function Animatable(scene, target, fromFrame, toFrame, loopAnimation, speedRatio, onAnimationEnd, animations) {
-            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._animations = new Array();
-            this._paused = false;
-            this.animationStarted = false;
-            if (animations) {
-                this.appendAnimations(target, animations);
-            }
-
-            this._scene = scene;
-            scene._activeAnimatables.push(this);
-        }
-        // Methods
-        Animatable.prototype.appendAnimations = function (target, animations) {
-            for (var index = 0; index < animations.length; index++) {
-                var animation = animations[index];
-
-                animation._target = target;
-                this._animations.push(animation);
-            }
-        };
-
-        Animatable.prototype.getAnimationByTargetProperty = function (property) {
-            var animations = this._animations;
-
-            for (var index = 0; index < animations.length; index++) {
-                if (animations[index].targetProperty === property) {
-                    return animations[index];
-                }
-            }
-
-            return null;
-        };
-
-        Animatable.prototype.pause = function () {
-            if (this._paused) {
-                return;
-            }
-            this._paused = true;
-        };
-
-        Animatable.prototype.restart = function () {
-            this._paused = false;
-        };
-
-        Animatable.prototype.stop = function () {
-            var index = this._scene._activeAnimatables.indexOf(this);
-
-            if (index > -1) {
-                this._scene._activeAnimatables.splice(index, 1);
-            }
-
-            if (this.onAnimationEnd) {
-                this.onAnimationEnd();
-            }
-        };
-
-        Animatable.prototype._animate = function (delay) {
-            if (this._paused) {
-                if (!this._pausedDelay) {
-                    this._pausedDelay = delay;
-                }
-                return true;
-            }
-
-            if (!this._localDelayOffset) {
-                this._localDelayOffset = delay;
-            } else if (this._pausedDelay) {
-                this._localDelayOffset += delay - this._pausedDelay;
-                this._pausedDelay = null;
-            }
-
-            // Animating
-            var running = false;
-            var animations = this._animations;
-
-            for (var index = 0; index < animations.length; index++) {
-                var animation = animations[index];
-                var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
-                running = running || isRunning;
-            }
-
-            if (!running && this.onAnimationEnd) {
-                this.onAnimationEnd();
-            }
-
-            return running;
-        };
-        return Animatable;
-    })();
-    BABYLON.Animatable = Animatable;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.animatable.js.map

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

@@ -1,97 +0,0 @@
-module BABYLON {
-    export class Animatable {
-        private _localDelayOffset: number;
-        private _pausedDelay: number;
-        private _animations = new Array<Animation>();
-        private _paused = false;
-        private _scene: Scene;
-
-        public animationStarted = false;
-
-        constructor(scene: Scene, public target, public fromFrame: number = 0, public toFrame: number = 100, public loopAnimation: boolean = false, public speedRatio: number = 1.0, public onAnimationEnd?, animations?: any) {
-            if (animations) {
-                this.appendAnimations(target, animations);
-            }
-
-            this._scene = scene;
-            scene._activeAnimatables.push(this);
-        }
-
-        // Methods
-        public appendAnimations(target: any, animations: Animation[]): void {
-            for (var index = 0; index < animations.length; index++) {
-                var animation = animations[index];
-
-                animation._target = target;
-                this._animations.push(animation);    
-            }            
-        }
-
-        public getAnimationByTargetProperty(property: string) {
-            var animations = this._animations;
-
-            for (var index = 0; index < animations.length; index++) {
-                if (animations[index].targetProperty === property) {
-                    return animations[index];
-                }
-            }
-
-            return null;
-        }
-
-        public pause(): void {
-            if (this._paused) {
-                return;
-            }
-            this._paused = true;
-        }
-
-        public restart(): void {
-            this._paused = false;
-        }
-
-        public stop(): void {
-            var index = this._scene._activeAnimatables.indexOf(this);
-
-            if (index > -1) {
-                this._scene._activeAnimatables.splice(index, 1);
-            }
-
-            if (this.onAnimationEnd) {
-                this.onAnimationEnd();
-            }
-        }
-
-        public _animate(delay: number): boolean {
-            if (this._paused) {
-                if (!this._pausedDelay) {
-                    this._pausedDelay = delay;
-                }
-                return true;
-            }
-
-            if (!this._localDelayOffset) {
-                this._localDelayOffset = delay;
-            } else if (this._pausedDelay) {
-                this._localDelayOffset += delay - this._pausedDelay;
-                this._pausedDelay = null;
-            }
-
-            // Animating
-            var running = false;
-            var animations = this._animations;
-
-            for (var index = 0; index < animations.length; index++) {
-                var animation = animations[index];
-                var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
-                running = running || isRunning;
-            }
-
-            if (!running && this.onAnimationEnd) {
-                this.onAnimationEnd();
-            }
-
-            return running;
-        }
-    }
-} 

+ 0 - 393
Babylon/Animations/babylon.animation.js

@@ -1,393 +0,0 @@
-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._stopped = false;
-            this.targetPropertyPath = targetProperty.split(".");
-            this.dataType = dataType;
-            this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;
-        }
-        Animation.CreateAndStartAnimation = function (name, mesh, tartgetProperty, framePerSecond, totalFrame, from, to, loopMode) {
-            var dataType = undefined;
-
-            if (!isNaN(parseFloat(from)) && isFinite(from)) {
-                dataType = Animation.ANIMATIONTYPE_FLOAT;
-            } else if (from instanceof BABYLON.Quaternion) {
-                dataType = Animation.ANIMATIONTYPE_QUATERNION;
-            } else if (from instanceof BABYLON.Vector3) {
-                dataType = Animation.ANIMATIONTYPE_VECTOR3;
-            } else if (from instanceof BABYLON.Vector2) {
-                dataType = Animation.ANIMATIONTYPE_VECTOR2;
-            } else if (from instanceof BABYLON.Color3) {
-                dataType = Animation.ANIMATIONTYPE_COLOR3;
-            }
-
-            if (dataType == undefined) {
-                return;
-            }
-
-            var animation = new Animation(name, tartgetProperty, framePerSecond, dataType, loopMode);
-
-            var keys = [];
-            keys.push({ frame: 0, value: from });
-            keys.push({ frame: totalFrame, value: to });
-            animation.setKeys(keys);
-
-            mesh.animations.push(animation);
-
-            mesh.getScene().beginAnimation(mesh, 0, totalFrame, (animation.loopMode == 1));
-        };
-
-        // Methods
-        Animation.prototype.isStopped = function () {
-            return this._stopped;
-        };
-
-        Animation.prototype.getKeys = function () {
-            return this._keys;
-        };
-
-        Animation.prototype.getEasingFunction = function () {
-            return this._easingFunction;
-        };
-
-        Animation.prototype.setEasingFunction = function (easingFunction) {
-            this._easingFunction = easingFunction;
-        };
-
-        Animation.prototype.floatInterpolateFunction = function (startValue, endValue, gradient) {
-            return startValue + (endValue - startValue) * gradient;
-        };
-
-        Animation.prototype.quaternionInterpolateFunction = function (startValue, endValue, gradient) {
-            return BABYLON.Quaternion.Slerp(startValue, endValue, gradient);
-        };
-
-        Animation.prototype.vector3InterpolateFunction = function (startValue, endValue, gradient) {
-            return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
-        };
-
-        Animation.prototype.vector2InterpolateFunction = function (startValue, endValue, gradient) {
-            return BABYLON.Vector2.Lerp(startValue, endValue, gradient);
-        };
-
-        Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {
-            return BABYLON.Color3.Lerp(startValue, endValue, gradient);
-        };
-
-        Animation.prototype.clone = function () {
-            var clone = new Animation(this.name, this.targetPropertyPath.join("."), this.framePerSecond, this.dataType, this.loopMode);
-
-            clone.setKeys(this._keys);
-
-            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++) {
-                // for each frame, we need the key just before the frame superior
-                if (this._keys[key + 1].frame >= currentFrame) {
-                    var startValue = this._keys[key].value;
-                    var endValue = this._keys[key + 1].value;
-
-                    // gradient : percent of currentFrame between the frame inf and the frame sup
-                    var gradient = (currentFrame - this._keys[key].frame) / (this._keys[key + 1].frame - this._keys[key].frame);
-
-                    // check for easingFunction and correction of gradient
-                    if (this._easingFunction != null) {
-                        gradient = this._easingFunction.ease(gradient);
-                    }
-
-                    switch (this.dataType) {
-                        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_VECTOR2:
-                            switch (loopMode) {
-                                case Animation.ANIMATIONLOOPMODE_CYCLE:
-                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
-                                    return this.vector2InterpolateFunction(startValue, endValue, gradient);
-                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
-                                    return this.vector2InterpolateFunction(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;
-                    }
-                    break;
-                }
-            }
-            return this._keys[this._keys.length - 1].value;
-        };
-
-        Animation.prototype.animate = function (delay, from, to, loop, speedRatio) {
-            if (!this.targetPropertyPath || this.targetPropertyPath.length < 1) {
-                this._stopped = true;
-                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 offsetValue;
-
-            // ratio represents the frame delta between from and to
-            var ratio = delay * (this.framePerSecond * speedRatio) / 1000.0;
-
-            if (ratio > range && !loop) {
-                returnValue = false;
-                highLimitValue = this._keys[this._keys.length - 1].value;
-            } else {
-                // Get max value if required
-                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_VECTOR2:
-                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
-
-                            case Animation.ANIMATIONTYPE_COLOR3:
-                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
-                            default:
-                                break;
-                        }
-
-                        this._highLimitsCache[keyOffset] = toValue;
-                    }
-
-                    highLimitValue = this._highLimitsCache[keyOffset];
-                    offsetValue = this._offsetsCache[keyOffset];
-                }
-            }
-
-            if (offsetValue === undefined) {
-                switch (this.dataType) {
-                    case Animation.ANIMATIONTYPE_FLOAT:
-                        offsetValue = 0;
-                        break;
-
-                    case Animation.ANIMATIONTYPE_QUATERNION:
-                        offsetValue = new BABYLON.Quaternion(0, 0, 0, 0);
-                        break;
-
-                    case Animation.ANIMATIONTYPE_VECTOR3:
-                        offsetValue = BABYLON.Vector3.Zero();
-                        break;
-
-                    case Animation.ANIMATIONTYPE_VECTOR2:
-                        offsetValue = BABYLON.Vector2.Zero();
-                        break;
-
-                    case Animation.ANIMATIONTYPE_COLOR3:
-                        offsetValue = BABYLON.Color3.Black();
-                }
-            }
-
-            // 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 = this._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 {
-                this._target[this.targetPropertyPath[0]] = currentValue;
-            }
-
-            if (this._target.markAsDirty) {
-                this._target.markAsDirty(this.targetProperty);
-            }
-
-            if (!returnValue) {
-                this._stopped = true;
-            }
-
-            return returnValue;
-        };
-
-        Object.defineProperty(Animation, "ANIMATIONTYPE_FLOAT", {
-            get: function () {
-                return Animation._ANIMATIONTYPE_FLOAT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Animation, "ANIMATIONTYPE_VECTOR3", {
-            get: function () {
-                return Animation._ANIMATIONTYPE_VECTOR3;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Animation, "ANIMATIONTYPE_VECTOR2", {
-            get: function () {
-                return Animation._ANIMATIONTYPE_VECTOR2;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Animation, "ANIMATIONTYPE_QUATERNION", {
-            get: function () {
-                return Animation._ANIMATIONTYPE_QUATERNION;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Animation, "ANIMATIONTYPE_MATRIX", {
-            get: function () {
-                return Animation._ANIMATIONTYPE_MATRIX;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Animation, "ANIMATIONTYPE_COLOR3", {
-            get: function () {
-                return Animation._ANIMATIONTYPE_COLOR3;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Animation, "ANIMATIONLOOPMODE_RELATIVE", {
-            get: function () {
-                return Animation._ANIMATIONLOOPMODE_RELATIVE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Animation, "ANIMATIONLOOPMODE_CYCLE", {
-            get: function () {
-                return Animation._ANIMATIONLOOPMODE_CYCLE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Animation, "ANIMATIONLOOPMODE_CONSTANT", {
-            get: function () {
-                return Animation._ANIMATIONLOOPMODE_CONSTANT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Animation._ANIMATIONTYPE_FLOAT = 0;
-        Animation._ANIMATIONTYPE_VECTOR3 = 1;
-        Animation._ANIMATIONTYPE_QUATERNION = 2;
-        Animation._ANIMATIONTYPE_MATRIX = 3;
-        Animation._ANIMATIONTYPE_COLOR3 = 4;
-        Animation._ANIMATIONTYPE_VECTOR2 = 5;
-        Animation._ANIMATIONLOOPMODE_RELATIVE = 0;
-        Animation._ANIMATIONLOOPMODE_CYCLE = 1;
-        Animation._ANIMATIONLOOPMODE_CONSTANT = 2;
-        return Animation;
-    })();
-    BABYLON.Animation = Animation;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.animation.js.map

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

@@ -1,371 +0,0 @@
-module BABYLON {
-    export class Animation {
-        private _keys: Array<any>;
-        private _offsetsCache = {};
-        private _highLimitsCache = {};
-        private _stopped = false;
-        public _target;
-        private _easingFunction: BABYLON.IEasingFunction;
-
-        public targetPropertyPath: string[];
-        public currentFrame: number;
-
-        public static CreateAndStartAnimation(name: string, mesh: BABYLON.AbstractMesh, tartgetProperty: string,
-            framePerSecond: number, totalFrame: number,
-            from: any, to: any, loopMode?: number) {
-
-            var dataType = undefined;
-
-            if (!isNaN(parseFloat(from)) && isFinite(from)) {
-                dataType = Animation.ANIMATIONTYPE_FLOAT;
-            } else if (from instanceof BABYLON.Quaternion) {
-                dataType = Animation.ANIMATIONTYPE_QUATERNION;
-            } else if (from instanceof BABYLON.Vector3) {
-                dataType = Animation.ANIMATIONTYPE_VECTOR3;
-            } else if (from instanceof BABYLON.Vector2) {
-                dataType = Animation.ANIMATIONTYPE_VECTOR2;
-            } else if (from instanceof BABYLON.Color3) {
-                dataType = Animation.ANIMATIONTYPE_COLOR3;
-            }
-
-            if (dataType == undefined) {
-                return;
-            }
-
-            var animation = new Animation(name, tartgetProperty, framePerSecond, dataType, loopMode);
-
-            var keys = [];
-            keys.push({ frame: 0, value: from });
-            keys.push({ frame: totalFrame, value: to });
-            animation.setKeys(keys);
-
-            mesh.animations.push(animation);
-
-            mesh.getScene().beginAnimation(mesh, 0, totalFrame, (animation.loopMode == 1));
-
-        }
-
-
-        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 isStopped(): boolean {
-            return this._stopped;
-        }
-
-        public getKeys(): any[] {
-            return this._keys;
-        }
-
-        public getEasingFunction() {
-            return this._easingFunction;
-        }
-
-        public setEasingFunction(easingFunction: BABYLON.EasingFunction) {
-            this._easingFunction = easingFunction;
-        }
-
-        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 vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2 {
-            return BABYLON.Vector2.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++) {
-                // for each frame, we need the key just before the frame superior
-                if (this._keys[key + 1].frame >= currentFrame) {
-
-                    var startValue = this._keys[key].value;
-                    var endValue = this._keys[key + 1].value;
-
-                    // gradient : percent of currentFrame between the frame inf and the frame sup
-                    var gradient = (currentFrame - this._keys[key].frame) / (this._keys[key + 1].frame - this._keys[key].frame);
-
-                    // check for easingFunction and correction of gradient
-                    if (this._easingFunction != null) {
-                        gradient = this._easingFunction.ease(gradient);
-                    }
-
-                    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));
-                            }
-                        // Vector2
-                        case Animation.ANIMATIONTYPE_VECTOR2:
-                            switch (loopMode) {
-                                case Animation.ANIMATIONLOOPMODE_CYCLE:
-                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
-                                    return this.vector2InterpolateFunction(startValue, endValue, gradient);
-                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
-                                    return this.vector2InterpolateFunction(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(delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean {
-            if (!this.targetPropertyPath || this.targetPropertyPath.length < 1) {
-                this._stopped = true;
-                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 offsetValue;
-            // ratio represents the frame delta between from and to
-            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
-                returnValue = false;
-                highLimitValue = this._keys[this._keys.length - 1].value;
-            } else {
-                // Get max value if required
-                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);
-                            // Vector2
-                            case Animation.ANIMATIONTYPE_VECTOR2:
-                                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];
-                }
-            }
-
-            if (offsetValue === undefined) {
-                switch (this.dataType) {
-                    // Float
-                    case Animation.ANIMATIONTYPE_FLOAT:
-                        offsetValue = 0;
-                        break;
-                    // Quaternion
-                    case Animation.ANIMATIONTYPE_QUATERNION:
-                        offsetValue = new Quaternion(0, 0, 0, 0);
-                        break;
-                    // Vector3
-                    case Animation.ANIMATIONTYPE_VECTOR3:
-                        offsetValue = Vector3.Zero();
-                        break;
-                    // Vector2
-                    case Animation.ANIMATIONTYPE_VECTOR2:
-                        offsetValue = Vector2.Zero();
-                        break;
-                    // Color3
-                    case Animation.ANIMATIONTYPE_COLOR3:
-                        offsetValue = Color3.Black();
-                }
-            }
-
-            // 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 = this._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 {
-                this._target[this.targetPropertyPath[0]] = currentValue;
-            }
-
-            if (this._target.markAsDirty) {
-                this._target.markAsDirty(this.targetProperty);
-            }
-
-            if (!returnValue) {
-                this._stopped = true;
-            }
-
-            return returnValue;
-        }
-
-
-
-        // Statics
-        private static _ANIMATIONTYPE_FLOAT = 0;
-        private static _ANIMATIONTYPE_VECTOR3 = 1;
-        private static _ANIMATIONTYPE_QUATERNION = 2;
-        private static _ANIMATIONTYPE_MATRIX = 3;
-        private static _ANIMATIONTYPE_COLOR3 = 4;
-        private static _ANIMATIONTYPE_VECTOR2 = 5;
-        private static _ANIMATIONLOOPMODE_RELATIVE = 0;
-        private static _ANIMATIONLOOPMODE_CYCLE = 1;
-        private static _ANIMATIONLOOPMODE_CONSTANT = 2;
-
-        public static get ANIMATIONTYPE_FLOAT(): number {
-            return Animation._ANIMATIONTYPE_FLOAT;
-        }
-
-        public static get ANIMATIONTYPE_VECTOR3(): number {
-            return Animation._ANIMATIONTYPE_VECTOR3;
-        }
-
-        public static get ANIMATIONTYPE_VECTOR2(): number {
-            return Animation._ANIMATIONTYPE_VECTOR2;
-        }
-
-        public static get ANIMATIONTYPE_QUATERNION(): number {
-            return Animation._ANIMATIONTYPE_QUATERNION;
-        }
-
-        public static get ANIMATIONTYPE_MATRIX(): number {
-            return Animation._ANIMATIONTYPE_MATRIX;
-        }
-
-        public static get ANIMATIONTYPE_COLOR3(): number {
-            return Animation._ANIMATIONTYPE_COLOR3;
-        }
-
-        public static get ANIMATIONLOOPMODE_RELATIVE(): number {
-            return Animation._ANIMATIONLOOPMODE_RELATIVE;
-        }
-
-        public static get ANIMATIONLOOPMODE_CYCLE(): number {
-            return Animation._ANIMATIONLOOPMODE_CYCLE;
-        }
-
-        public static get ANIMATIONLOOPMODE_CONSTANT(): number {
-            return Animation._ANIMATIONLOOPMODE_CONSTANT;
-        }
-    }
-} 

+ 0 - 270
Babylon/Animations/babylon.easing.js

@@ -1,270 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var EasingFunction = (function () {
-        function EasingFunction() {
-            // Properties
-            this._easingMode = EasingFunction.EASINGMODE_EASEIN;
-        }
-        Object.defineProperty(EasingFunction, "EASINGMODE_EASEIN", {
-            get: function () {
-                return EasingFunction._EASINGMODE_EASEIN;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(EasingFunction, "EASINGMODE_EASEOUT", {
-            get: function () {
-                return EasingFunction._EASINGMODE_EASEOUT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(EasingFunction, "EASINGMODE_EASEINOUT", {
-            get: function () {
-                return EasingFunction._EASINGMODE_EASEINOUT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        EasingFunction.prototype.setEasingMode = function (easingMode) {
-            var n = Math.min(Math.max(easingMode, 0), 2);
-            this._easingMode = n;
-        };
-        EasingFunction.prototype.getEasingMode = function () {
-            return this._easingMode;
-        };
-
-        EasingFunction.prototype.easeInCore = function (gradient) {
-            throw new Error('You must implement this method');
-        };
-
-        EasingFunction.prototype.ease = function (gradient) {
-            switch (this._easingMode) {
-                case EasingFunction.EASINGMODE_EASEIN:
-                    return this.easeInCore(gradient);
-                case EasingFunction.EASINGMODE_EASEOUT:
-                    return (1 - this.easeInCore(1 - gradient));
-            }
-
-            if (gradient >= 0.5) {
-                return (((1 - this.easeInCore((1 - gradient) * 2)) * 0.5) + 0.5);
-            }
-
-            return (this.easeInCore(gradient * 2) * 0.5);
-        };
-        EasingFunction._EASINGMODE_EASEIN = 0;
-        EasingFunction._EASINGMODE_EASEOUT = 1;
-        EasingFunction._EASINGMODE_EASEINOUT = 2;
-        return EasingFunction;
-    })();
-    BABYLON.EasingFunction = EasingFunction;
-
-    var CircleEase = (function (_super) {
-        __extends(CircleEase, _super);
-        function CircleEase() {
-            _super.apply(this, arguments);
-        }
-        CircleEase.prototype.easeInCore = function (gradient) {
-            gradient = Math.max(0, Math.min(1, gradient));
-            return (1.0 - Math.sqrt(1.0 - (gradient * gradient)));
-        };
-        return CircleEase;
-    })(EasingFunction);
-    BABYLON.CircleEase = CircleEase;
-
-    var BackEase = (function (_super) {
-        __extends(BackEase, _super);
-        function BackEase(amplitude) {
-            if (typeof amplitude === "undefined") { amplitude = 1; }
-            _super.call(this);
-            this.amplitude = amplitude;
-        }
-        BackEase.prototype.easeInCore = function (gradient) {
-            var num = Math.max(0, this.amplitude);
-            return (Math.pow(gradient, 3.0) - ((gradient * num) * Math.sin(3.1415926535897931 * gradient)));
-        };
-        return BackEase;
-    })(EasingFunction);
-    BABYLON.BackEase = BackEase;
-
-    var BounceEase = (function (_super) {
-        __extends(BounceEase, _super);
-        function BounceEase(bounces, bounciness) {
-            if (typeof bounces === "undefined") { bounces = 3; }
-            if (typeof bounciness === "undefined") { bounciness = 2; }
-            _super.call(this);
-            this.bounces = bounces;
-            this.bounciness = bounciness;
-        }
-        BounceEase.prototype.easeInCore = function (gradient) {
-            var y = Math.max(0.0, this.bounces);
-            var bounciness = this.bounciness;
-            if (bounciness <= 1.0) {
-                bounciness = 1.001;
-            }
-            var num9 = Math.pow(bounciness, y);
-            var num5 = 1.0 - bounciness;
-            var num4 = ((1.0 - num9) / num5) + (num9 * 0.5);
-            var num15 = gradient * num4;
-            var num65 = Math.log((-num15 * (1.0 - bounciness)) + 1.0) / Math.log(bounciness);
-            var num3 = Math.floor(num65);
-            var num13 = num3 + 1.0;
-            var num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);
-            var num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);
-            var num7 = (num8 + num12) * 0.5;
-            var num6 = gradient - num7;
-            var num2 = num7 - num8;
-            return (((-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2)) * (num6 + num2));
-        };
-        return BounceEase;
-    })(EasingFunction);
-    BABYLON.BounceEase = BounceEase;
-
-    var CubicEase = (function (_super) {
-        __extends(CubicEase, _super);
-        function CubicEase() {
-            _super.apply(this, arguments);
-        }
-        CubicEase.prototype.easeInCore = function (gradient) {
-            return (gradient * gradient * gradient);
-        };
-        return CubicEase;
-    })(EasingFunction);
-    BABYLON.CubicEase = CubicEase;
-
-    var ElasticEase = (function (_super) {
-        __extends(ElasticEase, _super);
-        function ElasticEase(oscillations, springiness) {
-            if (typeof oscillations === "undefined") { oscillations = 3; }
-            if (typeof springiness === "undefined") { springiness = 3; }
-            _super.call(this);
-            this.oscillations = oscillations;
-            this.springiness = springiness;
-        }
-        ElasticEase.prototype.easeInCore = function (gradient) {
-            var num2;
-            var num3 = Math.max(0.0, this.oscillations);
-            var num = Math.max(0.0, this.springiness);
-
-            if (num == 0) {
-                num2 = gradient;
-            } else {
-                num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);
-            }
-            return (num2 * Math.sin(((6.2831853071795862 * num3) + 1.5707963267948966) * gradient));
-        };
-        return ElasticEase;
-    })(EasingFunction);
-    BABYLON.ElasticEase = ElasticEase;
-
-    var ExponentialEase = (function (_super) {
-        __extends(ExponentialEase, _super);
-        function ExponentialEase(exponent) {
-            if (typeof exponent === "undefined") { exponent = 2; }
-            _super.call(this);
-            this.exponent = exponent;
-        }
-        ExponentialEase.prototype.easeInCore = function (gradient) {
-            if (this.exponent <= 0) {
-                return gradient;
-            }
-
-            return ((Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0));
-        };
-        return ExponentialEase;
-    })(EasingFunction);
-    BABYLON.ExponentialEase = ExponentialEase;
-
-    var PowerEase = (function (_super) {
-        __extends(PowerEase, _super);
-        function PowerEase(power) {
-            if (typeof power === "undefined") { power = 2; }
-            _super.call(this);
-            this.power = power;
-        }
-        PowerEase.prototype.easeInCore = function (gradient) {
-            var y = Math.max(0.0, this.power);
-            return Math.pow(gradient, y);
-        };
-        return PowerEase;
-    })(EasingFunction);
-    BABYLON.PowerEase = PowerEase;
-
-    var QuadraticEase = (function (_super) {
-        __extends(QuadraticEase, _super);
-        function QuadraticEase() {
-            _super.apply(this, arguments);
-        }
-        QuadraticEase.prototype.easeInCore = function (gradient) {
-            return (gradient * gradient);
-        };
-        return QuadraticEase;
-    })(EasingFunction);
-    BABYLON.QuadraticEase = QuadraticEase;
-
-    var QuarticEase = (function (_super) {
-        __extends(QuarticEase, _super);
-        function QuarticEase() {
-            _super.apply(this, arguments);
-        }
-        QuarticEase.prototype.easeInCore = function (gradient) {
-            return (gradient * gradient * gradient * gradient);
-        };
-        return QuarticEase;
-    })(EasingFunction);
-    BABYLON.QuarticEase = QuarticEase;
-
-    var QuinticEase = (function (_super) {
-        __extends(QuinticEase, _super);
-        function QuinticEase() {
-            _super.apply(this, arguments);
-        }
-        QuinticEase.prototype.easeInCore = function (gradient) {
-            return (gradient * gradient * gradient * gradient * gradient);
-        };
-        return QuinticEase;
-    })(EasingFunction);
-    BABYLON.QuinticEase = QuinticEase;
-
-    var SineEase = (function (_super) {
-        __extends(SineEase, _super);
-        function SineEase() {
-            _super.apply(this, arguments);
-        }
-        SineEase.prototype.easeInCore = function (gradient) {
-            return (1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient)));
-        };
-        return SineEase;
-    })(EasingFunction);
-    BABYLON.SineEase = SineEase;
-
-    var BezierCurveEase = (function (_super) {
-        __extends(BezierCurveEase, _super);
-        function BezierCurveEase(x1, y1, x2, y2) {
-            if (typeof x1 === "undefined") { x1 = 0; }
-            if (typeof y1 === "undefined") { y1 = 0; }
-            if (typeof x2 === "undefined") { x2 = 1; }
-            if (typeof y2 === "undefined") { y2 = 1; }
-            _super.call(this);
-            this.x1 = x1;
-            this.y1 = y1;
-            this.x2 = x2;
-            this.y2 = y2;
-        }
-        BezierCurveEase.prototype.easeInCore = function (gradient) {
-            return BABYLON.BezierCurve.interpolate(gradient, this.x1, this.y1, this.x2, this.y2);
-        };
-        return BezierCurveEase;
-    })(EasingFunction);
-    BABYLON.BezierCurveEase = BezierCurveEase;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.easing.js.map

+ 0 - 43
Babylon/Audio/babylon.audioengine.js

@@ -1,43 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var AudioEngine = (function () {
-        function AudioEngine() {
-            this.audioContext = null;
-            this.canUseWebAudio = false;
-            try  {
-                if (typeof AudioContext !== 'undefined') {
-                    this.audioContext = new AudioContext();
-                    this.canUseWebAudio = true;
-                } else if (typeof webkitAudioContext !== 'undefined') {
-                    this.audioContext = new webkitAudioContext();
-                    this.canUseWebAudio = true;
-                }
-            } catch (e) {
-                this.canUseWebAudio = false;
-            }
-
-            // create a global volume gain node
-            if (this.canUseWebAudio) {
-                this.masterGain = this.audioContext.createGain();
-                this.masterGain.gain.value = 1;
-                this.masterGain.connect(this.audioContext.destination);
-            }
-        }
-        AudioEngine.prototype.getGlobalVolume = function () {
-            if (this.canUseWebAudio) {
-                return this.masterGain.gain.value;
-            } else {
-                return -1;
-            }
-        };
-
-        AudioEngine.prototype.setGlobalVolume = function (newVolume) {
-            if (this.canUseWebAudio) {
-                this.masterGain.gain.value = newVolume;
-            }
-        };
-        return AudioEngine;
-    })();
-    BABYLON.AudioEngine = AudioEngine;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.audioengine.js.map

+ 0 - 46
Babylon/Audio/babylon.audioengine.ts

@@ -1,46 +0,0 @@
-module BABYLON {
-    export class AudioEngine {
-        public audioContext: AudioContext = null;
-        public canUseWebAudio: boolean = false;
-        public masterGain: GainNode;
-
-        constructor() {
-             // creating the audio context 
-            try {
-                if (typeof AudioContext !== 'undefined') {
-                    this.audioContext = new AudioContext();
-                    this.canUseWebAudio = true;
-                } else if (typeof webkitAudioContext !== 'undefined') {
-                    this.audioContext = new webkitAudioContext();
-                    this.canUseWebAudio = true;
-                } 
-            } catch (e) {
-                this.canUseWebAudio = false;
-            }
-
-            // create a global volume gain node 
-            if (this.canUseWebAudio) {
-                this.masterGain = this.audioContext.createGain();
-                this.masterGain.gain.value = 1;
-                this.masterGain.connect(this.audioContext.destination);
-            }
-        }
-
-        public getGlobalVolume(): number {
-            if (this.canUseWebAudio) {
-                return this.masterGain.gain.value;
-            }
-            else {
-                return -1;
-            }
-        }
-
-        public setGlobalVolume(newVolume: number) {
-            if (this.canUseWebAudio) {
-                this.masterGain.gain.value = newVolume;
-            }
-        }
-    }
-}
-
-

+ 0 - 93
Babylon/Audio/babylon.sound.js

@@ -1,93 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Sound = (function () {
-        function Sound(url, engine, readyToPlayCallback, distanceMax, autoplay, loop) {
-            var _this = this;
-            this.distanceMax = 10;
-            this.autoplay = false;
-            this.loop = false;
-            this._position = BABYLON.Vector3.Zero();
-            this._orientation = BABYLON.Vector3.Zero();
-            this._isLoaded = false;
-            this._isReadyToPlay = false;
-            this._audioEngine = engine.getAudioEngine();            
-            this._readyToPlayCallback = readyToPlayCallback;
-            if (distanceMax)
-                this.distanceMax = distanceMax;
-            if (autoplay)
-                this.autoplay = autoplay;
-            if (loop)
-                this.loop = loop;
-            if (this._audioEngine.canUseWebAudio) {
-                BABYLON.Tools.LoadFile(url, function (data) {
-                    _this._soundLoaded(data);
-                }, null, null, true);
-            }
-        }
-        Sound.prototype.setPosition = function (newPosition) {
-            this._position = newPosition;
-
-            if (this._isReadyToPlay) {
-                this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
-            }
-        };
-
-        Sound.prototype.setOrientiation = function (newOrientation) {
-            this._orientation = newOrientation;
-
-            if (this._isReadyToPlay) {
-                this._soundPanner.setOrientation(this._orientation.x, this._orientation.y, this._orientation.z);
-            }
-        };
-
-        Sound.prototype.play = function () {
-            if (this._isReadyToPlay) {
-                this._soundSource = this._audioEngine.audioContext.createBufferSource();
-                this._soundSource.buffer = this._audioBuffer;
-                this._soundPanner = this._audioEngine.audioContext.createPanner();
-                this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
-                this._soundPanner.connect(this._audioEngine.masterGain);
-                this._soundSource.connect(this._soundPanner);
-                this._soundSource.loop = this.loop;
-                this._soundSource.start(0);
-            }
-        };
-
-        Sound.prototype.stop = function () {
-        };
-
-        Sound.prototype.pause = function () {
-        };
-
-        Sound.prototype.attachToMesh = function (meshToConnectTo) {
-            var _this = this;
-            meshToConnectTo.registerAfterWorldMatrixUpdate(function (connectedMesh) {
-                return _this._onRegisterAfterWorldMatrixUpdate(connectedMesh);
-            });
-        };
-
-        Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (connectedMesh) {
-            this.setPosition(connectedMesh.position);
-        };
-
-        Sound.prototype._soundLoaded = function (audioData) {
-            var _this = this;
-            this._isLoaded = true;
-            this._audioEngine.audioContext.decodeAudioData(audioData, function (buffer) {
-                _this._audioBuffer = buffer;
-                _this._isReadyToPlay = true;
-                if (_this.autoplay) {
-                    _this.play();
-				}
-                if (_this._readyToPlayCallback) {
-                    _this._readyToPlayCallback();
-				}
-            }, function (error) {
-                BABYLON.Tools.Error("Error while decoding audio data: " + error.err);
-            });
-        };
-        return Sound;
-    })();
-    BABYLON.Sound = Sound;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.sound.js.map

+ 0 - 84
Babylon/Audio/babylon.sound.ts

@@ -1,84 +0,0 @@
-module BABYLON {
-    export class Sound {
-        private _audioBuffer;
-        public distanceMax: number = 10;
-        public autoplay: boolean = false;
-        public loop: boolean = false;
-        private _position: Vector3 = Vector3.Zero();
-        private _orientation: Vector3 = Vector3.Zero();
-        private _volume: number;
-        private _currentVolume: number;
-        private _isLoaded: boolean = false;
-        private _isReadyToPlay: boolean = false;
-        private _audioEngine: BABYLON.AudioEngine;
-        private _readyToPlayCallback;
-        private _soundSource: AudioBufferSourceNode;
-        private _soundPanner: PannerNode;
-
-        constructor(url: string, engine: BABYLON.Engine, readyToPlayCallback, distanceMax?: number, autoplay?: boolean, loop?: boolean) {
-            this._audioEngine = engine.getAudioEngine();;
-            this._readyToPlayCallback = readyToPlayCallback;
-            if (distanceMax) this.distanceMax = distanceMax;
-            if (autoplay) this.autoplay = autoplay;
-            if (loop) this.loop = loop;
-            if (this._audioEngine.canUseWebAudio) {
-                BABYLON.Tools.LoadFile(url, (data) => { this._soundLoaded(data); }, null, null, true);
-            }
-        }
-
-        public setPosition(newPosition: Vector3) {
-            this._position = newPosition;
-
-            if (this._isReadyToPlay) {    
-                this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
-            }
-        }
-
-        public setOrientiation(newOrientation: Vector3) {
-            this._orientation = newOrientation;
-
-            if (this._isReadyToPlay) {
-                this._soundPanner.setOrientation(this._orientation.x, this._orientation.y, this._orientation.z);
-            }
-        }
-
-        public play() {
-            if (this._isReadyToPlay) {
-                this._soundSource = this._audioEngine.audioContext.createBufferSource();
-                this._soundSource.buffer = this._audioBuffer;
-                this._soundPanner = this._audioEngine.audioContext.createPanner();
-                this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
-                this._soundPanner.connect(this._audioEngine.masterGain);
-                this._soundSource.connect(this._soundPanner);
-                this._soundSource.loop = this.loop;
-                this._soundSource.start(0);
-            }
-        }
-        
-        public stop() {
-        }   
-
-        public pause() {
-        }
-
-        public attachToMesh(meshToConnectTo: BABYLON.AbstractMesh) {
-            meshToConnectTo.registerAfterWorldMatrixUpdate((connectedMesh: BABYLON.AbstractMesh) => this._onRegisterAfterWorldMatrixUpdate(connectedMesh));
-        }
-
-        private _onRegisterAfterWorldMatrixUpdate(connectedMesh: BABYLON.AbstractMesh) {
-            this.setPosition(connectedMesh.position);
-        }
-
-        private _soundLoaded(audioData: ArrayBuffer) {
-            this._isLoaded = true;
-            this._audioEngine.audioContext.decodeAudioData(audioData, (buffer) => {
-                this._audioBuffer = buffer;
-                this._isReadyToPlay = true;
-                if (this.autoplay) { this.play(); }
-                if (this._readyToPlayCallback) { this._readyToPlayCallback(); }
-            }, function (error) {
-                BABYLON.Tools.Error("Error while decoding audio data: " + error.err);
-            });
-        }
-    }
-}

+ 0 - 88
Babylon/Bones/babylon.bone.js

@@ -1,88 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Bone = (function () {
-        function Bone(name, skeleton, parentBone, matrix) {
-            this.name = name;
-            this.children = new Array();
-            this.animations = new Array();
-            this._worldTransform = new BABYLON.Matrix();
-            this._absoluteTransform = new BABYLON.Matrix();
-            this._invertedAbsoluteTransform = new BABYLON.Matrix();
-            this._skeleton = skeleton;
-            this._matrix = matrix;
-            this._baseMatrix = matrix;
-
-            skeleton.bones.push(this);
-
-            if (parentBone) {
-                this._parent = parentBone;
-                parentBone.children.push(this);
-            } else {
-                this._parent = null;
-            }
-
-            this._updateDifferenceMatrix();
-        }
-        // Members
-        Bone.prototype.getParent = function () {
-            return this._parent;
-        };
-
-        Bone.prototype.getLocalMatrix = function () {
-            return this._matrix;
-        };
-
-        Bone.prototype.getBaseMatrix = function () {
-            return this._baseMatrix;
-        };
-
-        Bone.prototype.getWorldMatrix = function () {
-            return this._worldTransform;
-        };
-
-        Bone.prototype.getInvertedAbsoluteTransform = function () {
-            return this._invertedAbsoluteTransform;
-        };
-
-        Bone.prototype.getAbsoluteMatrix = function () {
-            var matrix = this._matrix.clone();
-            var parent = this._parent;
-
-            while (parent) {
-                matrix = matrix.multiply(parent.getLocalMatrix());
-                parent = parent.getParent();
-            }
-
-            return matrix;
-        };
-
-        // Methods
-        Bone.prototype.updateMatrix = function (matrix) {
-            this._matrix = matrix;
-            this._skeleton._markAsDirty();
-
-            this._updateDifferenceMatrix();
-        };
-
-        Bone.prototype._updateDifferenceMatrix = function () {
-            if (this._parent) {
-                this._matrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);
-            } else {
-                this._absoluteTransform.copyFrom(this._matrix);
-            }
-
-            this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform);
-
-            for (var index = 0; index < this.children.length; index++) {
-                this.children[index]._updateDifferenceMatrix();
-            }
-        };
-
-        Bone.prototype.markAsDirty = function () {
-            this._skeleton._markAsDirty();
-        };
-        return Bone;
-    })();
-    BABYLON.Bone = Bone;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.bone.js.map

+ 0 - 90
Babylon/Bones/babylon.bone.ts

@@ -1,90 +0,0 @@
-module BABYLON {
-    export class Bone {
-        public children = new Array<Bone>();
-        public animations = new Array<Animation>();
-
-        private _skeleton: Skeleton;
-        private _matrix: Matrix;
-        private _baseMatrix: Matrix;
-        private _worldTransform = new BABYLON.Matrix();
-        private _absoluteTransform = new BABYLON.Matrix();
-        private _invertedAbsoluteTransform = new BABYLON.Matrix();
-        private _parent: Bone;
-
-        constructor(public name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix) {
-            this._skeleton = skeleton;
-            this._matrix = matrix;
-            this._baseMatrix = matrix;
-
-            skeleton.bones.push(this);
-
-            if (parentBone) {
-                this._parent = parentBone;
-                parentBone.children.push(this);
-            } else {
-                this._parent = null;
-            }
-
-            this._updateDifferenceMatrix();
-        }
-
-        // Members
-        public getParent():Bone {
-            return this._parent;
-        }
-
-        public getLocalMatrix():Matrix {
-            return this._matrix;
-        }
-
-        public getBaseMatrix(): Matrix {
-            return this._baseMatrix;
-        }
-
-        public getWorldMatrix(): Matrix {
-            return this._worldTransform;
-        }
-
-        public getInvertedAbsoluteTransform(): Matrix {
-            return this._invertedAbsoluteTransform;
-        }
-
-        public getAbsoluteMatrix(): Matrix {
-            var matrix = this._matrix.clone();
-            var parent = this._parent;
-
-            while (parent) {
-                matrix = matrix.multiply(parent.getLocalMatrix());
-                parent = parent.getParent();
-            }
-
-            return matrix;
-        }
-
-        // Methods
-        public updateMatrix(matrix: Matrix): void {
-            this._matrix = matrix;
-            this._skeleton._markAsDirty();
-
-            this._updateDifferenceMatrix();
-        }
-
-        private _updateDifferenceMatrix(): void {
-            if (this._parent) {
-                this._matrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);
-            } else {
-                this._absoluteTransform.copyFrom(this._matrix);
-            }
-
-            this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform);
-
-            for (var index = 0; index < this.children.length; index++) {
-                this.children[index]._updateDifferenceMatrix();
-            }
-        }
-
-        public markAsDirty(): void {
-            this._skeleton._markAsDirty();
-        }
-    }
-} 

+ 0 - 87
Babylon/Bones/babylon.skeleton.js

@@ -1,87 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Skeleton = (function () {
-        function Skeleton(name, id, scene) {
-            this.name = name;
-            this.id = id;
-            this.bones = new Array();
-            this._isDirty = true;
-            this._identity = BABYLON.Matrix.Identity();
-            this.bones = [];
-
-            this._scene = scene;
-
-            scene.skeletons.push(this);
-        }
-        // Members
-        Skeleton.prototype.getTransformMatrices = function () {
-            return this._transformMatrices;
-        };
-
-        // Methods
-        Skeleton.prototype._markAsDirty = function () {
-            this._isDirty = true;
-        };
-
-        Skeleton.prototype.prepare = function () {
-            if (!this._isDirty) {
-                return;
-            }
-
-            if (!this._transformMatrices || this._transformMatrices.length !== 16 * (this.bones.length + 1)) {
-                this._transformMatrices = new Float32Array(16 * (this.bones.length + 1));
-            }
-
-            for (var index = 0; index < this.bones.length; index++) {
-                var bone = this.bones[index];
-                var parentBone = bone.getParent();
-
-                if (parentBone) {
-                    bone.getLocalMatrix().multiplyToRef(parentBone.getWorldMatrix(), bone.getWorldMatrix());
-                } else {
-                    bone.getWorldMatrix().copyFrom(bone.getLocalMatrix());
-                }
-
-                bone.getInvertedAbsoluteTransform().multiplyToArray(bone.getWorldMatrix(), this._transformMatrices, index * 16);
-            }
-
-            this._identity.copyToArray(this._transformMatrices, this.bones.length * 16);
-
-            this._isDirty = false;
-        };
-
-        Skeleton.prototype.getAnimatables = function () {
-            if (!this._animatables || this._animatables.length != this.bones.length) {
-                this._animatables = [];
-
-                for (var index = 0; index < this.bones.length; index++) {
-                    this._animatables.push(this.bones[index]);
-                }
-            }
-
-            return this._animatables;
-        };
-
-        Skeleton.prototype.clone = function (name, id) {
-            var result = new BABYLON.Skeleton(name, id || name, this._scene);
-
-            for (var index = 0; index < this.bones.length; index++) {
-                var source = this.bones[index];
-                var parentBone = null;
-
-                if (source.getParent()) {
-                    var parentIndex = this.bones.indexOf(source.getParent());
-                    parentBone = result.bones[parentIndex];
-                }
-
-                var bone = new BABYLON.Bone(source.name, result, parentBone, source.getBaseMatrix());
-                BABYLON.Tools.DeepCopy(source.animations, bone.animations);
-            }
-
-            return result;
-        };
-        return Skeleton;
-    })();
-    BABYLON.Skeleton = Skeleton;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.skeleton.js.map

+ 0 - 89
Babylon/Bones/babylon.skeleton.ts

@@ -1,89 +0,0 @@
-module BABYLON {
-    export class Skeleton {
-        public bones = new Array<Bone>();
-
-        private _scene: Scene;
-        private _isDirty = true;
-        private _transformMatrices: Float32Array;
-        private _animatables: IAnimatable[];
-        private _identity = Matrix.Identity();
-
-        constructor(public name: string, public id: string, scene: Scene) {
-            this.bones = [];
-
-            this._scene = scene;
-
-            scene.skeletons.push(this);
-        }
-
-        // Members
-        public getTransformMatrices() {
-            return this._transformMatrices;
-        }
-
-        // Methods
-        public _markAsDirty(): void {
-            this._isDirty = true;
-        }
-
-        public prepare(): void {
-            if (!this._isDirty) {
-                return;
-            }
-
-            if (!this._transformMatrices || this._transformMatrices.length !== 16 * (this.bones.length + 1)) {
-                this._transformMatrices = new Float32Array(16 * (this.bones.length + 1));
-            }
-
-            for (var index = 0; index < this.bones.length; index++) {
-                var bone = this.bones[index];
-                var parentBone = bone.getParent();
-
-                if (parentBone) {
-                    bone.getLocalMatrix().multiplyToRef(parentBone.getWorldMatrix(), bone.getWorldMatrix());
-                } else {
-                    bone.getWorldMatrix().copyFrom(bone.getLocalMatrix());
-                }
-
-                bone.getInvertedAbsoluteTransform().multiplyToArray(bone.getWorldMatrix(), this._transformMatrices, index * 16);
-            }
-
-
-            this._identity.copyToArray(this._transformMatrices, this.bones.length * 16);
-
-
-            this._isDirty = false;
-        }
-
-        public getAnimatables(): IAnimatable[] {
-            if (!this._animatables || this._animatables.length != this.bones.length) {
-                this._animatables = [];
-
-                for (var index = 0; index < this.bones.length; index++) {
-                    this._animatables.push(this.bones[index]);
-                }
-            }
-
-            return this._animatables;
-        }
-
-        public clone(name: string, id: string): Skeleton {
-            var result = new BABYLON.Skeleton(name, id || name, this._scene);
-
-            for (var index = 0; index < this.bones.length; index++) {
-                var source = this.bones[index];
-                var parentBone = null;
-
-                if (source.getParent()) {
-                    var parentIndex = this.bones.indexOf(source.getParent());
-                    parentBone = result.bones[parentIndex];
-                }
-
-                var bone = new BABYLON.Bone(source.name, result, parentBone, source.getBaseMatrix());
-                BABYLON.Tools.DeepCopy(source.animations, bone.animations);
-            }
-
-            return result;
-        }
-    }
-}

+ 0 - 109
Babylon/Cameras/babylon.anaglyphCamera.js

@@ -1,109 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var buildCamera = function (that, name) {
-        that._leftCamera.isIntermediate = true;
-
-        that.subCameras.push(that._leftCamera);
-        that.subCameras.push(that._rightCamera);
-
-        that._leftTexture = new BABYLON.PassPostProcess(name + "_leftTexture", 1.0, that._leftCamera);
-        that._anaglyphPostProcess = new BABYLON.AnaglyphPostProcess(name + "_anaglyph", 1.0, that._rightCamera);
-
-        that._anaglyphPostProcess.onApply = function (effect) {
-            effect.setTextureFromPostProcess("leftSampler", that._leftTexture);
-        };
-
-        that._update();
-    };
-
-    var AnaglyphArcRotateCamera = (function (_super) {
-        __extends(AnaglyphArcRotateCamera, _super);
-        // ANY
-        function AnaglyphArcRotateCamera(name, alpha, beta, radius, target, eyeSpace, scene) {
-            _super.call(this, name, alpha, beta, radius, target, scene);
-
-            this._eyeSpace = BABYLON.Tools.ToRadians(eyeSpace);
-
-            this._leftCamera = new BABYLON.ArcRotateCamera(name + "_left", alpha - this._eyeSpace, beta, radius, target, scene);
-            this._rightCamera = new BABYLON.ArcRotateCamera(name + "_right", alpha + this._eyeSpace, beta, radius, target, scene);
-
-            buildCamera(this, name);
-        }
-        AnaglyphArcRotateCamera.prototype._update = function () {
-            this._updateCamera(this._leftCamera);
-            this._updateCamera(this._rightCamera);
-
-            this._leftCamera.alpha = this.alpha - this._eyeSpace;
-            this._rightCamera.alpha = this.alpha + this._eyeSpace;
-
-            _super.prototype._update.call(this);
-        };
-
-        AnaglyphArcRotateCamera.prototype._updateCamera = function (camera) {
-            camera.beta = this.beta;
-            camera.radius = this.radius;
-
-            camera.minZ = this.minZ;
-            camera.maxZ = this.maxZ;
-
-            camera.fov = this.fov;
-
-            camera.target = this.target;
-        };
-        return AnaglyphArcRotateCamera;
-    })(BABYLON.ArcRotateCamera);
-    BABYLON.AnaglyphArcRotateCamera = AnaglyphArcRotateCamera;
-
-    var AnaglyphFreeCamera = (function (_super) {
-        __extends(AnaglyphFreeCamera, _super);
-        function AnaglyphFreeCamera(name, position, eyeSpace, scene) {
-            _super.call(this, name, position, scene);
-
-            this._eyeSpace = BABYLON.Tools.ToRadians(eyeSpace);
-            this._transformMatrix = new BABYLON.Matrix();
-
-            this._leftCamera = new BABYLON.FreeCamera(name + "_left", position.clone(), scene);
-            this._rightCamera = new BABYLON.FreeCamera(name + "_right", position.clone(), scene);
-
-            buildCamera(this, name);
-        }
-        AnaglyphFreeCamera.prototype._getSubCameraPosition = function (eyeSpace, result) {
-            var target = this.getTarget();
-            BABYLON.Matrix.Translation(-target.x, -target.y, -target.z).multiplyToRef(BABYLON.Matrix.RotationY(eyeSpace), this._transformMatrix);
-
-            this._transformMatrix = this._transformMatrix.multiply(BABYLON.Matrix.Translation(target.x, target.y, target.z));
-
-            BABYLON.Vector3.TransformCoordinatesToRef(this.position, this._transformMatrix, result);
-        };
-
-        AnaglyphFreeCamera.prototype._update = function () {
-            this._getSubCameraPosition(-this._eyeSpace, this._leftCamera.position);
-            this._getSubCameraPosition(this._eyeSpace, this._rightCamera.position);
-
-            this._updateCamera(this._leftCamera);
-            this._updateCamera(this._rightCamera);
-
-            _super.prototype._update.call(this);
-        };
-
-        AnaglyphFreeCamera.prototype._updateCamera = function (camera) {
-            camera.minZ = this.minZ;
-            camera.maxZ = this.maxZ;
-
-            camera.fov = this.fov;
-
-            camera.viewport = this.viewport;
-
-            camera.setTarget(this.getTarget());
-        };
-        return AnaglyphFreeCamera;
-    })(BABYLON.FreeCamera);
-    BABYLON.AnaglyphFreeCamera = AnaglyphFreeCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.anaglyphCamera.js.map

+ 0 - 106
Babylon/Cameras/babylon.anaglyphCamera.ts

@@ -1,106 +0,0 @@
-module BABYLON {
-    var buildCamera = (that, name) => {
-        that._leftCamera.isIntermediate = true;
-
-        that.subCameras.push(that._leftCamera);
-        that.subCameras.push(that._rightCamera);
-
-        that._leftTexture = new BABYLON.PassPostProcess(name + "_leftTexture", 1.0, that._leftCamera);
-        that._anaglyphPostProcess = new BABYLON.AnaglyphPostProcess(name + "_anaglyph", 1.0, that._rightCamera);
-
-        that._anaglyphPostProcess.onApply = effect => {
-            effect.setTextureFromPostProcess("leftSampler", that._leftTexture);
-        };
-
-        that._update();
-    };
-
-    export class AnaglyphArcRotateCamera extends ArcRotateCamera {
-        private _eyeSpace: number;
-        private _leftCamera: ArcRotateCamera;
-        private _rightCamera: ArcRotateCamera;
-
-        // ANY
-        constructor(name: string, alpha: number, beta: number, radius: number, target, eyeSpace: number, scene) {
-            super(name, alpha, beta, radius, target, scene);
-
-            this._eyeSpace = BABYLON.Tools.ToRadians(eyeSpace);
-
-            this._leftCamera = new BABYLON.ArcRotateCamera(name + "_left", alpha - this._eyeSpace, beta, radius, target, scene);
-            this._rightCamera = new BABYLON.ArcRotateCamera(name + "_right", alpha + this._eyeSpace, beta, radius, target, scene);
-
-            buildCamera(this, name);
-        }
-
-        public _update(): void {
-            this._updateCamera(this._leftCamera);
-            this._updateCamera(this._rightCamera);
-
-            this._leftCamera.alpha = this.alpha - this._eyeSpace;
-            this._rightCamera.alpha = this.alpha + this._eyeSpace;
-
-            super._update();
-        }
-
-        public _updateCamera(camera: ArcRotateCamera) {
-            camera.beta = this.beta;
-            camera.radius = this.radius;
-
-            camera.minZ = this.minZ;
-            camera.maxZ = this.maxZ;
-
-            camera.fov = this.fov;
-
-            camera.target = this.target;
-        }
-    }
-
-    export class AnaglyphFreeCamera extends FreeCamera {
-        private _eyeSpace: number;
-        private _leftCamera: FreeCamera;
-        private _rightCamera: FreeCamera;
-        private _transformMatrix: Matrix;
-
-        constructor(name: string, position: Vector3, eyeSpace: number, scene: Scene) {
-            super(name, position, scene);
-
-            this._eyeSpace = BABYLON.Tools.ToRadians(eyeSpace);
-            this._transformMatrix = new BABYLON.Matrix();
-
-            this._leftCamera = new BABYLON.FreeCamera(name + "_left", position.clone(), scene);
-            this._rightCamera = new BABYLON.FreeCamera(name + "_right", position.clone(), scene);
-
-            buildCamera(this, name);
-        }
-
-        public _getSubCameraPosition(eyeSpace, result) {
-            var target = this.getTarget();
-            BABYLON.Matrix.Translation(-target.x, -target.y, -target.z).multiplyToRef(BABYLON.Matrix.RotationY(eyeSpace), this._transformMatrix);
-
-            this._transformMatrix = this._transformMatrix.multiply(BABYLON.Matrix.Translation(target.x, target.y, target.z));
-
-            BABYLON.Vector3.TransformCoordinatesToRef(this.position, this._transformMatrix, result);
-        }
-
-        public _update(): void {
-            this._getSubCameraPosition(-this._eyeSpace, this._leftCamera.position);
-            this._getSubCameraPosition(this._eyeSpace, this._rightCamera.position);
-
-            this._updateCamera(this._leftCamera);
-            this._updateCamera(this._rightCamera);
-
-            super._update();
-        }
-
-        public _updateCamera(camera: FreeCamera): void {
-            camera.minZ = this.minZ;
-            camera.maxZ = this.maxZ;
-
-            camera.fov = this.fov;
-
-            camera.viewport = this.viewport;
-
-            camera.setTarget(this.getTarget());
-        }
-    }
-} 

+ 0 - 537
Babylon/Cameras/babylon.arcRotateCamera.js

@@ -1,537 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var eventPrefix = BABYLON.Tools.GetPointerPrefix();
-
-    var ArcRotateCamera = (function (_super) {
-        __extends(ArcRotateCamera, _super);
-        function ArcRotateCamera(name, alpha, beta, radius, target, scene) {
-            _super.call(this, name, BABYLON.Vector3.Zero(), scene);
-            this.alpha = alpha;
-            this.beta = beta;
-            this.radius = radius;
-            this.target = target;
-            this.inertialAlphaOffset = 0;
-            this.inertialBetaOffset = 0;
-            this.inertialRadiusOffset = 0;
-            this.lowerAlphaLimit = null;
-            this.upperAlphaLimit = null;
-            this.lowerBetaLimit = 0.01;
-            this.upperBetaLimit = Math.PI;
-            this.lowerRadiusLimit = null;
-            this.upperRadiusLimit = null;
-            this.angularSensibility = 1000.0;
-            this.wheelPrecision = 3.0;
-            this.keysUp = [38];
-            this.keysDown = [40];
-            this.keysLeft = [37];
-            this.keysRight = [39];
-            this.zoomOnFactor = 1;
-            this.targetScreenOffset = BABYLON.Vector2.Zero();
-            this._keys = [];
-            this._viewMatrix = new BABYLON.Matrix();
-            this.checkCollisions = false;
-            this.collisionRadius = new BABYLON.Vector3(0.5, 0.5, 0.5);
-            this._collider = new BABYLON.Collider();
-            this._previousPosition = BABYLON.Vector3.Zero();
-            this._collisionVelocity = BABYLON.Vector3.Zero();
-            this._newPosition = BABYLON.Vector3.Zero();
-            // Pinch
-            // value for pinch step scaling
-            // set to 20 by default
-            this.pinchPrecision = 20;
-
-            this.getViewMatrix();
-        }
-        ArcRotateCamera.prototype._getTargetPosition = function () {
-            return this.target.position || this.target;
-        };
-
-        // Cache
-        ArcRotateCamera.prototype._initCache = function () {
-            _super.prototype._initCache.call(this);
-            this._cache.target = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-            this._cache.alpha = undefined;
-            this._cache.beta = undefined;
-            this._cache.radius = undefined;
-            this._cache.targetScreenOffset = undefined;
-        };
-
-        ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {
-            if (!ignoreParentClass) {
-                _super.prototype._updateCache.call(this);
-            }
-
-            this._cache.target.copyFrom(this._getTargetPosition());
-            this._cache.alpha = this.alpha;
-            this._cache.beta = this.beta;
-            this._cache.radius = this.radius;
-            this._cache.targetScreenOffset = this.targetScreenOffset.clone();
-        };
-
-        // Synchronized
-        ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {
-            if (!_super.prototype._isSynchronizedViewMatrix.call(this))
-                return false;
-
-            return this._cache.target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius && this._cache.targetScreenOffset.equals(this.targetScreenOffset);
-        };
-
-        // Methods
-        ArcRotateCamera.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            var previousPosition;
-            var pointerId;
-
-            // to know if pinch started
-            var pinchStarted = false;
-
-            // two pinch point on X
-            // that will use for find if user action is pinch open or pinch close
-            var pinchPointX1, pinchPointX2;
-
-            if (this._attachedElement) {
-                return;
-            }
-            this._attachedElement = element;
-
-            var engine = this.getEngine();
-
-            if (this._onPointerDown === undefined) {
-                this._onPointerDown = function (evt) {
-                    if (pointerId) {
-                        return;
-                    }
-
-                    pointerId = evt.pointerId;
-
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onPointerUp = function (evt) {
-                    previousPosition = null;
-                    pointerId = null;
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onPointerMove = function (evt) {
-                    if (!previousPosition) {
-                        return;
-                    }
-
-                    if (pointerId !== evt.pointerId) {
-                        return;
-                    }
-
-                    // return pinch is started
-                    if (pinchStarted) {
-                        return;
-                    }
-
-                    var offsetX = evt.clientX - previousPosition.x;
-                    var offsetY = evt.clientY - previousPosition.y;
-
-                    _this.inertialAlphaOffset -= offsetX / _this.angularSensibility;
-                    _this.inertialBetaOffset -= offsetY / _this.angularSensibility;
-
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onMouseMove = function (evt) {
-                    if (!engine.isPointerLock) {
-                        return;
-                    }
-
-                    // return pinch is started
-                    if (pinchStarted) {
-                        return;
-                    }
-
-                    var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                    var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-
-                    _this.inertialAlphaOffset -= offsetX / _this.angularSensibility;
-                    _this.inertialBetaOffset -= offsetY / _this.angularSensibility;
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._wheel = function (event) {
-                    var delta = 0;
-                    if (event.wheelDelta) {
-                        delta = event.wheelDelta / (_this.wheelPrecision * 40);
-                    } else if (event.detail) {
-                        delta = -event.detail / _this.wheelPrecision;
-                    }
-
-                    if (delta)
-                        _this.inertialRadiusOffset += delta;
-
-                    if (event.preventDefault) {
-                        if (!noPreventDefault) {
-                            event.preventDefault();
-                        }
-                    }
-                };
-
-                this._onKeyDown = function (evt) {
-                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1) {
-                        var index = _this._keys.indexOf(evt.keyCode);
-
-                        if (index === -1) {
-                            _this._keys.push(evt.keyCode);
-                        }
-
-                        if (evt.preventDefault) {
-                            if (!noPreventDefault) {
-                                evt.preventDefault();
-                            }
-                        }
-                    }
-                };
-
-                this._onKeyUp = function (evt) {
-                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1) {
-                        var index = _this._keys.indexOf(evt.keyCode);
-
-                        if (index >= 0) {
-                            _this._keys.splice(index, 1);
-                        }
-
-                        if (evt.preventDefault) {
-                            if (!noPreventDefault) {
-                                evt.preventDefault();
-                            }
-                        }
-                    }
-                };
-
-                this._onLostFocus = function () {
-                    _this._keys = [];
-                    pointerId = null;
-                };
-
-                this._onGestureStart = function (e) {
-                    if (window.MSGesture === undefined) {
-                        return;
-                    }
-
-                    if (!_this._MSGestureHandler) {
-                        _this._MSGestureHandler = new MSGesture();
-                        _this._MSGestureHandler.target = element;
-                    }
-
-                    _this._MSGestureHandler.addPointer(e.pointerId);
-                };
-
-                this._onGesture = function (e) {
-                    _this.radius *= e.scale;
-
-                    if (e.preventDefault) {
-                        if (!noPreventDefault) {
-                            e.stopPropagation();
-                            e.preventDefault();
-                        }
-                    }
-                };
-
-                this._reset = function () {
-                    _this._keys = [];
-                    _this.inertialAlphaOffset = 0;
-                    _this.inertialBetaOffset = 0;
-                    _this.inertialRadiusOffset = 0;
-                    previousPosition = null;
-                    pointerId = null;
-                };
-
-                this._touchStart = function (event) {
-                    if (event.touches.length == 2) {
-                        //-- start pinch if two fingers on the screen
-                        pinchStarted = true;
-                        _this._pinchStart(event);
-                    }
-                };
-                this._touchMove = function (event) {
-                    if (pinchStarted) {
-                        //-- make scaling
-                        _this._pinchMove(event);
-                    }
-                };
-                this._touchEnd = function (event) {
-                    if (pinchStarted) {
-                        //-- end of pinch
-                        _this._pinchEnd(event);
-                    }
-                };
-
-                this._pinchStart = function (event) {
-                    // save origin touch point
-                    pinchPointX1 = event.touches[0].clientX;
-                    pinchPointX2 = event.touches[1].clientX;
-
-                    // block the camera
-                    // if not it rotate around target during pinch
-                    pinchStarted = true;
-                };
-                this._pinchMove = function (event) {
-                    // variable for new camera's radius
-                    var delta = 0;
-
-                    // variables to know if pinch open or pinch close
-                    var direction = 1;
-                    var distanceXOrigine, distanceXNow;
-
-                    if (event.touches.length != 2)
-                        return;
-
-                    // calculate absolute distances of the two fingers
-                    distanceXOrigine = Math.abs(pinchPointX1 - pinchPointX2);
-                    distanceXNow = Math.abs(event.touches[0].clientX - event.touches[1].clientX);
-
-                    // if distanceXNow < distanceXOrigine -> pinch close so direction = -1
-                    if (distanceXNow < distanceXOrigine) {
-                        direction = -1;
-                    }
-
-                    // calculate new radius
-                    delta = (_this.pinchPrecision / (_this.wheelPrecision * 40)) * direction;
-
-                    // set new radius
-                    _this.inertialRadiusOffset += delta;
-
-                    // save origin touch point
-                    pinchPointX1 = event.touches[0].clientX;
-                    pinchPointX2 = event.touches[1].clientX;
-                };
-                this._pinchEnd = function (event) {
-                    // cancel pinch and deblock camera rotation
-                    pinchStarted = false;
-                };
-            }
-
-            element.addEventListener(eventPrefix + "down", this._onPointerDown, false);
-            element.addEventListener(eventPrefix + "up", this._onPointerUp, false);
-            element.addEventListener(eventPrefix + "out", this._onPointerUp, false);
-            element.addEventListener(eventPrefix + "move", this._onPointerMove, false);
-            element.addEventListener("mousemove", this._onMouseMove, false);
-            element.addEventListener("MSPointerDown", this._onGestureStart, false);
-            element.addEventListener("MSGestureChange", this._onGesture, false);
-            element.addEventListener('mousewheel', this._wheel, false);
-            element.addEventListener('DOMMouseScroll', this._wheel, false);
-
-            // pinch
-            element.addEventListener('touchstart', this._touchStart, false);
-            element.addEventListener('touchmove', this._touchMove, false);
-            element.addEventListener('touchend', this._touchEnd, false);
-
-            BABYLON.Tools.RegisterTopRootEvents([
-                { name: "keydown", handler: this._onKeyDown },
-                { name: "keyup", handler: this._onKeyUp },
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        };
-
-        ArcRotateCamera.prototype.detachControl = function (element) {
-            if (this._attachedElement != element) {
-                return;
-            }
-
-            element.removeEventListener(eventPrefix + "down", this._onPointerDown);
-            element.removeEventListener(eventPrefix + "up", this._onPointerUp);
-            element.removeEventListener(eventPrefix + "out", this._onPointerUp);
-            element.removeEventListener(eventPrefix + "move", this._onPointerMove);
-            element.removeEventListener("mousemove", this._onMouseMove);
-            element.removeEventListener("MSPointerDown", this._onGestureStart);
-            element.removeEventListener("MSGestureChange", this._onGesture);
-            element.removeEventListener('mousewheel', this._wheel);
-            element.removeEventListener('DOMMouseScroll', this._wheel);
-
-            // pinch
-            element.removeEventListener('touchstart', this._touchStart);
-            element.removeEventListener('touchmove', this._touchMove);
-            element.removeEventListener('touchend', this._touchEnd);
-
-            BABYLON.Tools.UnregisterTopRootEvents([
-                { name: "keydown", handler: this._onKeyDown },
-                { name: "keyup", handler: this._onKeyUp },
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-
-            this._MSGestureHandler = null;
-            this._attachedElement = null;
-
-            if (this._reset) {
-                this._reset();
-            }
-        };
-
-        ArcRotateCamera.prototype._update = function () {
-            for (var index = 0; index < this._keys.length; index++) {
-                var keyCode = this._keys[index];
-
-                if (this.keysLeft.indexOf(keyCode) !== -1) {
-                    this.inertialAlphaOffset -= 0.01;
-                } else if (this.keysUp.indexOf(keyCode) !== -1) {
-                    this.inertialBetaOffset -= 0.01;
-                } else if (this.keysRight.indexOf(keyCode) !== -1) {
-                    this.inertialAlphaOffset += 0.01;
-                } else if (this.keysDown.indexOf(keyCode) !== -1) {
-                    this.inertialBetaOffset += 0.01;
-                }
-            }
-
-            // Inertia
-            if (this.inertialAlphaOffset != 0 || this.inertialBetaOffset != 0 || this.inertialRadiusOffset != 0) {
-                this.alpha += this.inertialAlphaOffset;
-                this.beta += this.inertialBetaOffset;
-                this.radius -= this.inertialRadiusOffset;
-
-                this.inertialAlphaOffset *= this.inertia;
-                this.inertialBetaOffset *= this.inertia;
-                this.inertialRadiusOffset *= this.inertia;
-
-                if (Math.abs(this.inertialAlphaOffset) < BABYLON.Engine.Epsilon)
-                    this.inertialAlphaOffset = 0;
-
-                if (Math.abs(this.inertialBetaOffset) < BABYLON.Engine.Epsilon)
-                    this.inertialBetaOffset = 0;
-
-                if (Math.abs(this.inertialRadiusOffset) < BABYLON.Engine.Epsilon)
-                    this.inertialRadiusOffset = 0;
-            }
-
-            // Limits
-            if (this.lowerAlphaLimit && this.alpha < this.lowerAlphaLimit) {
-                this.alpha = this.lowerAlphaLimit;
-            }
-            if (this.upperAlphaLimit && this.alpha > this.upperAlphaLimit) {
-                this.alpha = this.upperAlphaLimit;
-            }
-            if (this.lowerBetaLimit && this.beta < this.lowerBetaLimit) {
-                this.beta = this.lowerBetaLimit;
-            }
-            if (this.upperBetaLimit && this.beta > this.upperBetaLimit) {
-                this.beta = this.upperBetaLimit;
-            }
-            if (this.lowerRadiusLimit && this.radius < this.lowerRadiusLimit) {
-                this.radius = this.lowerRadiusLimit;
-            }
-            if (this.upperRadiusLimit && this.radius > this.upperRadiusLimit) {
-                this.radius = this.upperRadiusLimit;
-            }
-        };
-
-        ArcRotateCamera.prototype.setPosition = function (position) {
-            var radiusv3 = position.subtract(this._getTargetPosition());
-            this.radius = radiusv3.length();
-
-            // Alpha
-            this.alpha = Math.acos(radiusv3.x / Math.sqrt(Math.pow(radiusv3.x, 2) + Math.pow(radiusv3.z, 2)));
-
-            if (radiusv3.z < 0) {
-                this.alpha = 2 * Math.PI - this.alpha;
-            }
-
-            // Beta
-            this.beta = Math.acos(radiusv3.y / this.radius);
-        };
-
-        ArcRotateCamera.prototype._getViewMatrix = function () {
-            // Compute
-            var cosa = Math.cos(this.alpha);
-            var sina = Math.sin(this.alpha);
-            var cosb = Math.cos(this.beta);
-            var sinb = Math.sin(this.beta);
-
-            var target = this._getTargetPosition();
-
-            target.addToRef(new BABYLON.Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this.position);
-
-            if (this.checkCollisions) {
-                this._collider.radius = this.collisionRadius;
-                this.position.subtractToRef(this._previousPosition, this._collisionVelocity);
-
-                this.getScene()._getNewPosition(this._previousPosition, this._collisionVelocity, this._collider, 3, this._newPosition);
-
-                if (!this._newPosition.equalsWithEpsilon(this.position)) {
-                    this.position.copyFrom(this._previousPosition);
-
-                    this.alpha = this._previousAlpha;
-                    this.beta = this._previousBeta;
-                    this.radius = this._previousRadius;
-
-                    if (this.onCollide) {
-                        this.onCollide(this._collider.collidedMesh);
-                    }
-                }
-            }
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, target, this.upVector, this._viewMatrix);
-
-            this._previousAlpha = this.alpha;
-            this._previousBeta = this.beta;
-            this._previousRadius = this.radius;
-            this._previousPosition.copyFrom(this.position);
-
-            this._viewMatrix.m[12] += this.targetScreenOffset.x;
-            this._viewMatrix.m[13] += this.targetScreenOffset.y;
-
-            return this._viewMatrix;
-        };
-
-        ArcRotateCamera.prototype.zoomOn = function (meshes) {
-            meshes = meshes || this.getScene().meshes;
-
-            var minMaxVector = BABYLON.Mesh.MinMax(meshes);
-            var distance = BABYLON.Vector3.Distance(minMaxVector.min, minMaxVector.max);
-
-            this.radius = distance * this.zoomOnFactor;
-
-            this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance });
-        };
-
-        ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance) {
-            var meshesOrMinMaxVector;
-            var distance;
-
-            if (meshesOrMinMaxVectorAndDistance.min === undefined) {
-                meshesOrMinMaxVector = meshesOrMinMaxVectorAndDistance || this.getScene().meshes;
-                meshesOrMinMaxVector = BABYLON.Mesh.MinMax(meshesOrMinMaxVector);
-                distance = BABYLON.Vector3.Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);
-            } else {
-                meshesOrMinMaxVector = meshesOrMinMaxVectorAndDistance;
-                distance = meshesOrMinMaxVectorAndDistance.distance;
-            }
-
-            this.target = BABYLON.Mesh.Center(meshesOrMinMaxVector);
-
-            this.maxZ = distance * 2;
-        };
-        return ArcRotateCamera;
-    })(BABYLON.Camera);
-    BABYLON.ArcRotateCamera = ArcRotateCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.arcRotateCamera.js.map

+ 0 - 560
Babylon/Cameras/babylon.arcRotateCamera.ts

@@ -1,560 +0,0 @@
-module BABYLON {
-    var eventPrefix = Tools.GetPointerPrefix();
-
-    export class ArcRotateCamera extends Camera {
-        public inertialAlphaOffset = 0;
-        public inertialBetaOffset = 0;
-        public inertialRadiusOffset = 0;
-        public lowerAlphaLimit = null;
-        public upperAlphaLimit = null;
-        public lowerBetaLimit = 0.01;
-        public upperBetaLimit = Math.PI;
-        public lowerRadiusLimit = null;
-        public upperRadiusLimit = null;
-        public angularSensibility = 1000.0;
-        public wheelPrecision = 3.0;
-        public keysUp = [38];
-        public keysDown = [40];
-        public keysLeft = [37];
-        public keysRight = [39];
-        public zoomOnFactor = 1;
-		public targetScreenOffset = Vector2.Zero();
-		
-		
-        private _keys = [];
-        private _viewMatrix = new BABYLON.Matrix();
-        private _attachedElement: HTMLElement;
-
-        private _onPointerDown: (e: PointerEvent) => void;
-        private _onPointerUp: (e: PointerEvent) => void;
-        private _onPointerMove: (e: PointerEvent) => void;
-        private _wheel: (e: MouseWheelEvent) => void;
-        private _onMouseMove: (e: MouseEvent) => any;
-        private _onKeyDown: (e: KeyboardEvent) => any;
-        private _onKeyUp: (e: KeyboardEvent) => any;
-        private _onLostFocus: (e: FocusEvent) => any;
-        private _reset: () => void;
-        private _onGestureStart: (e: PointerEvent) => void;
-        private _onGesture: (e: MSGestureEvent) => void;
-        private _MSGestureHandler: MSGesture;
-
-        // Collisions
-        public onCollide: (collidedMesh: AbstractMesh) => void;
-        public checkCollisions = false;
-        public collisionRadius = new Vector3(0.5, 0.5, 0.5);
-        private _collider = new Collider();
-        private _previousPosition = Vector3.Zero();
-        private _collisionVelocity = Vector3.Zero();
-        private _newPosition = Vector3.Zero();
-        private _previousAlpha: number;
-        private _previousBeta: number;
-        private _previousRadius: number;
-
-        // Pinch
-        // value for pinch step scaling
-        // set to 20 by default
-        public pinchPrecision = 20;
-        // Event for pinch
-        private _touchStart: (e: any) => void;
-        private _touchMove: (e: any) => void;
-        private _touchEnd: (e: any) => void;
-        // Method for pinch
-        private _pinchStart: (e: any) => void;
-        private _pinchMove: (e: any) => void;
-        private _pinchEnd: (e: any) => void;
-
-        constructor(name: string, public alpha: number, public beta: number, public radius: number, public target: any, scene: Scene) {
-            super(name, BABYLON.Vector3.Zero(), scene);
-
-            this.getViewMatrix();
-        }
-
-        public _getTargetPosition(): Vector3 {
-            return this.target.position || this.target;
-        }
-
-        // Cache
-        public _initCache(): void {
-            super._initCache();
-            this._cache.target = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-            this._cache.alpha = undefined;
-            this._cache.beta = undefined;
-            this._cache.radius = undefined;
-			this._cache.targetScreenOffset = undefined;
-        }
-
-        public _updateCache(ignoreParentClass?: boolean): void {
-            if (!ignoreParentClass) {
-                super._updateCache();
-            }
-
-            this._cache.target.copyFrom(this._getTargetPosition());
-            this._cache.alpha = this.alpha;
-            this._cache.beta = this.beta;
-            this._cache.radius = this.radius;
-			this._cache.targetScreenOffset = this.targetScreenOffset.clone();
-        }
-
-        // Synchronized
-        public _isSynchronizedViewMatrix(): boolean {
-            if (!super._isSynchronizedViewMatrix())
-                return false;
-
-            return this._cache.target.equals(this._getTargetPosition())
-                && this._cache.alpha === this.alpha
-                && this._cache.beta === this.beta
-                && this._cache.radius === this.radius
-				&& this._cache.targetScreenOffset.equals(this.targetScreenOffset);
-        }
-
-        // Methods
-        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
-            var previousPosition;
-            var pointerId;
-            // to know if pinch started
-            var pinchStarted = false;
-            // two pinch point on X
-            // that will use for find if user action is pinch open or pinch close
-            var pinchPointX1, pinchPointX2;
-
-            if (this._attachedElement) {
-                return;
-            }
-            this._attachedElement = element;
-
-            var engine = this.getEngine();
-
-            if (this._onPointerDown === undefined) {
-                this._onPointerDown = evt => {
-
-                    if (pointerId) {
-                        return;
-                    }
-
-                    pointerId = evt.pointerId;
-
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onPointerUp = evt => {
-                    previousPosition = null;
-                    pointerId = null;
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-
-                this._onPointerMove = evt => {
-                    if (!previousPosition) {
-                        return;
-                    }
-
-                    if (pointerId !== evt.pointerId) {
-                        return;
-                    }
-
-                    // return pinch is started
-                    if (pinchStarted) {
-                        return;
-                    }
-
-                    var offsetX = evt.clientX - previousPosition.x;
-                    var offsetY = evt.clientY - previousPosition.y;
-
-                    this.inertialAlphaOffset -= offsetX / this.angularSensibility;
-                    this.inertialBetaOffset -= offsetY / this.angularSensibility;
-
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onMouseMove = evt => {
-                    if (!engine.isPointerLock) {
-                        return;
-                    }
-
-                    // return pinch is started
-                    if (pinchStarted) {
-                        return;
-                    }
-
-                    var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                    var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-
-                    this.inertialAlphaOffset -= offsetX / this.angularSensibility;
-                    this.inertialBetaOffset -= offsetY / this.angularSensibility;
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._wheel = event => {
-                    var delta = 0;
-                    if (event.wheelDelta) {
-                        delta = event.wheelDelta / (this.wheelPrecision * 40);
-                    } else if (event.detail) {
-                        delta = -event.detail / this.wheelPrecision;
-                    }
-
-                    if (delta)
-                        this.inertialRadiusOffset += delta;
-
-                    if (event.preventDefault) {
-                        if (!noPreventDefault) {
-                            event.preventDefault();
-                        }
-                    }
-                };
-
-                this._onKeyDown = evt => {
-                    if (this.keysUp.indexOf(evt.keyCode) !== -1 ||
-                        this.keysDown.indexOf(evt.keyCode) !== -1 ||
-                        this.keysLeft.indexOf(evt.keyCode) !== -1 ||
-                        this.keysRight.indexOf(evt.keyCode) !== -1) {
-                        var index = this._keys.indexOf(evt.keyCode);
-
-                        if (index === -1) {
-                            this._keys.push(evt.keyCode);
-                        }
-
-                        if (evt.preventDefault) {
-                            if (!noPreventDefault) {
-                                evt.preventDefault();
-                            }
-                        }
-                    }
-                };
-
-                this._onKeyUp = evt => {
-                    if (this.keysUp.indexOf(evt.keyCode) !== -1 ||
-                        this.keysDown.indexOf(evt.keyCode) !== -1 ||
-                        this.keysLeft.indexOf(evt.keyCode) !== -1 ||
-                        this.keysRight.indexOf(evt.keyCode) !== -1) {
-                        var index = this._keys.indexOf(evt.keyCode);
-
-                        if (index >= 0) {
-                            this._keys.splice(index, 1);
-                        }
-
-                        if (evt.preventDefault) {
-                            if (!noPreventDefault) {
-                                evt.preventDefault();
-                            }
-                        }
-                    }
-                };
-
-                this._onLostFocus = () => {
-                    this._keys = [];
-                    pointerId = null;
-                };
-
-                this._onGestureStart = e => {
-                    if (window.MSGesture === undefined) {
-                        return;
-                    }
-
-                    if (!this._MSGestureHandler) {
-                        this._MSGestureHandler = new MSGesture();
-                        this._MSGestureHandler.target = element;
-                    }
-
-                    this._MSGestureHandler.addPointer(e.pointerId);
-                };
-
-                this._onGesture = e => {
-                    this.radius *= e.scale;
-
-
-                    if (e.preventDefault) {
-                        if (!noPreventDefault) {
-                            e.stopPropagation();
-                            e.preventDefault();
-                        }
-                    }
-                };
-
-                this._reset = () => {
-                    this._keys = [];
-                    this.inertialAlphaOffset = 0;
-                    this.inertialBetaOffset = 0;
-                    this.inertialRadiusOffset = 0;
-                    previousPosition = null;
-                    pointerId = null;
-                };
-
-                this._touchStart = event => {
-                    if (event.touches.length == 2) {
-                        //-- start pinch if two fingers on the screen
-                        pinchStarted = true;
-                        this._pinchStart(event);
-                    }
-                };
-                this._touchMove = event => {
-                    if (pinchStarted) {
-                        //-- make scaling
-                        this._pinchMove(event);
-                    }
-                };
-                this._touchEnd = event => {
-                    if (pinchStarted) {
-                        //-- end of pinch
-                        this._pinchEnd(event);
-                    }
-                };
-
-                this._pinchStart = event => {
-                    // save origin touch point
-                    pinchPointX1 = event.touches[0].clientX;
-                    pinchPointX2 = event.touches[1].clientX;
-                    // block the camera 
-                    // if not it rotate around target during pinch
-                    pinchStarted = true;
-                };
-                this._pinchMove = event => {
-                    // variable for new camera's radius
-                    var delta = 0;
-                    // variables to know if pinch open or pinch close
-                    var direction = 1;
-                    var distanceXOrigine, distanceXNow;
-
-                    if (event.touches.length != 2)
-                        return;
-                    // calculate absolute distances of the two fingers
-                    distanceXOrigine = Math.abs(pinchPointX1 - pinchPointX2);
-                    distanceXNow = Math.abs(event.touches[0].clientX - event.touches[1].clientX);
-
-                    // if distanceXNow < distanceXOrigine -> pinch close so direction = -1
-                    if (distanceXNow < distanceXOrigine) {
-                        direction = -1;
-                    }
-                    // calculate new radius
-                    delta = (this.pinchPrecision / (this.wheelPrecision * 40)) * direction;
-                    // set new radius
-                    this.inertialRadiusOffset += delta;
-                    // save origin touch point
-                    pinchPointX1 = event.touches[0].clientX;
-                    pinchPointX2 = event.touches[1].clientX;
-                };
-                this._pinchEnd = event => {
-                    // cancel pinch and deblock camera rotation
-                    pinchStarted = false;
-                };
-            }
-
-            element.addEventListener(eventPrefix + "down", this._onPointerDown, false);
-            element.addEventListener(eventPrefix + "up", this._onPointerUp, false);
-            element.addEventListener(eventPrefix + "out", this._onPointerUp, false);
-            element.addEventListener(eventPrefix + "move", this._onPointerMove, false);
-            element.addEventListener("mousemove", this._onMouseMove, false);
-            element.addEventListener("MSPointerDown", this._onGestureStart, false);
-            element.addEventListener("MSGestureChange", this._onGesture, false);
-            element.addEventListener('mousewheel', this._wheel, false);
-            element.addEventListener('DOMMouseScroll', this._wheel, false);
-            // pinch
-            element.addEventListener('touchstart', this._touchStart, false);
-            element.addEventListener('touchmove', this._touchMove, false);
-            element.addEventListener('touchend', this._touchEnd, false);
-
-            Tools.RegisterTopRootEvents([
-                { name: "keydown", handler: this._onKeyDown },
-                { name: "keyup", handler: this._onKeyUp },
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        }
-
-        public detachControl(element: HTMLElement): void {
-            if (this._attachedElement != element) {
-                return;
-            }
-
-            element.removeEventListener(eventPrefix + "down", this._onPointerDown);
-            element.removeEventListener(eventPrefix + "up", this._onPointerUp);
-            element.removeEventListener(eventPrefix + "out", this._onPointerUp);
-            element.removeEventListener(eventPrefix + "move", this._onPointerMove);
-            element.removeEventListener("mousemove", this._onMouseMove);
-            element.removeEventListener("MSPointerDown", this._onGestureStart);
-            element.removeEventListener("MSGestureChange", this._onGesture);
-            element.removeEventListener('mousewheel', this._wheel);
-            element.removeEventListener('DOMMouseScroll', this._wheel);
-            // pinch
-            element.removeEventListener('touchstart', this._touchStart);
-            element.removeEventListener('touchmove', this._touchMove);
-            element.removeEventListener('touchend', this._touchEnd);
-
-            Tools.UnregisterTopRootEvents([
-                { name: "keydown", handler: this._onKeyDown },
-                { name: "keyup", handler: this._onKeyUp },
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-
-            this._MSGestureHandler = null;
-            this._attachedElement = null;
-
-            if (this._reset) {
-                this._reset();
-            }
-        }
-
-        public _update(): void {
-            // Keyboard
-            for (var index = 0; index < this._keys.length; index++) {
-                var keyCode = this._keys[index];
-
-                if (this.keysLeft.indexOf(keyCode) !== -1) {
-                    this.inertialAlphaOffset -= 0.01;
-                } else if (this.keysUp.indexOf(keyCode) !== -1) {
-                    this.inertialBetaOffset -= 0.01;
-                } else if (this.keysRight.indexOf(keyCode) !== -1) {
-                    this.inertialAlphaOffset += 0.01;
-                } else if (this.keysDown.indexOf(keyCode) !== -1) {
-                    this.inertialBetaOffset += 0.01;
-                }
-            }
-
-            // Inertia
-            if (this.inertialAlphaOffset != 0 || this.inertialBetaOffset != 0 || this.inertialRadiusOffset != 0) {
-
-                this.alpha += this.inertialAlphaOffset;
-                this.beta += this.inertialBetaOffset;
-                this.radius -= this.inertialRadiusOffset;
-
-                this.inertialAlphaOffset *= this.inertia;
-                this.inertialBetaOffset *= this.inertia;
-                this.inertialRadiusOffset *= this.inertia;
-
-                if (Math.abs(this.inertialAlphaOffset) < BABYLON.Engine.Epsilon)
-                    this.inertialAlphaOffset = 0;
-
-                if (Math.abs(this.inertialBetaOffset) < BABYLON.Engine.Epsilon)
-                    this.inertialBetaOffset = 0;
-
-                if (Math.abs(this.inertialRadiusOffset) < BABYLON.Engine.Epsilon)
-                    this.inertialRadiusOffset = 0;
-            }
-
-            // Limits
-            if (this.lowerAlphaLimit && this.alpha < this.lowerAlphaLimit) {
-                this.alpha = this.lowerAlphaLimit;
-            }
-            if (this.upperAlphaLimit && this.alpha > this.upperAlphaLimit) {
-                this.alpha = this.upperAlphaLimit;
-            }
-            if (this.lowerBetaLimit && this.beta < this.lowerBetaLimit) {
-                this.beta = this.lowerBetaLimit;
-            }
-            if (this.upperBetaLimit && this.beta > this.upperBetaLimit) {
-                this.beta = this.upperBetaLimit;
-            }
-            if (this.lowerRadiusLimit && this.radius < this.lowerRadiusLimit) {
-                this.radius = this.lowerRadiusLimit;
-            }
-            if (this.upperRadiusLimit && this.radius > this.upperRadiusLimit) {
-                this.radius = this.upperRadiusLimit;
-            }
-        }
-
-        public setPosition(position: Vector3): void {
-            var radiusv3 = position.subtract(this._getTargetPosition());
-            this.radius = radiusv3.length();
-
-            // Alpha
-            this.alpha = Math.acos(radiusv3.x / Math.sqrt(Math.pow(radiusv3.x, 2) + Math.pow(radiusv3.z, 2)));
-
-            if (radiusv3.z < 0) {
-                this.alpha = 2 * Math.PI - this.alpha;
-            }
-
-            // Beta
-            this.beta = Math.acos(radiusv3.y / this.radius);
-        }
-
-        public _getViewMatrix(): Matrix {
-            // Compute
-            var cosa = Math.cos(this.alpha);
-            var sina = Math.sin(this.alpha);
-            var cosb = Math.cos(this.beta);
-            var sinb = Math.sin(this.beta);
-
-            var target = this._getTargetPosition();
-
-            target.addToRef(new BABYLON.Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this.position);
-
-            if (this.checkCollisions) {
-                this._collider.radius = this.collisionRadius;
-                this.position.subtractToRef(this._previousPosition, this._collisionVelocity);
-
-                this.getScene()._getNewPosition(this._previousPosition, this._collisionVelocity, this._collider, 3, this._newPosition);
-
-                if (!this._newPosition.equalsWithEpsilon(this.position)) {
-                    this.position.copyFrom(this._previousPosition);
-
-                    this.alpha = this._previousAlpha;
-                    this.beta = this._previousBeta;
-                    this.radius = this._previousRadius;
-
-                    if (this.onCollide) {
-                        this.onCollide(this._collider.collidedMesh);
-                    }
-                }
-            }
-
-            Matrix.LookAtLHToRef(this.position, target, this.upVector, this._viewMatrix);
-
-            this._previousAlpha = this.alpha;
-            this._previousBeta = this.beta;
-            this._previousRadius = this.radius;
-            this._previousPosition.copyFrom(this.position);
-
-			this._viewMatrix.m[12] += this.targetScreenOffset.x;
-			this._viewMatrix.m[13] += this.targetScreenOffset.y;
-						
-            return this._viewMatrix;
-        }
-
-        public zoomOn(meshes?: AbstractMesh[]): void {
-            meshes = meshes || this.getScene().meshes;
-
-            var minMaxVector = BABYLON.Mesh.MinMax(meshes);
-            var distance = BABYLON.Vector3.Distance(minMaxVector.min, minMaxVector.max);
-
-            this.radius = distance * this.zoomOnFactor;
-
-            this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance });
-        }
-
-        public focusOn(meshesOrMinMaxVectorAndDistance): void {
-            var meshesOrMinMaxVector;
-            var distance;
-
-            if (meshesOrMinMaxVectorAndDistance.min === undefined) { // meshes
-                meshesOrMinMaxVector = meshesOrMinMaxVectorAndDistance || this.getScene().meshes;
-                meshesOrMinMaxVector = BABYLON.Mesh.MinMax(meshesOrMinMaxVector);
-                distance = BABYLON.Vector3.Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);
-            }
-            else { //minMaxVector and distance
-                meshesOrMinMaxVector = meshesOrMinMaxVectorAndDistance;
-                distance = meshesOrMinMaxVectorAndDistance.distance;
-            }
-
-            this.target = Mesh.Center(meshesOrMinMaxVector);
-
-            this.maxZ = distance * 2;
-        }
-    }
-} 

+ 0 - 303
Babylon/Cameras/babylon.camera.js

@@ -1,303 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var Camera = (function (_super) {
-        __extends(Camera, _super);
-        function Camera(name, position, scene) {
-            _super.call(this, name, scene);
-            this.position = position;
-            // Members
-            this.upVector = BABYLON.Vector3.Up();
-            this.orthoLeft = null;
-            this.orthoRight = null;
-            this.orthoBottom = null;
-            this.orthoTop = null;
-            this.fov = 0.8;
-            this.minZ = 1.0;
-            this.maxZ = 10000.0;
-            this.inertia = 0.9;
-            this.mode = Camera.PERSPECTIVE_CAMERA;
-            this.isIntermediate = false;
-            this.viewport = new BABYLON.Viewport(0, 0, 1.0, 1.0);
-            this.subCameras = [];
-            this.layerMask = 0xFFFFFFFF;
-            this._computedViewMatrix = BABYLON.Matrix.Identity();
-            this._projectionMatrix = new BABYLON.Matrix();
-            this._postProcesses = new Array();
-            this._postProcessesTakenIndices = [];
-
-            scene.cameras.push(this);
-
-            if (!scene.activeCamera) {
-                scene.activeCamera = this;
-            }
-        }
-        //Cache
-        Camera.prototype._initCache = function () {
-            _super.prototype._initCache.call(this);
-
-            this._cache.position = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-            this._cache.upVector = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-
-            this._cache.mode = undefined;
-            this._cache.minZ = undefined;
-            this._cache.maxZ = undefined;
-
-            this._cache.fov = undefined;
-            this._cache.aspectRatio = undefined;
-
-            this._cache.orthoLeft = undefined;
-            this._cache.orthoRight = undefined;
-            this._cache.orthoBottom = undefined;
-            this._cache.orthoTop = undefined;
-            this._cache.renderWidth = undefined;
-            this._cache.renderHeight = undefined;
-        };
-
-        Camera.prototype._updateCache = function (ignoreParentClass) {
-            if (!ignoreParentClass) {
-                _super.prototype._updateCache.call(this);
-            }
-
-            var engine = this.getEngine();
-
-            this._cache.position.copyFrom(this.position);
-            this._cache.upVector.copyFrom(this.upVector);
-
-            this._cache.mode = this.mode;
-            this._cache.minZ = this.minZ;
-            this._cache.maxZ = this.maxZ;
-
-            this._cache.fov = this.fov;
-            this._cache.aspectRatio = engine.getAspectRatio(this);
-
-            this._cache.orthoLeft = this.orthoLeft;
-            this._cache.orthoRight = this.orthoRight;
-            this._cache.orthoBottom = this.orthoBottom;
-            this._cache.orthoTop = this.orthoTop;
-            this._cache.renderWidth = engine.getRenderWidth();
-            this._cache.renderHeight = engine.getRenderHeight();
-        };
-
-        Camera.prototype._updateFromScene = function () {
-            this.updateCache();
-            this._update();
-        };
-
-        // Synchronized
-        Camera.prototype._isSynchronized = function () {
-            return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();
-        };
-
-        Camera.prototype._isSynchronizedViewMatrix = function () {
-            if (!_super.prototype._isSynchronized.call(this))
-                return false;
-
-            return this._cache.position.equals(this.position) && this._cache.upVector.equals(this.upVector) && this.isSynchronizedWithParent();
-        };
-
-        Camera.prototype._isSynchronizedProjectionMatrix = function () {
-            var check = this._cache.mode === this.mode && this._cache.minZ === this.minZ && this._cache.maxZ === this.maxZ;
-
-            if (!check) {
-                return false;
-            }
-
-            var engine = this.getEngine();
-
-            if (this.mode === BABYLON.Camera.PERSPECTIVE_CAMERA) {
-                check = this._cache.fov === this.fov && this._cache.aspectRatio === engine.getAspectRatio(this);
-            } else {
-                check = this._cache.orthoLeft === this.orthoLeft && this._cache.orthoRight === this.orthoRight && this._cache.orthoBottom === this.orthoBottom && this._cache.orthoTop === this.orthoTop && this._cache.renderWidth === engine.getRenderWidth() && this._cache.renderHeight === engine.getRenderHeight();
-            }
-
-            return check;
-        };
-
-        // Controls
-        Camera.prototype.attachControl = function (element) {
-        };
-
-        Camera.prototype.detachControl = function (element) {
-        };
-
-        Camera.prototype._update = function () {
-        };
-
-        Camera.prototype.attachPostProcess = function (postProcess, insertAt) {
-            if (typeof insertAt === "undefined") { insertAt = null; }
-            if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {
-                BABYLON.Tools.Error("You're trying to reuse a post process not defined as reusable.");
-                return 0;
-            }
-
-            if (insertAt == null || insertAt < 0) {
-                this._postProcesses.push(postProcess);
-                this._postProcessesTakenIndices.push(this._postProcesses.length - 1);
-
-                return this._postProcesses.length - 1;
-            }
-
-            var add = 0;
-
-            if (this._postProcesses[insertAt]) {
-                var start = this._postProcesses.length - 1;
-
-                for (var i = start; i >= insertAt + 1; --i) {
-                    this._postProcesses[i + 1] = this._postProcesses[i];
-                }
-
-                add = 1;
-            }
-
-            for (i = 0; i < this._postProcessesTakenIndices.length; ++i) {
-                if (this._postProcessesTakenIndices[i] < insertAt) {
-                    continue;
-                }
-
-                start = this._postProcessesTakenIndices.length - 1;
-                for (var j = start; j >= i; --j) {
-                    this._postProcessesTakenIndices[j + 1] = this._postProcessesTakenIndices[j] + add;
-                }
-                this._postProcessesTakenIndices[i] = insertAt;
-                break;
-            }
-
-            if (!add && this._postProcessesTakenIndices.indexOf(insertAt) == -1) {
-                this._postProcessesTakenIndices.push(insertAt);
-            }
-
-            var result = insertAt + add;
-
-            this._postProcesses[result] = postProcess;
-
-            return result;
-        };
-
-        Camera.prototype.detachPostProcess = function (postProcess, atIndices) {
-            if (typeof atIndices === "undefined") { atIndices = null; }
-            var result = [];
-
-            if (!atIndices) {
-                var length = this._postProcesses.length;
-
-                for (var i = 0; i < length; i++) {
-                    if (this._postProcesses[i] !== postProcess) {
-                        continue;
-                    }
-
-                    delete this._postProcesses[i];
-
-                    var index = this._postProcessesTakenIndices.indexOf(i);
-                    this._postProcessesTakenIndices.splice(index, 1);
-                }
-            } else {
-                atIndices = (atIndices instanceof Array) ? atIndices : [atIndices];
-                for (i = 0; i < atIndices.length; i++) {
-                    var foundPostProcess = this._postProcesses[atIndices[i]];
-
-                    if (foundPostProcess !== postProcess) {
-                        result.push(i);
-                        continue;
-                    }
-
-                    delete this._postProcesses[atIndices[i]];
-
-                    index = this._postProcessesTakenIndices.indexOf(atIndices[i]);
-                    this._postProcessesTakenIndices.splice(index, 1);
-                }
-            }
-            return result;
-        };
-
-        Camera.prototype.getWorldMatrix = function () {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            var viewMatrix = this.getViewMatrix();
-
-            viewMatrix.invertToRef(this._worldMatrix);
-
-            return this._worldMatrix;
-        };
-
-        Camera.prototype._getViewMatrix = function () {
-            return BABYLON.Matrix.Identity();
-        };
-
-        Camera.prototype.getViewMatrix = function () {
-            this._computedViewMatrix = this._computeViewMatrix();
-
-            if (!this.parent || !this.parent.getWorldMatrix || this.isSynchronized()) {
-                return this._computedViewMatrix;
-            }
-
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            this._computedViewMatrix.invertToRef(this._worldMatrix);
-
-            this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
-
-            this._computedViewMatrix.invert();
-
-            this._currentRenderId = this.getScene().getRenderId();
-            return this._computedViewMatrix;
-        };
-
-        Camera.prototype._computeViewMatrix = function (force) {
-            if (!force && this._isSynchronizedViewMatrix()) {
-                return this._computedViewMatrix;
-            }
-
-            this._computedViewMatrix = this._getViewMatrix();
-            if (!this.parent || !this.parent.getWorldMatrix) {
-                this._currentRenderId = this.getScene().getRenderId();
-            }
-            return this._computedViewMatrix;
-        };
-
-        Camera.prototype.getProjectionMatrix = function (force) {
-            if (!force && this._isSynchronizedProjectionMatrix()) {
-                return this._projectionMatrix;
-            }
-
-            var engine = this.getEngine();
-            if (this.mode === BABYLON.Camera.PERSPECTIVE_CAMERA) {
-                if (this.minZ <= 0) {
-                    this.minZ = 0.1;
-                }
-
-                BABYLON.Matrix.PerspectiveFovLHToRef(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix);
-                return this._projectionMatrix;
-            }
-
-            var halfWidth = engine.getRenderWidth() / 2.0;
-            var halfHeight = engine.getRenderHeight() / 2.0;
-            BABYLON.Matrix.OrthoOffCenterLHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);
-            return this._projectionMatrix;
-        };
-
-        Camera.prototype.dispose = function () {
-            // Remove from scene
-            var index = this.getScene().cameras.indexOf(this);
-            this.getScene().cameras.splice(index, 1);
-
-            for (var i = 0; i < this._postProcessesTakenIndices.length; ++i) {
-                this._postProcesses[this._postProcessesTakenIndices[i]].dispose(this);
-            }
-        };
-        Camera.PERSPECTIVE_CAMERA = 0;
-        Camera.ORTHOGRAPHIC_CAMERA = 1;
-        return Camera;
-    })(BABYLON.Node);
-    BABYLON.Camera = Camera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.camera.js.map

+ 0 - 315
Babylon/Cameras/babylon.camera.ts

@@ -1,315 +0,0 @@
-module BABYLON {
-    export class Camera extends Node {
-        // Statics
-        public static PERSPECTIVE_CAMERA = 0;
-        public static ORTHOGRAPHIC_CAMERA = 1;
-
-        // Members
-        public upVector = Vector3.Up();
-        public orthoLeft = null;
-        public orthoRight = null;
-        public orthoBottom = null;
-        public orthoTop = null;
-        public fov = 0.8;
-        public minZ = 1.0;
-        public maxZ = 10000.0;
-        public inertia = 0.9;
-        public mode = Camera.PERSPECTIVE_CAMERA;
-        public isIntermediate = false;
-        public viewport = new Viewport(0, 0, 1.0, 1.0);
-        public subCameras = [];
-        public layerMask: number = 0xFFFFFFFF;
-
-        private _computedViewMatrix = BABYLON.Matrix.Identity();
-        public _projectionMatrix = new BABYLON.Matrix();
-        private _worldMatrix: Matrix;
-        public _postProcesses = new Array<PostProcess>();
-        public _postProcessesTakenIndices = [];               
-
-        constructor(name: string, public position: Vector3, scene: Scene) {
-            super(name, scene);
-
-            scene.cameras.push(this);
-
-            if (!scene.activeCamera) {
-                scene.activeCamera = this;
-            }
-        }
-
-        //Cache
-        public _initCache() {
-            super._initCache();
-
-            this._cache.position = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-            this._cache.upVector = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-
-            this._cache.mode = undefined;
-            this._cache.minZ = undefined;
-            this._cache.maxZ = undefined;
-
-            this._cache.fov = undefined;
-            this._cache.aspectRatio = undefined;
-
-            this._cache.orthoLeft = undefined;
-            this._cache.orthoRight = undefined;
-            this._cache.orthoBottom = undefined;
-            this._cache.orthoTop = undefined;
-            this._cache.renderWidth = undefined;
-            this._cache.renderHeight = undefined;
-        }
-
-        public _updateCache(ignoreParentClass?: boolean): void {
-            if (!ignoreParentClass) {
-                super._updateCache();
-            }
-
-            var engine = this.getEngine();
-
-            this._cache.position.copyFrom(this.position);
-            this._cache.upVector.copyFrom(this.upVector);
-
-            this._cache.mode = this.mode;
-            this._cache.minZ = this.minZ;
-            this._cache.maxZ = this.maxZ;
-
-            this._cache.fov = this.fov;
-            this._cache.aspectRatio = engine.getAspectRatio(this);
-
-            this._cache.orthoLeft = this.orthoLeft;
-            this._cache.orthoRight = this.orthoRight;
-            this._cache.orthoBottom = this.orthoBottom;
-            this._cache.orthoTop = this.orthoTop;
-            this._cache.renderWidth = engine.getRenderWidth();
-            this._cache.renderHeight = engine.getRenderHeight();
-        }
-
-        public _updateFromScene(): void {
-            this.updateCache();
-            this._update();
-        }
-
-        // Synchronized
-        public _isSynchronized(): boolean {
-            return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();
-        }
-
-        public _isSynchronizedViewMatrix(): boolean {
-            if (!super._isSynchronized())
-                return false;
-
-            return this._cache.position.equals(this.position)
-                && this._cache.upVector.equals(this.upVector)
-                && this.isSynchronizedWithParent();
-        }
-
-        public _isSynchronizedProjectionMatrix(): boolean {
-            var check = this._cache.mode === this.mode
-                && this._cache.minZ === this.minZ
-                && this._cache.maxZ === this.maxZ;
-
-            if (!check) {
-                return false;
-            }
-
-            var engine = this.getEngine();
-
-            if (this.mode === BABYLON.Camera.PERSPECTIVE_CAMERA) {
-                check = this._cache.fov === this.fov
-                && this._cache.aspectRatio === engine.getAspectRatio(this);
-            }
-            else {
-                check = this._cache.orthoLeft === this.orthoLeft
-                && this._cache.orthoRight === this.orthoRight
-                && this._cache.orthoBottom === this.orthoBottom
-                && this._cache.orthoTop === this.orthoTop
-                && this._cache.renderWidth === engine.getRenderWidth()
-                && this._cache.renderHeight === engine.getRenderHeight();
-            }
-
-            return check;
-        }
-
-        // Controls
-        public attachControl(element: HTMLElement): void {
-        }
-
-        public detachControl(element: HTMLElement): void {
-        }
-
-        public _update(): void {
-        }
-
-        public attachPostProcess(postProcess: PostProcess, insertAt: number = null): number {
-            if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {
-                Tools.Error("You're trying to reuse a post process not defined as reusable.");
-                return 0;
-            }
-
-            if (insertAt == null || insertAt < 0) {
-                this._postProcesses.push(postProcess);
-                this._postProcessesTakenIndices.push(this._postProcesses.length - 1);
-
-                return this._postProcesses.length - 1;
-            }
-
-            var add = 0;
-
-            if (this._postProcesses[insertAt]) {
-
-                var start = this._postProcesses.length - 1;
-
-
-                for (var i = start; i >= insertAt + 1; --i) {
-                    this._postProcesses[i + 1] = this._postProcesses[i];
-                }
-
-                add = 1;
-            }
-
-            for (i = 0; i < this._postProcessesTakenIndices.length; ++i) {
-                if (this._postProcessesTakenIndices[i] < insertAt) {
-                    continue;
-                }
-
-                start = this._postProcessesTakenIndices.length - 1;
-                for (var j = start; j >= i; --j) {
-                    this._postProcessesTakenIndices[j + 1] = this._postProcessesTakenIndices[j] + add;
-                }
-                this._postProcessesTakenIndices[i] = insertAt;
-                break;
-            }
-
-            if (!add && this._postProcessesTakenIndices.indexOf(insertAt) == -1) {
-                this._postProcessesTakenIndices.push(insertAt);
-            }
-
-            var result = insertAt + add;
-
-            this._postProcesses[result] = postProcess;
-
-            return result;
-        }
-
-        public detachPostProcess(postProcess: PostProcess, atIndices: any = null): number[] {
-            var result = [];
-
-            if (!atIndices) {
-
-                var length = this._postProcesses.length;
-
-                for (var i = 0; i < length; i++) {
-
-                    if (this._postProcesses[i] !== postProcess) {
-                        continue;
-                    }
-
-                    delete this._postProcesses[i];
-
-                    var index = this._postProcessesTakenIndices.indexOf(i);
-                    this._postProcessesTakenIndices.splice(index, 1);
-                }
-
-            }
-            else {
-                atIndices = (atIndices instanceof Array) ? atIndices : [atIndices];
-                for (i = 0; i < atIndices.length; i++) {
-                    var foundPostProcess = this._postProcesses[atIndices[i]];
-
-                    if (foundPostProcess !== postProcess) {
-                        result.push(i);
-                        continue;
-                    }
-
-                    delete this._postProcesses[atIndices[i]];
-
-                    index = this._postProcessesTakenIndices.indexOf(atIndices[i]);
-                    this._postProcessesTakenIndices.splice(index, 1);
-                }
-            }
-            return result;
-        }
-
-        public getWorldMatrix(): Matrix {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            var viewMatrix = this.getViewMatrix();
-
-            viewMatrix.invertToRef(this._worldMatrix);
-
-            return this._worldMatrix;
-        }
-
-        public _getViewMatrix(): Matrix {
-            return BABYLON.Matrix.Identity();
-        }
-
-        public getViewMatrix(): Matrix {
-            this._computedViewMatrix = this._computeViewMatrix();
-
-            if (!this.parent
-                || !this.parent.getWorldMatrix
-                || this.isSynchronized()) {
-                return this._computedViewMatrix;
-            }
-
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            this._computedViewMatrix.invertToRef(this._worldMatrix);
-
-            this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
-
-            this._computedViewMatrix.invert();
-
-            this._currentRenderId = this.getScene().getRenderId();
-            return this._computedViewMatrix;
-        }
-
-        public _computeViewMatrix(force?: boolean): Matrix {
-            if (!force && this._isSynchronizedViewMatrix()) {
-                return this._computedViewMatrix;
-            }
-
-            this._computedViewMatrix = this._getViewMatrix();
-            if (!this.parent || !this.parent.getWorldMatrix) {
-                this._currentRenderId = this.getScene().getRenderId();
-            }
-            return this._computedViewMatrix;
-        }
-
-        public getProjectionMatrix(force?: boolean): Matrix {
-            if (!force && this._isSynchronizedProjectionMatrix()) {
-                return this._projectionMatrix;
-            }
-
-            var engine = this.getEngine();
-            if (this.mode === BABYLON.Camera.PERSPECTIVE_CAMERA) {
-                if (this.minZ <= 0) {
-                    this.minZ = 0.1;
-                }
-
-                BABYLON.Matrix.PerspectiveFovLHToRef(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix);
-                return this._projectionMatrix;
-            }
-
-            var halfWidth = engine.getRenderWidth() / 2.0;
-            var halfHeight = engine.getRenderHeight() / 2.0;
-            BABYLON.Matrix.OrthoOffCenterLHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);
-            return this._projectionMatrix;
-        }
-
-        public dispose(): void {
-            // Remove from scene
-            var index = this.getScene().cameras.indexOf(this);
-            this.getScene().cameras.splice(index, 1);
-
-            // Postprocesses
-            for (var i = 0; i < this._postProcessesTakenIndices.length; ++i) {
-                this._postProcesses[this._postProcessesTakenIndices[i]].dispose(this);
-            }
-        }
-    }
-}

+ 0 - 83
Babylon/Cameras/babylon.deviceOrientationCamera.js

@@ -1,83 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    // We're mainly based on the logic defined into the FreeCamera code
-    var DeviceOrientationCamera = (function (_super) {
-        __extends(DeviceOrientationCamera, _super);
-        function DeviceOrientationCamera(name, position, scene) {
-            var _this = this;
-            _super.call(this, name, position, scene);
-            this._offsetX = null;
-            this._offsetY = null;
-            this._orientationGamma = 0;
-            this._orientationBeta = 0;
-            this._initialOrientationGamma = 0;
-            this._initialOrientationBeta = 0;
-            this.angularSensibility = 10000.0;
-            this.moveSensibility = 50.0;
-
-            window.addEventListener("resize", function () {
-                _this._initialOrientationGamma = null;
-            }, false);
-        }
-        DeviceOrientationCamera.prototype.attachControl = function (canvas, noPreventDefault) {
-            var _this = this;
-            if (this._attachedCanvas) {
-                return;
-            }
-            this._attachedCanvas = canvas;
-
-            if (!this._orientationChanged) {
-                this._orientationChanged = function (evt) {
-                    if (!_this._initialOrientationGamma) {
-                        _this._initialOrientationGamma = evt.gamma;
-                        _this._initialOrientationBeta = evt.beta;
-                    }
-
-                    _this._orientationGamma = evt.gamma;
-                    _this._orientationBeta = evt.beta;
-
-                    _this._offsetY = (_this._initialOrientationBeta - _this._orientationBeta);
-                    _this._offsetX = (_this._initialOrientationGamma - _this._orientationGamma);
-                };
-            }
-
-            window.addEventListener("deviceorientation", this._orientationChanged);
-        };
-
-        DeviceOrientationCamera.prototype.detachControl = function (canvas) {
-            if (this._attachedCanvas != canvas) {
-                return;
-            }
-
-            window.removeEventListener("deviceorientation", this._orientationChanged);
-
-            this._attachedCanvas = null;
-            this._orientationGamma = 0;
-            this._orientationBeta = 0;
-            this._initialOrientationGamma = 0;
-            this._initialOrientationBeta = 0;
-        };
-
-        DeviceOrientationCamera.prototype._checkInputs = function () {
-            if (!this._offsetX) {
-                return;
-            }
-            this.cameraRotation.y -= this._offsetX / this.angularSensibility;
-
-            var speed = this._computeLocalCameraSpeed();
-            var direction = new BABYLON.Vector3(0, 0, speed * this._offsetY / this.moveSensibility);
-
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, 0, this._cameraRotationMatrix);
-            this.cameraDirection.addInPlace(BABYLON.Vector3.TransformCoordinates(direction, this._cameraRotationMatrix));
-        };
-        return DeviceOrientationCamera;
-    })(BABYLON.FreeCamera);
-    BABYLON.DeviceOrientationCamera = DeviceOrientationCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.deviceOrientationCamera.js.map

+ 0 - 76
Babylon/Cameras/babylon.deviceOrientationCamera.ts

@@ -1,76 +0,0 @@
-module BABYLON {
-    // We're mainly based on the logic defined into the FreeCamera code
-    export class DeviceOrientationCamera extends FreeCamera {
-        private _offsetX: number = null;
-        private _offsetY: number = null;
-        private _orientationGamma: number = 0;
-        private _orientationBeta: number = 0;
-        private _initialOrientationGamma: number = 0;
-        private _initialOrientationBeta: number = 0;
-        private _attachedCanvas: HTMLCanvasElement;
-        private _orientationChanged: (e: DeviceOrientationEvent) => any;
-
-        public angularSensibility: number = 10000.0;
-        public moveSensibility: number = 50.0;
-
-        constructor(name: string, position: Vector3, scene: Scene) {
-            super(name, position, scene);
-
-            window.addEventListener("resize", () => {
-                this._initialOrientationGamma = null;
-            }, false);
-        }
-
-        public attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void {
-            if (this._attachedCanvas) {
-                return;
-            }
-            this._attachedCanvas = canvas;
-
-            if (!this._orientationChanged) {
-                this._orientationChanged = (evt) => {
-
-                    if (!this._initialOrientationGamma) {
-                            this._initialOrientationGamma = evt.gamma;
-                            this._initialOrientationBeta = evt.beta;
-                    }
-
-                    this._orientationGamma = evt.gamma;
-                    this._orientationBeta = evt.beta;
- 
-                    this._offsetY = (this._initialOrientationBeta - this._orientationBeta);
-                    this._offsetX = (this._initialOrientationGamma - this._orientationGamma);
-                };
-            }
-
-            window.addEventListener("deviceorientation", this._orientationChanged);
-        }
-
-        public detachControl(canvas: HTMLCanvasElement): void {
-            if (this._attachedCanvas != canvas) {
-                return;
-            }
-
-            window.removeEventListener("deviceorientation", this._orientationChanged);
-
-            this._attachedCanvas = null;
-            this._orientationGamma = 0;
-            this._orientationBeta = 0;
-            this._initialOrientationGamma = 0;
-            this._initialOrientationBeta = 0;
-        }
-
-        public _checkInputs(): void {
-            if (!this._offsetX) {
-                return;
-            }
-            this.cameraRotation.y -= this._offsetX / this.angularSensibility;
-
-            var speed = this._computeLocalCameraSpeed();
-            var direction = new BABYLON.Vector3(0, 0, speed * this._offsetY / this.moveSensibility);
-
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, 0, this._cameraRotationMatrix);
-            this.cameraDirection.addInPlace(BABYLON.Vector3.TransformCoordinates(direction, this._cameraRotationMatrix));
-        }
-    }
-}

+ 0 - 62
Babylon/Cameras/babylon.followCamera.js

@@ -1,62 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var FollowCamera = (function (_super) {
-        __extends(FollowCamera, _super);
-        function FollowCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this.radius = 12;
-            this.rotationOffset = 0;
-            this.heightOffset = 4;
-            this.cameraAcceleration = 0.05;
-            this.maxCameraSpeed = 20;
-        }
-        FollowCamera.prototype.getRadians = function (degrees) {
-            return degrees * Math.PI / 180;
-        };
-
-        FollowCamera.prototype.follow = function (cameraTarget) {
-            if (!cameraTarget)
-                return;
-
-            var radians = this.getRadians(this.rotationOffset) + cameraTarget.rotation.y;
-            var targetX = cameraTarget.position.x + Math.sin(radians) * this.radius;
-
-            var targetZ = cameraTarget.position.z + Math.cos(radians) * this.radius;
-            var dx = targetX - this.position.x;
-            var dy = (cameraTarget.position.y + this.heightOffset) - this.position.y;
-            var dz = (targetZ) - this.position.z;
-            var vx = dx * this.cameraAcceleration * 2;
-            var vy = dy * this.cameraAcceleration;
-            var vz = dz * this.cameraAcceleration * 2;
-
-            if (vx > this.maxCameraSpeed || vx < -this.maxCameraSpeed) {
-                vx = vx < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;
-            }
-
-            if (vy > this.maxCameraSpeed || vy < -this.maxCameraSpeed) {
-                vy = vy < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;
-            }
-
-            if (vz > this.maxCameraSpeed || vz < -this.maxCameraSpeed) {
-                vz = vz < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;
-            }
-
-            this.position = new BABYLON.Vector3(this.position.x + vx, this.position.y + vy, this.position.z + vz);
-            this.setTarget(cameraTarget.position);
-        };
-
-        FollowCamera.prototype._update = function () {
-            _super.prototype._update.call(this);
-            this.follow(this.target);
-        };
-        return FollowCamera;
-    })(BABYLON.TargetCamera);
-    BABYLON.FollowCamera = FollowCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.followCamera.js.map

+ 0 - 55
Babylon/Cameras/babylon.followCamera.ts

@@ -1,55 +0,0 @@
-module BABYLON {
-    export class FollowCamera extends TargetCamera {
-
-        public radius:number = 12;
-        public rotationOffset:number = 0;
-        public heightOffset:number = 4;
-        public cameraAcceleration:number = 0.05;
-        public maxCameraSpeed:number = 20;
-        public target:BABYLON.AbstractMesh;
-
-        constructor(name:string, position:Vector3, scene:Scene) {
-            super(name, position, scene);
-        }
-
-        private getRadians(degrees):number {
-            return degrees * Math.PI / 180;
-        }
-
-        private follow(cameraTarget:BABYLON.AbstractMesh) {
-            if (!cameraTarget)
-                return;
-
-            var radians = this.getRadians(this.rotationOffset) + cameraTarget.rotation.y;
-            var targetX:number = cameraTarget.position.x + Math.sin(radians) * this.radius;
-
-            var targetZ:number = cameraTarget.position.z + Math.cos(radians) * this.radius;
-            var dx:number = targetX - this.position.x;
-            var dy:number = (cameraTarget.position.y + this.heightOffset) - this.position.y;
-            var dz:number = (targetZ) - this.position.z;
-            var vx:number = dx * this.cameraAcceleration * 2;//this is set to .05
-            var vy:number = dy * this.cameraAcceleration;
-            var vz:number = dz * this.cameraAcceleration * 2;
-
-            if (vx > this.maxCameraSpeed || vx < -this.maxCameraSpeed) {
-                vx = vx < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;
-            }
-
-            if (vy > this.maxCameraSpeed || vy < -this.maxCameraSpeed) {
-                vy = vy < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;
-            }
-
-            if (vz > this.maxCameraSpeed || vz < -this.maxCameraSpeed) {
-                vz = vz < 1 ? -this.maxCameraSpeed : this.maxCameraSpeed;
-            }
-
-            this.position = new BABYLON.Vector3(this.position.x + vx, this.position.y + vy, this.position.z + vz);
-            this.setTarget(cameraTarget.position);
-        }
-
-        public _update():void {
-            super._update();
-            this.follow(this.target);
-        }
-    }
-} 

+ 0 - 240
Babylon/Cameras/babylon.freeCamera.js

@@ -1,240 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var FreeCamera = (function (_super) {
-        __extends(FreeCamera, _super);
-        function FreeCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this.ellipsoid = new BABYLON.Vector3(0.5, 1, 0.5);
-            this.keysUp = [38];
-            this.keysDown = [40];
-            this.keysLeft = [37];
-            this.keysRight = [39];
-            this.checkCollisions = false;
-            this.applyGravity = false;
-            this.angularSensibility = 2000.0;
-            this._keys = [];
-            this._collider = new BABYLON.Collider();
-            this._needMoveForGravity = true;
-            this._oldPosition = BABYLON.Vector3.Zero();
-            this._diffPosition = BABYLON.Vector3.Zero();
-            this._newPosition = BABYLON.Vector3.Zero();
-        }
-        // Controls
-        FreeCamera.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            var previousPosition;
-            var engine = this.getEngine();
-
-            if (this._attachedElement) {
-                return;
-            }
-            this._attachedElement = element;
-
-            if (this._onMouseDown === undefined) {
-                this._onMouseDown = function (evt) {
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onMouseUp = function (evt) {
-                    previousPosition = null;
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onMouseOut = function (evt) {
-                    previousPosition = null;
-                    _this._keys = [];
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onMouseMove = function (evt) {
-                    if (!previousPosition && !engine.isPointerLock) {
-                        return;
-                    }
-
-                    var offsetX;
-                    var offsetY;
-
-                    if (!engine.isPointerLock) {
-                        offsetX = evt.clientX - previousPosition.x;
-                        offsetY = evt.clientY - previousPosition.y;
-                    } else {
-                        offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                        offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-                    }
-
-                    _this.cameraRotation.y += offsetX / _this.angularSensibility;
-                    _this.cameraRotation.x += offsetY / _this.angularSensibility;
-
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onKeyDown = function (evt) {
-                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1) {
-                        var index = _this._keys.indexOf(evt.keyCode);
-
-                        if (index === -1) {
-                            _this._keys.push(evt.keyCode);
-                        }
-                        if (!noPreventDefault) {
-                            evt.preventDefault();
-                        }
-                    }
-                };
-
-                this._onKeyUp = function (evt) {
-                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1) {
-                        var index = _this._keys.indexOf(evt.keyCode);
-
-                        if (index >= 0) {
-                            _this._keys.splice(index, 1);
-                        }
-                        if (!noPreventDefault) {
-                            evt.preventDefault();
-                        }
-                    }
-                };
-
-                this._onLostFocus = function () {
-                    _this._keys = [];
-                };
-
-                this._reset = function () {
-                    _this._keys = [];
-                    previousPosition = null;
-                    _this.cameraDirection = new BABYLON.Vector3(0, 0, 0);
-                    _this.cameraRotation = new BABYLON.Vector2(0, 0);
-                };
-            }
-
-            element.addEventListener("mousedown", this._onMouseDown, false);
-            element.addEventListener("mouseup", this._onMouseUp, false);
-            element.addEventListener("mouseout", this._onMouseOut, false);
-            element.addEventListener("mousemove", this._onMouseMove, false);
-
-            BABYLON.Tools.RegisterTopRootEvents([
-                { name: "keydown", handler: this._onKeyDown },
-                { name: "keyup", handler: this._onKeyUp },
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        };
-
-        FreeCamera.prototype.detachControl = function (element) {
-            if (this._attachedElement != element) {
-                return;
-            }
-
-            element.removeEventListener("mousedown", this._onMouseDown);
-            element.removeEventListener("mouseup", this._onMouseUp);
-            element.removeEventListener("mouseout", this._onMouseOut);
-            element.removeEventListener("mousemove", this._onMouseMove);
-
-            BABYLON.Tools.UnregisterTopRootEvents([
-                { name: "keydown", handler: this._onKeyDown },
-                { name: "keyup", handler: this._onKeyUp },
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-
-            this._attachedElement = null;
-            if (this._reset) {
-                this._reset();
-            }
-        };
-
-        FreeCamera.prototype._collideWithWorld = function (velocity) {
-            var globalPosition;
-
-            if (this.parent) {
-                globalPosition = BABYLON.Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());
-            } else {
-                globalPosition = this.position;
-            }
-
-            globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);
-            this._collider.radius = this.ellipsoid;
-
-            this.getScene()._getNewPosition(this._oldPosition, velocity, this._collider, 3, this._newPosition);
-            this._newPosition.subtractToRef(this._oldPosition, this._diffPosition);
-
-            if (this._diffPosition.length() > BABYLON.Engine.CollisionsEpsilon) {
-                this.position.addInPlace(this._diffPosition);
-                if (this.onCollide) {
-                    this.onCollide(this._collider.collidedMesh);
-                }
-            }
-        };
-
-        FreeCamera.prototype._checkInputs = function () {
-            if (!this._localDirection) {
-                this._localDirection = BABYLON.Vector3.Zero();
-                this._transformedDirection = BABYLON.Vector3.Zero();
-            }
-
-            for (var index = 0; index < this._keys.length; index++) {
-                var keyCode = this._keys[index];
-                var speed = this._computeLocalCameraSpeed();
-
-                if (this.keysLeft.indexOf(keyCode) !== -1) {
-                    this._localDirection.copyFromFloats(-speed, 0, 0);
-                } else if (this.keysUp.indexOf(keyCode) !== -1) {
-                    this._localDirection.copyFromFloats(0, 0, speed);
-                } else if (this.keysRight.indexOf(keyCode) !== -1) {
-                    this._localDirection.copyFromFloats(speed, 0, 0);
-                } else if (this.keysDown.indexOf(keyCode) !== -1) {
-                    this._localDirection.copyFromFloats(0, 0, -speed);
-                }
-
-                this.getViewMatrix().invertToRef(this._cameraTransformMatrix);
-                BABYLON.Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);
-                this.cameraDirection.addInPlace(this._transformedDirection);
-            }
-        };
-
-        FreeCamera.prototype._decideIfNeedsToMove = function () {
-            return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;
-        };
-
-        FreeCamera.prototype._updatePosition = function () {
-            if (this.checkCollisions && this.getScene().collisionsEnabled) {
-                this._collideWithWorld(this.cameraDirection);
-                if (this.applyGravity) {
-                    var oldPosition = this.position;
-                    this._collideWithWorld(this.getScene().gravity);
-                    this._needMoveForGravity = (BABYLON.Vector3.DistanceSquared(oldPosition, this.position) != 0);
-                }
-            } else {
-                this.position.addInPlace(this.cameraDirection);
-            }
-        };
-
-        FreeCamera.prototype._update = function () {
-            this._checkInputs();
-            _super.prototype._update.call(this);
-        };
-        return FreeCamera;
-    })(BABYLON.TargetCamera);
-    BABYLON.FreeCamera = FreeCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.freeCamera.js.map

+ 0 - 253
Babylon/Cameras/babylon.freeCamera.ts

@@ -1,253 +0,0 @@
-module BABYLON {
-    export class FreeCamera extends TargetCamera {
-        public ellipsoid = new BABYLON.Vector3(0.5, 1, 0.5);
-        public keysUp = [38];
-        public keysDown = [40];
-        public keysLeft = [37];
-        public keysRight = [39];
-        public checkCollisions = false;
-        public applyGravity = false;
-        public angularSensibility = 2000.0;
-        public onCollide: (collidedMesh: AbstractMesh) => void;
-
-        private _keys = [];
-        private _collider = new Collider();
-        private _needMoveForGravity = true;
-        private _oldPosition = BABYLON.Vector3.Zero();
-        private _diffPosition = BABYLON.Vector3.Zero();
-        private _newPosition = BABYLON.Vector3.Zero();
-        private _attachedElement: HTMLElement;
-        private _localDirection: Vector3;
-        private _transformedDirection: Vector3;
-
-        private _onMouseDown: (e: MouseEvent) => any;
-        private _onMouseUp: (e: MouseEvent) => any;
-        private _onMouseOut: (e: MouseEvent) => any;
-        private _onMouseMove: (e: MouseEvent) => any;
-        private _onKeyDown: (e: KeyboardEvent) => any;
-        private _onKeyUp: (e: KeyboardEvent) => any;
-        public _onLostFocus: (e: FocusEvent) => any;
-
-        public _waitingLockedTargetId: string;
-
-        constructor(name: string, position: Vector3, scene: Scene) {
-            super(name, position, scene);
-        }
-
-        // Controls
-        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
-            var previousPosition;
-            var engine = this.getEngine();
-
-            if (this._attachedElement) {
-                return;
-            }
-            this._attachedElement = element;
-
-            if (this._onMouseDown === undefined) {
-                this._onMouseDown = evt => {
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onMouseUp = evt => {
-                    previousPosition = null;
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onMouseOut = evt => {
-                    previousPosition = null;
-                    this._keys = [];
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onMouseMove = evt => {
-                    if (!previousPosition && !engine.isPointerLock) {
-                        return;
-                    }
-
-                    var offsetX;
-                    var offsetY;
-
-                    if (!engine.isPointerLock) {
-                        offsetX = evt.clientX - previousPosition.x;
-                        offsetY = evt.clientY - previousPosition.y;
-                    } else {
-                        offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                        offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-                    }
-
-                    this.cameraRotation.y += offsetX / this.angularSensibility;
-                    this.cameraRotation.x += offsetY / this.angularSensibility;
-
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                };
-
-                this._onKeyDown = evt => {
-                    if (this.keysUp.indexOf(evt.keyCode) !== -1 ||
-                        this.keysDown.indexOf(evt.keyCode) !== -1 ||
-                        this.keysLeft.indexOf(evt.keyCode) !== -1 ||
-                        this.keysRight.indexOf(evt.keyCode) !== -1) {
-                        var index = this._keys.indexOf(evt.keyCode);
-
-                        if (index === -1) {
-                            this._keys.push(evt.keyCode);
-                        }
-                        if (!noPreventDefault) {
-                            evt.preventDefault();
-                        }
-                    }
-                };
-
-                this._onKeyUp = evt => {
-                    if (this.keysUp.indexOf(evt.keyCode) !== -1 ||
-                        this.keysDown.indexOf(evt.keyCode) !== -1 ||
-                        this.keysLeft.indexOf(evt.keyCode) !== -1 ||
-                        this.keysRight.indexOf(evt.keyCode) !== -1) {
-                        var index = this._keys.indexOf(evt.keyCode);
-
-                        if (index >= 0) {
-                            this._keys.splice(index, 1);
-                        }
-                        if (!noPreventDefault) {
-                            evt.preventDefault();
-                        }
-                    }
-                };
-
-                this._onLostFocus = () => {
-                    this._keys = [];
-                };
-
-                this._reset = () => {
-                    this._keys = [];
-                    previousPosition = null;
-                    this.cameraDirection = new BABYLON.Vector3(0, 0, 0);
-                    this.cameraRotation = new BABYLON.Vector2(0, 0);
-                };
-            }
-
-            element.addEventListener("mousedown", this._onMouseDown, false);
-            element.addEventListener("mouseup", this._onMouseUp, false);
-            element.addEventListener("mouseout", this._onMouseOut, false);
-            element.addEventListener("mousemove", this._onMouseMove, false);
-
-            Tools.RegisterTopRootEvents([
-                { name: "keydown", handler: this._onKeyDown },
-                { name: "keyup", handler: this._onKeyUp },
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        }
-
-        public detachControl(element: HTMLElement): void {
-            if (this._attachedElement != element) {
-                return;
-            }
-
-            element.removeEventListener("mousedown", this._onMouseDown);
-            element.removeEventListener("mouseup", this._onMouseUp);
-            element.removeEventListener("mouseout", this._onMouseOut);
-            element.removeEventListener("mousemove", this._onMouseMove);
-
-            Tools.UnregisterTopRootEvents([
-                { name: "keydown", handler: this._onKeyDown },
-                { name: "keyup", handler: this._onKeyUp },
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-
-            this._attachedElement = null;
-            if (this._reset) {
-                this._reset();
-            }
-        }
-
-        public _collideWithWorld(velocity: Vector3): void {
-            var globalPosition: Vector3;
-
-            if (this.parent) {
-                globalPosition = BABYLON.Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());
-            } else {
-                globalPosition = this.position;
-            }
-
-            globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);
-            this._collider.radius = this.ellipsoid;
-
-            this.getScene()._getNewPosition(this._oldPosition, velocity, this._collider, 3, this._newPosition);
-            this._newPosition.subtractToRef(this._oldPosition, this._diffPosition);
-
-            if (this._diffPosition.length() > Engine.CollisionsEpsilon) {
-                this.position.addInPlace(this._diffPosition);
-                if (this.onCollide) {
-                    this.onCollide(this._collider.collidedMesh);
-                }
-            }
-        }
-
-        public _checkInputs(): void {
-            if (!this._localDirection) {
-                this._localDirection = BABYLON.Vector3.Zero();
-                this._transformedDirection = BABYLON.Vector3.Zero();
-            }
-
-            // Keyboard
-            for (var index = 0; index < this._keys.length; index++) {
-                var keyCode = this._keys[index];
-                var speed = this._computeLocalCameraSpeed();
-
-                if (this.keysLeft.indexOf(keyCode) !== -1) {
-                    this._localDirection.copyFromFloats(-speed, 0, 0);
-                } else if (this.keysUp.indexOf(keyCode) !== -1) {
-                    this._localDirection.copyFromFloats(0, 0, speed);
-                } else if (this.keysRight.indexOf(keyCode) !== -1) {
-                    this._localDirection.copyFromFloats(speed, 0, 0);
-                } else if (this.keysDown.indexOf(keyCode) !== -1) {
-                    this._localDirection.copyFromFloats(0, 0, -speed);
-                }
-
-                this.getViewMatrix().invertToRef(this._cameraTransformMatrix);
-                BABYLON.Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);
-                this.cameraDirection.addInPlace(this._transformedDirection);
-            }
-        }
-
-        public _decideIfNeedsToMove(): boolean {
-            return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;
-        }
-
-        public _updatePosition(): void {
-            if (this.checkCollisions && this.getScene().collisionsEnabled) {
-                this._collideWithWorld(this.cameraDirection);
-                if (this.applyGravity) {
-                    var oldPosition = this.position;
-                    this._collideWithWorld(this.getScene().gravity);
-                    this._needMoveForGravity = (BABYLON.Vector3.DistanceSquared(oldPosition, this.position) != 0);
-                }
-            } else {
-                this.position.addInPlace(this.cameraDirection);
-            }
-        }
-
-        public _update(): void {
-            this._checkInputs();
-            super._update();
-        }
-
-    }
-} 

+ 0 - 60
Babylon/Cameras/babylon.gamepadCamera.js

@@ -1,60 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    // We're mainly based on the logic defined into the FreeCamera code
-    var GamepadCamera = (function (_super) {
-        __extends(GamepadCamera, _super);
-        function GamepadCamera(name, position, scene) {
-            var _this = this;
-            _super.call(this, name, position, scene);
-            this.angularSensibility = 200;
-            this.moveSensibility = 75;
-            this._gamepads = new BABYLON.Gamepads(function (gamepad) {
-                _this._onNewGameConnected(gamepad);
-            });
-        }
-        GamepadCamera.prototype._onNewGameConnected = function (gamepad) {
-            // Only the first gamepad can control the camera
-            if (gamepad.index === 0) {
-                this._gamepad = gamepad;
-            }
-        };
-
-        GamepadCamera.prototype._checkInputs = function () {
-            if (!this._gamepad) {
-                return;
-            }
-
-            var LSValues = this._gamepad.leftStick;
-            var normalizedLX = LSValues.x / this.moveSensibility;
-            var normalizedLY = LSValues.y / this.moveSensibility;
-            LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;
-            LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;
-
-            var RSValues = this._gamepad.rightStick;
-            var normalizedRX = RSValues.x / this.angularSensibility;
-            var normalizedRY = RSValues.y / this.angularSensibility;
-            RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;
-            RSValues.y = Math.abs(normalizedRY) > 0.001 ? 0 + normalizedRY : 0;
-            ;
-
-            var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
-            var deltaTransform = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(LSValues.x, 0, -LSValues.y), cameraTransform);
-            this.cameraDirection = this.cameraDirection.add(deltaTransform);
-            this.cameraRotation = this.cameraRotation.add(new BABYLON.Vector2(RSValues.y, RSValues.x));
-        };
-
-        GamepadCamera.prototype.dispose = function () {
-            this._gamepads.dispose();
-            _super.prototype.dispose.call(this);
-        };
-        return GamepadCamera;
-    })(BABYLON.FreeCamera);
-    BABYLON.GamepadCamera = GamepadCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.gamepadCamera.js.map

+ 0 - 49
Babylon/Cameras/babylon.gamepadCamera.ts

@@ -1,49 +0,0 @@
-module BABYLON {
-    // We're mainly based on the logic defined into the FreeCamera code
-    export class GamepadCamera extends FreeCamera {
-        private _gamepad: BABYLON.Gamepad;
-        private _gamepads: BABYLON.Gamepads;
-        public angularSensibility = 200;
-        public moveSensibility = 75;
-
-        constructor(name: string, position: Vector3, scene: Scene) {
-            super(name, position, scene);
-            this._gamepads = new BABYLON.Gamepads((gamepad: BABYLON.Gamepad) => { this._onNewGameConnected(gamepad); });
-        }
-
-        private _onNewGameConnected(gamepad: BABYLON.Gamepad) {
-            // Only the first gamepad can control the camera
-            if (gamepad.index === 0) {
-                this._gamepad = gamepad;
-            }
-        }
-
-        public _checkInputs(): void {
-            if (!this._gamepad) {
-                return;
-            }
-
-            var LSValues = this._gamepad.leftStick;
-            var normalizedLX = LSValues.x / this.moveSensibility;
-            var normalizedLY = LSValues.y / this.moveSensibility;
-            LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;
-            LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;
-
-            var RSValues = this._gamepad.rightStick;
-            var normalizedRX = RSValues.x / this.angularSensibility;
-            var normalizedRY = RSValues.y / this.angularSensibility;
-            RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;
-            RSValues.y = Math.abs(normalizedRY) > 0.001 ? 0 + normalizedRY : 0;;
-
-            var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
-            var deltaTransform = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(LSValues.x, 0, -LSValues.y), cameraTransform);
-            this.cameraDirection = this.cameraDirection.add(deltaTransform);
-            this.cameraRotation = this.cameraRotation.add(new BABYLON.Vector2(RSValues.y, RSValues.x));
-        }
-
-        public dispose(): void {
-            this._gamepads.dispose();
-            super.dispose();
-        }
-    }
-}

+ 0 - 141
Babylon/Cameras/babylon.oculusCamera.js

@@ -1,141 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var OculusRiftDevKit2013_Metric = {
-        HResolution: 1280,
-        VResolution: 800,
-        HScreenSize: 0.149759993,
-        VScreenSize: 0.0935999975,
-        VScreenCenter: 0.0467999987,
-        EyeToScreenDistance: 0.0410000011,
-        LensSeparationDistance: 0.0635000020,
-        InterpupillaryDistance: 0.0640000030,
-        DistortionK: [1.0, 0.219999999, 0.239999995, 0.0],
-        ChromaAbCorrection: [0.995999992, -0.00400000019, 1.01400006, 0.0],
-        PostProcessScaleFactor: 1.714605507808412,
-        LensCenterOffset: 0.151976421
-    };
-
-    var _OculusInnerCamera = (function (_super) {
-        __extends(_OculusInnerCamera, _super);
-        function _OculusInnerCamera(name, position, scene, isLeftEye) {
-            _super.call(this, name, position, scene);
-            this._workMatrix = new BABYLON.Matrix();
-            this._actualUp = new BABYLON.Vector3(0, 0, 0);
-
-            // Constants
-            this._aspectRatioAspectRatio = OculusRiftDevKit2013_Metric.HResolution / (2 * OculusRiftDevKit2013_Metric.VResolution);
-            this._aspectRatioFov = (2 * Math.atan((OculusRiftDevKit2013_Metric.PostProcessScaleFactor * OculusRiftDevKit2013_Metric.VScreenSize) / (2 * OculusRiftDevKit2013_Metric.EyeToScreenDistance)));
-
-            var hMeters = (OculusRiftDevKit2013_Metric.HScreenSize / 4) - (OculusRiftDevKit2013_Metric.LensSeparationDistance / 2);
-            var h = (4 * hMeters) / OculusRiftDevKit2013_Metric.HScreenSize;
-
-            this._hMatrix = BABYLON.Matrix.Translation(isLeftEye ? h : -h, 0, 0);
-
-            this.viewport = new BABYLON.Viewport(isLeftEye ? 0 : 0.5, 0, 0.5, 1.0);
-
-            this._preViewMatrix = BABYLON.Matrix.Translation(isLeftEye ? .5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance : -.5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance, 0, 0);
-
-            // Postprocess
-            var postProcess = new BABYLON.OculusDistortionCorrectionPostProcess("Oculus Distortion", this, !isLeftEye, OculusRiftDevKit2013_Metric);
-        }
-        _OculusInnerCamera.prototype.getProjectionMatrix = function () {
-            BABYLON.Matrix.PerspectiveFovLHToRef(this._aspectRatioFov, this._aspectRatioAspectRatio, this.minZ, this.maxZ, this._workMatrix);
-            this._workMatrix.multiplyToRef(this._hMatrix, this._projectionMatrix);
-            return this._projectionMatrix;
-        };
-
-        _OculusInnerCamera.prototype._getViewMatrix = function () {
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-
-            BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
-            BABYLON.Vector3.TransformNormalToRef(this.upVector, this._cameraRotationMatrix, this._actualUp);
-
-            // Computing target and final matrix
-            this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this._actualUp, this._workMatrix);
-
-            this._workMatrix.multiplyToRef(this._preViewMatrix, this._viewMatrix);
-            return this._viewMatrix;
-        };
-        return _OculusInnerCamera;
-    })(BABYLON.FreeCamera);
-
-    var OculusCamera = (function (_super) {
-        __extends(OculusCamera, _super);
-        function OculusCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-
-            this._leftCamera = new _OculusInnerCamera(name + "_left", position.clone(), scene, true);
-            this._rightCamera = new _OculusInnerCamera(name + "_right", position.clone(), scene, false);
-
-            this.subCameras.push(this._leftCamera);
-            this.subCameras.push(this._rightCamera);
-
-            this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
-        }
-        OculusCamera.prototype._update = function () {
-            this._leftCamera.position.copyFrom(this.position);
-            this._rightCamera.position.copyFrom(this.position);
-
-            this._updateCamera(this._leftCamera);
-            this._updateCamera(this._rightCamera);
-
-            _super.prototype._update.call(this);
-        };
-
-        OculusCamera.prototype._updateCamera = function (camera) {
-            camera.minZ = this.minZ;
-            camera.maxZ = this.maxZ;
-
-            camera.rotation.x = this.rotation.x;
-            camera.rotation.y = this.rotation.y;
-            camera.rotation.z = this.rotation.z;
-        };
-
-        // Oculus events
-        OculusCamera.prototype._onOrientationEvent = function (evt) {
-            var yaw = evt.alpha / 180 * Math.PI;
-            var pitch = evt.beta / 180 * Math.PI;
-            var roll = evt.gamma / 180 * Math.PI;
-
-            if (!this._offsetOrientation) {
-                this._offsetOrientation = {
-                    yaw: yaw,
-                    pitch: pitch,
-                    roll: roll
-                };
-                return;
-            } else {
-                this.rotation.y += yaw - this._offsetOrientation.yaw;
-                this.rotation.x += pitch - this._offsetOrientation.pitch;
-                this.rotation.z += this._offsetOrientation.roll - roll;
-
-                this._offsetOrientation.yaw = yaw;
-                this._offsetOrientation.pitch = pitch;
-                this._offsetOrientation.roll = roll;
-            }
-        };
-
-        OculusCamera.prototype.attachControl = function (element, noPreventDefault) {
-            _super.prototype.attachControl.call(this, element, noPreventDefault);
-
-            window.addEventListener("deviceorientation", this._deviceOrientationHandler);
-        };
-
-        OculusCamera.prototype.detachControl = function (element) {
-            _super.prototype.detachControl.call(this, element);
-
-            window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
-        };
-        return OculusCamera;
-    })(BABYLON.FreeCamera);
-    BABYLON.OculusCamera = OculusCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.oculusCamera.js.map

+ 0 - 142
Babylon/Cameras/babylon.oculusCamera.ts

@@ -1,142 +0,0 @@
-module BABYLON {
-
-    var OculusRiftDevKit2013_Metric = {
-        HResolution: 1280,
-        VResolution: 800,
-        HScreenSize: 0.149759993,
-        VScreenSize: 0.0935999975,
-        VScreenCenter: 0.0467999987,
-        EyeToScreenDistance: 0.0410000011,
-        LensSeparationDistance: 0.0635000020,
-        InterpupillaryDistance: 0.0640000030,
-        DistortionK: [1.0, 0.219999999, 0.239999995, 0.0],
-        ChromaAbCorrection: [0.995999992, -0.00400000019, 1.01400006, 0.0],
-        PostProcessScaleFactor: 1.714605507808412,
-        LensCenterOffset: 0.151976421
-    };
-
-    class _OculusInnerCamera extends FreeCamera {
-        private _aspectRatioAspectRatio: number;
-        private _aspectRatioFov: number;
-        private _hMatrix: Matrix;
-        private _workMatrix = new BABYLON.Matrix();
-        private _preViewMatrix: Matrix;
-        private _actualUp = new BABYLON.Vector3(0, 0, 0);
-
-        constructor(name: string, position: Vector3, scene: Scene, isLeftEye: boolean) {
-            super(name, position, scene);
-
-            // Constants
-            this._aspectRatioAspectRatio = OculusRiftDevKit2013_Metric.HResolution / (2 * OculusRiftDevKit2013_Metric.VResolution);
-            this._aspectRatioFov = (2 * Math.atan((OculusRiftDevKit2013_Metric.PostProcessScaleFactor * OculusRiftDevKit2013_Metric.VScreenSize) / (2 * OculusRiftDevKit2013_Metric.EyeToScreenDistance)));
-
-            var hMeters = (OculusRiftDevKit2013_Metric.HScreenSize / 4) - (OculusRiftDevKit2013_Metric.LensSeparationDistance / 2);
-            var h = (4 * hMeters) / OculusRiftDevKit2013_Metric.HScreenSize;
-
-            this._hMatrix = BABYLON.Matrix.Translation(isLeftEye ? h : -h, 0, 0);
-
-            this.viewport = new BABYLON.Viewport(isLeftEye ? 0 : 0.5, 0, 0.5, 1.0);
-
-            this._preViewMatrix = BABYLON.Matrix.Translation(isLeftEye ? .5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance : -.5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance, 0, 0);
-
-            // Postprocess
-            var postProcess = new BABYLON.OculusDistortionCorrectionPostProcess("Oculus Distortion", this, !isLeftEye, OculusRiftDevKit2013_Metric);
-        }
-
-        public getProjectionMatrix(): Matrix {
-            BABYLON.Matrix.PerspectiveFovLHToRef(this._aspectRatioFov, this._aspectRatioAspectRatio, this.minZ, this.maxZ, this._workMatrix);
-            this._workMatrix.multiplyToRef(this._hMatrix, this._projectionMatrix);
-            return this._projectionMatrix;
-        }
-
-        public _getViewMatrix(): Matrix {
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-
-            BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
-            BABYLON.Vector3.TransformNormalToRef(this.upVector, this._cameraRotationMatrix, this._actualUp);
-
-            // Computing target and final matrix
-            this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this._actualUp, this._workMatrix);
-
-            this._workMatrix.multiplyToRef(this._preViewMatrix, this._viewMatrix);
-            return this._viewMatrix;
-        }
-    }
-
-    export class OculusCamera extends FreeCamera {
-        private _leftCamera: _OculusInnerCamera;
-        private _rightCamera: _OculusInnerCamera;
-        private _offsetOrientation: { yaw: number; pitch: number; roll: number };
-        private _deviceOrientationHandler;
-
-        constructor(name: string, position: Vector3, scene: Scene) {
-            super(name, position, scene);
-
-            this._leftCamera = new _OculusInnerCamera(name + "_left", position.clone(), scene, true);
-            this._rightCamera = new _OculusInnerCamera(name + "_right", position.clone(), scene, false);
-
-            this.subCameras.push(this._leftCamera);
-            this.subCameras.push(this._rightCamera);
-
-            this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
-        }
-
-        public _update(): void {
-            this._leftCamera.position.copyFrom(this.position);
-            this._rightCamera.position.copyFrom(this.position);
-
-            this._updateCamera(this._leftCamera);
-            this._updateCamera(this._rightCamera);
-
-            super._update();
-        }
-
-        public _updateCamera(camera: FreeCamera): void {
-            camera.minZ = this.minZ;
-            camera.maxZ = this.maxZ;
-
-            camera.rotation.x = this.rotation.x;
-            camera.rotation.y = this.rotation.y;
-            camera.rotation.z = this.rotation.z;
-        }
-
-        // Oculus events
-        public _onOrientationEvent(evt: DeviceOrientationEvent): void {
-            var yaw = evt.alpha / 180 * Math.PI;
-            var pitch = evt.beta / 180 * Math.PI;
-            var roll = evt.gamma / 180 * Math.PI;
-
-            if (!this._offsetOrientation) {
-                this._offsetOrientation = {
-                    yaw: yaw,
-                    pitch: pitch,
-                    roll: roll
-                };
-                return;
-            }
-            else {
-                this.rotation.y += yaw - this._offsetOrientation.yaw;
-                this.rotation.x += pitch - this._offsetOrientation.pitch;
-                this.rotation.z += this._offsetOrientation.roll - roll;
-
-                this._offsetOrientation.yaw = yaw;
-                this._offsetOrientation.pitch = pitch;
-                this._offsetOrientation.roll = roll;
-            }
-        }
-
-        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
-            super.attachControl(element, noPreventDefault);
-
-            window.addEventListener("deviceorientation", this._deviceOrientationHandler);
-        }
-
-        public detachControl(element: HTMLElement): void {
-            super.detachControl(element);
-
-            window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
-        }
-    }
-} 

+ 0 - 175
Babylon/Cameras/babylon.oculusGamepadCamera.js

@@ -1,175 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var OculusRiftDevKit2013_Metric = {
-        HResolution: 1280,
-        VResolution: 800,
-        HScreenSize: 0.149759993,
-        VScreenSize: 0.0935999975,
-        VScreenCenter: 0.0467999987,
-        EyeToScreenDistance: 0.0410000011,
-        LensSeparationDistance: 0.0635000020,
-        InterpupillaryDistance: 0.0640000030,
-        DistortionK: [1.0, 0.219999999, 0.239999995, 0.0],
-        ChromaAbCorrection: [0.995999992, -0.00400000019, 1.01400006, 0.0],
-        PostProcessScaleFactor: 1.714605507808412,
-        LensCenterOffset: 0.151976421
-    };
-
-    var _OculusInnerGamepadCamera = (function (_super) {
-        __extends(_OculusInnerGamepadCamera, _super);
-        function _OculusInnerGamepadCamera(name, position, scene, isLeftEye) {
-            _super.call(this, name, position, scene);
-            this._workMatrix = new BABYLON.Matrix();
-            this._actualUp = new BABYLON.Vector3(0, 0, 0);
-
-            // Constants
-            this._aspectRatioAspectRatio = OculusRiftDevKit2013_Metric.HResolution / (2 * OculusRiftDevKit2013_Metric.VResolution);
-            this._aspectRatioFov = (2 * Math.atan((OculusRiftDevKit2013_Metric.PostProcessScaleFactor * OculusRiftDevKit2013_Metric.VScreenSize) / (2 * OculusRiftDevKit2013_Metric.EyeToScreenDistance)));
-
-            var hMeters = (OculusRiftDevKit2013_Metric.HScreenSize / 4) - (OculusRiftDevKit2013_Metric.LensSeparationDistance / 2);
-            var h = (4 * hMeters) / OculusRiftDevKit2013_Metric.HScreenSize;
-
-            this._hMatrix = BABYLON.Matrix.Translation(isLeftEye ? h : -h, 0, 0);
-
-            this.viewport = new BABYLON.Viewport(isLeftEye ? 0 : 0.5, 0, 0.5, 1.0);
-
-            this._preViewMatrix = BABYLON.Matrix.Translation(isLeftEye ? .5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance : -.5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance, 0, 0);
-
-            // Postprocess
-            var postProcess = new BABYLON.OculusDistortionCorrectionPostProcess("Oculus Distortion", this, !isLeftEye, OculusRiftDevKit2013_Metric);
-        }
-        _OculusInnerGamepadCamera.prototype.getProjectionMatrix = function () {
-            BABYLON.Matrix.PerspectiveFovLHToRef(this._aspectRatioFov, this._aspectRatioAspectRatio, this.minZ, this.maxZ, this._workMatrix);
-            this._workMatrix.multiplyToRef(this._hMatrix, this._projectionMatrix);
-            return this._projectionMatrix;
-        };
-
-        _OculusInnerGamepadCamera.prototype._getViewMatrix = function () {
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-
-            BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
-            BABYLON.Vector3.TransformNormalToRef(this.upVector, this._cameraRotationMatrix, this._actualUp);
-
-            // Computing target and final matrix
-            this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this._actualUp, this._workMatrix);
-
-            this._workMatrix.multiplyToRef(this._preViewMatrix, this._viewMatrix);
-            return this._viewMatrix;
-        };
-        return _OculusInnerGamepadCamera;
-    })(BABYLON.FreeCamera);
-
-    var OculusGamepadCamera = (function (_super) {
-        __extends(OculusGamepadCamera, _super);
-        function OculusGamepadCamera(name, position, scene) {
-            var _this = this;
-            _super.call(this, name, position, scene);
-            this.angularSensibility = 200;
-            this.moveSensibility = 75;
-
-            this._leftCamera = new _OculusInnerGamepadCamera(name + "_left", position.clone(), scene, true);
-            this._rightCamera = new _OculusInnerGamepadCamera(name + "_right", position.clone(), scene, false);
-
-            this.subCameras.push(this._leftCamera);
-            this.subCameras.push(this._rightCamera);
-
-            this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
-            this._gamepads = new BABYLON.Gamepads(function (gamepad) {
-                _this._onNewGameConnected(gamepad);
-            });
-        }
-        OculusGamepadCamera.prototype._onNewGameConnected = function (gamepad) {
-            // Only the first gamepad can control the camera
-            if (gamepad.index === 0) {
-                this._gamepad = gamepad;
-            }
-        };
-
-        OculusGamepadCamera.prototype._update = function () {
-            this._leftCamera.position.copyFrom(this.position);
-            this._rightCamera.position.copyFrom(this.position);
-
-            this._updateCamera(this._leftCamera);
-            this._updateCamera(this._rightCamera);
-
-            _super.prototype._update.call(this);
-        };
-
-        OculusGamepadCamera.prototype._checkInputs = function () {
-            if (!this._gamepad) {
-                return;
-            }
-
-            var LSValues = this._gamepad.leftStick;
-            var normalizedLX = LSValues.x / this.moveSensibility;
-            var normalizedLY = LSValues.y / this.moveSensibility;
-            LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;
-            LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;
-
-            var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
-            var deltaTransform = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(LSValues.x, 0, -LSValues.y), cameraTransform);
-            this.cameraDirection = this.cameraDirection.add(deltaTransform);
-        };
-
-        OculusGamepadCamera.prototype._updateCamera = function (camera) {
-            camera.minZ = this.minZ;
-            camera.maxZ = this.maxZ;
-
-            camera.rotation.x = this.rotation.x;
-            camera.rotation.y = this.rotation.y;
-            camera.rotation.z = this.rotation.z;
-        };
-
-        // Oculus events
-        OculusGamepadCamera.prototype._onOrientationEvent = function (evt) {
-            var yaw = evt.alpha / 180 * Math.PI;
-            var pitch = evt.beta / 180 * Math.PI;
-            var roll = evt.gamma / 180 * Math.PI;
-
-            if (!this._offsetOrientation) {
-                this._offsetOrientation = {
-                    yaw: yaw,
-                    pitch: pitch,
-                    roll: roll
-                };
-                return;
-            } else {
-                this.rotation.y += yaw - this._offsetOrientation.yaw;
-                this.rotation.x += pitch - this._offsetOrientation.pitch;
-                this.rotation.z += this._offsetOrientation.roll - roll;
-
-                this._offsetOrientation.yaw = yaw;
-                this._offsetOrientation.pitch = pitch;
-                this._offsetOrientation.roll = roll;
-            }
-        };
-
-        OculusGamepadCamera.prototype.attachControl = function (element, noPreventDefault) {
-            _super.prototype.attachControl.call(this, element, noPreventDefault);
-
-            window.addEventListener("deviceorientation", this._deviceOrientationHandler);
-        };
-
-        OculusGamepadCamera.prototype.detachControl = function (element) {
-            _super.prototype.detachControl.call(this, element);
-
-            window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
-        };
-
-        OculusGamepadCamera.prototype.dispose = function () {
-            this._gamepads.dispose();
-            _super.prototype.dispose.call(this);
-        };
-        return OculusGamepadCamera;
-    })(BABYLON.FreeCamera);
-    BABYLON.OculusGamepadCamera = OculusGamepadCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.oculusGamepadCamera.js.map

+ 0 - 175
Babylon/Cameras/babylon.oculusGamepadCamera.ts

@@ -1,175 +0,0 @@
-module BABYLON {
-
-    var OculusRiftDevKit2013_Metric = {
-        HResolution: 1280,
-        VResolution: 800,
-        HScreenSize: 0.149759993,
-        VScreenSize: 0.0935999975,
-        VScreenCenter: 0.0467999987,
-        EyeToScreenDistance: 0.0410000011,
-        LensSeparationDistance: 0.0635000020,
-        InterpupillaryDistance: 0.0640000030,
-        DistortionK: [1.0, 0.219999999, 0.239999995, 0.0],
-        ChromaAbCorrection: [0.995999992, -0.00400000019, 1.01400006, 0.0],
-        PostProcessScaleFactor: 1.714605507808412,
-        LensCenterOffset: 0.151976421
-    };
-
-    class _OculusInnerGamepadCamera extends FreeCamera {
-        private _aspectRatioAspectRatio: number;
-        private _aspectRatioFov: number;
-        private _hMatrix: Matrix;
-        private _workMatrix = new BABYLON.Matrix();
-        private _preViewMatrix: Matrix;
-        private _actualUp = new BABYLON.Vector3(0, 0, 0);
-
-        constructor(name: string, position: Vector3, scene: Scene, isLeftEye: boolean) {
-            super(name, position, scene);
-
-            // Constants
-            this._aspectRatioAspectRatio = OculusRiftDevKit2013_Metric.HResolution / (2 * OculusRiftDevKit2013_Metric.VResolution);
-            this._aspectRatioFov = (2 * Math.atan((OculusRiftDevKit2013_Metric.PostProcessScaleFactor * OculusRiftDevKit2013_Metric.VScreenSize) / (2 * OculusRiftDevKit2013_Metric.EyeToScreenDistance)));
-
-            var hMeters = (OculusRiftDevKit2013_Metric.HScreenSize / 4) - (OculusRiftDevKit2013_Metric.LensSeparationDistance / 2);
-            var h = (4 * hMeters) / OculusRiftDevKit2013_Metric.HScreenSize;
-
-            this._hMatrix = BABYLON.Matrix.Translation(isLeftEye ? h : -h, 0, 0);
-
-            this.viewport = new BABYLON.Viewport(isLeftEye ? 0 : 0.5, 0, 0.5, 1.0);
-
-            this._preViewMatrix = BABYLON.Matrix.Translation(isLeftEye ? .5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance : -.5 * OculusRiftDevKit2013_Metric.InterpupillaryDistance, 0, 0);
-
-            // Postprocess
-            var postProcess = new BABYLON.OculusDistortionCorrectionPostProcess("Oculus Distortion", this, !isLeftEye, OculusRiftDevKit2013_Metric);
-        }
-
-        public getProjectionMatrix(): Matrix {
-            BABYLON.Matrix.PerspectiveFovLHToRef(this._aspectRatioFov, this._aspectRatioAspectRatio, this.minZ, this.maxZ, this._workMatrix);
-            this._workMatrix.multiplyToRef(this._hMatrix, this._projectionMatrix);
-            return this._projectionMatrix;
-        }
-
-        public _getViewMatrix(): Matrix {
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-
-            BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
-            BABYLON.Vector3.TransformNormalToRef(this.upVector, this._cameraRotationMatrix, this._actualUp);
-
-            // Computing target and final matrix
-            this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this._actualUp, this._workMatrix);
-
-            this._workMatrix.multiplyToRef(this._preViewMatrix, this._viewMatrix);
-            return this._viewMatrix;
-        }
-    }
-
-    export class OculusGamepadCamera extends FreeCamera {
-        private _leftCamera: _OculusInnerGamepadCamera;
-        private _rightCamera: _OculusInnerGamepadCamera;
-        private _offsetOrientation: { yaw: number; pitch: number; roll: number };
-        private _deviceOrientationHandler;
-        private _gamepad: BABYLON.Gamepad;
-        private _gamepads: BABYLON.Gamepads;
-        public angularSensibility = 200;
-        public moveSensibility = 75;
-
-        constructor(name: string, position: Vector3, scene: Scene) {
-            super(name, position, scene);
-
-            this._leftCamera = new _OculusInnerGamepadCamera(name + "_left", position.clone(), scene, true);
-            this._rightCamera = new _OculusInnerGamepadCamera(name + "_right", position.clone(), scene, false);
-
-            this.subCameras.push(this._leftCamera);
-            this.subCameras.push(this._rightCamera);
-
-            this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
-            this._gamepads = new BABYLON.Gamepads((gamepad: BABYLON.Gamepad) => { this._onNewGameConnected(gamepad); });
-        }
-
-        private _onNewGameConnected(gamepad: BABYLON.Gamepad) {
-            // Only the first gamepad can control the camera
-            if (gamepad.index === 0) {
-                this._gamepad = gamepad;
-            }
-        }
-
-        public _update(): void {
-            this._leftCamera.position.copyFrom(this.position);
-            this._rightCamera.position.copyFrom(this.position);
-
-            this._updateCamera(this._leftCamera);
-            this._updateCamera(this._rightCamera);
-
-            super._update();
-        }
-
-        public _checkInputs(): void {
-            if (!this._gamepad) {
-                return;
-            }
-
-            var LSValues = this._gamepad.leftStick;
-            var normalizedLX = LSValues.x / this.moveSensibility;
-            var normalizedLY = LSValues.y / this.moveSensibility;
-            LSValues.x = Math.abs(normalizedLX) > 0.005 ? 0 + normalizedLX : 0;
-            LSValues.y = Math.abs(normalizedLY) > 0.005 ? 0 + normalizedLY : 0;
-
-            var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
-            var deltaTransform = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(LSValues.x, 0, -LSValues.y), cameraTransform);
-            this.cameraDirection = this.cameraDirection.add(deltaTransform);
-        }
-
-        public _updateCamera(camera: FreeCamera): void {
-            camera.minZ = this.minZ;
-            camera.maxZ = this.maxZ;
-
-            camera.rotation.x = this.rotation.x;
-            camera.rotation.y = this.rotation.y;
-            camera.rotation.z = this.rotation.z;
-        }
-
-        // Oculus events
-        public _onOrientationEvent(evt: DeviceOrientationEvent): void {
-            var yaw = evt.alpha / 180 * Math.PI;
-            var pitch = evt.beta / 180 * Math.PI;
-            var roll = evt.gamma / 180 * Math.PI;
-
-            if (!this._offsetOrientation) {
-                this._offsetOrientation = {
-                    yaw: yaw,
-                    pitch: pitch,
-                    roll: roll
-                };
-                return;
-            }
-            else {
-                this.rotation.y += yaw - this._offsetOrientation.yaw;
-                this.rotation.x += pitch - this._offsetOrientation.pitch;
-                this.rotation.z += this._offsetOrientation.roll - roll;
-
-                this._offsetOrientation.yaw = yaw;
-                this._offsetOrientation.pitch = pitch;
-                this._offsetOrientation.roll = roll;
-            }
-        }
-
-        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
-            super.attachControl(element, noPreventDefault);
-
-            window.addEventListener("deviceorientation", this._deviceOrientationHandler);
-        }
-
-        public detachControl(element: HTMLElement): void {
-            super.detachControl(element);
-
-            window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
-        }
-
-        public dispose(): void {
-            this._gamepads.dispose();
-            super.dispose();
-        }
-    }
-} 

+ 0 - 203
Babylon/Cameras/babylon.targetCamera.js

@@ -1,203 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var TargetCamera = (function (_super) {
-        __extends(TargetCamera, _super);
-        function TargetCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this.cameraDirection = new BABYLON.Vector3(0, 0, 0);
-            this.cameraRotation = new BABYLON.Vector2(0, 0);
-            this.rotation = new BABYLON.Vector3(0, 0, 0);
-            this.speed = 2.0;
-            this.noRotationConstraint = false;
-            this.lockedTarget = null;
-            this._currentTarget = BABYLON.Vector3.Zero();
-            this._viewMatrix = BABYLON.Matrix.Zero();
-            this._camMatrix = BABYLON.Matrix.Zero();
-            this._cameraTransformMatrix = BABYLON.Matrix.Zero();
-            this._cameraRotationMatrix = BABYLON.Matrix.Zero();
-            this._referencePoint = new BABYLON.Vector3(0, 0, 1);
-            this._transformedReferencePoint = BABYLON.Vector3.Zero();
-            this._lookAtTemp = BABYLON.Matrix.Zero();
-            this._tempMatrix = BABYLON.Matrix.Zero();
-        }
-        TargetCamera.prototype._getLockedTargetPosition = function () {
-            if (!this.lockedTarget) {
-                return null;
-            }
-
-            return this.lockedTarget.position || this.lockedTarget;
-        };
-
-        // Cache
-        TargetCamera.prototype._initCache = function () {
-            _super.prototype._initCache.call(this);
-            this._cache.lockedTarget = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-            this._cache.rotation = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-        };
-
-        TargetCamera.prototype._updateCache = function (ignoreParentClass) {
-            if (!ignoreParentClass) {
-                _super.prototype._updateCache.call(this);
-            }
-
-            var lockedTargetPosition = this._getLockedTargetPosition();
-            if (!lockedTargetPosition) {
-                this._cache.lockedTarget = null;
-            } else {
-                if (!this._cache.lockedTarget) {
-                    this._cache.lockedTarget = lockedTargetPosition.clone();
-                } else {
-                    this._cache.lockedTarget.copyFrom(lockedTargetPosition);
-                }
-            }
-
-            this._cache.rotation.copyFrom(this.rotation);
-        };
-
-        // Synchronized
-        TargetCamera.prototype._isSynchronizedViewMatrix = function () {
-            if (!_super.prototype._isSynchronizedViewMatrix.call(this)) {
-                return false;
-            }
-
-            var lockedTargetPosition = this._getLockedTargetPosition();
-
-            return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition) && this._cache.rotation.equals(this.rotation);
-        };
-
-        // Methods
-        TargetCamera.prototype._computeLocalCameraSpeed = function () {
-            return this.speed * ((BABYLON.Tools.GetDeltaTime() / (BABYLON.Tools.GetFps() * 10.0)));
-        };
-
-        // Target
-        TargetCamera.prototype.setTarget = function (target) {
-            this.upVector.normalize();
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, target, this.upVector, this._camMatrix);
-            this._camMatrix.invert();
-
-            this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]);
-
-            var vDir = target.subtract(this.position);
-
-            if (vDir.x >= 0.0) {
-                this.rotation.y = (-Math.atan(vDir.z / vDir.x) + Math.PI / 2.0);
-            } else {
-                this.rotation.y = (-Math.atan(vDir.z / vDir.x) - Math.PI / 2.0);
-            }
-
-            this.rotation.z = -Math.acos(BABYLON.Vector3.Dot(new BABYLON.Vector3(0, 1.0, 0), this.upVector));
-
-            if (isNaN(this.rotation.x)) {
-                this.rotation.x = 0;
-            }
-
-            if (isNaN(this.rotation.y)) {
-                this.rotation.y = 0;
-            }
-
-            if (isNaN(this.rotation.z)) {
-                this.rotation.z = 0;
-            }
-        };
-
-        TargetCamera.prototype.getTarget = function () {
-            return this._currentTarget;
-        };
-
-        TargetCamera.prototype._decideIfNeedsToMove = function () {
-            return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;
-        };
-
-        TargetCamera.prototype._updatePosition = function () {
-            this.position.addInPlace(this.cameraDirection);
-        };
-        TargetCamera.prototype._update = function () {
-            var needToMove = this._decideIfNeedsToMove();
-            var needToRotate = Math.abs(this.cameraRotation.x) > 0 || Math.abs(this.cameraRotation.y) > 0;
-
-            // Move
-            if (needToMove) {
-                this._updatePosition();
-            }
-
-            // Rotate
-            if (needToRotate) {
-                this.rotation.x += this.cameraRotation.x;
-                this.rotation.y += this.cameraRotation.y;
-
-                if (!this.noRotationConstraint) {
-                    var limit = (Math.PI / 2) * 0.95;
-
-                    if (this.rotation.x > limit)
-                        this.rotation.x = limit;
-                    if (this.rotation.x < -limit)
-                        this.rotation.x = -limit;
-                }
-            }
-
-            // Inertia
-            if (needToMove) {
-                if (Math.abs(this.cameraDirection.x) < BABYLON.Engine.Epsilon) {
-                    this.cameraDirection.x = 0;
-                }
-
-                if (Math.abs(this.cameraDirection.y) < BABYLON.Engine.Epsilon) {
-                    this.cameraDirection.y = 0;
-                }
-
-                if (Math.abs(this.cameraDirection.z) < BABYLON.Engine.Epsilon) {
-                    this.cameraDirection.z = 0;
-                }
-
-                this.cameraDirection.scaleInPlace(this.inertia);
-            }
-            if (needToRotate) {
-                if (Math.abs(this.cameraRotation.x) < BABYLON.Engine.Epsilon) {
-                    this.cameraRotation.x = 0;
-                }
-
-                if (Math.abs(this.cameraRotation.y) < BABYLON.Engine.Epsilon) {
-                    this.cameraRotation.y = 0;
-                }
-                this.cameraRotation.scaleInPlace(this.inertia);
-            }
-        };
-
-        TargetCamera.prototype._getViewMatrix = function () {
-            if (!this.lockedTarget) {
-                // Compute
-                if (this.upVector.x != 0 || this.upVector.y != 1.0 || this.upVector.z != 0) {
-                    BABYLON.Matrix.LookAtLHToRef(BABYLON.Vector3.Zero(), this._referencePoint, this.upVector, this._lookAtTemp);
-                    BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-
-                    this._lookAtTemp.multiplyToRef(this._cameraRotationMatrix, this._tempMatrix);
-                    this._lookAtTemp.invert();
-                    this._tempMatrix.multiplyToRef(this._lookAtTemp, this._cameraRotationMatrix);
-                } else {
-                    BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-                }
-
-                BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
-
-                // Computing target and final matrix
-                this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-            } else {
-                this._currentTarget.copyFrom(this._getLockedTargetPosition());
-            }
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this.upVector, this._viewMatrix);
-            return this._viewMatrix;
-        };
-        return TargetCamera;
-    })(BABYLON.Camera);
-    BABYLON.TargetCamera = TargetCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.targetCamera.js.map

+ 0 - 209
Babylon/Cameras/babylon.targetCamera.ts

@@ -1,209 +0,0 @@
-module BABYLON {
-    export class TargetCamera extends Camera {
-
-        public cameraDirection = new BABYLON.Vector3(0, 0, 0);
-        public cameraRotation = new BABYLON.Vector2(0, 0);
-        public rotation = new BABYLON.Vector3(0, 0, 0);
-
-        public speed = 2.0;
-        public noRotationConstraint = false;
-        public lockedTarget = null;
-
-        public _currentTarget = BABYLON.Vector3.Zero();
-        public _viewMatrix = BABYLON.Matrix.Zero();
-        public _camMatrix = BABYLON.Matrix.Zero();
-        public _cameraTransformMatrix = BABYLON.Matrix.Zero();
-        public _cameraRotationMatrix = BABYLON.Matrix.Zero();
-        public _referencePoint = new BABYLON.Vector3(0, 0, 1);
-        public _transformedReferencePoint = BABYLON.Vector3.Zero();
-        public _lookAtTemp = BABYLON.Matrix.Zero();
-        public _tempMatrix = BABYLON.Matrix.Zero();
-
-        public _reset:() => void;
-
-        public _waitingLockedTargetId:string;
-
-        constructor(name:string, position:Vector3, scene:Scene) {
-            super(name, position, scene);
-        }
-
-        public _getLockedTargetPosition():Vector3 {
-            if (!this.lockedTarget) {
-                return null;
-            }
-
-            return this.lockedTarget.position || this.lockedTarget;
-        }
-
-        // Cache
-        public _initCache() {
-            super._initCache();
-            this._cache.lockedTarget = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-            this._cache.rotation = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
-        }
-
-        public _updateCache(ignoreParentClass?:boolean):void {
-            if (!ignoreParentClass) {
-                super._updateCache();
-            }
-
-            var lockedTargetPosition = this._getLockedTargetPosition();
-            if (!lockedTargetPosition) {
-                this._cache.lockedTarget = null;
-            }
-            else {
-                if (!this._cache.lockedTarget) {
-                    this._cache.lockedTarget = lockedTargetPosition.clone();
-                }
-                else {
-                    this._cache.lockedTarget.copyFrom(lockedTargetPosition);
-                }
-            }
-
-            this._cache.rotation.copyFrom(this.rotation);
-        }
-
-        // Synchronized
-        public _isSynchronizedViewMatrix():boolean {
-            if (!super._isSynchronizedViewMatrix()) {
-                return false;
-            }
-
-            var lockedTargetPosition = this._getLockedTargetPosition();
-
-            return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition)
-                && this._cache.rotation.equals(this.rotation);
-        }
-
-        // Methods
-        public _computeLocalCameraSpeed():number {
-            return this.speed * ((BABYLON.Tools.GetDeltaTime() / (BABYLON.Tools.GetFps() * 10.0)));
-        }
-
-        // Target
-        public setTarget(target:Vector3):void {
-            this.upVector.normalize();
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, target, this.upVector, this._camMatrix);
-            this._camMatrix.invert();
-
-            this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]);
-
-            var vDir = target.subtract(this.position);
-
-            if (vDir.x >= 0.0) {
-                this.rotation.y = (-Math.atan(vDir.z / vDir.x) + Math.PI / 2.0);
-            } else {
-                this.rotation.y = (-Math.atan(vDir.z / vDir.x) - Math.PI / 2.0);
-            }
-
-            this.rotation.z = -Math.acos(BABYLON.Vector3.Dot(new BABYLON.Vector3(0, 1.0, 0), this.upVector));
-
-            if (isNaN(this.rotation.x)) {
-                this.rotation.x = 0;
-            }
-
-            if (isNaN(this.rotation.y)) {
-                this.rotation.y = 0;
-            }
-
-            if (isNaN(this.rotation.z)) {
-                this.rotation.z = 0;
-            }
-        }
-
-        public getTarget():Vector3 {
-            return this._currentTarget;
-        }
-
-
-        public _decideIfNeedsToMove():boolean {
-            return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;
-        }
-
-        public _updatePosition():void{
-            this.position.addInPlace(this.cameraDirection);
-        }
-        public _update():void {
-            var needToMove = this._decideIfNeedsToMove();
-            var needToRotate = Math.abs(this.cameraRotation.x) > 0 || Math.abs(this.cameraRotation.y) > 0;
-
-            // Move
-            if (needToMove) {
-                this._updatePosition();
-            }
-
-            // Rotate
-            if (needToRotate) {
-                this.rotation.x += this.cameraRotation.x;
-                this.rotation.y += this.cameraRotation.y;
-
-
-                if (!this.noRotationConstraint) {
-                    var limit = (Math.PI / 2) * 0.95;
-
-
-                    if (this.rotation.x > limit)
-                        this.rotation.x = limit;
-                    if (this.rotation.x < -limit)
-                        this.rotation.x = -limit;
-                }
-            }
-
-            // Inertia
-            if (needToMove) {
-                if (Math.abs(this.cameraDirection.x) < BABYLON.Engine.Epsilon) {
-                    this.cameraDirection.x = 0;
-                }
-
-                if (Math.abs(this.cameraDirection.y) < BABYLON.Engine.Epsilon) {
-                    this.cameraDirection.y = 0;
-                }
-
-                if (Math.abs(this.cameraDirection.z) < BABYLON.Engine.Epsilon) {
-                    this.cameraDirection.z = 0;
-                }
-
-                this.cameraDirection.scaleInPlace(this.inertia);
-            }
-            if (needToRotate) {
-                if (Math.abs(this.cameraRotation.x) < BABYLON.Engine.Epsilon) {
-                    this.cameraRotation.x = 0;
-                }
-
-                if (Math.abs(this.cameraRotation.y) < BABYLON.Engine.Epsilon) {
-                    this.cameraRotation.y = 0;
-                }
-                this.cameraRotation.scaleInPlace(this.inertia);
-            }
-        }
-
-
-        public _getViewMatrix():Matrix {
-            if (!this.lockedTarget) {
-                // Compute
-                if (this.upVector.x != 0 || this.upVector.y != 1.0 || this.upVector.z != 0) {
-                    BABYLON.Matrix.LookAtLHToRef(BABYLON.Vector3.Zero(), this._referencePoint, this.upVector, this._lookAtTemp);
-                    BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-
-
-                    this._lookAtTemp.multiplyToRef(this._cameraRotationMatrix, this._tempMatrix);
-                    this._lookAtTemp.invert();
-                    this._tempMatrix.multiplyToRef(this._lookAtTemp, this._cameraRotationMatrix);
-                } else {
-                    BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-                }
-
-                BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
-
-                // Computing target and final matrix
-                this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
-            } else {
-                this._currentTarget.copyFrom(this._getLockedTargetPosition());
-            }
-
-            BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this.upVector, this._viewMatrix);
-            return this._viewMatrix;
-        }
-    }
-} 

+ 0 - 140
Babylon/Cameras/babylon.touchCamera.js

@@ -1,140 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    // We're mainly based on the logic defined into the FreeCamera code
-    var TouchCamera = (function (_super) {
-        __extends(TouchCamera, _super);
-        function TouchCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this._offsetX = null;
-            this._offsetY = null;
-            this._pointerCount = 0;
-            this._pointerPressed = [];
-            this.angularSensibility = 200000.0;
-            this.moveSensibility = 500.0;
-        }
-        TouchCamera.prototype.attachControl = function (canvas, noPreventDefault) {
-            var _this = this;
-            var previousPosition;
-
-            if (this._attachedCanvas) {
-                return;
-            }
-            this._attachedCanvas = canvas;
-
-            if (this._onPointerDown === undefined) {
-                this._onPointerDown = function (evt) {
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-
-                    _this._pointerPressed.push(evt.pointerId);
-
-                    if (_this._pointerPressed.length !== 1) {
-                        return;
-                    }
-
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-                };
-
-                this._onPointerUp = function (evt) {
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-
-                    var index = _this._pointerPressed.indexOf(evt.pointerId);
-
-                    if (index === -1) {
-                        return;
-                    }
-                    _this._pointerPressed.splice(index, 1);
-
-                    if (index != 0) {
-                        return;
-                    }
-                    previousPosition = null;
-                    _this._offsetX = null;
-                    _this._offsetY = null;
-                };
-
-                this._onPointerMove = function (evt) {
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-
-                    if (!previousPosition) {
-                        return;
-                    }
-
-                    var index = _this._pointerPressed.indexOf(evt.pointerId);
-
-                    if (index != 0) {
-                        return;
-                    }
-
-                    _this._offsetX = evt.clientX - previousPosition.x;
-                    _this._offsetY = -(evt.clientY - previousPosition.y);
-                };
-
-                this._onLostFocus = function () {
-                    _this._offsetX = null;
-                    _this._offsetY = null;
-                };
-            }
-
-            canvas.addEventListener("pointerdown", this._onPointerDown);
-            canvas.addEventListener("pointerup", this._onPointerUp);
-            canvas.addEventListener("pointerout", this._onPointerUp);
-            canvas.addEventListener("pointermove", this._onPointerMove);
-
-            BABYLON.Tools.RegisterTopRootEvents([
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        };
-
-        TouchCamera.prototype.detachControl = function (canvas) {
-            if (this._attachedCanvas != canvas) {
-                return;
-            }
-
-            canvas.removeEventListener("pointerdown", this._onPointerDown);
-            canvas.removeEventListener("pointerup", this._onPointerUp);
-            canvas.removeEventListener("pointerout", this._onPointerUp);
-            canvas.removeEventListener("pointermove", this._onPointerMove);
-
-            BABYLON.Tools.UnregisterTopRootEvents([
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-
-            this._attachedCanvas = null;
-        };
-
-        TouchCamera.prototype._checkInputs = function () {
-            if (!this._offsetX) {
-                return;
-            }
-            this.cameraRotation.y += this._offsetX / this.angularSensibility;
-
-            if (this._pointerPressed.length > 1) {
-                this.cameraRotation.x += -this._offsetY / this.angularSensibility;
-            } else {
-                var speed = this._computeLocalCameraSpeed();
-                var direction = new BABYLON.Vector3(0, 0, speed * this._offsetY / this.moveSensibility);
-
-                BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, 0, this._cameraRotationMatrix);
-                this.cameraDirection.addInPlace(BABYLON.Vector3.TransformCoordinates(direction, this._cameraRotationMatrix));
-            }
-        };
-        return TouchCamera;
-    })(BABYLON.FreeCamera);
-    BABYLON.TouchCamera = TouchCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.touchCamera.js.map

+ 0 - 137
Babylon/Cameras/babylon.touchCamera.ts

@@ -1,137 +0,0 @@
-module BABYLON {
-    // We're mainly based on the logic defined into the FreeCamera code
-    export class TouchCamera extends FreeCamera {
-        private _offsetX: number = null;
-        private _offsetY: number = null;
-        private _pointerCount:number = 0;
-        private _pointerPressed = [];
-        private _attachedCanvas: HTMLCanvasElement;
-        private _onPointerDown: (e: PointerEvent) => any;
-        private _onPointerUp: (e: PointerEvent) => any;
-        private _onPointerMove: (e: PointerEvent) => any;
-
-        public angularSensibility: number = 200000.0;
-        public moveSensibility: number = 500.0;
-
-        constructor(name: string, position: Vector3, scene: Scene) {
-            super(name, position, scene);
-        }
-
-        public attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void {
-            var previousPosition;
-
-            if (this._attachedCanvas) {
-                return;
-            }
-            this._attachedCanvas = canvas;
-
-            if (this._onPointerDown === undefined) {
-
-                this._onPointerDown = (evt) => {
-
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-
-                    this._pointerPressed.push(evt.pointerId);
-
-                    if (this._pointerPressed.length !== 1) {
-                        return;
-                    }
-
-                    previousPosition = {
-                        x: evt.clientX,
-                        y: evt.clientY
-                    };
-                };
-
-                this._onPointerUp = (evt) => {
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-
-                    var index: number = this._pointerPressed.indexOf(evt.pointerId);
-
-                    if (index === -1) {
-                        return;
-                    }
-                    this._pointerPressed.splice(index, 1);
-
-                    if (index != 0) {
-                        return;
-                    }
-                    previousPosition = null;
-                    this._offsetX = null;
-                    this._offsetY = null;
-                };
-
-                this._onPointerMove = (evt) => {
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-
-                    if (!previousPosition) {
-                        return;
-                    }
-
-                    var index: number = this._pointerPressed.indexOf(evt.pointerId);
-
-                    if (index != 0) {
-                        return;
-                    }
-
-                    this._offsetX = evt.clientX - previousPosition.x;
-                    this._offsetY = -(evt.clientY - previousPosition.y);
-                };
-
-                this._onLostFocus = () => {
-                    this._offsetX = null;
-                    this._offsetY = null;
-                };
-            }
-
-            canvas.addEventListener("pointerdown", this._onPointerDown);
-            canvas.addEventListener("pointerup", this._onPointerUp);
-            canvas.addEventListener("pointerout", this._onPointerUp);
-            canvas.addEventListener("pointermove", this._onPointerMove);
-
-            BABYLON.Tools.RegisterTopRootEvents([
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        }
-
-        public detachControl(canvas: HTMLCanvasElement): void {
-            if (this._attachedCanvas != canvas) {
-                return;
-            }
-
-            canvas.removeEventListener("pointerdown", this._onPointerDown);
-            canvas.removeEventListener("pointerup", this._onPointerUp);
-            canvas.removeEventListener("pointerout", this._onPointerUp);
-            canvas.removeEventListener("pointermove", this._onPointerMove);
-
-            BABYLON.Tools.UnregisterTopRootEvents([
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-
-            this._attachedCanvas = null;
-        }
-
-        public _checkInputs(): void {
-            if (!this._offsetX) {
-                return;
-            }
-            this.cameraRotation.y += this._offsetX / this.angularSensibility;
-
-            if (this._pointerPressed.length > 1) {
-                this.cameraRotation.x += -this._offsetY / this.angularSensibility;
-            } else {
-                var speed = this._computeLocalCameraSpeed();
-                var direction = new BABYLON.Vector3(0, 0, speed * this._offsetY / this.moveSensibility);
-
-                BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, 0, this._cameraRotationMatrix);
-                this.cameraDirection.addInPlace(BABYLON.Vector3.TransformCoordinates(direction, this._cameraRotationMatrix));
-            }
-        }
-    }
-}

+ 0 - 46
Babylon/Cameras/babylon.virtualJoysticksCamera.js

@@ -1,46 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    // We're mainly based on the logic defined into the FreeCamera code
-    var VirtualJoysticksCamera = (function (_super) {
-        __extends(VirtualJoysticksCamera, _super);
-        function VirtualJoysticksCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this._leftjoystick = new BABYLON.VirtualJoystick(true);
-            this._leftjoystick.setAxisForUpDown(2 /* Z */);
-            this._leftjoystick.setAxisForLeftRight(0 /* X */);
-            this._leftjoystick.setJoystickSensibility(0.15);
-            this._rightjoystick = new BABYLON.VirtualJoystick(false);
-            this._rightjoystick.setAxisForUpDown(0 /* X */);
-            this._rightjoystick.setAxisForLeftRight(1 /* Y */);
-            this._rightjoystick.reverseUpDown = true;
-            this._rightjoystick.setJoystickSensibility(0.05);
-            this._rightjoystick.setJoystickColor("yellow");
-        }
-        VirtualJoysticksCamera.prototype._checkInputs = function () {
-            var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
-            var deltaTransform = BABYLON.Vector3.TransformCoordinates(this._leftjoystick.deltaPosition, cameraTransform);
-            this.cameraDirection = this.cameraDirection.add(deltaTransform);
-            this.cameraRotation = this.cameraRotation.addVector3(this._rightjoystick.deltaPosition);
-            if (!this._leftjoystick.pressed) {
-                this._leftjoystick.deltaPosition = this._leftjoystick.deltaPosition.scale(0.9);
-            }
-            if (!this._rightjoystick.pressed) {
-                this._rightjoystick.deltaPosition = this._rightjoystick.deltaPosition.scale(0.9);
-            }
-        };
-
-        VirtualJoysticksCamera.prototype.dispose = function () {
-            this._leftjoystick.releaseCanvas();
-            _super.prototype.dispose.call(this);
-        };
-        return VirtualJoysticksCamera;
-    })(BABYLON.FreeCamera);
-    BABYLON.VirtualJoysticksCamera = VirtualJoysticksCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.virtualJoysticksCamera.js.map

+ 0 - 39
Babylon/Cameras/babylon.virtualJoysticksCamera.ts

@@ -1,39 +0,0 @@
-module BABYLON {
-    // We're mainly based on the logic defined into the FreeCamera code
-    export class VirtualJoysticksCamera extends FreeCamera {
-        private _leftjoystick: BABYLON.VirtualJoystick;
-        private _rightjoystick: BABYLON.VirtualJoystick;
-
-        constructor(name: string, position: Vector3, scene: Scene) {
-            super(name, position, scene);
-            this._leftjoystick = new BABYLON.VirtualJoystick(true);
-            this._leftjoystick.setAxisForUpDown(BABYLON.JoystickAxis.Z);
-            this._leftjoystick.setAxisForLeftRight(BABYLON.JoystickAxis.X);
-            this._leftjoystick.setJoystickSensibility(0.15);
-            this._rightjoystick = new BABYLON.VirtualJoystick(false);
-            this._rightjoystick.setAxisForUpDown(BABYLON.JoystickAxis.X);
-            this._rightjoystick.setAxisForLeftRight(BABYLON.JoystickAxis.Y);
-            this._rightjoystick.reverseUpDown = true;
-            this._rightjoystick.setJoystickSensibility(0.05);
-            this._rightjoystick.setJoystickColor("yellow");
-        }
-
-        public _checkInputs(): void {
-            var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
-            var deltaTransform = BABYLON.Vector3.TransformCoordinates(this._leftjoystick.deltaPosition, cameraTransform);
-            this.cameraDirection = this.cameraDirection.add(deltaTransform);
-            this.cameraRotation = this.cameraRotation.addVector3(this._rightjoystick.deltaPosition);
-            if (!this._leftjoystick.pressed) {
-                this._leftjoystick.deltaPosition = this._leftjoystick.deltaPosition.scale(0.9);
-            }
-            if (!this._rightjoystick.pressed) {
-                this._rightjoystick.deltaPosition = this._rightjoystick.deltaPosition.scale(0.9);
-            }
-        }
-
-        public dispose(): void {
-            this._leftjoystick.releaseCanvas();
-            super.dispose();
-        }
-    }
-}

+ 0 - 37
Babylon/Cameras/babylon.vrDeviceOrientationCamera.js

@@ -1,37 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var VRDeviceOrientationCamera = (function (_super) {
-        __extends(VRDeviceOrientationCamera, _super);
-        function VRDeviceOrientationCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this._alpha = 0;
-            this._beta = 0;
-            this._gamma = 0;
-        }
-        VRDeviceOrientationCamera.prototype._onOrientationEvent = function (evt) {
-            this._alpha = +evt.alpha | 0;
-            this._beta = +evt.beta | 0;
-            this._gamma = +evt.gamma | 0;
-
-            if (this._gamma < 0) {
-                this._gamma = 90 + this._gamma;
-            } else {
-                // Incline it in the correct angle.
-                this._gamma = 270 - this._gamma;
-            }
-
-            this.rotation.x = this._gamma / 180.0 * Math.PI;
-            this.rotation.y = -this._alpha / 180.0 * Math.PI;
-            this.rotation.z = this._beta / 180.0 * Math.PI;
-        };
-        return VRDeviceOrientationCamera;
-    })(BABYLON.OculusCamera);
-    BABYLON.VRDeviceOrientationCamera = VRDeviceOrientationCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.vrDeviceOrientationCamera.js.map

+ 0 - 29
Babylon/Cameras/babylon.vrDeviceOrientationCamera.ts

@@ -1,29 +0,0 @@
-module BABYLON {
-	export class VRDeviceOrientationCamera extends BABYLON.OculusCamera {
-		public _alpha = 0;
-		public _beta = 0;
-		public _gamma = 0;
-	
-		constructor(name: string, position: Vector3, scene: Scene) {
-			super(name, position, scene);
-		}
-
-        public _onOrientationEvent(evt: DeviceOrientationEvent): void {
-            this._alpha = +evt.alpha|0;
-            this._beta = +evt.beta|0;
-            this._gamma = +evt.gamma|0;
-
-            if (this._gamma < 0) {
-            	this._gamma = 90 + this._gamma;
-            }
-            else {
-				// Incline it in the correct angle.
-            	this._gamma = 270 - this._gamma;
-            }
-
-            this.rotation.x = this._gamma / 180.0 * Math.PI;   
-			this.rotation.y = -this._alpha / 180.0 * Math.PI;	
-			this.rotation.z	= this._beta / 180.0 * Math.PI;		
-        }
-	}
-}

+ 0 - 80
Babylon/Cameras/babylon.webVRCamera.js

@@ -1,80 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var WebVRCamera = (function (_super) {
-        __extends(WebVRCamera, _super);
-        function WebVRCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this._hmdDevice = null;
-            this._sensorDevice = null;
-            this._cacheState = null;
-            this._cacheQuaternion = new BABYLON.Quaternion();
-            this._cacheRotation = BABYLON.Vector3.Zero();
-            this._vrEnabled = false;
-            this._getWebVRDevices = this._getWebVRDevices.bind(this);
-        }
-        WebVRCamera.prototype._getWebVRDevices = function (devices) {
-            var size = devices.length;
-            var i = 0;
-
-            // Reset devices.
-            this._sensorDevice = null;
-            this._hmdDevice = null;
-
-            while (i < size && this._hmdDevice === null) {
-                if (devices[i] instanceof HMDVRDevice) {
-                    this._hmdDevice = devices[i];
-                }
-                i++;
-            }
-
-            i = 0;
-
-            while (i < size && this._sensorDevice === null) {
-                if (devices[i] instanceof PositionSensorVRDevice && (!this._hmdDevice || devices[i].hardwareUnitId === this._hmdDevice.hardwareUnitId)) {
-                    this._sensorDevice = devices[i];
-                }
-                i++;
-            }
-
-            this._vrEnabled = this._sensorDevice && this._hmdDevice ? true : false;
-        };
-
-        WebVRCamera.prototype._update = function () {
-            if (this._vrEnabled) {
-                this._cacheState = this._sensorDevice.getState();
-                this._cacheQuaternion.copyFromFloats(this._cacheState.orientation.x, this._cacheState.orientation.y, this._cacheState.orientation.z, this._cacheState.orientation.w);
-                this._cacheQuaternion.toEulerAnglesToRef(this._cacheRotation);
-
-                this.rotation.x = -this._cacheRotation.z;
-                this.rotation.y = -this._cacheRotation.y;
-                this.rotation.z = this._cacheRotation.x;
-            }
-
-            _super.prototype._update.call(this);
-        };
-
-        WebVRCamera.prototype.attachControl = function (element, noPreventDefault) {
-            _super.prototype.attachControl.call(this, element, noPreventDefault);
-
-            if (navigator.getVRDevices) {
-                navigator.getVRDevices().then(this._getWebVRDevices);
-            } else if (navigator.mozGetVRDevices) {
-                navigator.mozGetVRDevices(this._getWebVRDevices);
-            }
-        };
-
-        WebVRCamera.prototype.detachControl = function (element) {
-            _super.prototype.detachControl.call(this, element);
-            this._vrEnabled = false;
-        };
-        return WebVRCamera;
-    })(BABYLON.OculusCamera);
-    BABYLON.WebVRCamera = WebVRCamera;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.webVRCamera.js.map

+ 0 - 76
Babylon/Cameras/babylon.webVRCamera.ts

@@ -1,76 +0,0 @@
-declare var HMDVRDevice;
-declare var PositionSensorVRDevice;
-
-module BABYLON {
-    export class WebVRCamera extends BABYLON.OculusCamera {
-        public _hmdDevice = null;
-        public _sensorDevice = null;
-        public _cacheState = null;
-        public _cacheQuaternion = new BABYLON.Quaternion();
-        public _cacheRotation = BABYLON.Vector3.Zero();
-        public _vrEnabled = false;
-
-        constructor(name: string, position: Vector3, scene: Scene) {
-            super(name, position, scene);
-            this._getWebVRDevices = this._getWebVRDevices.bind(this);
-        }
-
-        private _getWebVRDevices(devices: Array<any>): void {
-            var size = devices.length;
-            var i = 0;
-
-            // Reset devices.
-            this._sensorDevice = null;
-            this._hmdDevice = null;
-
-            // Search for a HmdDevice.
-            while (i < size && this._hmdDevice === null) {
-                if (devices[i] instanceof HMDVRDevice) {
-                    this._hmdDevice = devices[i];
-                }
-                i++;
-            }
-
-            i = 0;
-
-            while (i < size && this._sensorDevice === null) {
-                if (devices[i] instanceof PositionSensorVRDevice && (!this._hmdDevice || devices[i].hardwareUnitId === this._hmdDevice.hardwareUnitId)) {
-                    this._sensorDevice = devices[i];
-                }
-                i++;
-            }
-
-            this._vrEnabled = this._sensorDevice && this._hmdDevice ? true : false;
-        }
-
-        public _update(): void {
-            if (this._vrEnabled) {
-                this._cacheState = this._sensorDevice.getState();
-                this._cacheQuaternion.copyFromFloats(this._cacheState.orientation.x, this._cacheState.orientation.y, this._cacheState.orientation.z, this._cacheState.orientation.w);
-                this._cacheQuaternion.toEulerAnglesToRef(this._cacheRotation);
-
-                this.rotation.x = -this._cacheRotation.z;
-                this.rotation.y = -this._cacheRotation.y;
-                this.rotation.z = this._cacheRotation.x;
-            }
-
-            super._update();
-        }
-
-        public attachControl(element: HTMLElement, noPreventDefault?: boolean): void {
-            super.attachControl(element, noPreventDefault);
-
-            if (navigator.getVRDevices) {
-                navigator.getVRDevices().then(this._getWebVRDevices);
-            }
-            else if (navigator.mozGetVRDevices) {
-                navigator.mozGetVRDevices(this._getWebVRDevices);
-            }
-        }
-
-        public detachControl(element: HTMLElement): void {
-            super.detachControl(element);
-            this._vrEnabled = false;
-        }
-    }
-}

+ 0 - 339
Babylon/Collisions/babylon.collider.js

@@ -1,339 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var intersectBoxAASphere = function (boxMin, boxMax, sphereCenter, sphereRadius) {
-        if (boxMin.x > sphereCenter.x + sphereRadius)
-            return false;
-
-        if (sphereCenter.x - sphereRadius > boxMax.x)
-            return false;
-
-        if (boxMin.y > sphereCenter.y + sphereRadius)
-            return false;
-
-        if (sphereCenter.y - sphereRadius > boxMax.y)
-            return false;
-
-        if (boxMin.z > sphereCenter.z + sphereRadius)
-            return false;
-
-        if (sphereCenter.z - sphereRadius > boxMax.z)
-            return false;
-
-        return true;
-    };
-
-    var getLowestRoot = function (a, b, c, maxR) {
-        var determinant = b * b - 4.0 * a * c;
-        var result = { root: 0, found: false };
-
-        if (determinant < 0)
-            return result;
-
-        var sqrtD = Math.sqrt(determinant);
-        var r1 = (-b - sqrtD) / (2.0 * a);
-        var r2 = (-b + sqrtD) / (2.0 * a);
-
-        if (r1 > r2) {
-            var temp = r2;
-            r2 = r1;
-            r1 = temp;
-        }
-
-        if (r1 > 0 && r1 < maxR) {
-            result.root = r1;
-            result.found = true;
-            return result;
-        }
-
-        if (r2 > 0 && r2 < maxR) {
-            result.root = r2;
-            result.found = true;
-            return result;
-        }
-
-        return result;
-    };
-
-    var Collider = (function () {
-        function Collider() {
-            this.radius = new BABYLON.Vector3(1, 1, 1);
-            this.retry = 0;
-            this.basePointWorld = BABYLON.Vector3.Zero();
-            this.velocityWorld = BABYLON.Vector3.Zero();
-            this.normalizedVelocity = BABYLON.Vector3.Zero();
-            this._collisionPoint = BABYLON.Vector3.Zero();
-            this._planeIntersectionPoint = BABYLON.Vector3.Zero();
-            this._tempVector = BABYLON.Vector3.Zero();
-            this._tempVector2 = BABYLON.Vector3.Zero();
-            this._tempVector3 = BABYLON.Vector3.Zero();
-            this._tempVector4 = BABYLON.Vector3.Zero();
-            this._edge = BABYLON.Vector3.Zero();
-            this._baseToVertex = BABYLON.Vector3.Zero();
-            this._destinationPoint = BABYLON.Vector3.Zero();
-            this._slidePlaneNormal = BABYLON.Vector3.Zero();
-            this._displacementVector = BABYLON.Vector3.Zero();
-        }
-        // Methods
-        Collider.prototype._initialize = function (source, dir, e) {
-            this.velocity = dir;
-            BABYLON.Vector3.NormalizeToRef(dir, this.normalizedVelocity);
-            this.basePoint = source;
-
-            source.multiplyToRef(this.radius, this.basePointWorld);
-            dir.multiplyToRef(this.radius, this.velocityWorld);
-
-            this.velocityWorldLength = this.velocityWorld.length();
-
-            this.epsilon = e;
-            this.collisionFound = false;
-        };
-
-        Collider.prototype._checkPointInTriangle = function (point, pa, pb, pc, n) {
-            pa.subtractToRef(point, this._tempVector);
-            pb.subtractToRef(point, this._tempVector2);
-
-            BABYLON.Vector3.CrossToRef(this._tempVector, this._tempVector2, this._tempVector4);
-            var d = BABYLON.Vector3.Dot(this._tempVector4, n);
-            if (d < 0)
-                return false;
-
-            pc.subtractToRef(point, this._tempVector3);
-            BABYLON.Vector3.CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4);
-            d = BABYLON.Vector3.Dot(this._tempVector4, n);
-            if (d < 0)
-                return false;
-
-            BABYLON.Vector3.CrossToRef(this._tempVector3, this._tempVector, this._tempVector4);
-            d = BABYLON.Vector3.Dot(this._tempVector4, n);
-            return d >= 0;
-        };
-
-        Collider.prototype._canDoCollision = function (sphereCenter, sphereRadius, vecMin, vecMax) {
-            var distance = BABYLON.Vector3.Distance(this.basePointWorld, sphereCenter);
-
-            var max = Math.max(this.radius.x, this.radius.y, this.radius.z);
-
-            if (distance > this.velocityWorldLength + max + sphereRadius) {
-                return false;
-            }
-
-            if (!intersectBoxAASphere(vecMin, vecMax, this.basePointWorld, this.velocityWorldLength + max))
-                return false;
-
-            return true;
-        };
-
-        Collider.prototype._testTriangle = function (faceIndex, subMesh, p1, p2, p3) {
-            var t0;
-            var embeddedInPlane = false;
-
-            if (!subMesh._trianglePlanes) {
-                subMesh._trianglePlanes = [];
-            }
-
-            if (!subMesh._trianglePlanes[faceIndex]) {
-                subMesh._trianglePlanes[faceIndex] = new BABYLON.Plane(0, 0, 0, 0);
-                subMesh._trianglePlanes[faceIndex].copyFromPoints(p1, p2, p3);
-            }
-
-            var trianglePlane = subMesh._trianglePlanes[faceIndex];
-
-            if ((!subMesh.getMaterial()) && !trianglePlane.isFrontFacingTo(this.normalizedVelocity, 0))
-                return;
-
-            var signedDistToTrianglePlane = trianglePlane.signedDistanceTo(this.basePoint);
-            var normalDotVelocity = BABYLON.Vector3.Dot(trianglePlane.normal, this.velocity);
-
-            if (normalDotVelocity == 0) {
-                if (Math.abs(signedDistToTrianglePlane) >= 1.0)
-                    return;
-                embeddedInPlane = true;
-                t0 = 0;
-            } else {
-                t0 = (-1.0 - signedDistToTrianglePlane) / normalDotVelocity;
-                var t1 = (1.0 - signedDistToTrianglePlane) / normalDotVelocity;
-
-                if (t0 > t1) {
-                    var temp = t1;
-                    t1 = t0;
-                    t0 = temp;
-                }
-
-                if (t0 > 1.0 || t1 < 0.0)
-                    return;
-
-                if (t0 < 0)
-                    t0 = 0;
-                if (t0 > 1.0)
-                    t0 = 1.0;
-            }
-
-            this._collisionPoint.copyFromFloats(0, 0, 0);
-
-            var found = false;
-            var t = 1.0;
-
-            if (!embeddedInPlane) {
-                this.basePoint.subtractToRef(trianglePlane.normal, this._planeIntersectionPoint);
-                this.velocity.scaleToRef(t0, this._tempVector);
-                this._planeIntersectionPoint.addInPlace(this._tempVector);
-
-                if (this._checkPointInTriangle(this._planeIntersectionPoint, p1, p2, p3, trianglePlane.normal)) {
-                    found = true;
-                    t = t0;
-                    this._collisionPoint.copyFrom(this._planeIntersectionPoint);
-                }
-            }
-
-            if (!found) {
-                var velocitySquaredLength = this.velocity.lengthSquared();
-
-                var a = velocitySquaredLength;
-
-                this.basePoint.subtractToRef(p1, this._tempVector);
-                var b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
-                var c = this._tempVector.lengthSquared() - 1.0;
-
-                var lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    t = lowestRoot.root;
-                    found = true;
-                    this._collisionPoint.copyFrom(p1);
-                }
-
-                this.basePoint.subtractToRef(p2, this._tempVector);
-                b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
-                c = this._tempVector.lengthSquared() - 1.0;
-
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    t = lowestRoot.root;
-                    found = true;
-                    this._collisionPoint.copyFrom(p2);
-                }
-
-                this.basePoint.subtractToRef(p3, this._tempVector);
-                b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
-                c = this._tempVector.lengthSquared() - 1.0;
-
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    t = lowestRoot.root;
-                    found = true;
-                    this._collisionPoint.copyFrom(p3);
-                }
-
-                p2.subtractToRef(p1, this._edge);
-                p1.subtractToRef(this.basePoint, this._baseToVertex);
-                var edgeSquaredLength = this._edge.lengthSquared();
-                var edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                var edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
-
-                a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
-                c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
-
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    var f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;
-
-                    if (f >= 0.0 && f <= 1.0) {
-                        t = lowestRoot.root;
-                        found = true;
-                        this._edge.scaleInPlace(f);
-                        p1.addToRef(this._edge, this._collisionPoint);
-                    }
-                }
-
-                p3.subtractToRef(p2, this._edge);
-                p2.subtractToRef(this.basePoint, this._baseToVertex);
-                edgeSquaredLength = this._edge.lengthSquared();
-                edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
-
-                a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
-                c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;
-
-                    if (f >= 0.0 && f <= 1.0) {
-                        t = lowestRoot.root;
-                        found = true;
-                        this._edge.scaleInPlace(f);
-                        p2.addToRef(this._edge, this._collisionPoint);
-                    }
-                }
-
-                p1.subtractToRef(p3, this._edge);
-                p3.subtractToRef(this.basePoint, this._baseToVertex);
-                edgeSquaredLength = this._edge.lengthSquared();
-                edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
-
-                a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
-                c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
-
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;
-
-                    if (f >= 0.0 && f <= 1.0) {
-                        t = lowestRoot.root;
-                        found = true;
-                        this._edge.scaleInPlace(f);
-                        p3.addToRef(this._edge, this._collisionPoint);
-                    }
-                }
-            }
-
-            if (found) {
-                var distToCollision = t * this.velocity.length();
-
-                if (!this.collisionFound || distToCollision < this.nearestDistance) {
-                    if (!this.intersectionPoint) {
-                        this.intersectionPoint = this._collisionPoint.clone();
-                    } else {
-                        this.intersectionPoint.copyFrom(this._collisionPoint);
-                    }
-                    this.nearestDistance = distToCollision;
-                    this.collisionFound = true;
-                    this.collidedMesh = subMesh.getMesh();
-                }
-            }
-        };
-
-        Collider.prototype._collide = function (subMesh, pts, indices, indexStart, indexEnd, decal) {
-            for (var i = indexStart; i < indexEnd; i += 3) {
-                var p1 = pts[indices[i] - decal];
-                var p2 = pts[indices[i + 1] - decal];
-                var p3 = pts[indices[i + 2] - decal];
-
-                this._testTriangle(i, subMesh, p3, p2, p1);
-            }
-        };
-
-        Collider.prototype._getResponse = function (pos, vel) {
-            pos.addToRef(vel, this._destinationPoint);
-            vel.scaleInPlace((this.nearestDistance / vel.length()));
-
-            this.basePoint.addToRef(vel, pos);
-            pos.subtractToRef(this.intersectionPoint, this._slidePlaneNormal);
-            this._slidePlaneNormal.normalize();
-            this._slidePlaneNormal.scaleToRef(this.epsilon, this._displacementVector);
-
-            pos.addInPlace(this._displacementVector);
-            this.intersectionPoint.addInPlace(this._displacementVector);
-
-            this._slidePlaneNormal.scaleInPlace(BABYLON.Plane.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint));
-            this._destinationPoint.subtractInPlace(this._slidePlaneNormal);
-
-            this._destinationPoint.subtractToRef(this.intersectionPoint, vel);
-        };
-        return Collider;
-    })();
-    BABYLON.Collider = Collider;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.collider.js.map

+ 0 - 346
Babylon/Collisions/babylon.collider.ts

@@ -1,346 +0,0 @@
-module BABYLON {
-    var intersectBoxAASphere = (boxMin: Vector3, boxMax: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean => {
-        if (boxMin.x > sphereCenter.x + sphereRadius)
-            return false;
-
-        if (sphereCenter.x - sphereRadius > boxMax.x)
-            return false;
-
-        if (boxMin.y > sphereCenter.y + sphereRadius)
-            return false;
-
-        if (sphereCenter.y - sphereRadius > boxMax.y)
-            return false;
-
-        if (boxMin.z > sphereCenter.z + sphereRadius)
-            return false;
-
-        if (sphereCenter.z - sphereRadius > boxMax.z)
-            return false;
-
-        return true;
-    };
-
-    var getLowestRoot = (a: number, b: number, c: number, maxR: number) => {
-        var determinant = b * b - 4.0 * a * c;
-        var result = { root: 0, found: false };
-
-        if (determinant < 0)
-            return result;
-
-        var sqrtD = Math.sqrt(determinant);
-        var r1 = (-b - sqrtD) / (2.0 * a);
-        var r2 = (-b + sqrtD) / (2.0 * a);
-
-        if (r1 > r2) {
-            var temp = r2;
-            r2 = r1;
-            r1 = temp;
-        }
-
-        if (r1 > 0 && r1 < maxR) {
-            result.root = r1;
-            result.found = true;
-            return result;
-        }
-
-        if (r2 > 0 && r2 < maxR) {
-            result.root = r2;
-            result.found = true;
-            return result;
-        }
-
-        return result;
-    };
-
-    export class Collider {
-        public radius = new BABYLON.Vector3(1, 1, 1);
-        public retry = 0;
-        public velocity: Vector3;
-        public basePoint: Vector3;
-        public epsilon: number;
-        public collisionFound: boolean;
-        public velocityWorldLength: number;
-        public basePointWorld = BABYLON.Vector3.Zero();
-        public velocityWorld = BABYLON.Vector3.Zero();
-        public normalizedVelocity = BABYLON.Vector3.Zero();
-        public initialVelocity: Vector3;
-        public initialPosition: Vector3;
-        public nearestDistance: number;
-        public intersectionPoint: Vector3;
-        public collidedMesh: AbstractMesh
-
-        private _collisionPoint = BABYLON.Vector3.Zero();
-        private _planeIntersectionPoint = BABYLON.Vector3.Zero();
-        private _tempVector = BABYLON.Vector3.Zero();
-        private _tempVector2 = BABYLON.Vector3.Zero();
-        private _tempVector3 = BABYLON.Vector3.Zero();
-        private _tempVector4 = BABYLON.Vector3.Zero();
-        private _edge = BABYLON.Vector3.Zero();
-        private _baseToVertex = BABYLON.Vector3.Zero();
-        private _destinationPoint = BABYLON.Vector3.Zero();
-        private _slidePlaneNormal = BABYLON.Vector3.Zero();
-        private _displacementVector = BABYLON.Vector3.Zero();
-
-        // Methods
-        public _initialize(source: Vector3, dir: Vector3, e: number): void {
-            this.velocity = dir;
-            BABYLON.Vector3.NormalizeToRef(dir, this.normalizedVelocity);
-            this.basePoint = source;
-
-            source.multiplyToRef(this.radius, this.basePointWorld);
-            dir.multiplyToRef(this.radius, this.velocityWorld);
-
-            this.velocityWorldLength = this.velocityWorld.length();
-
-            this.epsilon = e;
-            this.collisionFound = false;
-        }
-
-        public _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean {
-            pa.subtractToRef(point, this._tempVector);
-            pb.subtractToRef(point, this._tempVector2);
-
-            BABYLON.Vector3.CrossToRef(this._tempVector, this._tempVector2, this._tempVector4);
-            var d = BABYLON.Vector3.Dot(this._tempVector4, n);
-            if (d < 0)
-                return false;
-
-            pc.subtractToRef(point, this._tempVector3);
-            BABYLON.Vector3.CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4);
-            d = BABYLON.Vector3.Dot(this._tempVector4, n);
-            if (d < 0)
-                return false;
-
-            BABYLON.Vector3.CrossToRef(this._tempVector3, this._tempVector, this._tempVector4);
-            d = BABYLON.Vector3.Dot(this._tempVector4, n);
-            return d >= 0;
-        }
-
-        public _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean {
-            var distance = BABYLON.Vector3.Distance(this.basePointWorld, sphereCenter);
-
-            var max = Math.max(this.radius.x, this.radius.y, this.radius.z);
-
-            if (distance > this.velocityWorldLength + max + sphereRadius) {
-                return false;
-            }
-
-            if (!intersectBoxAASphere(vecMin, vecMax, this.basePointWorld, this.velocityWorldLength + max))
-                return false;
-
-            return true;
-        }
-
-        public _testTriangle(faceIndex: number, subMesh: SubMesh, p1: Vector3, p2: Vector3, p3: Vector3): void {
-            var t0;
-            var embeddedInPlane = false;
-
-            if (!subMesh._trianglePlanes) {
-                subMesh._trianglePlanes = [];
-            }
-
-            if (!subMesh._trianglePlanes[faceIndex]) {
-                subMesh._trianglePlanes[faceIndex] = new BABYLON.Plane(0, 0, 0, 0);
-                subMesh._trianglePlanes[faceIndex].copyFromPoints(p1, p2, p3);
-            }
-
-            var trianglePlane = subMesh._trianglePlanes[faceIndex];
-
-            if ((!subMesh.getMaterial()) && !trianglePlane.isFrontFacingTo(this.normalizedVelocity, 0))
-                return;
-
-            var signedDistToTrianglePlane = trianglePlane.signedDistanceTo(this.basePoint);
-            var normalDotVelocity = BABYLON.Vector3.Dot(trianglePlane.normal, this.velocity);
-
-            if (normalDotVelocity == 0) {
-                if (Math.abs(signedDistToTrianglePlane) >= 1.0)
-                    return;
-                embeddedInPlane = true;
-                t0 = 0;
-            }
-            else {
-                t0 = (-1.0 - signedDistToTrianglePlane) / normalDotVelocity;
-                var t1 = (1.0 - signedDistToTrianglePlane) / normalDotVelocity;
-
-                if (t0 > t1) {
-                    var temp = t1;
-                    t1 = t0;
-                    t0 = temp;
-                }
-
-                if (t0 > 1.0 || t1 < 0.0)
-                    return;
-
-                if (t0 < 0)
-                    t0 = 0;
-                if (t0 > 1.0)
-                    t0 = 1.0;
-            }
-
-            this._collisionPoint.copyFromFloats(0, 0, 0);
-
-            var found = false;
-            var t = 1.0;
-
-            if (!embeddedInPlane) {
-                this.basePoint.subtractToRef(trianglePlane.normal, this._planeIntersectionPoint);
-                this.velocity.scaleToRef(t0, this._tempVector);
-                this._planeIntersectionPoint.addInPlace(this._tempVector);
-
-                if (this._checkPointInTriangle(this._planeIntersectionPoint, p1, p2, p3, trianglePlane.normal)) {
-                    found = true;
-                    t = t0;
-                    this._collisionPoint.copyFrom(this._planeIntersectionPoint);
-                }
-            }
-
-            if (!found) {
-                var velocitySquaredLength = this.velocity.lengthSquared();
-
-                var a = velocitySquaredLength;
-
-                this.basePoint.subtractToRef(p1, this._tempVector);
-                var b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
-                var c = this._tempVector.lengthSquared() - 1.0;
-
-                var lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    t = lowestRoot.root;
-                    found = true;
-                    this._collisionPoint.copyFrom(p1);
-                }
-
-                this.basePoint.subtractToRef(p2, this._tempVector);
-                b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
-                c = this._tempVector.lengthSquared() - 1.0;
-
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    t = lowestRoot.root;
-                    found = true;
-                    this._collisionPoint.copyFrom(p2);
-                }
-
-                this.basePoint.subtractToRef(p3, this._tempVector);
-                b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
-                c = this._tempVector.lengthSquared() - 1.0;
-
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    t = lowestRoot.root;
-                    found = true;
-                    this._collisionPoint.copyFrom(p3);
-                }
-
-                p2.subtractToRef(p1, this._edge);
-                p1.subtractToRef(this.basePoint, this._baseToVertex);
-                var edgeSquaredLength = this._edge.lengthSquared();
-                var edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                var edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
-
-                a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
-                c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
-
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    var f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;
-
-                    if (f >= 0.0 && f <= 1.0) {
-                        t = lowestRoot.root;
-                        found = true;
-                        this._edge.scaleInPlace(f);
-                        p1.addToRef(this._edge, this._collisionPoint);
-                    }
-                }
-
-                p3.subtractToRef(p2, this._edge);
-                p2.subtractToRef(this.basePoint, this._baseToVertex);
-                edgeSquaredLength = this._edge.lengthSquared();
-                edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
-
-                a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
-                c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;
-
-                    if (f >= 0.0 && f <= 1.0) {
-                        t = lowestRoot.root;
-                        found = true;
-                        this._edge.scaleInPlace(f);
-                        p2.addToRef(this._edge, this._collisionPoint);
-                    }
-                }
-
-                p1.subtractToRef(p3, this._edge);
-                p3.subtractToRef(this.basePoint, this._baseToVertex);
-                edgeSquaredLength = this._edge.lengthSquared();
-                edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
-
-                a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
-                c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
-
-                lowestRoot = getLowestRoot(a, b, c, t);
-                if (lowestRoot.found) {
-                    f = (edgeDotVelocity * lowestRoot.root - edgeDotBaseToVertex) / edgeSquaredLength;
-
-                    if (f >= 0.0 && f <= 1.0) {
-                        t = lowestRoot.root;
-                        found = true;
-                        this._edge.scaleInPlace(f);
-                        p3.addToRef(this._edge, this._collisionPoint);
-                    }
-                }
-            }
-
-            if (found) {
-                var distToCollision = t * this.velocity.length();
-
-                if (!this.collisionFound || distToCollision < this.nearestDistance) {
-                    if (!this.intersectionPoint) {
-                        this.intersectionPoint = this._collisionPoint.clone();
-                    } else {
-                        this.intersectionPoint.copyFrom(this._collisionPoint);
-                    }
-                    this.nearestDistance = distToCollision;
-                    this.collisionFound = true;
-                    this.collidedMesh = subMesh.getMesh();
-                }
-            }
-        }
-
-        public _collide(subMesh, pts: Vector3[], indices: number[], indexStart: number, indexEnd: number, decal: number): void {
-            for (var i = indexStart; i < indexEnd; i += 3) {
-                var p1 = pts[indices[i] - decal];
-                var p2 = pts[indices[i + 1] - decal];
-                var p3 = pts[indices[i + 2] - decal];
-
-                this._testTriangle(i, subMesh, p3, p2, p1);
-            }
-        }
-
-        public _getResponse(pos: Vector3, vel: Vector3): void {
-            pos.addToRef(vel, this._destinationPoint);
-            vel.scaleInPlace((this.nearestDistance / vel.length()));
-
-            this.basePoint.addToRef(vel, pos);
-            pos.subtractToRef(this.intersectionPoint, this._slidePlaneNormal);
-            this._slidePlaneNormal.normalize();
-            this._slidePlaneNormal.scaleToRef(this.epsilon, this._displacementVector);
-
-            pos.addInPlace(this._displacementVector);
-            this.intersectionPoint.addInPlace(this._displacementVector);
-
-            this._slidePlaneNormal.scaleInPlace(BABYLON.Plane.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint));
-            this._destinationPoint.subtractInPlace(this._slidePlaneNormal);
-
-            this._destinationPoint.subtractToRef(this.intersectionPoint, vel);
-        }
-    }
-} 

+ 0 - 66
Babylon/Collisions/babylon.pickingInfo.js

@@ -1,66 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var IntersectionInfo = (function () {
-        function IntersectionInfo(bu, bv, distance) {
-            this.bu = bu;
-            this.bv = bv;
-            this.distance = distance;
-            this.faceId = 0;
-        }
-        return IntersectionInfo;
-    })();
-    BABYLON.IntersectionInfo = IntersectionInfo;
-
-    var PickingInfo = (function () {
-        function PickingInfo() {
-            this.hit = false;
-            this.distance = 0;
-            this.pickedPoint = null;
-            this.pickedMesh = null;
-            this.bu = 0;
-            this.bv = 0;
-            this.faceId = -1;
-        }
-        // Methods
-        PickingInfo.prototype.getNormal = function () {
-            if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
-                return null;
-            }
-
-            var indices = this.pickedMesh.getIndices();
-            var normals = this.pickedMesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
-
-            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);
-            normal2 = normal2.scale(1.0 - this.bu - this.bv);
-
-            return new BABYLON.Vector3(normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);
-        };
-
-        PickingInfo.prototype.getTextureCoordinates = function () {
-            if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                return null;
-            }
-
-            var indices = this.pickedMesh.getIndices();
-            var uvs = this.pickedMesh.getVerticesData(BABYLON.VertexBuffer.UVKind);
-
-            var uv0 = BABYLON.Vector2.FromArray(uvs, indices[this.faceId * 3] * 2);
-            var uv1 = BABYLON.Vector2.FromArray(uvs, indices[this.faceId * 3 + 1] * 2);
-            var uv2 = BABYLON.Vector2.FromArray(uvs, indices[this.faceId * 3 + 2] * 2);
-
-            uv0 = uv0.scale(this.bu);
-            uv1 = uv1.scale(this.bv);
-            uv2 = uv2.scale(1.0 - this.bu - this.bv);
-
-            return new BABYLON.Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);
-        };
-        return PickingInfo;
-    })();
-    BABYLON.PickingInfo = PickingInfo;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.pickingInfo.js.map

+ 0 - 57
Babylon/Collisions/babylon.pickingInfo.ts

@@ -1,57 +0,0 @@
-module BABYLON {
-    export class IntersectionInfo {
-        public faceId = 0;
-
-        constructor(public bu: number, public bv: number, public distance: number) {
-        }
-    }
-
-    export class PickingInfo {
-        public hit = false;
-        public distance = 0;
-        public pickedPoint: Vector3 = null;
-        public pickedMesh: AbstractMesh = null;
-        public bu = 0;
-        public bv = 0;
-        public faceId = -1;
-
-        // Methods
-        public getNormal(): Vector3 {
-            if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
-                return null;
-            }
-
-            var indices = this.pickedMesh.getIndices();
-            var normals = this.pickedMesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
-
-            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);
-            normal2 = normal2.scale(1.0 - this.bu - this.bv);
-
-            return new BABYLON.Vector3(normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);
-        }
-
-        public getTextureCoordinates(): Vector2 {
-            if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                return null;
-            }
-
-            var indices = this.pickedMesh.getIndices();
-            var uvs = this.pickedMesh.getVerticesData(BABYLON.VertexBuffer.UVKind);
-
-            var uv0 = BABYLON.Vector2.FromArray(uvs, indices[this.faceId * 3] * 2);
-            var uv1 = BABYLON.Vector2.FromArray(uvs, indices[this.faceId * 3 + 1] * 2);
-            var uv2 = BABYLON.Vector2.FromArray(uvs, indices[this.faceId * 3 + 2] * 2);
-
-            uv0 = uv0.scale(this.bu);
-            uv1 = uv1.scale(this.bv);
-            uv2 = uv2.scale(1.0 - this.bu - this.bv);
-
-            return new BABYLON.Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);
-        }
-    }
-} 

+ 0 - 104
Babylon/Culling/Octrees/babylon.octree.js

@@ -1,104 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Octree = (function () {
-        function Octree(creationFunc, maxBlockCapacity, maxDepth) {
-            if (typeof maxDepth === "undefined") { maxDepth = 2; }
-            this.maxDepth = maxDepth;
-            this.dynamicContent = new Array();
-            this._maxBlockCapacity = maxBlockCapacity || 64;
-            this._selectionContent = new BABYLON.SmartArray(1024);
-            this._creationFunc = creationFunc;
-        }
-        // Methods
-        Octree.prototype.update = function (worldMin, worldMax, entries) {
-            Octree._CreateBlocks(worldMin, worldMax, entries, this._maxBlockCapacity, 0, this.maxDepth, this, this._creationFunc);
-        };
-
-        Octree.prototype.addMesh = function (entry) {
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.addEntry(entry);
-            }
-        };
-
-        Octree.prototype.select = function (frustumPlanes, allowDuplicate) {
-            this._selectionContent.reset();
-
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.select(frustumPlanes, this._selectionContent, allowDuplicate);
-            }
-
-            if (allowDuplicate) {
-                this._selectionContent.concat(this.dynamicContent);
-            } else {
-                this._selectionContent.concatWithNoDuplicate(this.dynamicContent);
-            }
-
-            return this._selectionContent;
-        };
-
-        Octree.prototype.intersects = function (sphereCenter, sphereRadius, allowDuplicate) {
-            this._selectionContent.reset();
-
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.intersects(sphereCenter, sphereRadius, this._selectionContent, allowDuplicate);
-            }
-
-            if (allowDuplicate) {
-                this._selectionContent.concat(this.dynamicContent);
-            } else {
-                this._selectionContent.concatWithNoDuplicate(this.dynamicContent);
-            }
-
-            return this._selectionContent;
-        };
-
-        Octree.prototype.intersectsRay = function (ray) {
-            this._selectionContent.reset();
-
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.intersectsRay(ray, this._selectionContent);
-            }
-
-            this._selectionContent.concatWithNoDuplicate(this.dynamicContent);
-
-            return this._selectionContent;
-        };
-
-        Octree._CreateBlocks = function (worldMin, worldMax, entries, maxBlockCapacity, currentDepth, maxDepth, target, creationFunc) {
-            target.blocks = new Array();
-            var blockSize = new BABYLON.Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);
-
-            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, currentDepth + 1, maxDepth, creationFunc);
-                        block.addEntries(entries);
-                        target.blocks.push(block);
-                    }
-                }
-            }
-        };
-
-        Octree.CreationFuncForMeshes = function (entry, block) {
-            if (!entry.isBlocked && entry.getBoundingInfo().boundingBox.intersectsMinMax(block.minPoint, block.maxPoint)) {
-                block.entries.push(entry);
-            }
-        };
-
-        Octree.CreationFuncForSubMeshes = function (entry, block) {
-            if (entry.getBoundingInfo().boundingBox.intersectsMinMax(block.minPoint, block.maxPoint)) {
-                block.entries.push(entry);
-            }
-        };
-        return Octree;
-    })();
-    BABYLON.Octree = Octree;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.octree.js.map

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

@@ -1,110 +0,0 @@
-module BABYLON {
-    export interface IOctreeContainer<T> {
-        blocks: Array<OctreeBlock<T>>;
-    }
-
-    export class Octree<T> {
-        public blocks: Array<OctreeBlock<T>>;
-        public dynamicContent = new Array<T>();
-
-        private _maxBlockCapacity: number;
-        private _selectionContent: SmartArray<T>;       
-        private _creationFunc: (entry: T, block: OctreeBlock<T>) => void;
-
-        constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, public maxDepth = 2) {
-            this._maxBlockCapacity = maxBlockCapacity || 64;
-            this._selectionContent = new BABYLON.SmartArray<T>(1024);
-            this._creationFunc = creationFunc;
-        }
-
-        // Methods
-        public update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void {
-            Octree._CreateBlocks(worldMin, worldMax, entries, this._maxBlockCapacity, 0, this.maxDepth, this, this._creationFunc);
-        }
-
-        public addMesh(entry: T): void {
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.addEntry(entry);
-            }
-        }
-
-        public select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray<T> {
-            this._selectionContent.reset();
-
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.select(frustumPlanes, this._selectionContent, allowDuplicate);
-            }
-
-            if (allowDuplicate) {
-                this._selectionContent.concat(this.dynamicContent);
-            } else {
-                this._selectionContent.concatWithNoDuplicate(this.dynamicContent);                
-            }
-
-            return this._selectionContent;
-        }
-
-        public intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray<T> {
-            this._selectionContent.reset();
-
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.intersects(sphereCenter, sphereRadius, this._selectionContent, allowDuplicate);
-            }
-
-            if (allowDuplicate) {
-                this._selectionContent.concat(this.dynamicContent);
-            } else {
-                this._selectionContent.concatWithNoDuplicate(this.dynamicContent);
-            }
-
-            return this._selectionContent;
-        }
-
-        public intersectsRay(ray: Ray): SmartArray<T> {
-            this._selectionContent.reset();
-
-            for (var index = 0; index < this.blocks.length; index++) {
-                var block = this.blocks[index];
-                block.intersectsRay(ray, this._selectionContent);
-            }
-
-            this._selectionContent.concatWithNoDuplicate(this.dynamicContent);
-
-            return this._selectionContent;
-        }
-
-        public static _CreateBlocks<T>(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer<T>, creationFunc: (entry: T, block: OctreeBlock<T>) => void): void {
-            target.blocks = new Array<OctreeBlock<T>>();
-            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<T>(localMin, localMax, maxBlockCapacity, currentDepth + 1, maxDepth, creationFunc);
-                        block.addEntries(entries);
-                        target.blocks.push(block);
-                    }
-                }
-            }
-        }
-
-        public static CreationFuncForMeshes = (entry: AbstractMesh, block: OctreeBlock<AbstractMesh>): void => {
-            if (!entry.isBlocked && entry.getBoundingInfo().boundingBox.intersectsMinMax(block.minPoint, block.maxPoint)) {
-                block.entries.push(entry);
-            }
-        }
-
-        public static CreationFuncForSubMeshes = (entry: SubMesh, block: OctreeBlock<SubMesh>): void => {
-            if (entry.getBoundingInfo().boundingBox.intersectsMinMax(block.minPoint, block.maxPoint)) {
-                block.entries.push(entry);
-            }
-        }
-    }
-} 

+ 0 - 141
Babylon/Culling/Octrees/babylon.octreeBlock.js

@@ -1,141 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var OctreeBlock = (function () {
-        function OctreeBlock(minPoint, maxPoint, capacity, depth, maxDepth, creationFunc) {
-            this.entries = new Array();
-            this._boundingVectors = new Array();
-            this._capacity = capacity;
-            this._depth = depth;
-            this._maxDepth = maxDepth;
-            this._creationFunc = creationFunc;
-
-            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;
-        }
-        Object.defineProperty(OctreeBlock.prototype, "capacity", {
-            // Property
-            get: function () {
-                return this._capacity;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(OctreeBlock.prototype, "minPoint", {
-            get: function () {
-                return this._minPoint;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(OctreeBlock.prototype, "maxPoint", {
-            get: function () {
-                return this._maxPoint;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        // Methods
-        OctreeBlock.prototype.addEntry = function (entry) {
-            if (this.blocks) {
-                for (var index = 0; index < this.blocks.length; index++) {
-                    var block = this.blocks[index];
-                    block.addEntry(entry);
-                }
-                return;
-            }
-
-            this._creationFunc(entry, this);
-
-            if (this.entries.length > this.capacity && this._depth < this._maxDepth) {
-                this.createInnerBlocks();
-            }
-        };
-
-        OctreeBlock.prototype.addEntries = function (entries) {
-            for (var index = 0; index < entries.length; index++) {
-                var mesh = entries[index];
-                this.addEntry(mesh);
-            }
-        };
-
-        OctreeBlock.prototype.select = function (frustumPlanes, selection, allowDuplicate) {
-            if (BABYLON.BoundingBox.IsInFrustum(this._boundingVectors, frustumPlanes)) {
-                if (this.blocks) {
-                    for (var index = 0; index < this.blocks.length; index++) {
-                        var block = this.blocks[index];
-                        block.select(frustumPlanes, selection, allowDuplicate);
-                    }
-                    return;
-                }
-
-                if (allowDuplicate) {
-                    selection.concat(this.entries);
-                } else {
-                    selection.concatWithNoDuplicate(this.entries);
-                }
-            }
-        };
-
-        OctreeBlock.prototype.intersects = function (sphereCenter, sphereRadius, selection, allowDuplicate) {
-            if (BABYLON.BoundingBox.IntersectsSphere(this._minPoint, this._maxPoint, sphereCenter, sphereRadius)) {
-                if (this.blocks) {
-                    for (var index = 0; index < this.blocks.length; index++) {
-                        var block = this.blocks[index];
-                        block.intersects(sphereCenter, sphereRadius, selection, allowDuplicate);
-                    }
-                    return;
-                }
-
-                if (allowDuplicate) {
-                    selection.concat(this.entries);
-                } else {
-                    selection.concatWithNoDuplicate(this.entries);
-                }
-            }
-        };
-
-        OctreeBlock.prototype.intersectsRay = function (ray, selection) {
-            if (ray.intersectsBoxMinMax(this._minPoint, this._maxPoint)) {
-                if (this.blocks) {
-                    for (var index = 0; index < this.blocks.length; index++) {
-                        var block = this.blocks[index];
-                        block.intersectsRay(ray, selection);
-                    }
-                    return;
-                }
-                selection.concatWithNoDuplicate(this.entries);
-            }
-        };
-
-        OctreeBlock.prototype.createInnerBlocks = function () {
-            BABYLON.Octree._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc);
-        };
-        return OctreeBlock;
-    })();
-    BABYLON.OctreeBlock = OctreeBlock;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.octreeBlock.js.map

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

@@ -1,135 +0,0 @@
-module BABYLON {
-    export class OctreeBlock<T> {
-        public entries = new Array<T>();
-        public blocks: Array<OctreeBlock<T>>;
-
-        private _depth: number;
-        private _maxDepth: number;
-        private _capacity: number;
-        private _minPoint: Vector3;
-        private _maxPoint: Vector3;
-        private _boundingVectors = new Array<Vector3>();
-        private _creationFunc: (entry: T, block: OctreeBlock<T>) => void;
-
-        constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock<T>) => void) {
-            this._capacity = capacity;
-            this._depth = depth;
-            this._maxDepth = maxDepth;
-            this._creationFunc = creationFunc;
-
-            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;
-        }
-
-        // Property
-        public get capacity(): number {
-            return this._capacity;
-        }
-
-        public get minPoint(): Vector3 {
-            return this._minPoint;
-        }
-
-        public get maxPoint(): Vector3 {
-            return this._maxPoint;
-        }
-
-        // Methods
-        public addEntry(entry: T): void {
-            if (this.blocks) {
-                for (var index = 0; index < this.blocks.length; index++) {
-                    var block = this.blocks[index];
-                    block.addEntry(entry);
-                }
-                return;
-            }
-
-            this._creationFunc(entry, this);
-
-            if (this.entries.length > this.capacity && this._depth < this._maxDepth) {
-                this.createInnerBlocks();
-            }
-        }
-
-        public addEntries(entries: T[]): void {
-            for (var index = 0; index < entries.length; index++) {
-                var mesh = entries[index];
-                this.addEntry(mesh);
-            }
-        }
-
-        public select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void {
-            if (BABYLON.BoundingBox.IsInFrustum(this._boundingVectors, frustumPlanes)) {
-                if (this.blocks) {
-                    for (var index = 0; index < this.blocks.length; index++) {
-                        var block = this.blocks[index];
-                        block.select(frustumPlanes, selection, allowDuplicate);
-                    }
-                    return;
-                }
-
-                if (allowDuplicate) {
-                    selection.concat(this.entries);
-                } else {
-                    selection.concatWithNoDuplicate(this.entries);
-                }
-            }
-        }
-
-        public intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void {
-            if (BABYLON.BoundingBox.IntersectsSphere(this._minPoint, this._maxPoint, sphereCenter, sphereRadius)) {
-                if (this.blocks) {
-                    for (var index = 0; index < this.blocks.length; index++) {
-                        var block = this.blocks[index];
-                        block.intersects(sphereCenter, sphereRadius, selection, allowDuplicate);
-                    }
-                    return;
-                }
-
-                if (allowDuplicate) {
-                    selection.concat(this.entries);
-                } else {
-                    selection.concatWithNoDuplicate(this.entries);
-                }
-            }
-        }
-
-        public intersectsRay(ray: Ray, selection: SmartArray<T>): void {
-            if (ray.intersectsBoxMinMax(this._minPoint, this._maxPoint)) {
-                if (this.blocks) {
-                    for (var index = 0; index < this.blocks.length; index++) {
-                        var block = this.blocks[index];
-                        block.intersectsRay(ray, selection);
-                    }
-                    return;
-                }
-                selection.concatWithNoDuplicate(this.entries);
-            }
-        }
-
-        public createInnerBlocks(): void {
-            Octree._CreateBlocks(this._minPoint, this._maxPoint, this.entries, this._capacity, this._depth, this._maxDepth, this, this._creationFunc);
-        }
-    }
-} 

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

@@ -1,178 +0,0 @@
-module BABYLON {
-    export class BoundingBox {
-        public vectors: Vector3[] = new Array<Vector3>();
-        public center: Vector3;
-        public extendSize: Vector3;
-        public directions: Vector3[];
-        public vectorsWorld: Vector3[] = new Array<Vector3>();
-        public minimumWorld: Vector3;
-        public maximumWorld: Vector3;
-
-        private _worldMatrix: Matrix;
-
-        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.extendSize = 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 getWorldMatrix(): Matrix {
-            return this._worldMatrix;
-        }
-
-        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]);
-
-            this._worldMatrix = world;
-        }
-
-        public isInFrustum(frustumPlanes: Plane[]): boolean {
-            return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);
-        }
-
-        public isCompletelyInFrustum(frustumPlanes: Plane[]): boolean {
-            return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);
-        }
-
-        public intersectsPoint(point: Vector3): boolean {
-            var delta = Engine.Epsilon;
-
-            if (this.maximumWorld.x - point.x < delta || delta > point.x - this.minimumWorld.x)
-                return false;
-
-            if (this.maximumWorld.y - point.y < delta || delta > point.y - this.minimumWorld.y)
-                return false;
-
-            if (this.maximumWorld.z - point.z < delta || delta > point.z - this.minimumWorld.z)
-                return false;
-
-            return true;
-        }
-
-        public intersectsSphere(sphere: BoundingSphere): boolean {
-            return BoundingBox.IntersectsSphere(this.minimumWorld, this.maximumWorld, sphere.centerWorld, 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 IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean {
-            var vector = BABYLON.Vector3.Clamp(sphereCenter, minPoint, maxPoint);
-            var num = BABYLON.Vector3.DistanceSquared(sphereCenter, vector);
-            return (num <= (sphereRadius * sphereRadius));
-        }
-
-        public static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean {
-            for (var p = 0; p < 6; p++) {
-                for (var i = 0; i < 8; i++) {
-                    if (frustumPlanes[p].dotCoordinate(boundingVectors[i]) < 0) {
-                        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;
-        }
-    }
-} 

+ 0 - 174
Babylon/Culling/babylon.boundingBox.js

@@ -1,174 +0,0 @@
-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.extendSize = 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();
-
-            this._update(BABYLON.Matrix.Identity());
-        }
-        // Methods
-        BoundingBox.prototype.getWorldMatrix = function () {
-            return this._worldMatrix;
-        };
-
-        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);
-
-            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]);
-
-            this._worldMatrix = world;
-        };
-
-        BoundingBox.prototype.isInFrustum = function (frustumPlanes) {
-            return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);
-        };
-
-        BoundingBox.prototype.isCompletelyInFrustum = function (frustumPlanes) {
-            return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);
-        };
-
-        BoundingBox.prototype.intersectsPoint = function (point) {
-            var delta = BABYLON.Engine.Epsilon;
-
-            if (this.maximumWorld.x - point.x < delta || delta > point.x - this.minimumWorld.x)
-                return false;
-
-            if (this.maximumWorld.y - point.y < delta || delta > point.y - this.minimumWorld.y)
-                return false;
-
-            if (this.maximumWorld.z - point.z < delta || delta > point.z - this.minimumWorld.z)
-                return false;
-
-            return true;
-        };
-
-        BoundingBox.prototype.intersectsSphere = function (sphere) {
-            return BoundingBox.IntersectsSphere(this.minimumWorld, this.maximumWorld, sphere.centerWorld, sphere.radiusWorld);
-        };
-
-        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.z < min.z || this.minimumWorld.z > max.z)
-                return false;
-
-            return true;
-        };
-
-        // 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.z < box1.minimumWorld.z || box0.minimumWorld.z > box1.maximumWorld.z)
-                return false;
-
-            return true;
-        };
-
-        BoundingBox.IntersectsSphere = function (minPoint, maxPoint, sphereCenter, sphereRadius) {
-            var vector = BABYLON.Vector3.Clamp(sphereCenter, minPoint, maxPoint);
-            var num = BABYLON.Vector3.DistanceSquared(sphereCenter, vector);
-            return (num <= (sphereRadius * sphereRadius));
-        };
-
-        BoundingBox.IsCompletelyInFrustum = function (boundingVectors, frustumPlanes) {
-            for (var p = 0; p < 6; p++) {
-                for (var i = 0; i < 8; i++) {
-                    if (frustumPlanes[p].dotCoordinate(boundingVectors[i]) < 0) {
-                        return false;
-                    }
-                }
-            }
-            return true;
-        };
-
-        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;
-                    }
-                }
-                if (inCount == 0)
-                    return false;
-            }
-            return true;
-        };
-        return BoundingBox;
-    })();
-    BABYLON.BoundingBox = BoundingBox;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.boundingBox.js.map

+ 0 - 129
Babylon/Culling/babylon.boundingInfo.js

@@ -1,129 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var computeBoxExtents = function (axis, box) {
-        var p = BABYLON.Vector3.Dot(box.center, axis);
-
-        var r0 = Math.abs(BABYLON.Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;
-        var r1 = Math.abs(BABYLON.Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
-        var r2 = Math.abs(BABYLON.Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;
-
-        var r = r0 + r1 + r2;
-        return {
-            min: p - r,
-            max: p + r
-        };
-    };
-
-    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);
-
-        return extentsOverlap(result0.min, result0.max, result1.min, result1.max);
-    };
-
-    var BoundingInfo = (function () {
-        function BoundingInfo(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
-            this.boundingBox = new BABYLON.BoundingBox(minimum, maximum);
-            this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum);
-        }
-        // Methods
-        BoundingInfo.prototype._update = function (world) {
-            this.boundingBox._update(world);
-            this.boundingSphere._update(world);
-        };
-
-        BoundingInfo.prototype.isInFrustum = function (frustumPlanes) {
-            if (!this.boundingSphere.isInFrustum(frustumPlanes))
-                return false;
-
-            return this.boundingBox.isInFrustum(frustumPlanes);
-        };
-
-        BoundingInfo.prototype.isCompletelyInFrustum = function (frustumPlanes) {
-            return this.boundingBox.isCompletelyInFrustum(frustumPlanes);
-        };
-
-        BoundingInfo.prototype._checkCollision = function (collider) {
-            return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);
-        };
-
-        BoundingInfo.prototype.intersectsPoint = function (point) {
-            if (!this.boundingSphere.centerWorld) {
-                return false;
-            }
-
-            if (!this.boundingSphere.intersectsPoint(point)) {
-                return false;
-            }
-
-            if (!this.boundingBox.intersectsPoint(point)) {
-                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

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

@@ -1,110 +0,0 @@
-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.extendSize.x;
-        var r1 = Math.abs(Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
-        var r2 = Math.abs(Vector3.Dot(box.directions[2], axis)) * box.extendSize.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(public minimum: Vector3, public maximum: Vector3) {
-            this.boundingBox = new BABYLON.BoundingBox(minimum, maximum);
-            this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum);
-        }
-
-        // Methods
-        public _update(world: Matrix) {
-            this.boundingBox._update(world);
-            this.boundingSphere._update(world);
-        }
-
-        public isInFrustum(frustumPlanes: Plane[]): boolean {
-            if (!this.boundingSphere.isInFrustum(frustumPlanes))
-                return false;
-
-            return this.boundingBox.isInFrustum(frustumPlanes);
-        }
-
-        public isCompletelyInFrustum(frustumPlanes: Plane[]): boolean {
-            return this.boundingBox.isCompletelyInFrustum(frustumPlanes);
-        }
-       
-        public _checkCollision(collider: 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;
-        }
-    }
-} 

+ 0 - 62
Babylon/Culling/babylon.boundingSphere.js

@@ -1,62 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var BoundingSphere = (function () {
-        function BoundingSphere(minimum, maximum) {
-            this.minimum = minimum;
-            this.maximum = maximum;
-            this._tempRadiusVector = BABYLON.Vector3.Zero();
-            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) {
-            BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
-            BABYLON.Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, world, this._tempRadiusVector);
-            this.radiusWorld = Math.max(Math.abs(this._tempRadiusVector.x), Math.abs(this._tempRadiusVector.y), Math.abs(this._tempRadiusVector.z)) * this.radius;
-        };
-
-        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 (Math.abs(this.radiusWorld - distance) < BABYLON.Engine.Epsilon)
-                return false;
-
-            return true;
-        };
-
-        // 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;
-
-            var distance = Math.sqrt((x * x) + (y * y) + (z * z));
-
-            if (sphere0.radiusWorld + sphere1.radiusWorld < distance)
-                return false;
-
-            return true;
-        };
-        return BoundingSphere;
-    })();
-    BABYLON.BoundingSphere = BoundingSphere;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.boundingSphere.js.map

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

@@ -1,64 +0,0 @@
-module BABYLON {
-    export class BoundingSphere {
-        public center: Vector3;
-        public radius: number;
-        public centerWorld: Vector3;
-        public radiusWorld: number;
-
-        private _tempRadiusVector = Vector3.Zero();
-
-        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): void {
-            BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
-            BABYLON.Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, world, this._tempRadiusVector);
-            this.radiusWorld = Math.max(Math.abs(this._tempRadiusVector.x), Math.abs(this._tempRadiusVector.y), Math.abs(this._tempRadiusVector.z)) * this.radius;
-        }
-
-        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 (Math.abs(this.radiusWorld - distance) < Engine.Epsilon)
-                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;
-        }
-
-    }
-} 

+ 0 - 95
Babylon/Layer/babylon.layer.js

@@ -1,95 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Layer = (function () {
-        function Layer(name, imgUrl, scene, isBackground, color) {
-            this.name = name;
-            this._vertexDeclaration = [2];
-            this._vertexStrideSize = 2 * 4;
-            this.texture = imgUrl ? new BABYLON.Texture(imgUrl, scene, true) : null;
-            this.isBackground = isBackground === undefined ? true : isBackground;
-            this.color = color === undefined ? new BABYLON.Color4(1, 1, 1, 1) : color;
-
-            this._scene = scene;
-            this._scene.layers.push(this);
-
-            // VBO
-            var vertices = [];
-            vertices.push(1, 1);
-            vertices.push(-1, 1);
-            vertices.push(-1, -1);
-            vertices.push(1, -1);
-
-            this._vertexBuffer = scene.getEngine().createVertexBuffer(vertices);
-
-            // Indices
-            var indices = [];
-            indices.push(0);
-            indices.push(1);
-            indices.push(2);
-
-            indices.push(0);
-            indices.push(2);
-            indices.push(3);
-
-            this._indexBuffer = scene.getEngine().createIndexBuffer(indices);
-
-            // Effects
-            this._effect = this._scene.getEngine().createEffect("layer", ["position"], ["textureMatrix", "color"], ["textureSampler"], "");
-        }
-        Layer.prototype.render = function () {
-            // Check
-            if (!this._effect.isReady() || !this.texture || !this.texture.isReady())
-                return;
-
-            var engine = this._scene.getEngine();
-
-            // Render
-            engine.enableEffect(this._effect);
-            engine.setState(false);
-
-            // Texture
-            this._effect.setTexture("textureSampler", this.texture);
-            this._effect.setMatrix("textureMatrix", this.texture.getTextureMatrix());
-
-            // Color
-            this._effect.setFloat4("color", this.color.r, this.color.g, this.color.b, this.color.a);
-
-            // VBOs
-            engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
-
-            // Draw order
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
-            engine.draw(true, 0, 6);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
-        };
-
-        Layer.prototype.dispose = function () {
-            if (this._vertexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._vertexBuffer);
-                this._vertexBuffer = null;
-            }
-
-            if (this._indexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._indexBuffer);
-                this._indexBuffer = null;
-            }
-
-            if (this.texture) {
-                this.texture.dispose();
-                this.texture = null;
-            }
-
-            // Remove from scene
-            var index = this._scene.layers.indexOf(this);
-            this._scene.layers.splice(index, 1);
-
-            // Callback
-            if (this.onDispose) {
-                this.onDispose();
-            }
-        };
-        return Layer;
-    })();
-    BABYLON.Layer = Layer;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.layer.js.map

+ 0 - 104
Babylon/Layer/babylon.layer.ts

@@ -1,104 +0,0 @@
-module BABYLON {
-    export class Layer {
-        public texture: Texture;
-        public isBackground: boolean;
-        public color: Color4;
-        public onDispose: () => void;
-
-        private _scene: Scene;
-        private _vertexDeclaration = [2];
-        private _vertexStrideSize = 2 * 4;
-        private _vertexBuffer: WebGLBuffer;
-        private _indexBuffer: WebGLBuffer;
-        private _effect: Effect;
-
-        constructor(public name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4) {
-            this.texture = imgUrl ? new BABYLON.Texture(imgUrl, scene, true) : null;
-            this.isBackground = isBackground === undefined ? true : isBackground;
-            this.color = color === undefined ? new BABYLON.Color4(1, 1, 1, 1) : color;
-
-            this._scene = scene;
-            this._scene.layers.push(this);
-
-            // VBO
-            var vertices = [];
-            vertices.push(1, 1);
-            vertices.push(-1, 1);
-            vertices.push(-1, -1);
-            vertices.push(1, -1);
-
-            this._vertexBuffer = scene.getEngine().createVertexBuffer(vertices);
-
-            // Indices
-            var indices = [];
-            indices.push(0);
-            indices.push(1);
-            indices.push(2);
-
-            indices.push(0);
-            indices.push(2);
-            indices.push(3);
-
-            this._indexBuffer = scene.getEngine().createIndexBuffer(indices);
-
-            // Effects
-            this._effect = this._scene.getEngine().createEffect("layer",
-                ["position"],
-                ["textureMatrix", "color"],
-                ["textureSampler"], "");
-        }
-
-        public render(): void {
-            // Check
-            if (!this._effect.isReady() || !this.texture || !this.texture.isReady())
-                return;
-
-            var engine = this._scene.getEngine();
-
-            // Render
-            engine.enableEffect(this._effect);
-            engine.setState(false);
-
-            // Texture
-            this._effect.setTexture("textureSampler", this.texture);
-            this._effect.setMatrix("textureMatrix", this.texture.getTextureMatrix());
-
-            // Color
-            this._effect.setFloat4("color", this.color.r, this.color.g, this.color.b, this.color.a);
-
-            // VBOs
-            engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
-
-            // Draw order
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
-            engine.draw(true, 0, 6);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
-        }
-
-        public dispose(): void {
-            if (this._vertexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._vertexBuffer);
-                this._vertexBuffer = null;
-            }
-
-            if (this._indexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._indexBuffer);
-                this._indexBuffer = null;
-            }
-
-            if (this.texture) {
-                this.texture.dispose();
-                this.texture = null;
-            }
-
-            // Remove from scene
-            var index = this._scene.layers.indexOf(this);
-            this._scene.layers.splice(index, 1);
-
-            // Callback
-            if (this.onDispose) {
-                this.onDispose();
-            }
-        }
-    }
-} 

+ 0 - 26
Babylon/LensFlare/babylon.lensFlare.js

@@ -1,26 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var LensFlare = (function () {
-        function LensFlare(size, position, color, imgUrl, system) {
-            this.size = size;
-            this.position = position;
-            this.dispose = function () {
-                if (this.texture) {
-                    this.texture.dispose();
-                }
-
-                // Remove from scene
-                var index = this._system.lensFlares.indexOf(this);
-                this._system.lensFlares.splice(index, 1);
-            };
-            this.color = color || new BABYLON.Color3(1, 1, 1);
-            this.texture = imgUrl ? new BABYLON.Texture(imgUrl, system.getScene(), true) : null;
-            this._system = system;
-
-            system.lensFlares.push(this);
-        }
-        return LensFlare;
-    })();
-    BABYLON.LensFlare = LensFlare;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.lensFlare.js.map

+ 0 - 26
Babylon/LensFlare/babylon.lensFlare.ts

@@ -1,26 +0,0 @@
-module BABYLON {
-    export class LensFlare {
-        public color: Color3;
-        public texture: Texture;
-
-        private _system: LensFlareSystem;
-
-        constructor(public size: number, public position: number, color, imgUrl: string, system: LensFlareSystem) {
-            this.color = color || new BABYLON.Color3(1, 1, 1);
-            this.texture = imgUrl ? new BABYLON.Texture(imgUrl, system.getScene(), true) : null;
-            this._system = system;
-
-            system.lensFlares.push(this);
-        }
-
-        public dispose = function (): void {
-            if (this.texture) {
-                this.texture.dispose();
-            }
-
-            // Remove from scene
-            var index = this._system.lensFlares.indexOf(this);
-            this._system.lensFlares.splice(index, 1);
-        };
-    }
-} 

+ 0 - 223
Babylon/LensFlare/babylon.lensFlareSystem.js

@@ -1,223 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var LensFlareSystem = (function () {
-        function LensFlareSystem(name, emitter, scene) {
-            this.name = name;
-            this.lensFlares = new Array();
-            this.borderLimit = 300;
-            this._vertexDeclaration = [2];
-            this._vertexStrideSize = 2 * 4;
-            this._isEnabled = true;
-            this._scene = scene;
-            this._emitter = emitter;
-            scene.lensFlareSystems.push(this);
-
-            this.meshesSelectionPredicate = function (m) {
-                return m.material && m.isVisible && m.isEnabled() && m.isBlocker && ((m.layerMask & scene.activeCamera.layerMask) != 0);
-            };
-
-            // VBO
-            var vertices = [];
-            vertices.push(1, 1);
-            vertices.push(-1, 1);
-            vertices.push(-1, -1);
-            vertices.push(1, -1);
-
-            this._vertexBuffer = scene.getEngine().createVertexBuffer(vertices);
-
-            // Indices
-            var indices = [];
-            indices.push(0);
-            indices.push(1);
-            indices.push(2);
-
-            indices.push(0);
-            indices.push(2);
-            indices.push(3);
-
-            this._indexBuffer = scene.getEngine().createIndexBuffer(indices);
-
-            // Effects
-            this._effect = this._scene.getEngine().createEffect("lensFlare", ["position"], ["color", "viewportMatrix"], ["textureSampler"], "");
-        }
-        Object.defineProperty(LensFlareSystem.prototype, "isEnabled", {
-            get: function () {
-                return this._isEnabled;
-            },
-            set: function (value) {
-                this._isEnabled = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-
-        LensFlareSystem.prototype.getScene = function () {
-            return this._scene;
-        };
-
-        LensFlareSystem.prototype.getEmitter = function () {
-            return this._emitter;
-        };
-
-        LensFlareSystem.prototype.getEmitterPosition = function () {
-            return this._emitter.getAbsolutePosition ? this._emitter.getAbsolutePosition() : this._emitter.position;
-        };
-
-        LensFlareSystem.prototype.computeEffectivePosition = function (globalViewport) {
-            var position = this.getEmitterPosition();
-
-            position = BABYLON.Vector3.Project(position, BABYLON.Matrix.Identity(), this._scene.getTransformMatrix(), globalViewport);
-
-            this._positionX = position.x;
-            this._positionY = position.y;
-
-            position = BABYLON.Vector3.TransformCoordinates(this.getEmitterPosition(), this._scene.getViewMatrix());
-
-            if (position.z > 0) {
-                if ((this._positionX > globalViewport.x) && (this._positionX < globalViewport.x + globalViewport.width)) {
-                    if ((this._positionY > globalViewport.y) && (this._positionY < globalViewport.y + globalViewport.height))
-                        return true;
-                }
-            }
-
-            return false;
-        };
-
-        LensFlareSystem.prototype._isVisible = function () {
-            if (!this._isEnabled) {
-                return false;
-            }
-
-            var emitterPosition = this.getEmitterPosition();
-            var direction = emitterPosition.subtract(this._scene.activeCamera.position);
-            var distance = direction.length();
-            direction.normalize();
-
-            var ray = new BABYLON.Ray(this._scene.activeCamera.position, direction);
-            var pickInfo = this._scene.pickWithRay(ray, this.meshesSelectionPredicate, true);
-
-            return !pickInfo.hit || pickInfo.distance > distance;
-        };
-
-        LensFlareSystem.prototype.render = function () {
-            if (!this._effect.isReady())
-                return false;
-
-            var engine = this._scene.getEngine();
-            var viewport = this._scene.activeCamera.viewport;
-            var globalViewport = viewport.toGlobal(engine);
-
-            // Position
-            if (!this.computeEffectivePosition(globalViewport)) {
-                return false;
-            }
-
-            // Visibility
-            if (!this._isVisible()) {
-                return false;
-            }
-
-            // Intensity
-            var awayX;
-            var awayY;
-
-            if (this._positionX < this.borderLimit + globalViewport.x) {
-                awayX = this.borderLimit + globalViewport.x - this._positionX;
-            } else if (this._positionX > globalViewport.x + globalViewport.width - this.borderLimit) {
-                awayX = this._positionX - globalViewport.x - globalViewport.width + this.borderLimit;
-            } else {
-                awayX = 0;
-            }
-
-            if (this._positionY < this.borderLimit + globalViewport.y) {
-                awayY = this.borderLimit + globalViewport.y - this._positionY;
-            } else if (this._positionY > globalViewport.y + globalViewport.height - this.borderLimit) {
-                awayY = this._positionY - globalViewport.y - globalViewport.height + this.borderLimit;
-            } else {
-                awayY = 0;
-            }
-
-            var away = (awayX > awayY) ? awayX : awayY;
-            if (away > this.borderLimit) {
-                away = this.borderLimit;
-            }
-
-            var intensity = 1.0 - (away / this.borderLimit);
-            if (intensity < 0) {
-                return false;
-            }
-
-            if (intensity > 1.0) {
-                intensity = 1.0;
-            }
-
-            // Position
-            var centerX = globalViewport.x + globalViewport.width / 2;
-            var centerY = globalViewport.y + globalViewport.height / 2;
-            var distX = centerX - this._positionX;
-            var distY = centerY - this._positionY;
-
-            // Effects
-            engine.enableEffect(this._effect);
-            engine.setState(false);
-            engine.setDepthBuffer(false);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_ADD);
-
-            // VBOs
-            engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
-
-            for (var index = 0; index < this.lensFlares.length; index++) {
-                var flare = this.lensFlares[index];
-
-                var x = centerX - (distX * flare.position);
-                var y = centerY - (distY * flare.position);
-
-                var cw = flare.size;
-                var ch = flare.size * engine.getAspectRatio(this._scene.activeCamera);
-                var cx = 2 * (x / globalViewport.width) - 1.0;
-                var cy = 1.0 - 2 * (y / globalViewport.height);
-
-                var viewportMatrix = BABYLON.Matrix.FromValues(cw / 2, 0, 0, 0, 0, ch / 2, 0, 0, 0, 0, 1, 0, cx, cy, 0, 1);
-
-                this._effect.setMatrix("viewportMatrix", viewportMatrix);
-
-                // Texture
-                this._effect.setTexture("textureSampler", flare.texture);
-
-                // Color
-                this._effect.setFloat4("color", flare.color.r * intensity, flare.color.g * intensity, flare.color.b * intensity, 1.0);
-
-                // Draw order
-                engine.draw(true, 0, 6);
-            }
-
-            engine.setDepthBuffer(true);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
-            return true;
-        };
-
-        LensFlareSystem.prototype.dispose = function () {
-            if (this._vertexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._vertexBuffer);
-                this._vertexBuffer = null;
-            }
-
-            if (this._indexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._indexBuffer);
-                this._indexBuffer = null;
-            }
-
-            while (this.lensFlares.length) {
-                this.lensFlares[0].dispose();
-            }
-
-            // Remove from scene
-            var index = this._scene.lensFlareSystems.indexOf(this);
-            this._scene.lensFlareSystems.splice(index, 1);
-        };
-        return LensFlareSystem;
-    })();
-    BABYLON.LensFlareSystem = LensFlareSystem;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.lensFlareSystem.js.map

+ 0 - 232
Babylon/LensFlare/babylon.lensFlareSystem.ts

@@ -1,232 +0,0 @@
-module BABYLON {
-    export class LensFlareSystem {
-        public lensFlares = new Array<LensFlare>();
-        public borderLimit = 300;
-        public meshesSelectionPredicate: (mesh: Mesh) => boolean;
-
-        private _scene: Scene;
-        private _emitter: any;
-        private _vertexDeclaration = [2];
-        private _vertexStrideSize = 2 * 4;
-        private _vertexBuffer: WebGLBuffer;
-        private _indexBuffer: WebGLBuffer;
-        private _effect: Effect;
-        private _positionX: number;
-        private _positionY: number;
-        private _isEnabled = true;
-
-        constructor(public name: string, emitter: any, scene: Scene) {
-
-            this._scene = scene;
-            this._emitter = emitter;
-            scene.lensFlareSystems.push(this);
-
-            this.meshesSelectionPredicate = m => m.material && m.isVisible && m.isEnabled() && m.isBlocker && ((m.layerMask & scene.activeCamera.layerMask) != 0);
-
-            // VBO
-            var vertices = [];
-            vertices.push(1, 1);
-            vertices.push(-1, 1);
-            vertices.push(-1, -1);
-            vertices.push(1, -1);
-
-            this._vertexBuffer = scene.getEngine().createVertexBuffer(vertices);
-
-            // Indices
-            var indices = [];
-            indices.push(0);
-            indices.push(1);
-            indices.push(2);
-
-            indices.push(0);
-            indices.push(2);
-            indices.push(3);
-
-            this._indexBuffer = scene.getEngine().createIndexBuffer(indices);
-
-            // Effects
-            this._effect = this._scene.getEngine().createEffect("lensFlare",
-                ["position"],
-                ["color", "viewportMatrix"],
-                ["textureSampler"], "");
-        }
-
-        public get isEnabled(): boolean {
-            return this._isEnabled;
-        }
-
-        public set isEnabled(value: boolean) {
-            this._isEnabled = value;
-        }
-
-        public getScene(): Scene {
-            return this._scene;
-        }
-
-        public getEmitter(): any {
-            return this._emitter;
-        }
-
-        public getEmitterPosition(): Vector3 {
-            return this._emitter.getAbsolutePosition ? this._emitter.getAbsolutePosition() : this._emitter.position;
-        }
-
-        public computeEffectivePosition(globalViewport: Viewport): boolean {
-            var position = this.getEmitterPosition();
-
-            position = BABYLON.Vector3.Project(position, BABYLON.Matrix.Identity(), this._scene.getTransformMatrix(), globalViewport);
-
-            this._positionX = position.x;
-            this._positionY = position.y;
-
-            position = BABYLON.Vector3.TransformCoordinates(this.getEmitterPosition(), this._scene.getViewMatrix());
-
-            if (position.z > 0) {
-                if ((this._positionX > globalViewport.x) && (this._positionX < globalViewport.x + globalViewport.width)) {
-                    if ((this._positionY > globalViewport.y) && (this._positionY < globalViewport.y + globalViewport.height))
-                        return true;
-                }
-            }
-
-            return false;
-        }
-
-        public _isVisible(): boolean {
-            if (!this._isEnabled) {
-                return false;
-            }
-
-            var emitterPosition = this.getEmitterPosition();
-            var direction = emitterPosition.subtract(this._scene.activeCamera.position);
-            var distance = direction.length();
-            direction.normalize();
-
-            var ray = new BABYLON.Ray(this._scene.activeCamera.position, direction);
-            var pickInfo = this._scene.pickWithRay(ray, this.meshesSelectionPredicate, true);
-
-            return !pickInfo.hit || pickInfo.distance > distance;
-        }
-
-        public render(): boolean {
-            if (!this._effect.isReady())
-                return false;
-
-            var engine = this._scene.getEngine();
-            var viewport = this._scene.activeCamera.viewport;
-            var globalViewport = viewport.toGlobal(engine);
-
-            // Position
-            if (!this.computeEffectivePosition(globalViewport)) {
-                return false;
-            }
-
-            // Visibility
-            if (!this._isVisible()) {
-                return false;
-            }
-
-            // Intensity
-            var awayX;
-            var awayY;
-
-            if (this._positionX < this.borderLimit + globalViewport.x) {
-                awayX = this.borderLimit + globalViewport.x - this._positionX;
-            } else if (this._positionX > globalViewport.x + globalViewport.width - this.borderLimit) {
-                awayX = this._positionX - globalViewport.x - globalViewport.width + this.borderLimit;
-            } else {
-                awayX = 0;
-            }
-
-            if (this._positionY < this.borderLimit + globalViewport.y) {
-                awayY = this.borderLimit + globalViewport.y - this._positionY;
-            } else if (this._positionY > globalViewport.y + globalViewport.height - this.borderLimit) {
-                awayY = this._positionY - globalViewport.y - globalViewport.height + this.borderLimit;
-            } else {
-                awayY = 0;
-            }
-
-            var away = (awayX > awayY) ? awayX : awayY;
-            if (away > this.borderLimit) {
-                away = this.borderLimit;
-            }
-
-            var intensity = 1.0 - (away / this.borderLimit);
-            if (intensity < 0) {
-                return false;
-            }
-
-            if (intensity > 1.0) {
-                intensity = 1.0;
-            }
-
-            // Position
-            var centerX = globalViewport.x + globalViewport.width / 2;
-            var centerY = globalViewport.y + globalViewport.height / 2;
-            var distX = centerX - this._positionX;
-            var distY = centerY - this._positionY;
-
-            // Effects
-            engine.enableEffect(this._effect);
-            engine.setState(false);
-            engine.setDepthBuffer(false);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_ADD);
-
-            // VBOs
-            engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
-
-            // Flares
-            for (var index = 0; index < this.lensFlares.length; index++) {
-                var flare = this.lensFlares[index];
-
-                var x = centerX - (distX * flare.position);
-                var y = centerY - (distY * flare.position);
-
-                var cw = flare.size;
-                var ch = flare.size * engine.getAspectRatio(this._scene.activeCamera);
-                var cx = 2 * (x / globalViewport.width) - 1.0;
-                var cy = 1.0 - 2 * (y / globalViewport.height);
-
-                var viewportMatrix = BABYLON.Matrix.FromValues(
-                    cw / 2, 0, 0, 0,
-                    0, ch / 2, 0, 0,
-                    0, 0, 1, 0,
-                    cx, cy, 0, 1);
-
-                this._effect.setMatrix("viewportMatrix", viewportMatrix);
-
-                // Texture
-                this._effect.setTexture("textureSampler", flare.texture);
-
-                // Color
-                this._effect.setFloat4("color", flare.color.r * intensity, flare.color.g * intensity, flare.color.b * intensity, 1.0);
-
-                // Draw order
-                engine.draw(true, 0, 6);
-            }
-
-            engine.setDepthBuffer(true);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
-            return true;
-        }
-
-        public dispose(): void {
-            if (this._vertexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._vertexBuffer);
-                this._vertexBuffer = null;
-            }
-
-            if (this._indexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._indexBuffer);
-                this._indexBuffer = null;
-            }
-
-            while (this.lensFlares.length) {
-                this.lensFlares[0].dispose();
-            }
-
-            // Remove from scene
-            var index = this._scene.lensFlareSystems.indexOf(this);
-            this._scene.lensFlareSystems.splice(index, 1);
-        }
-    }
-} 

+ 0 - 267
Babylon/Lights/Shadows/babylon.shadowGenerator.js

@@ -1,267 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var ShadowGenerator = (function () {
-        function ShadowGenerator(mapSize, light) {
-            var _this = this;
-            // Members
-            this.filter = ShadowGenerator.FILTER_VARIANCESHADOWMAP;
-            this._darkness = 0;
-            this._transparencyShadow = false;
-            this._viewMatrix = BABYLON.Matrix.Zero();
-            this._projectionMatrix = BABYLON.Matrix.Zero();
-            this._transformMatrix = BABYLON.Matrix.Zero();
-            this._worldViewProjection = BABYLON.Matrix.Zero();
-            this._light = light;
-            this._scene = light.getScene();
-
-            light._shadowGenerator = this;
-
-            // Render target
-            this._shadowMap = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false);
-            this._shadowMap.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._shadowMap.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._shadowMap.renderParticles = false;
-
-            // Custom render function
-            var renderSubMesh = function (subMesh) {
-                var mesh = subMesh.getRenderingMesh();
-                var scene = _this._scene;
-                var engine = scene.getEngine();
-
-                // Culling
-                engine.setState(subMesh.getMaterial().backFaceCulling);
-
-                // Managing instances
-                var batch = mesh._getInstancesRenderList(subMesh._id);
-
-                if (batch.mustReturn) {
-                    return;
-                }
-
-                var hardwareInstancedRendering = (engine.getCaps().instancedArrays !== null) && (batch.visibleInstances[subMesh._id] !== null);
-
-                if (_this.isReady(subMesh, hardwareInstancedRendering)) {
-                    engine.enableEffect(_this._effect);
-                    mesh._bind(subMesh, _this._effect, BABYLON.Material.TriangleFillMode);
-                    var material = subMesh.getMaterial();
-
-                    _this._effect.setMatrix("viewProjection", _this.getTransformMatrix());
-
-                    // Alpha test
-                    if (material && material.needAlphaTesting()) {
-                        var alphaTexture = material.getAlphaTestTexture();
-                        _this._effect.setTexture("diffuseSampler", alphaTexture);
-                        _this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
-                    }
-
-                    // Bones
-                    var useBones = mesh.skeleton && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind) && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind);
-
-                    if (useBones) {
-                        _this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices());
-                    }
-
-                    if (hardwareInstancedRendering) {
-                        mesh._renderWithInstances(subMesh, BABYLON.Material.TriangleFillMode, batch, _this._effect, engine);
-                    } else {
-                        if (batch.renderSelf[subMesh._id]) {
-                            _this._effect.setMatrix("world", mesh.getWorldMatrix());
-
-                            // Draw
-                            mesh._draw(subMesh, BABYLON.Material.TriangleFillMode);
-                        }
-
-                        if (batch.visibleInstances[subMesh._id]) {
-                            for (var instanceIndex = 0; instanceIndex < batch.visibleInstances[subMesh._id].length; instanceIndex++) {
-                                var instance = batch.visibleInstances[subMesh._id][instanceIndex];
-
-                                _this._effect.setMatrix("world", instance.getWorldMatrix());
-
-                                // Draw
-                                mesh._draw(subMesh, BABYLON.Material.TriangleFillMode);
-                            }
-                        }
-                    }
-                } else {
-                    // Need to reset refresh rate of the shadowMap
-                    _this._shadowMap.resetRefreshCounter();
-                }
-            };
-
-            this._shadowMap.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes) {
-                var index;
-
-                for (index = 0; index < opaqueSubMeshes.length; index++) {
-                    renderSubMesh(opaqueSubMeshes.data[index]);
-                }
-
-                for (index = 0; index < alphaTestSubMeshes.length; index++) {
-                    renderSubMesh(alphaTestSubMeshes.data[index]);
-                }
-
-                if (_this._transparencyShadow) {
-                    for (index = 0; index < transparentSubMeshes.length; index++) {
-                        renderSubMesh(transparentSubMeshes.data[index]);
-                    }
-                }
-            };
-        }
-        Object.defineProperty(ShadowGenerator, "FILTER_NONE", {
-            // Static
-            get: function () {
-                return ShadowGenerator._FILTER_NONE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ShadowGenerator, "FILTER_VARIANCESHADOWMAP", {
-            get: function () {
-                return ShadowGenerator._FILTER_VARIANCESHADOWMAP;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ShadowGenerator, "FILTER_POISSONSAMPLING", {
-            get: function () {
-                return ShadowGenerator._FILTER_POISSONSAMPLING;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ShadowGenerator.prototype, "useVarianceShadowMap", {
-            get: function () {
-                return this.filter === ShadowGenerator.FILTER_VARIANCESHADOWMAP;
-            },
-            set: function (value) {
-                this.filter = (value ? ShadowGenerator.FILTER_VARIANCESHADOWMAP : ShadowGenerator.FILTER_NONE);
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(ShadowGenerator.prototype, "usePoissonSampling", {
-            get: function () {
-                return this.filter === ShadowGenerator.FILTER_POISSONSAMPLING;
-            },
-            set: function (value) {
-                this.filter = (value ? ShadowGenerator.FILTER_POISSONSAMPLING : ShadowGenerator.FILTER_NONE);
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        ShadowGenerator.prototype.isReady = function (subMesh, useInstances) {
-            var defines = [];
-
-            if (this.useVarianceShadowMap) {
-                defines.push("#define VSM");
-            }
-
-            var attribs = [BABYLON.VertexBuffer.PositionKind];
-
-            var mesh = subMesh.getMesh();
-            var material = subMesh.getMaterial();
-
-            // Alpha test
-            if (material && material.needAlphaTesting()) {
-                defines.push("#define ALPHATEST");
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                    attribs.push(BABYLON.VertexBuffer.UVKind);
-                    defines.push("#define UV1");
-                }
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind)) {
-                    attribs.push(BABYLON.VertexBuffer.UV2Kind);
-                    defines.push("#define UV2");
-                }
-            }
-
-            // Bones
-            if (mesh.skeleton && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind) && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
-                attribs.push(BABYLON.VertexBuffer.MatricesIndicesKind);
-                attribs.push(BABYLON.VertexBuffer.MatricesWeightsKind);
-                defines.push("#define BONES");
-                defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
-            }
-
-            // Instances
-            if (useInstances) {
-                defines.push("#define INSTANCES");
-                attribs.push("world0");
-                attribs.push("world1");
-                attribs.push("world2");
-                attribs.push("world3");
-            }
-
-            // Get correct effect
-            var join = defines.join("\n");
-            if (this._cachedDefines != join) {
-                this._cachedDefines = join;
-                this._effect = this._scene.getEngine().createEffect("shadowMap", attribs, ["world", "mBones", "viewProjection", "diffuseMatrix"], ["diffuseSampler"], join);
-            }
-
-            return this._effect.isReady();
-        };
-
-        ShadowGenerator.prototype.getShadowMap = function () {
-            return this._shadowMap;
-        };
-
-        ShadowGenerator.prototype.getLight = function () {
-            return this._light;
-        };
-
-        // Methods
-        ShadowGenerator.prototype.getTransformMatrix = function () {
-            var lightPosition = this._light.position;
-            var lightDirection = this._light.direction;
-
-            if (this._light._computeTransformedPosition()) {
-                lightPosition = this._light._transformedPosition;
-            }
-
-            if (!this._cachedPosition || !this._cachedDirection || !lightPosition.equals(this._cachedPosition) || !lightDirection.equals(this._cachedDirection)) {
-                this._cachedPosition = lightPosition.clone();
-                this._cachedDirection = lightDirection.clone();
-
-                var activeCamera = this._scene.activeCamera;
-
-                BABYLON.Matrix.LookAtLHToRef(lightPosition, this._light.position.add(lightDirection), BABYLON.Vector3.Up(), this._viewMatrix);
-                BABYLON.Matrix.PerspectiveFovLHToRef(Math.PI / 2.0, 1.0, activeCamera.minZ, activeCamera.maxZ, this._projectionMatrix);
-
-                this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);
-            }
-
-            return this._transformMatrix;
-        };
-
-        ShadowGenerator.prototype.getDarkness = function () {
-            return this._darkness;
-        };
-
-        ShadowGenerator.prototype.setDarkness = function (darkness) {
-            if (darkness >= 1.0)
-                this._darkness = 1.0;
-            else if (darkness <= 0.0)
-                this._darkness = 0.0;
-            else
-                this._darkness = darkness;
-        };
-
-        ShadowGenerator.prototype.setTransparencyShadow = function (hasShadow) {
-            this._transparencyShadow = hasShadow;
-        };
-
-        ShadowGenerator.prototype.dispose = function () {
-            this._shadowMap.dispose();
-        };
-        ShadowGenerator._FILTER_NONE = 0;
-        ShadowGenerator._FILTER_VARIANCESHADOWMAP = 1;
-        ShadowGenerator._FILTER_POISSONSAMPLING = 2;
-        return ShadowGenerator;
-    })();
-    BABYLON.ShadowGenerator = ShadowGenerator;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.shadowGenerator.js.map

+ 0 - 259
Babylon/Lights/Shadows/babylon.shadowGenerator.ts

@@ -1,259 +0,0 @@
-module BABYLON {
-    export class ShadowGenerator {
-        private static _FILTER_NONE = 0;
-        private static _FILTER_VARIANCESHADOWMAP = 1;
-        private static _FILTER_POISSONSAMPLING = 2;
-
-        // Static
-        public static get FILTER_NONE(): number {
-            return ShadowGenerator._FILTER_NONE;
-        }
-
-        public static get FILTER_VARIANCESHADOWMAP(): number {
-            return ShadowGenerator._FILTER_VARIANCESHADOWMAP;
-        }
-
-        public static get FILTER_POISSONSAMPLING(): number {
-            return ShadowGenerator._FILTER_POISSONSAMPLING;
-        }
-
-        // Members
-        public filter = ShadowGenerator.FILTER_VARIANCESHADOWMAP;
-
-        public get useVarianceShadowMap(): boolean {
-            return this.filter === ShadowGenerator.FILTER_VARIANCESHADOWMAP;
-        }
-        public set useVarianceShadowMap(value: boolean) {
-            this.filter = (value ? ShadowGenerator.FILTER_VARIANCESHADOWMAP : ShadowGenerator.FILTER_NONE);
-        }
-
-        public get usePoissonSampling(): boolean {
-            return this.filter === ShadowGenerator.FILTER_POISSONSAMPLING;
-        }
-        public set usePoissonSampling(value: boolean) {
-            this.filter = (value ? ShadowGenerator.FILTER_POISSONSAMPLING : ShadowGenerator.FILTER_NONE);
-        }
-
-        private _light: DirectionalLight;
-        private _scene: Scene;
-        private _shadowMap: RenderTargetTexture;
-        private _darkness = 0;
-        private _transparencyShadow = false;
-        private _effect: Effect;
-
-        private _viewMatrix = BABYLON.Matrix.Zero();
-        private _projectionMatrix = BABYLON.Matrix.Zero();
-        private _transformMatrix = BABYLON.Matrix.Zero();
-        private _worldViewProjection = BABYLON.Matrix.Zero();
-        private _cachedPosition: Vector3;
-        private _cachedDirection: Vector3;
-        private _cachedDefines: string;
-
-        constructor(mapSize: number, light: DirectionalLight) {
-            this._light = light;
-            this._scene = light.getScene();
-
-            light._shadowGenerator = this;
-
-            // Render target
-            this._shadowMap = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false);
-            this._shadowMap.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._shadowMap.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._shadowMap.renderParticles = false;
-
-            // Custom render function
-            var renderSubMesh = (subMesh: SubMesh): void => {
-                var mesh = subMesh.getRenderingMesh();
-                var scene = this._scene;
-                var engine = scene.getEngine();
-
-                // Culling
-                engine.setState(subMesh.getMaterial().backFaceCulling);
-
-                // Managing instances
-                var batch = mesh._getInstancesRenderList(subMesh._id);
-
-                if (batch.mustReturn) {
-                    return;
-                }
-
-                var hardwareInstancedRendering = (engine.getCaps().instancedArrays !== null) && (batch.visibleInstances[subMesh._id] !== null);
-
-                if (this.isReady(subMesh, hardwareInstancedRendering)) {
-                    engine.enableEffect(this._effect);
-                    mesh._bind(subMesh, this._effect, Material.TriangleFillMode);
-                    var material = subMesh.getMaterial();
-
-                    this._effect.setMatrix("viewProjection", this.getTransformMatrix());
-
-                    // Alpha test
-                    if (material && material.needAlphaTesting()) {
-                        var alphaTexture = material.getAlphaTestTexture();
-                        this._effect.setTexture("diffuseSampler", alphaTexture);
-                        this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
-                    }
-
-                    // Bones
-                    var useBones = mesh.skeleton && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind) && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind);
-
-                    if (useBones) {
-                        this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices());
-                    }
-
-                    if (hardwareInstancedRendering) {
-                        mesh._renderWithInstances(subMesh, Material.TriangleFillMode, batch, this._effect, engine);
-                    } else {
-                        if (batch.renderSelf[subMesh._id]) {
-                            this._effect.setMatrix("world", mesh.getWorldMatrix());
-
-                            // Draw
-                            mesh._draw(subMesh, Material.TriangleFillMode);
-                        }
-
-                        if (batch.visibleInstances[subMesh._id]) {
-                            for (var instanceIndex = 0; instanceIndex < batch.visibleInstances[subMesh._id].length; instanceIndex++) {
-                                var instance = batch.visibleInstances[subMesh._id][instanceIndex];
-
-                                this._effect.setMatrix("world", instance.getWorldMatrix());
-
-                                // Draw
-                                mesh._draw(subMesh, Material.TriangleFillMode);
-                            }
-                        }
-                    }
-                } else {
-                    // Need to reset refresh rate of the shadowMap
-                    this._shadowMap.resetRefreshCounter();
-                }
-            };
-
-            this._shadowMap.customRenderFunction = (opaqueSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>): void => {
-                var index;
-
-                for (index = 0; index < opaqueSubMeshes.length; index++) {
-                    renderSubMesh(opaqueSubMeshes.data[index]);
-                }
-
-                for (index = 0; index < alphaTestSubMeshes.length; index++) {
-                    renderSubMesh(alphaTestSubMeshes.data[index]);
-                }
-
-                if (this._transparencyShadow) {
-                    for (index = 0; index < transparentSubMeshes.length; index++) {
-                        renderSubMesh(transparentSubMeshes.data[index]);
-                    }
-                }
-            };
-
-        }
-
-        public isReady(subMesh: SubMesh, useInstances: boolean): boolean {
-            var defines = [];
-
-            if (this.useVarianceShadowMap) {
-                defines.push("#define VSM");
-            }
-
-            var attribs = [BABYLON.VertexBuffer.PositionKind];
-
-            var mesh = subMesh.getMesh();
-            var material = subMesh.getMaterial();
-
-            // Alpha test
-            if (material && material.needAlphaTesting()) {
-                defines.push("#define ALPHATEST");
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                    attribs.push(BABYLON.VertexBuffer.UVKind);
-                    defines.push("#define UV1");
-                }
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind)) {
-                    attribs.push(BABYLON.VertexBuffer.UV2Kind);
-                    defines.push("#define UV2");
-                }
-            }
-
-            // Bones
-            if (mesh.skeleton && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind) && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
-                attribs.push(BABYLON.VertexBuffer.MatricesIndicesKind);
-                attribs.push(BABYLON.VertexBuffer.MatricesWeightsKind);
-                defines.push("#define BONES");
-                defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
-            }
-
-            // Instances
-            if (useInstances) {
-                defines.push("#define INSTANCES");
-                attribs.push("world0");
-                attribs.push("world1");
-                attribs.push("world2");
-                attribs.push("world3");
-            }
-
-            // Get correct effect      
-            var join = defines.join("\n");
-            if (this._cachedDefines != join) {
-                this._cachedDefines = join;
-                this._effect = this._scene.getEngine().createEffect("shadowMap",
-                    attribs,
-                    ["world", "mBones", "viewProjection", "diffuseMatrix"],
-                    ["diffuseSampler"], join);
-            }
-
-            return this._effect.isReady();
-        }
-
-        public getShadowMap(): RenderTargetTexture {
-            return this._shadowMap;
-        }
-
-        public getLight(): DirectionalLight {
-            return this._light;
-        }
-
-        // Methods
-        public getTransformMatrix(): Matrix {
-            var lightPosition = this._light.position;
-            var lightDirection = this._light.direction;
-
-            if (this._light._computeTransformedPosition()) {
-                lightPosition = this._light._transformedPosition;
-            }
-
-            if (!this._cachedPosition || !this._cachedDirection || !lightPosition.equals(this._cachedPosition) || !lightDirection.equals(this._cachedDirection)) {
-
-                this._cachedPosition = lightPosition.clone();
-                this._cachedDirection = lightDirection.clone();
-
-                var activeCamera = this._scene.activeCamera;
-
-                BABYLON.Matrix.LookAtLHToRef(lightPosition, this._light.position.add(lightDirection), BABYLON.Vector3.Up(), this._viewMatrix);
-                BABYLON.Matrix.PerspectiveFovLHToRef(Math.PI / 2.0, 1.0, activeCamera.minZ, activeCamera.maxZ, this._projectionMatrix);
-
-                this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);
-            }
-
-            return this._transformMatrix;
-        }
-
-        public getDarkness(): number {
-            return this._darkness;
-        }
-
-        public setDarkness(darkness: number): void {
-            if (darkness >= 1.0)
-                this._darkness = 1.0;
-            else if (darkness <= 0.0)
-                this._darkness = 0.0;
-            else
-                this._darkness = darkness;
-        }
-
-        public setTransparencyShadow(hasShadow: boolean): void {
-            this._transparencyShadow = hasShadow;
-        }
-
-        public dispose(): void {
-            this._shadowMap.dispose();
-        }
-    }
-} 

+ 0 - 63
Babylon/Lights/babylon.directionalLight.js

@@ -1,63 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var DirectionalLight = (function (_super) {
-        __extends(DirectionalLight, _super);
-        function DirectionalLight(name, direction, scene) {
-            _super.call(this, name, scene);
-            this.direction = direction;
-
-            this.position = direction.scale(-1);
-        }
-        DirectionalLight.prototype.setDirectionToTarget = function (target) {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(this.position));
-            return this.direction;
-        };
-
-        DirectionalLight.prototype._computeTransformedPosition = function () {
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedPosition) {
-                    this._transformedPosition = BABYLON.Vector3.Zero();
-                }
-
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this._transformedPosition);
-                return true;
-            }
-
-            return false;
-        };
-
-        DirectionalLight.prototype.transferToEffect = function (effect, directionUniformName) {
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedDirection) {
-                    this._transformedDirection = BABYLON.Vector3.Zero();
-                }
-
-                BABYLON.Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this._transformedDirection);
-                effect.setFloat4(directionUniformName, this._transformedDirection.x, this._transformedDirection.y, this._transformedDirection.z, 1);
-
-                return;
-            }
-
-            effect.setFloat4(directionUniformName, this.direction.x, this.direction.y, this.direction.z, 1);
-        };
-
-        DirectionalLight.prototype._getWorldMatrix = function () {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
-
-            return this._worldMatrix;
-        };
-        return DirectionalLight;
-    })(BABYLON.Light);
-    BABYLON.DirectionalLight = DirectionalLight;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.directionalLight.js.map

+ 0 - 58
Babylon/Lights/babylon.directionalLight.ts

@@ -1,58 +0,0 @@
-module BABYLON {
-    export class DirectionalLight extends Light {
-        public position: Vector3;
-
-        private _transformedDirection: Vector3;
-        public _transformedPosition: Vector3;
-        private _worldMatrix: Matrix;
-
-        constructor(name: string, public direction: Vector3, scene: Scene) {
-            super(name, scene);
-
-            this.position = direction.scale(-1);
-        }
-
-        public setDirectionToTarget(target: Vector3): Vector3 {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(this.position));
-            return this.direction;
-        }
-
-        public _computeTransformedPosition(): boolean {
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedPosition) {
-                    this._transformedPosition = BABYLON.Vector3.Zero();
-                }
-
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this._transformedPosition);
-                return true;
-            }
-
-            return false;
-        }
-
-        public transferToEffect(effect: Effect, directionUniformName: string): void {
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedDirection) {
-                    this._transformedDirection = BABYLON.Vector3.Zero();
-                }
-
-                BABYLON.Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this._transformedDirection);
-                effect.setFloat4(directionUniformName, this._transformedDirection.x, this._transformedDirection.y, this._transformedDirection.z, 1);
-
-                return;
-            }
-
-            effect.setFloat4(directionUniformName, this.direction.x, this.direction.y, this.direction.z, 1);
-        }
-
-        public _getWorldMatrix(): Matrix {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
-
-            return this._worldMatrix;
-        }
-    }
-}  

+ 0 - 42
Babylon/Lights/babylon.hemisphericLight.js

@@ -1,42 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var HemisphericLight = (function (_super) {
-        __extends(HemisphericLight, _super);
-        function HemisphericLight(name, direction, scene) {
-            _super.call(this, name, scene);
-            this.direction = direction;
-            this.groundColor = new BABYLON.Color3(0.0, 0.0, 0.0);
-        }
-        HemisphericLight.prototype.setDirectionToTarget = function (target) {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(BABYLON.Vector3.Zero()));
-            return this.direction;
-        };
-
-        HemisphericLight.prototype.getShadowGenerator = function () {
-            return null;
-        };
-
-        HemisphericLight.prototype.transferToEffect = function (effect, directionUniformName, groundColorUniformName) {
-            var normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
-            effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0);
-            effect.setColor3(groundColorUniformName, this.groundColor.scale(this.intensity));
-        };
-
-        HemisphericLight.prototype._getWorldMatrix = function () {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            return this._worldMatrix;
-        };
-        return HemisphericLight;
-    })(BABYLON.Light);
-    BABYLON.HemisphericLight = HemisphericLight;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.hemisphericLight.js.map

+ 0 - 34
Babylon/Lights/babylon.hemisphericLight.ts

@@ -1,34 +0,0 @@
-module BABYLON {
-    export class HemisphericLight extends Light {
-        public groundColor = new BABYLON.Color3(0.0, 0.0, 0.0);
-
-        private _worldMatrix: Matrix;
-
-        constructor(name: string, public direction: Vector3, scene: Scene) {
-            super(name, scene);
-        }
-
-        public setDirectionToTarget(target: Vector3): Vector3 {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(Vector3.Zero()));
-            return this.direction;
-        }
-
-        public getShadowGenerator(): ShadowGenerator {
-            return null;
-        }
-
-        public transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void {
-            var normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
-            effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0);
-            effect.setColor3(groundColorUniformName, this.groundColor.scale(this.intensity));
-        }
-
-        public _getWorldMatrix(): Matrix {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            return this._worldMatrix;
-        }
-    }
-} 

+ 0 - 83
Babylon/Lights/babylon.light.js

@@ -1,83 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var Light = (function (_super) {
-        __extends(Light, _super);
-        function Light(name, scene) {
-            _super.call(this, name, scene);
-            this.diffuse = new BABYLON.Color3(1.0, 1.0, 1.0);
-            this.specular = new BABYLON.Color3(1.0, 1.0, 1.0);
-            this.intensity = 1.0;
-            this.range = Number.MAX_VALUE;
-            this.includedOnlyMeshes = new Array();
-            this.excludedMeshes = new Array();
-            this._excludedMeshesIds = new Array();
-            this._includedOnlyMeshesIds = new Array();
-
-            scene.lights.push(this);
-        }
-        Light.prototype.getShadowGenerator = function () {
-            return this._shadowGenerator;
-        };
-
-        Light.prototype.transferToEffect = function (effect, uniformName0, uniformName1) {
-        };
-
-        Light.prototype._getWorldMatrix = function () {
-            return BABYLON.Matrix.Identity();
-        };
-
-        Light.prototype.canAffectMesh = function (mesh) {
-            if (!mesh) {
-                return true;
-            }
-
-            if (this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {
-                return false;
-            }
-
-            if (this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {
-                return false;
-            }
-
-            return true;
-        };
-
-        Light.prototype.getWorldMatrix = function () {
-            this._currentRenderId = this.getScene().getRenderId();
-
-            var worldMatrix = this._getWorldMatrix();
-
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._parentedWorldMatrix) {
-                    this._parentedWorldMatrix = BABYLON.Matrix.Identity();
-                }
-
-                worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._parentedWorldMatrix);
-
-                return this._parentedWorldMatrix;
-            }
-
-            return worldMatrix;
-        };
-
-        Light.prototype.dispose = function () {
-            if (this._shadowGenerator) {
-                this._shadowGenerator.dispose();
-                this._shadowGenerator = null;
-            }
-
-            // Remove from scene
-            var index = this.getScene().lights.indexOf(this);
-            this.getScene().lights.splice(index, 1);
-        };
-        return Light;
-    })(BABYLON.Node);
-    BABYLON.Light = Light;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.light.js.map

+ 0 - 77
Babylon/Lights/babylon.light.ts

@@ -1,77 +0,0 @@
-module BABYLON {
-    export class Light extends Node {
-        public diffuse = new Color3(1.0, 1.0, 1.0);
-        public specular = new Color3(1.0, 1.0, 1.0);
-        public intensity = 1.0;
-        public range = Number.MAX_VALUE;
-        public includedOnlyMeshes = new Array<AbstractMesh>();
-        public excludedMeshes = new Array<AbstractMesh>();
-
-        public _shadowGenerator: ShadowGenerator;
-        private _parentedWorldMatrix: Matrix;
-        public _excludedMeshesIds = new Array<string>();
-        public _includedOnlyMeshesIds = new Array<string>();
-
-        constructor(name: string, scene: Scene) {
-            super(name, scene);
-
-            scene.lights.push(this);
-        }
-
-        public getShadowGenerator(): ShadowGenerator {
-            return this._shadowGenerator;
-        }
-
-        public transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void {
-        }
-
-        public _getWorldMatrix(): Matrix {
-            return Matrix.Identity();
-        }
-
-        public canAffectMesh(mesh: AbstractMesh): boolean {
-            if (!mesh) {
-                return true;
-            }
-
-            if (this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {
-                return false;
-            }
-
-            if (this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {
-                return false;
-            }
-
-            return true;
-        }
-
-        public getWorldMatrix(): Matrix {
-            this._currentRenderId = this.getScene().getRenderId();
-
-            var worldMatrix = this._getWorldMatrix();
-
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._parentedWorldMatrix) {
-                    this._parentedWorldMatrix = BABYLON.Matrix.Identity();
-                }
-
-                worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._parentedWorldMatrix);
-
-                return this._parentedWorldMatrix;
-            }
-
-            return worldMatrix;
-        }
-
-        public dispose(): void {
-            if (this._shadowGenerator) {
-                this._shadowGenerator.dispose();
-                this._shadowGenerator = null;
-            }
-
-            // Remove from scene
-            var index = this.getScene().lights.indexOf(this);
-            this.getScene().lights.splice(index, 1);
-        }
-    }
-} 

+ 0 - 47
Babylon/Lights/babylon.pointLight.js

@@ -1,47 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var PointLight = (function (_super) {
-        __extends(PointLight, _super);
-        function PointLight(name, position, scene) {
-            _super.call(this, name, scene);
-            this.position = position;
-        }
-        PointLight.prototype.transferToEffect = function (effect, positionUniformName) {
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedPosition) {
-                    this._transformedPosition = BABYLON.Vector3.Zero();
-                }
-
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this._transformedPosition);
-                effect.setFloat4(positionUniformName, this._transformedPosition.x, this._transformedPosition.y, this._transformedPosition.z, 0);
-
-                return;
-            }
-
-            effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, 0);
-        };
-
-        PointLight.prototype.getShadowGenerator = function () {
-            return null;
-        };
-
-        PointLight.prototype._getWorldMatrix = function () {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
-
-            return this._worldMatrix;
-        };
-        return PointLight;
-    })(BABYLON.Light);
-    BABYLON.PointLight = PointLight;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.pointLight.js.map

+ 0 - 39
Babylon/Lights/babylon.pointLight.ts

@@ -1,39 +0,0 @@
-module BABYLON {
-    export class PointLight extends Light {
-        private _worldMatrix: Matrix;
-        private _transformedPosition: Vector3;
-
-        constructor(name: string, public position: Vector3, scene: Scene) {
-            super(name, scene);
-        }
-
-        public transferToEffect(effect: Effect, positionUniformName: string): void {
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedPosition) {
-                    this._transformedPosition = BABYLON.Vector3.Zero();
-                }
-
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this._transformedPosition);
-                effect.setFloat4(positionUniformName, this._transformedPosition.x, this._transformedPosition.y, this._transformedPosition.z, 0);
-
-                return;
-            }
-
-            effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, 0);
-        }
-
-        public getShadowGenerator(): ShadowGenerator {
-            return null;
-        }
-
-        public _getWorldMatrix(): Matrix {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
-
-            return this._worldMatrix;
-        }
-    }
-} 

+ 0 - 62
Babylon/Lights/babylon.spotLight.js

@@ -1,62 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var SpotLight = (function (_super) {
-        __extends(SpotLight, _super);
-        function SpotLight(name, position, direction, angle, exponent, scene) {
-            _super.call(this, name, scene);
-            this.position = position;
-            this.direction = direction;
-            this.angle = angle;
-            this.exponent = exponent;
-        }
-        SpotLight.prototype.setDirectionToTarget = function (target) {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(this.position));
-            return this.direction;
-        };
-
-        SpotLight.prototype.transferToEffect = function (effect, positionUniformName, directionUniformName) {
-            var normalizeDirection;
-
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedDirection) {
-                    this._transformedDirection = BABYLON.Vector3.Zero();
-                }
-                if (!this._transformedPosition) {
-                    this._transformedPosition = BABYLON.Vector3.Zero();
-                }
-
-                var parentWorldMatrix = this.parent.getWorldMatrix();
-
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, parentWorldMatrix, this._transformedPosition);
-                BABYLON.Vector3.TransformNormalToRef(this.direction, parentWorldMatrix, this._transformedDirection);
-
-                effect.setFloat4(positionUniformName, this._transformedPosition.x, this._transformedPosition.y, this._transformedPosition.z, this.exponent);
-                normalizeDirection = BABYLON.Vector3.Normalize(this._transformedDirection);
-            } else {
-                effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, this.exponent);
-                normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
-            }
-
-            effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, Math.cos(this.angle * 0.5));
-        };
-
-        SpotLight.prototype._getWorldMatrix = function () {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
-
-            return this._worldMatrix;
-        };
-        return SpotLight;
-    })(BABYLON.Light);
-    BABYLON.SpotLight = SpotLight;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.spotLight.js.map

+ 0 - 53
Babylon/Lights/babylon.spotLight.ts

@@ -1,53 +0,0 @@
-module BABYLON {
-    export class SpotLight extends Light {
-
-        private _transformedDirection: Vector3;
-        private _transformedPosition: Vector3;
-        private _worldMatrix: Matrix;
-
-        constructor(name: string, public position: Vector3, public direction: Vector3, public angle: number, public exponent: number, scene: Scene) {
-            super(name, scene);
-        }
-
-        public setDirectionToTarget(target: Vector3): Vector3 {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(this.position));
-            return this.direction;
-        }
-
-        public transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void {
-            var normalizeDirection;
-
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedDirection) {
-                    this._transformedDirection = BABYLON.Vector3.Zero();
-                }
-                if (!this._transformedPosition) {
-                    this._transformedPosition = BABYLON.Vector3.Zero();
-                }
-
-                var parentWorldMatrix = this.parent.getWorldMatrix();
-
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, parentWorldMatrix, this._transformedPosition);
-                BABYLON.Vector3.TransformNormalToRef(this.direction, parentWorldMatrix, this._transformedDirection);
-
-                effect.setFloat4(positionUniformName, this._transformedPosition.x, this._transformedPosition.y, this._transformedPosition.z, this.exponent);
-                normalizeDirection = BABYLON.Vector3.Normalize(this._transformedDirection);
-            } else {
-                effect.setFloat4(positionUniformName, this.position.x, this.position.y, this.position.z, this.exponent);
-                normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
-            }
-
-            effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, Math.cos(this.angle * 0.5));
-        }
-
-        public _getWorldMatrix(): Matrix {
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
-            }
-
-            BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
-
-            return this._worldMatrix;
-        }
-    }
-}

Файловите разлики са ограничени, защото са твърде много
+ 0 - 1272
Babylon/Loading/Plugins/babylon.babylonFileLoader.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 1286
Babylon/Loading/Plugins/babylon.babylonFileLoader.ts


+ 0 - 174
Babylon/Loading/babylon.sceneLoader.js

@@ -1,174 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var SceneLoader = (function () {
-        function SceneLoader() {
-        }
-        Object.defineProperty(SceneLoader, "ForceFullSceneLoadingForIncremental", {
-            get: function () {
-                return SceneLoader._ForceFullSceneLoadingForIncremental;
-            },
-            set: function (value) {
-                SceneLoader._ForceFullSceneLoadingForIncremental = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-
-        Object.defineProperty(SceneLoader, "ShowLoadingScreen", {
-            get: function () {
-                return SceneLoader._ShowLoadingScreen;
-            },
-            set: function (value) {
-                SceneLoader._ShowLoadingScreen = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-
-        SceneLoader._getPluginForFilename = function (sceneFilename) {
-            var dotPosition = sceneFilename.lastIndexOf(".");
-
-            var queryStringPosition = sceneFilename.indexOf("?");
-            var extension = sceneFilename.substring(dotPosition, queryStringPosition).toLowerCase();
-
-            for (var index = 0; index < this._registeredPlugins.length; index++) {
-                var plugin = this._registeredPlugins[index];
-
-                if (plugin.extensions.indexOf(extension) !== -1) {
-                    return plugin;
-                }
-            }
-
-            return this._registeredPlugins[this._registeredPlugins.length - 1];
-        };
-
-        // Public functions
-        SceneLoader.RegisterPlugin = function (plugin) {
-            plugin.extensions = plugin.extensions.toLowerCase();
-            SceneLoader._registeredPlugins.push(plugin);
-        };
-
-        SceneLoader.ImportMesh = function (meshesNames, rootUrl, sceneFilename, scene, onsuccess, progressCallBack, onerror) {
-            var manifestChecked = function (success) {
-                scene.database = database;
-
-                var plugin = SceneLoader._getPluginForFilename(sceneFilename);
-
-                var importMeshFromData = function (data) {
-                    var meshes = [];
-                    var particleSystems = [];
-                    var skeletons = [];
-
-                    try  {
-                        if (!plugin.importMesh(meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons)) {
-                            if (onerror) {
-                                onerror(scene, 'unable to load the scene');
-                            }
-
-                            return;
-                        }
-                    } catch (e) {
-                        if (onerror) {
-                            onerror(scene, e);
-                        }
-
-                        return;
-                    }
-
-                    if (onsuccess) {
-                        scene.importedMeshesFiles.push(rootUrl + sceneFilename);
-                        onsuccess(meshes, particleSystems, skeletons);
-                    }
-                };
-
-                if (sceneFilename.substr && sceneFilename.substr(0, 5) === "data:") {
-                    // Direct load
-                    importMeshFromData(sceneFilename.substr(5));
-                    return;
-                }
-
-                BABYLON.Tools.LoadFile(rootUrl + sceneFilename, function (data) {
-                    importMeshFromData(data);
-                }, progressCallBack, database);
-            };
-
-            // Checking if a manifest file has been set for this scene and if offline mode has been requested
-            var database = new BABYLON.Database(rootUrl + sceneFilename, manifestChecked);
-        };
-
-        /**
-        * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param engine is the instance of BABYLON.Engine to use to create the scene
-        */
-        SceneLoader.Load = function (rootUrl, sceneFilename, engine, onsuccess, progressCallBack, onerror) {
-            SceneLoader.Append(rootUrl, sceneFilename, new BABYLON.Scene(engine), onsuccess, progressCallBack, onerror);
-        };
-
-        /**
-        * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene is the instance of BABYLON.Scene to append to
-        */
-        SceneLoader.Append = function (rootUrl, sceneFilename, scene, onsuccess, progressCallBack, onerror) {
-            var plugin = this._getPluginForFilename(sceneFilename.name || sceneFilename);
-            var database;
-
-            if (SceneLoader.ShowLoadingScreen) {
-                scene.getEngine().displayLoadingUI();
-            }
-
-            var loadSceneFromData = function (data) {
-                scene.database = database;
-
-                if (!plugin.load(scene, data, rootUrl)) {
-                    if (onerror) {
-                        onerror(scene);
-                    }
-
-                    scene.getEngine().hideLoadingUI();
-                    return;
-                }
-
-                if (onsuccess) {
-                    onsuccess(scene);
-                }
-
-                if (SceneLoader.ShowLoadingScreen) {
-                    scene.executeWhenReady(function () {
-                        scene.getEngine().hideLoadingUI();
-                    });
-                }
-            };
-
-            var manifestChecked = function (success) {
-                BABYLON.Tools.LoadFile(rootUrl + sceneFilename, loadSceneFromData, progressCallBack, database);
-            };
-
-            if (sceneFilename.substr && sceneFilename.substr(0, 5) === "data:") {
-                // Direct load
-                loadSceneFromData(sceneFilename.substr(5));
-                return;
-            }
-
-            if (rootUrl.indexOf("file:") === -1) {
-                // Checking if a manifest file has been set for this scene and if offline mode has been requested
-                database = new BABYLON.Database(rootUrl + sceneFilename, manifestChecked);
-            } else {
-                BABYLON.Tools.ReadFile(sceneFilename, loadSceneFromData, progressCallBack);
-            }
-        };
-        SceneLoader._ForceFullSceneLoadingForIncremental = false;
-        SceneLoader._ShowLoadingScreen = true;
-
-        SceneLoader._registeredPlugins = new Array();
-        return SceneLoader;
-    })();
-    BABYLON.SceneLoader = SceneLoader;
-    ;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.sceneLoader.js.map

+ 0 - 172
Babylon/Loading/babylon.sceneLoader.ts

@@ -1,172 +0,0 @@
-module BABYLON {
-    export interface ISceneLoaderPlugin {
-        extensions: string;
-        importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean;
-        load: (scene: Scene, data: string, rootUrl: string) => boolean;
-    }
-
-    export class SceneLoader {
-        // Flags
-        private static _ForceFullSceneLoadingForIncremental = false;
-        private static _ShowLoadingScreen = true;
-
-        public static get ForceFullSceneLoadingForIncremental() {
-            return SceneLoader._ForceFullSceneLoadingForIncremental;
-        }
-
-        public static set ForceFullSceneLoadingForIncremental(value: boolean) {
-            SceneLoader._ForceFullSceneLoadingForIncremental = value;
-        }
-
-        public static get ShowLoadingScreen() {
-            return SceneLoader._ShowLoadingScreen;
-        }
-
-        public static set ShowLoadingScreen(value: boolean) {
-            SceneLoader._ShowLoadingScreen = value;
-        }
-
-        // Members
-        private static _registeredPlugins = new Array<ISceneLoaderPlugin>();
-
-        private static _getPluginForFilename(sceneFilename): ISceneLoaderPlugin {
-            var dotPosition = sceneFilename.lastIndexOf(".");
-
-            var queryStringPosition = sceneFilename.indexOf("?");
-            var extension = sceneFilename.substring(dotPosition, queryStringPosition).toLowerCase();
-
-            for (var index = 0; index < this._registeredPlugins.length; index++) {
-                var plugin = this._registeredPlugins[index];
-
-                if (plugin.extensions.indexOf(extension) !== -1) {
-                    return plugin;
-                }
-            }
-
-            return this._registeredPlugins[this._registeredPlugins.length - 1];
-        }
-
-        // Public functions
-        public static RegisterPlugin(plugin: ISceneLoaderPlugin): void {
-            plugin.extensions = plugin.extensions.toLowerCase();
-            SceneLoader._registeredPlugins.push(plugin);
-        }
-
-        public static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, e:any) => void): void {
-            var manifestChecked = success => {
-                scene.database = database;
-
-                var plugin = SceneLoader._getPluginForFilename(sceneFilename);
-
-                var importMeshFromData = data => {
-                    var meshes = [];
-                    var particleSystems = [];
-                    var skeletons = [];
-
-                    try {
-                        if (!plugin.importMesh(meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons)) {
-                            if (onerror) {
-                                onerror(scene, 'unable to load the scene');
-                            }
-
-                            return;
-                        }
-                    } catch (e) {
-                        if (onerror) {
-                            onerror(scene, e);
-                        }
-
-                        return;
-                    }
-
-
-                    if (onsuccess) {
-                        scene.importedMeshesFiles.push(rootUrl + sceneFilename);
-                        onsuccess(meshes, particleSystems, skeletons);
-                    }
-                };
-
-                if (sceneFilename.substr && sceneFilename.substr(0, 5) === "data:") {
-                    // Direct load
-                    importMeshFromData(sceneFilename.substr(5));
-                    return;
-                }
-
-                BABYLON.Tools.LoadFile(rootUrl + sceneFilename, data => {
-                    importMeshFromData(data);
-                }, progressCallBack, database);
-            };
-
-            // Checking if a manifest file has been set for this scene and if offline mode has been requested
-            var database = new BABYLON.Database(rootUrl + sceneFilename, manifestChecked);
-        }
-
-        /**
-        * Load a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param engine is the instance of BABYLON.Engine to use to create the scene
-        */
-        public static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void {
-            SceneLoader.Append(rootUrl, sceneFilename, new BABYLON.Scene(engine), onsuccess, progressCallBack, onerror);
-        }
-
-        /**
-        * Append a scene
-        * @param rootUrl a string that defines the root url for scene and resources
-        * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene
-        * @param scene is the instance of BABYLON.Scene to append to
-        */
-        public static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void {
-
-            var plugin = this._getPluginForFilename(sceneFilename.name || sceneFilename);
-            var database;
-
-            if (SceneLoader.ShowLoadingScreen) {
-                scene.getEngine().displayLoadingUI();
-            }
-
-            var loadSceneFromData = data => {
-                scene.database = database;
-
-                if (!plugin.load(scene, data, rootUrl)) {
-                    if (onerror) {
-                        onerror(scene);
-                    }
-
-                    scene.getEngine().hideLoadingUI();
-                    return;
-                }
-
-                if (onsuccess) {
-                    onsuccess(scene);
-                }
-
-                if (SceneLoader.ShowLoadingScreen) {
-                    scene.executeWhenReady(() => {
-                        scene.getEngine().hideLoadingUI();
-                    });
-                }                
-            };
-
-            var manifestChecked = success => {
-                BABYLON.Tools.LoadFile(rootUrl + sceneFilename, loadSceneFromData, progressCallBack, database);
-            };
-
-            if (sceneFilename.substr && sceneFilename.substr(0, 5) === "data:") {
-                // Direct load
-                loadSceneFromData(sceneFilename.substr(5));
-                return;
-            }
-
-            if (rootUrl.indexOf("file:") === -1) {
-                // Checking if a manifest file has been set for this scene and if offline mode has been requested
-                database = new BABYLON.Database(rootUrl + sceneFilename, manifestChecked);
-            }
-            // Loading file from disk via input file or drag'n'drop
-            else {
-                BABYLON.Tools.ReadFile(sceneFilename, loadSceneFromData, progressCallBack);
-            }
-        }
-    };
-}

+ 0 - 418
Babylon/Materials/babylon.effect.js

@@ -1,418 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var EffectFallbacks = (function () {
-        function EffectFallbacks() {
-            this._defines = {};
-            this._currentRank = 32;
-            this._maxRank = -1;
-        }
-        EffectFallbacks.prototype.addFallback = function (rank, define) {
-            if (!this._defines[rank]) {
-                if (rank < this._currentRank) {
-                    this._currentRank = rank;
-                }
-
-                if (rank > this._maxRank) {
-                    this._maxRank = rank;
-                }
-
-                this._defines[rank] = new Array();
-            }
-
-            this._defines[rank].push(define);
-        };
-
-        Object.defineProperty(EffectFallbacks.prototype, "isMoreFallbacks", {
-            get: function () {
-                return this._currentRank <= this._maxRank;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        EffectFallbacks.prototype.reduce = function (currentDefines) {
-            var currentFallbacks = this._defines[this._currentRank];
-
-            for (var index = 0; index < currentFallbacks.length; index++) {
-                currentDefines = currentDefines.replace("#define " + currentFallbacks[index], "");
-            }
-
-            this._currentRank++;
-
-            return currentDefines;
-        };
-        return EffectFallbacks;
-    })();
-    BABYLON.EffectFallbacks = EffectFallbacks;
-
-    var Effect = (function () {
-        function Effect(baseName, attributesNames, uniformsNames, samplers, engine, defines, fallbacks, onCompiled, onError) {
-            var _this = this;
-            this._isReady = false;
-            this._compilationError = "";
-            this._valueCache = [];
-            this._engine = engine;
-            this.name = baseName;
-            this.defines = defines;
-            this._uniformsNames = uniformsNames.concat(samplers);
-            this._samplers = samplers;
-            this._attributesNames = attributesNames;
-
-            this.onError = onError;
-            this.onCompiled = onCompiled;
-
-            var vertexSource;
-            var fragmentSource;
-
-            if (baseName.vertexElement) {
-                vertexSource = document.getElementById(baseName.vertexElement);
-
-                if (!vertexSource) {
-                    vertexSource = baseName.vertexElement;
-                }
-            } else {
-                vertexSource = baseName.vertex || baseName;
-            }
-
-            if (baseName.fragmentElement) {
-                fragmentSource = document.getElementById(baseName.fragmentElement);
-
-                if (!fragmentSource) {
-                    fragmentSource = baseName.fragmentElement;
-                }
-            } else {
-                fragmentSource = baseName.fragment || baseName;
-            }
-
-            this._loadVertexShader(vertexSource, function (vertexCode) {
-                _this._loadFragmentShader(fragmentSource, function (fragmentCode) {
-                    _this._prepareEffect(vertexCode, fragmentCode, attributesNames, defines, fallbacks);
-                });
-            });
-        }
-        // Properties
-        Effect.prototype.isReady = function () {
-            return this._isReady;
-        };
-
-        Effect.prototype.getProgram = function () {
-            return this._program;
-        };
-
-        Effect.prototype.getAttributesNames = function () {
-            return this._attributesNames;
-        };
-
-        Effect.prototype.getAttributeLocation = function (index) {
-            return this._attributes[index];
-        };
-
-        Effect.prototype.getAttributeLocationByName = function (name) {
-            var index = this._attributesNames.indexOf(name);
-
-            return this._attributes[index];
-        };
-
-        Effect.prototype.getAttributesCount = function () {
-            return this._attributes.length;
-        };
-
-        Effect.prototype.getUniformIndex = function (uniformName) {
-            return this._uniformsNames.indexOf(uniformName);
-        };
-
-        Effect.prototype.getUniform = function (uniformName) {
-            return this._uniforms[this._uniformsNames.indexOf(uniformName)];
-        };
-
-        Effect.prototype.getSamplers = function () {
-            return this._samplers;
-        };
-
-        Effect.prototype.getCompilationError = function () {
-            return this._compilationError;
-        };
-
-        // Methods
-        Effect.prototype._loadVertexShader = function (vertex, callback) {
-            // DOM element ?
-            if (vertex instanceof HTMLElement) {
-                var vertexCode = BABYLON.Tools.GetDOMTextContent(vertex);
-                callback(vertexCode);
-                return;
-            }
-
-            // Is in local store ?
-            if (BABYLON.Effect.ShadersStore[vertex + "VertexShader"]) {
-                callback(BABYLON.Effect.ShadersStore[vertex + "VertexShader"]);
-                return;
-            }
-
-            var vertexShaderUrl;
-
-            if (vertex[0] === ".") {
-                vertexShaderUrl = vertex;
-            } else {
-                vertexShaderUrl = BABYLON.Engine.ShadersRepository + vertex;
-            }
-
-            // Vertex shader
-            BABYLON.Tools.LoadFile(vertexShaderUrl + ".vertex.fx", callback);
-        };
-
-        Effect.prototype._loadFragmentShader = function (fragment, callback) {
-            // DOM element ?
-            if (fragment instanceof HTMLElement) {
-                var fragmentCode = BABYLON.Tools.GetDOMTextContent(fragment);
-                callback(fragmentCode);
-                return;
-            }
-
-            // Is in local store ?
-            if (BABYLON.Effect.ShadersStore[fragment + "PixelShader"]) {
-                callback(BABYLON.Effect.ShadersStore[fragment + "PixelShader"]);
-                return;
-            }
-
-            if (BABYLON.Effect.ShadersStore[fragment + "FragmentShader"]) {
-                callback(BABYLON.Effect.ShadersStore[fragment + "FragmentShader"]);
-                return;
-            }
-
-            var fragmentShaderUrl;
-
-            if (fragment[0] === ".") {
-                fragmentShaderUrl = fragment;
-            } else {
-                fragmentShaderUrl = BABYLON.Engine.ShadersRepository + fragment;
-            }
-
-            // Fragment shader
-            BABYLON.Tools.LoadFile(fragmentShaderUrl + ".fragment.fx", callback);
-        };
-
-        Effect.prototype._prepareEffect = function (vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks) {
-            try  {
-                var engine = this._engine;
-
-                this._program = engine.createShaderProgram(vertexSourceCode, fragmentSourceCode, defines);
-
-                this._uniforms = engine.getUniforms(this._program, this._uniformsNames);
-                this._attributes = engine.getAttributes(this._program, attributesNames);
-
-                for (var index = 0; index < this._samplers.length; index++) {
-                    var sampler = this.getUniform(this._samplers[index]);
-
-                    if (sampler == null) {
-                        this._samplers.splice(index, 1);
-                        index--;
-                    }
-                }
-
-                engine.bindSamplers(this);
-
-                this._isReady = true;
-                if (this.onCompiled) {
-                    this.onCompiled(this);
-                }
-            } catch (e) {
-                // Is it a problem with precision?
-                if (e.message.indexOf("highp") !== -1) {
-                    vertexSourceCode = vertexSourceCode.replace("precision highp float", "precision mediump float");
-                    fragmentSourceCode = fragmentSourceCode.replace("precision highp float", "precision mediump float");
-
-                    this._prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks);
-
-                    return;
-                }
-
-                // Let's go through fallbacks then
-                if (fallbacks && fallbacks.isMoreFallbacks) {
-                    defines = fallbacks.reduce(defines);
-                    this._prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks);
-                } else {
-                    BABYLON.Tools.Error("Unable to compile effect: " + this.name);
-                    BABYLON.Tools.Error("Defines: " + defines);
-                    BABYLON.Tools.Error("Error: " + e.message);
-                    this._compilationError = e.message;
-
-                    if (this.onError) {
-                        this.onError(this, this._compilationError);
-                    }
-                }
-            }
-        };
-
-        Effect.prototype._bindTexture = function (channel, texture) {
-            this._engine._bindTexture(this._samplers.indexOf(channel), texture);
-        };
-
-        Effect.prototype.setTexture = function (channel, texture) {
-            this._engine.setTexture(this._samplers.indexOf(channel), texture);
-        };
-
-        Effect.prototype.setTextureFromPostProcess = function (channel, postProcess) {
-            this._engine.setTextureFromPostProcess(this._samplers.indexOf(channel), postProcess);
-        };
-
-        //public _cacheMatrix(uniformName, matrix) {
-        //    if (!this._valueCache[uniformName]) {
-        //        this._valueCache[uniformName] = new BABYLON.Matrix();
-        //    }
-        //    for (var index = 0; index < 16; index++) {
-        //        this._valueCache[uniformName].m[index] = matrix.m[index];
-        //    }
-        //};
-        Effect.prototype._cacheFloat2 = function (uniformName, x, y) {
-            if (!this._valueCache[uniformName]) {
-                this._valueCache[uniformName] = [x, y];
-                return;
-            }
-
-            this._valueCache[uniformName][0] = x;
-            this._valueCache[uniformName][1] = y;
-        };
-
-        Effect.prototype._cacheFloat3 = function (uniformName, x, y, z) {
-            if (!this._valueCache[uniformName]) {
-                this._valueCache[uniformName] = [x, y, z];
-                return;
-            }
-
-            this._valueCache[uniformName][0] = x;
-            this._valueCache[uniformName][1] = y;
-            this._valueCache[uniformName][2] = z;
-        };
-
-        Effect.prototype._cacheFloat4 = function (uniformName, x, y, z, w) {
-            if (!this._valueCache[uniformName]) {
-                this._valueCache[uniformName] = [x, y, z, w];
-                return;
-            }
-
-            this._valueCache[uniformName][0] = x;
-            this._valueCache[uniformName][1] = y;
-            this._valueCache[uniformName][2] = z;
-            this._valueCache[uniformName][3] = w;
-        };
-
-        Effect.prototype.setArray = function (uniformName, array) {
-            this._engine.setArray(this.getUniform(uniformName), array);
-
-            return this;
-        };
-
-        Effect.prototype.setMatrices = function (uniformName, matrices) {
-            this._engine.setMatrices(this.getUniform(uniformName), matrices);
-
-            return this;
-        };
-
-        Effect.prototype.setMatrix = function (uniformName, matrix) {
-            //if (this._valueCache[uniformName] && this._valueCache[uniformName].equals(matrix))
-            //    return;
-            //this._cacheMatrix(uniformName, matrix);
-            this._engine.setMatrix(this.getUniform(uniformName), matrix);
-
-            return this;
-        };
-
-        Effect.prototype.setFloat = function (uniformName, value) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName] === value)
-                return this;
-
-            this._valueCache[uniformName] = value;
-
-            this._engine.setFloat(this.getUniform(uniformName), value);
-
-            return this;
-        };
-
-        Effect.prototype.setBool = function (uniformName, bool) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName] === bool)
-                return this;
-
-            this._valueCache[uniformName] = bool;
-
-            this._engine.setBool(this.getUniform(uniformName), bool ? 1 : 0);
-
-            return this;
-        };
-
-        Effect.prototype.setVector2 = function (uniformName, vector2) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == vector2.x && this._valueCache[uniformName][1] == vector2.y)
-                return this;
-
-            this._cacheFloat2(uniformName, vector2.x, vector2.y);
-            this._engine.setFloat2(this.getUniform(uniformName), vector2.x, vector2.y);
-
-            return this;
-        };
-
-        Effect.prototype.setFloat2 = function (uniformName, x, y) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == x && this._valueCache[uniformName][1] == y)
-                return this;
-
-            this._cacheFloat2(uniformName, x, y);
-            this._engine.setFloat2(this.getUniform(uniformName), x, y);
-
-            return this;
-        };
-
-        Effect.prototype.setVector3 = function (uniformName, vector3) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == vector3.x && this._valueCache[uniformName][1] == vector3.y && this._valueCache[uniformName][2] == vector3.z)
-                return this;
-
-            this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z);
-
-            this._engine.setFloat3(this.getUniform(uniformName), vector3.x, vector3.y, vector3.z);
-
-            return this;
-        };
-
-        Effect.prototype.setFloat3 = function (uniformName, x, y, z) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == x && this._valueCache[uniformName][1] == y && this._valueCache[uniformName][2] == z)
-                return this;
-
-            this._cacheFloat3(uniformName, x, y, z);
-            this._engine.setFloat3(this.getUniform(uniformName), x, y, z);
-
-            return this;
-        };
-
-        Effect.prototype.setFloat4 = function (uniformName, x, y, z, w) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == x && this._valueCache[uniformName][1] == y && this._valueCache[uniformName][2] == z && this._valueCache[uniformName][3] == w)
-                return this;
-
-            this._cacheFloat4(uniformName, x, y, z, w);
-            this._engine.setFloat4(this.getUniform(uniformName), x, y, z, w);
-
-            return this;
-        };
-
-        Effect.prototype.setColor3 = function (uniformName, color3) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == color3.r && this._valueCache[uniformName][1] == color3.g && this._valueCache[uniformName][2] == color3.b)
-                return this;
-
-            this._cacheFloat3(uniformName, color3.r, color3.g, color3.b);
-            this._engine.setColor3(this.getUniform(uniformName), color3);
-
-            return this;
-        };
-
-        Effect.prototype.setColor4 = function (uniformName, color3, alpha) {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == color3.r && this._valueCache[uniformName][1] == color3.g && this._valueCache[uniformName][2] == color3.b && this._valueCache[uniformName][3] == alpha)
-                return this;
-
-            this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha);
-            this._engine.setColor4(this.getUniform(uniformName), color3, alpha);
-
-            return this;
-        };
-
-        Effect.ShadersStore = {};
-        return Effect;
-    })();
-    BABYLON.Effect = Effect;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.effect.js.map

+ 0 - 428
Babylon/Materials/babylon.effect.ts

@@ -1,428 +0,0 @@
-module BABYLON {
-    export class EffectFallbacks {
-        private _defines = {};
-
-        private _currentRank = 32;
-        private _maxRank = -1;
-
-        public addFallback(rank: number, define: string): void {
-            if (!this._defines[rank]) {
-                if (rank < this._currentRank) {
-                    this._currentRank = rank;
-                }
-
-                if (rank > this._maxRank) {
-                    this._maxRank = rank;
-                }
-
-                this._defines[rank] = new Array<String>();
-            }
-
-            this._defines[rank].push(define);
-        }
-
-        public get isMoreFallbacks(): boolean {
-            return this._currentRank <= this._maxRank;
-        }
-
-        public reduce(currentDefines: string): string {
-
-            var currentFallbacks = this._defines[this._currentRank];
-
-            for (var index = 0; index < currentFallbacks.length; index++) {
-                currentDefines = currentDefines.replace("#define " + currentFallbacks[index], "");
-            }
-
-            this._currentRank++;
-
-            return currentDefines;
-        }
-    }
-
-    export class Effect {
-        public name: any;
-        public defines: string;
-        public onCompiled: (effect: Effect) => void;
-        public onError: (effect: Effect, errors: string) => void;
-        public onBind: (effect: Effect) => void;
-
-        private _engine: Engine;
-        private _uniformsNames: string[];
-        private _samplers: string[];
-        private _isReady = false;
-        private _compilationError = "";
-        private _attributesNames: string[];
-        private _attributes: number[];
-        private _uniforms: WebGLUniformLocation[];
-        public _key: string;
-
-        private _program: WebGLProgram;
-        private _valueCache = [];
-
-        constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void) {
-            this._engine = engine;
-            this.name = baseName;
-            this.defines = defines;
-            this._uniformsNames = uniformsNames.concat(samplers);
-            this._samplers = samplers;
-            this._attributesNames = attributesNames;
-
-            this.onError = onError;
-            this.onCompiled = onCompiled;
-
-            var vertexSource;
-            var fragmentSource;
-
-            if (baseName.vertexElement) {
-                vertexSource = document.getElementById(baseName.vertexElement);
-
-                if (!vertexSource) {
-                    vertexSource = baseName.vertexElement;
-                }
-            } else {
-                vertexSource = baseName.vertex || baseName;
-            }
-
-            if (baseName.fragmentElement) {
-                fragmentSource = document.getElementById(baseName.fragmentElement);
-
-                if (!fragmentSource) {
-                    fragmentSource = baseName.fragmentElement;
-                }
-            } else {
-                fragmentSource = baseName.fragment || baseName;
-            }
-
-            this._loadVertexShader(vertexSource, vertexCode => {
-                this._loadFragmentShader(fragmentSource, (fragmentCode) => {
-                    this._prepareEffect(vertexCode, fragmentCode, attributesNames, defines, fallbacks);
-                });
-            });
-        }
-
-        // Properties
-        public isReady(): boolean {
-            return this._isReady;
-        }
-
-        public getProgram(): WebGLProgram {
-            return this._program;
-        }
-
-        public getAttributesNames(): string[] {
-            return this._attributesNames;
-        }
-
-        public getAttributeLocation(index: number): number {
-            return this._attributes[index];
-        }
-
-        public getAttributeLocationByName(name: string): number {
-            var index = this._attributesNames.indexOf(name);
-
-            return this._attributes[index];
-        }
-
-        public getAttributesCount(): number {
-            return this._attributes.length;
-        }
-
-        public getUniformIndex(uniformName: string): number {
-            return this._uniformsNames.indexOf(uniformName);
-        }
-
-        public getUniform(uniformName: string): WebGLUniformLocation {
-            return this._uniforms[this._uniformsNames.indexOf(uniformName)];
-        }
-
-        public getSamplers(): string[] {
-            return this._samplers;
-        }
-
-        public getCompilationError(): string {
-            return this._compilationError;
-        }
-
-        // Methods
-        public _loadVertexShader(vertex: any, callback: (data: any) => void): void {
-            // DOM element ?
-            if (vertex instanceof HTMLElement) {
-                var vertexCode = BABYLON.Tools.GetDOMTextContent(vertex);
-                callback(vertexCode);
-                return;
-            }
-
-            // Is in local store ?
-            if (BABYLON.Effect.ShadersStore[vertex + "VertexShader"]) {
-                callback(BABYLON.Effect.ShadersStore[vertex + "VertexShader"]);
-                return;
-            }
-
-            var vertexShaderUrl;
-
-            if (vertex[0] === ".") {
-                vertexShaderUrl = vertex;
-            } else {
-                vertexShaderUrl = BABYLON.Engine.ShadersRepository + vertex;
-            }
-
-            // Vertex shader
-            BABYLON.Tools.LoadFile(vertexShaderUrl + ".vertex.fx", callback);
-        }
-
-        public _loadFragmentShader(fragment: any, callback: (data: any) => void): void {
-            // DOM element ?
-            if (fragment instanceof HTMLElement) {
-                var fragmentCode = BABYLON.Tools.GetDOMTextContent(fragment);
-                callback(fragmentCode);
-                return;
-            }
-
-            // Is in local store ?
-            if (BABYLON.Effect.ShadersStore[fragment + "PixelShader"]) {
-                callback(BABYLON.Effect.ShadersStore[fragment + "PixelShader"]);
-                return;
-            }
-
-            if (BABYLON.Effect.ShadersStore[fragment + "FragmentShader"]) {
-                callback(BABYLON.Effect.ShadersStore[fragment + "FragmentShader"]);
-                return;
-            }
-
-            var fragmentShaderUrl;
-
-            if (fragment[0] === ".") {
-                fragmentShaderUrl = fragment;
-            } else {
-                fragmentShaderUrl = BABYLON.Engine.ShadersRepository + fragment;
-            }
-
-            // Fragment shader
-            BABYLON.Tools.LoadFile(fragmentShaderUrl + ".fragment.fx", callback);
-        }
-
-        private _prepareEffect(vertexSourceCode: string, fragmentSourceCode: string, attributesNames: string[], defines: string, fallbacks?: EffectFallbacks): void {
-            try {
-                var engine = this._engine;
-
-                this._program = engine.createShaderProgram(vertexSourceCode, fragmentSourceCode, defines);
-
-                this._uniforms = engine.getUniforms(this._program, this._uniformsNames);
-                this._attributes = engine.getAttributes(this._program, attributesNames);
-
-                for (var index = 0; index < this._samplers.length; index++) {
-                    var sampler = this.getUniform(this._samplers[index]);
-
-                    if (sampler == null) {
-                        this._samplers.splice(index, 1);
-                        index--;
-                    }
-                }
-
-                engine.bindSamplers(this);
-
-                this._isReady = true;
-                if (this.onCompiled) {
-                    this.onCompiled(this);
-                }
-            } catch (e) {
-                // Is it a problem with precision?
-                if (e.message.indexOf("highp") !== -1) {
-                    vertexSourceCode = vertexSourceCode.replace("precision highp float", "precision mediump float");
-                    fragmentSourceCode = fragmentSourceCode.replace("precision highp float", "precision mediump float");
-
-                    this._prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks);
-
-                    return;
-                }
-                // Let's go through fallbacks then
-                if (fallbacks && fallbacks.isMoreFallbacks) {
-                    defines = fallbacks.reduce(defines);
-                    this._prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks);
-                } else { // SOrry we did everything we can
-                    Tools.Error("Unable to compile effect: " + this.name);
-                    Tools.Error("Defines: " + defines);
-                    Tools.Error("Error: " + e.message);
-                    this._compilationError = e.message;
-
-                    if (this.onError) {
-                        this.onError(this, this._compilationError);
-                    }
-                }
-            }
-        }
-
-        public _bindTexture(channel: string, texture: WebGLTexture): void {
-            this._engine._bindTexture(this._samplers.indexOf(channel), texture);
-        }
-
-        public setTexture(channel: string, texture: BaseTexture): void {
-            this._engine.setTexture(this._samplers.indexOf(channel), texture);
-        }
-
-        public setTextureFromPostProcess(channel: string, postProcess: PostProcess): void {
-            this._engine.setTextureFromPostProcess(this._samplers.indexOf(channel), postProcess);
-        }
-
-        //public _cacheMatrix(uniformName, matrix) {
-        //    if (!this._valueCache[uniformName]) {
-        //        this._valueCache[uniformName] = new BABYLON.Matrix();
-        //    }
-
-        //    for (var index = 0; index < 16; index++) {
-        //        this._valueCache[uniformName].m[index] = matrix.m[index];
-        //    }
-        //};
-
-        public _cacheFloat2(uniformName: string, x: number, y: number): void {
-            if (!this._valueCache[uniformName]) {
-                this._valueCache[uniformName] = [x, y];
-                return;
-            }
-
-            this._valueCache[uniformName][0] = x;
-            this._valueCache[uniformName][1] = y;
-        }
-
-        public _cacheFloat3(uniformName: string, x: number, y: number, z: number): void {
-            if (!this._valueCache[uniformName]) {
-                this._valueCache[uniformName] = [x, y, z];
-                return;
-            }
-
-            this._valueCache[uniformName][0] = x;
-            this._valueCache[uniformName][1] = y;
-            this._valueCache[uniformName][2] = z;
-        }
-
-        public _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void {
-            if (!this._valueCache[uniformName]) {
-                this._valueCache[uniformName] = [x, y, z, w];
-                return;
-            }
-
-            this._valueCache[uniformName][0] = x;
-            this._valueCache[uniformName][1] = y;
-            this._valueCache[uniformName][2] = z;
-            this._valueCache[uniformName][3] = w;
-        }
-
-        public setArray(uniformName: string, array: number[]): Effect {
-            this._engine.setArray(this.getUniform(uniformName), array);
-
-            return this;
-        }
-
-        public setMatrices(uniformName: string, matrices: Float32Array): Effect {
-            this._engine.setMatrices(this.getUniform(uniformName), matrices);
-
-            return this;
-        }
-
-        public setMatrix(uniformName: string, matrix: Matrix): Effect {
-            //if (this._valueCache[uniformName] && this._valueCache[uniformName].equals(matrix))
-            //    return;
-
-            //this._cacheMatrix(uniformName, matrix);
-            this._engine.setMatrix(this.getUniform(uniformName), matrix);
-
-            return this;
-        }
-
-        public setFloat(uniformName: string, value: number): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName] === value)
-                return this;
-
-            this._valueCache[uniformName] = value;
-
-            this._engine.setFloat(this.getUniform(uniformName), value);
-
-            return this;
-        }
-
-        public setBool(uniformName: string, bool: boolean): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName] === bool)
-                return this;
-
-            this._valueCache[uniformName] = bool;
-
-            this._engine.setBool(this.getUniform(uniformName), bool ? 1 : 0);
-
-            return this;
-        }
-
-        public setVector2(uniformName: string, vector2: Vector2): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == vector2.x && this._valueCache[uniformName][1] == vector2.y)
-                return this;
-
-            this._cacheFloat2(uniformName, vector2.x, vector2.y);
-            this._engine.setFloat2(this.getUniform(uniformName), vector2.x, vector2.y);
-
-            return this;
-        }
-
-        public setFloat2(uniformName: string, x: number, y: number): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == x && this._valueCache[uniformName][1] == y)
-                return this;
-
-            this._cacheFloat2(uniformName, x, y);
-            this._engine.setFloat2(this.getUniform(uniformName), x, y);
-
-            return this;
-        }
-
-        public setVector3(uniformName: string, vector3: Vector3): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == vector3.x && this._valueCache[uniformName][1] == vector3.y && this._valueCache[uniformName][2] == vector3.z)
-                return this;
-
-            this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z);
-
-            this._engine.setFloat3(this.getUniform(uniformName), vector3.x, vector3.y, vector3.z);
-
-            return this;
-        }
-
-        public setFloat3(uniformName: string, x: number, y: number, z: number): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == x && this._valueCache[uniformName][1] == y && this._valueCache[uniformName][2] == z)
-                return this;
-
-            this._cacheFloat3(uniformName, x, y, z);
-            this._engine.setFloat3(this.getUniform(uniformName), x, y, z);
-
-            return this;
-        }
-
-        public setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == x && this._valueCache[uniformName][1] == y && this._valueCache[uniformName][2] == z && this._valueCache[uniformName][3] == w)
-                return this;
-
-            this._cacheFloat4(uniformName, x, y, z, w);
-            this._engine.setFloat4(this.getUniform(uniformName), x, y, z, w);
-
-            return this;
-        }
-
-        public setColor3(uniformName: string, color3: Color3): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == color3.r && this._valueCache[uniformName][1] == color3.g && this._valueCache[uniformName][2] == color3.b)
-                return this;
-
-            this._cacheFloat3(uniformName, color3.r, color3.g, color3.b);
-            this._engine.setColor3(this.getUniform(uniformName), color3);
-
-            return this;
-        }
-
-        public setColor4(uniformName: string, color3: Color3, alpha: number): Effect {
-            if (this._valueCache[uniformName] && this._valueCache[uniformName][0] == color3.r && this._valueCache[uniformName][1] == color3.g && this._valueCache[uniformName][2] == color3.b && this._valueCache[uniformName][3] == alpha)
-                return this;
-
-            this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha);
-            this._engine.setColor4(this.getUniform(uniformName), color3, alpha);
-
-            return this;
-        }
-
-        // Statics
-        public static ShadersStore = {};
-    }
-} 

+ 0 - 148
Babylon/Materials/babylon.material.js

@@ -1,148 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Material = (function () {
-        function Material(name, scene, doNotAdd) {
-            this.name = name;
-            this.checkReadyOnEveryCall = true;
-            this.checkReadyOnlyOnce = false;
-            this.state = "";
-            this.alpha = 1.0;
-            this.backFaceCulling = true;
-            this._wasPreviouslyReady = false;
-            this._fillMode = Material.TriangleFillMode;
-            this.pointSize = 1.0;
-            this.id = name;
-
-            this._scene = scene;
-
-            if (!doNotAdd) {
-                scene.materials.push(this);
-            }
-        }
-        Object.defineProperty(Material, "TriangleFillMode", {
-            get: function () {
-                return Material._TriangleFillMode;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Material, "WireFrameFillMode", {
-            get: function () {
-                return Material._WireFrameFillMode;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Material, "PointFillMode", {
-            get: function () {
-                return Material._PointFillMode;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        Object.defineProperty(Material.prototype, "wireframe", {
-            get: function () {
-                return this._fillMode === Material.WireFrameFillMode;
-            },
-            set: function (value) {
-                this._fillMode = (value ? Material.WireFrameFillMode : Material.TriangleFillMode);
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-
-        Object.defineProperty(Material.prototype, "pointsCloud", {
-            get: function () {
-                return this._fillMode === Material.PointFillMode;
-            },
-            set: function (value) {
-                this._fillMode = (value ? Material.PointFillMode : Material.TriangleFillMode);
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-
-        Object.defineProperty(Material.prototype, "fillMode", {
-            get: function () {
-                return this._fillMode;
-            },
-            set: function (value) {
-                this._fillMode = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-
-        Material.prototype.isReady = function (mesh, useInstances) {
-            return true;
-        };
-
-        Material.prototype.getEffect = function () {
-            return this._effect;
-        };
-
-        Material.prototype.getScene = function () {
-            return this._scene;
-        };
-
-        Material.prototype.needAlphaBlending = function () {
-            return (this.alpha < 1.0);
-        };
-
-        Material.prototype.needAlphaTesting = function () {
-            return false;
-        };
-
-        Material.prototype.getAlphaTestTexture = function () {
-            return null;
-        };
-
-        Material.prototype.trackCreation = function (onCompiled, onError) {
-        };
-
-        Material.prototype._preBind = function () {
-            var engine = this._scene.getEngine();
-
-            engine.enableEffect(this._effect);
-            engine.setState(this.backFaceCulling);
-        };
-
-        Material.prototype.bind = function (world, mesh) {
-        };
-
-        Material.prototype.bindOnlyWorldMatrix = function (world) {
-        };
-
-        Material.prototype.unbind = function () {
-        };
-
-        Material.prototype.dispose = function (forceDisposeEffect) {
-            // Remove from scene
-            var index = this._scene.materials.indexOf(this);
-            this._scene.materials.splice(index, 1);
-
-            // Shader are kept in cache for further use but we can get rid of this by using forceDisposeEffect
-            if (forceDisposeEffect && this._effect) {
-                this._scene.getEngine()._releaseEffect(this._effect);
-                this._effect = null;
-            }
-
-            // Callback
-            if (this.onDispose) {
-                this.onDispose();
-            }
-        };
-        Material._TriangleFillMode = 0;
-        Material._WireFrameFillMode = 1;
-        Material._PointFillMode = 2;
-        return Material;
-    })();
-    BABYLON.Material = Material;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.material.js.map

+ 0 - 131
Babylon/Materials/babylon.material.ts

@@ -1,131 +0,0 @@
-module BABYLON {
-    export class Material {
-        private static _TriangleFillMode = 0;
-        private static _WireFrameFillMode = 1;
-        private static _PointFillMode = 2;
-
-        public static get TriangleFillMode(): number {
-            return Material._TriangleFillMode;
-        }
-
-        public static get WireFrameFillMode(): number {
-            return Material._WireFrameFillMode;
-        }
-
-        public static get PointFillMode(): number {
-            return Material._PointFillMode;
-        }
-
-        public id: string;
-        public checkReadyOnEveryCall = true;
-        public checkReadyOnlyOnce = false;
-        public state = "";
-        public alpha = 1.0;
-        public backFaceCulling = true;
-        public onCompiled: (effect: Effect) => void;
-        public onError: (effect: Effect, errors: string) => void;
-        public onDispose: () => void;
-        public getRenderTargetTextures: () => SmartArray<RenderTargetTexture>;
-
-        public _effect: Effect;
-        public _wasPreviouslyReady = false;
-        private _scene: Scene;
-        private _fillMode = Material.TriangleFillMode;
-
-        public pointSize = 1.0;
-
-        public get wireframe(): boolean {
-            return this._fillMode === Material.WireFrameFillMode;
-        }
-
-        public set wireframe(value:boolean) {
-            this._fillMode = (value ? Material.WireFrameFillMode : Material.TriangleFillMode);
-        }
-
-        public get pointsCloud(): boolean {
-            return this._fillMode === Material.PointFillMode;
-        }
-
-        public set pointsCloud(value: boolean) {
-            this._fillMode = (value ? Material.PointFillMode : Material.TriangleFillMode);
-        }
-
-        public get fillMode(): number {
-            return this._fillMode;
-        }
-
-        public set fillMode(value: number) {
-            this._fillMode = value;
-        }
-
-        constructor(public name: string, scene: Scene, doNotAdd?: boolean) {
-            this.id = name;
-
-            this._scene = scene;
-
-            if (!doNotAdd) {
-                scene.materials.push(this);
-            }
-        }
-
-        public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean {
-            return true;
-        }
-
-        public getEffect(): Effect {
-            return this._effect;
-        }
-
-        public getScene(): Scene {
-            return this._scene;
-        }
-
-        public needAlphaBlending(): boolean {
-            return (this.alpha < 1.0);
-        }
-
-        public needAlphaTesting(): boolean {
-            return false;
-        }
-
-        public getAlphaTestTexture(): BaseTexture {
-            return null;
-        }
-
-        public trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void) {
-        }
-
-        public _preBind(): void {
-            var engine = this._scene.getEngine();
-
-            engine.enableEffect(this._effect);
-            engine.setState(this.backFaceCulling);
-        }
-
-        public bind(world: Matrix, mesh: Mesh): void {
-        }
-
-        public bindOnlyWorldMatrix(world: Matrix): void {
-        }
-
-        public unbind(): void {
-        }
-
-        public dispose(forceDisposeEffect?: boolean): void {
-            // Remove from scene
-            var index = this._scene.materials.indexOf(this);
-            this._scene.materials.splice(index, 1);
-
-            // Shader are kept in cache for further use but we can get rid of this by using forceDisposeEffect
-            if (forceDisposeEffect && this._effect) {
-                this._scene.getEngine()._releaseEffect(this._effect);
-                this._effect = null;
-            }
-
-            // Callback
-            if (this.onDispose) {
-                this.onDispose();
-            }
-        }
-    }
-} 

+ 0 - 43
Babylon/Materials/babylon.multiMaterial.js

@@ -1,43 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var MultiMaterial = (function (_super) {
-        __extends(MultiMaterial, _super);
-        function MultiMaterial(name, scene) {
-            _super.call(this, name, scene, true);
-            this.subMaterials = new Array();
-
-            scene.multiMaterials.push(this);
-        }
-        // Properties
-        MultiMaterial.prototype.getSubMaterial = function (index) {
-            if (index < 0 || index >= this.subMaterials.length) {
-                return this.getScene().defaultMaterial;
-            }
-
-            return this.subMaterials[index];
-        };
-
-        // Methods
-        MultiMaterial.prototype.isReady = function (mesh) {
-            for (var index = 0; index < this.subMaterials.length; index++) {
-                var subMaterial = this.subMaterials[index];
-                if (subMaterial) {
-                    if (!this.subMaterials[index].isReady(mesh)) {
-                        return false;
-                    }
-                }
-            }
-
-            return true;
-        };
-        return MultiMaterial;
-    })(BABYLON.Material);
-    BABYLON.MultiMaterial = MultiMaterial;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.multiMaterial.js.map

+ 0 - 34
Babylon/Materials/babylon.multiMaterial.ts

@@ -1,34 +0,0 @@
-module BABYLON {
-    export class MultiMaterial extends Material {
-        public subMaterials = new Array<Material>();
-
-        constructor(name: string, scene: Scene) {
-            super(name, scene, true);
-
-            scene.multiMaterials.push(this);
-        }
-
-        // Properties
-        public getSubMaterial(index) {
-            if (index < 0 || index >= this.subMaterials.length) {
-                return this.getScene().defaultMaterial;
-            }
-
-            return this.subMaterials[index];
-        }
-
-        // Methods
-        public isReady(mesh?: AbstractMesh): boolean {
-            for (var index = 0; index < this.subMaterials.length; index++) {
-                var subMaterial = this.subMaterials[index];
-                if (subMaterial) {
-                    if (!this.subMaterials[index].isReady(mesh)) {
-                        return false;
-                    }
-                }
-            }
-
-            return true;
-        }
-    }
-} 

+ 0 - 186
Babylon/Materials/babylon.shaderMaterial.js

@@ -1,186 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var ShaderMaterial = (function (_super) {
-        __extends(ShaderMaterial, _super);
-        function ShaderMaterial(name, scene, shaderPath, options) {
-            _super.call(this, name, scene);
-            this._textures = new Array();
-            this._floats = new Array();
-            this._floatsArrays = {};
-            this._colors3 = new Array();
-            this._colors4 = new Array();
-            this._vectors2 = new Array();
-            this._vectors3 = new Array();
-            this._matrices = new Array();
-            this._cachedWorldViewMatrix = new BABYLON.Matrix();
-            this._shaderPath = shaderPath;
-
-            options.needAlphaBlending = options.needAlphaBlending || false;
-            options.needAlphaTesting = options.needAlphaTesting || false;
-            options.attributes = options.attributes || ["position", "normal", "uv"];
-            options.uniforms = options.uniforms || ["worldViewProjection"];
-            options.samplers = options.samplers || [];
-
-            this._options = options;
-        }
-        ShaderMaterial.prototype.needAlphaBlending = function () {
-            return this._options.needAlphaBlending;
-        };
-
-        ShaderMaterial.prototype.needAlphaTesting = function () {
-            return this._options.needAlphaTesting;
-        };
-
-        ShaderMaterial.prototype._checkUniform = function (uniformName) {
-            if (this._options.uniforms.indexOf(uniformName) === -1) {
-                this._options.uniforms.push(uniformName);
-            }
-        };
-
-        ShaderMaterial.prototype.setTexture = function (name, texture) {
-            if (this._options.samplers.indexOf(name) === -1) {
-                this._options.samplers.push(name);
-            }
-            this._textures[name] = texture;
-
-            return this;
-        };
-
-        ShaderMaterial.prototype.setFloat = function (name, value) {
-            this._checkUniform(name);
-            this._floats[name] = value;
-
-            return this;
-        };
-
-        ShaderMaterial.prototype.setFloats = function (name, value) {
-            this._checkUniform(name);
-            this._floatsArrays[name] = value;
-
-            return this;
-        };
-
-        ShaderMaterial.prototype.setColor3 = function (name, value) {
-            this._checkUniform(name);
-            this._colors3[name] = value;
-
-            return this;
-        };
-
-        ShaderMaterial.prototype.setColor4 = function (name, value) {
-            this._checkUniform(name);
-            this._colors4[name] = value;
-
-            return this;
-        };
-
-        ShaderMaterial.prototype.setVector2 = function (name, value) {
-            this._checkUniform(name);
-            this._vectors2[name] = value;
-
-            return this;
-        };
-
-        ShaderMaterial.prototype.setVector3 = function (name, value) {
-            this._checkUniform(name);
-            this._vectors3[name] = value;
-
-            return this;
-        };
-
-        ShaderMaterial.prototype.setMatrix = function (name, value) {
-            this._checkUniform(name);
-            this._matrices[name] = value;
-
-            return this;
-        };
-
-        ShaderMaterial.prototype.isReady = function () {
-            var engine = this.getScene().getEngine();
-
-            this._effect = engine.createEffect(this._shaderPath, this._options.attributes, this._options.uniforms, this._options.samplers, "", null, this.onCompiled, this.onError);
-
-            if (!this._effect.isReady()) {
-                return false;
-            }
-
-            return true;
-        };
-
-        ShaderMaterial.prototype.bind = function (world) {
-            // Std values
-            if (this._options.uniforms.indexOf("world") !== -1) {
-                this._effect.setMatrix("world", world);
-            }
-
-            if (this._options.uniforms.indexOf("view") !== -1) {
-                this._effect.setMatrix("view", this.getScene().getViewMatrix());
-            }
-
-            if (this._options.uniforms.indexOf("worldView") !== -1) {
-                world.multiplyToRef(this.getScene().getViewMatrix(), this._cachedWorldViewMatrix);
-                this._effect.setMatrix("worldView", this._cachedWorldViewMatrix);
-            }
-
-            if (this._options.uniforms.indexOf("projection") !== -1) {
-                this._effect.setMatrix("projection", this.getScene().getProjectionMatrix());
-            }
-
-            if (this._options.uniforms.indexOf("worldViewProjection") !== -1) {
-                this._effect.setMatrix("worldViewProjection", world.multiply(this.getScene().getTransformMatrix()));
-            }
-
-            for (var name in this._textures) {
-                this._effect.setTexture(name, this._textures[name]);
-            }
-
-            for (name in this._floats) {
-                this._effect.setFloat(name, this._floats[name]);
-            }
-
-            for (name in this._floatsArrays) {
-                this._effect.setArray(name, this._floatsArrays[name]);
-            }
-
-            for (name in this._colors3) {
-                this._effect.setColor3(name, this._colors3[name]);
-            }
-
-            for (name in this._colors4) {
-                var color = this._colors4[name];
-                this._effect.setFloat4(name, color.r, color.g, color.b, color.a);
-            }
-
-            for (name in this._vectors2) {
-                this._effect.setVector2(name, this._vectors2[name]);
-            }
-
-            for (name in this._vectors3) {
-                this._effect.setVector3(name, this._vectors3[name]);
-            }
-
-            for (name in this._matrices) {
-                this._effect.setMatrix(name, this._matrices[name]);
-            }
-        };
-
-        ShaderMaterial.prototype.dispose = function (forceDisposeEffect) {
-            for (var name in this._textures) {
-                this._textures[name].dispose();
-            }
-
-            this._textures = [];
-
-            _super.prototype.dispose.call(this, forceDisposeEffect);
-        };
-        return ShaderMaterial;
-    })(BABYLON.Material);
-    BABYLON.ShaderMaterial = ShaderMaterial;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.shaderMaterial.js.map

+ 0 - 191
Babylon/Materials/babylon.shaderMaterial.ts

@@ -1,191 +0,0 @@
-module BABYLON {
-    export class ShaderMaterial extends Material {
-        private _shaderPath: any;
-        private _options: any;
-        private _textures = new Array<Texture>();
-        private _floats = new Array<number>();
-        private _floatsArrays = {};
-        private _colors3 = new Array<Color3>();
-        private _colors4 = new Array<Color4>();
-        private _vectors2 = new Array<Vector2>();
-        private _vectors3 = new Array<Vector3>();
-        private _matrices = new Array<Matrix>();
-        private _cachedWorldViewMatrix = new BABYLON.Matrix();
-
-        constructor(name: string, scene: Scene, shaderPath: any, options: any) {
-            super(name, scene);
-            this._shaderPath = shaderPath;
-
-            options.needAlphaBlending = options.needAlphaBlending || false;
-            options.needAlphaTesting = options.needAlphaTesting || false;
-            options.attributes = options.attributes || ["position", "normal", "uv"];
-            options.uniforms = options.uniforms || ["worldViewProjection"];
-            options.samplers = options.samplers || [];
-
-            this._options = options;
-        }
-
-        public needAlphaBlending(): boolean {
-            return this._options.needAlphaBlending;
-        }
-
-        public needAlphaTesting(): boolean {
-            return this._options.needAlphaTesting;
-        }
-   
-        private _checkUniform(uniformName): void {
-            if (this._options.uniforms.indexOf(uniformName) === -1) {
-                this._options.uniforms.push(uniformName);
-            }
-        }
-
-        public setTexture(name: string, texture: Texture): ShaderMaterial {
-            if (this._options.samplers.indexOf(name) === -1) {
-                this._options.samplers.push(name);
-            }
-            this._textures[name] = texture;
-
-            return this;
-        }
-
-        public setFloat(name: string, value: number): ShaderMaterial {
-            this._checkUniform(name);
-            this._floats[name] = value;
-
-            return this;
-        }
-
-        public setFloats(name: string, value: number[]): ShaderMaterial {
-            this._checkUniform(name);
-            this._floatsArrays[name] = value;
-
-            return this;
-        }
-
-        public setColor3(name: string, value: Color3): ShaderMaterial {
-            this._checkUniform(name);
-            this._colors3[name] = value;
-
-            return this;
-        }
-
-        public setColor4(name: string, value: Color4): ShaderMaterial {
-            this._checkUniform(name);
-            this._colors4[name] = value;
-
-            return this;
-        }
-
-        public setVector2(name: string, value: Vector2): ShaderMaterial {
-            this._checkUniform(name);
-            this._vectors2[name] = value;
-
-            return this;
-        }
-
-        public setVector3(name: string, value: Vector3): ShaderMaterial {
-            this._checkUniform(name);
-            this._vectors3[name] = value;
-
-            return this;
-        }
-
-        public setMatrix(name: string, value: Matrix): ShaderMaterial {
-            this._checkUniform(name);
-            this._matrices[name] = value;
-
-            return this;
-        }
-
-        public isReady(): boolean {
-            var engine = this.getScene().getEngine();
-
-            this._effect = engine.createEffect(this._shaderPath,
-                this._options.attributes,
-                this._options.uniforms,
-                this._options.samplers,
-                "", null, this.onCompiled, this.onError);
-
-            if (!this._effect.isReady()) {
-                return false;
-            }
-
-            return true;
-        }
-
-        public bind(world: Matrix): void {
-            // Std values
-            if (this._options.uniforms.indexOf("world") !== -1) {
-                this._effect.setMatrix("world", world);
-            }
-
-            if (this._options.uniforms.indexOf("view") !== -1) {
-                this._effect.setMatrix("view", this.getScene().getViewMatrix());
-            }
-
-            if (this._options.uniforms.indexOf("worldView") !== -1) {
-                world.multiplyToRef(this.getScene().getViewMatrix(), this._cachedWorldViewMatrix);
-                this._effect.setMatrix("worldView", this._cachedWorldViewMatrix);
-            }
-
-            if (this._options.uniforms.indexOf("projection") !== -1) {
-                this._effect.setMatrix("projection", this.getScene().getProjectionMatrix());
-            }
-
-            if (this._options.uniforms.indexOf("worldViewProjection") !== -1) {
-                this._effect.setMatrix("worldViewProjection", world.multiply(this.getScene().getTransformMatrix()));
-            }
-
-            // Texture
-            for (var name in this._textures) {
-                this._effect.setTexture(name, this._textures[name]);
-            }
-
-            // Float    
-            for (name in this._floats) {
-                this._effect.setFloat(name, this._floats[name]);
-            }
-
-            // Float s   
-            for (name in this._floatsArrays) {
-                this._effect.setArray(name, this._floatsArrays[name]);
-            }
-
-            // Color3        
-            for (name in this._colors3) {
-                this._effect.setColor3(name, this._colors3[name]);
-            }
-
-            // Color4      
-            for (name in this._colors4) {
-                var color = this._colors4[name];
-                this._effect.setFloat4(name, color.r, color.g, color.b, color.a);
-            }
-
-            // Vector2        
-            for (name in this._vectors2) {
-                this._effect.setVector2(name, this._vectors2[name]);
-            }
-
-            // Vector3        
-            for (name in this._vectors3) {
-                this._effect.setVector3(name, this._vectors3[name]);
-            }
-
-            // Matrix      
-            for (name in this._matrices) {
-                this._effect.setMatrix(name, this._matrices[name]);
-            }
-        }
-
-        public dispose(forceDisposeEffect?: boolean): void {
-            for (var name in this._textures) {
-                this._textures[name].dispose();
-            }
-
-            this._textures = [];
-
-            super.dispose(forceDisposeEffect);
-        }
-    }
-} 

+ 0 - 679
Babylon/Materials/babylon.standardMaterial.js

@@ -1,679 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var maxSimultaneousLights = 4;
-
-    var FresnelParameters = (function () {
-        function FresnelParameters() {
-            this.isEnabled = true;
-            this.leftColor = BABYLON.Color3.White();
-            this.rightColor = BABYLON.Color3.Black();
-            this.bias = 0;
-            this.power = 1;
-        }
-        return FresnelParameters;
-    })();
-    BABYLON.FresnelParameters = FresnelParameters;
-
-    var StandardMaterial = (function (_super) {
-        __extends(StandardMaterial, _super);
-        function StandardMaterial(name, scene) {
-            var _this = this;
-            _super.call(this, name, scene);
-            this.ambientColor = new BABYLON.Color3(0, 0, 0);
-            this.diffuseColor = new BABYLON.Color3(1, 1, 1);
-            this.specularColor = new BABYLON.Color3(1, 1, 1);
-            this.specularPower = 64;
-            this.emissiveColor = new BABYLON.Color3(0, 0, 0);
-            this.useAlphaFromDiffuseTexture = false;
-            this.useSpecularOverAlpha = true;
-            this.fogEnabled = true;
-            this._cachedDefines = null;
-            this._renderTargets = new BABYLON.SmartArray(16);
-            this._worldViewProjectionMatrix = BABYLON.Matrix.Zero();
-            this._globalAmbientColor = new BABYLON.Color3(0, 0, 0);
-            this._scaledDiffuse = new BABYLON.Color3();
-            this._scaledSpecular = new BABYLON.Color3();
-
-            this.getRenderTargetTextures = function () {
-                _this._renderTargets.reset();
-
-                if (_this.reflectionTexture && _this.reflectionTexture.isRenderTarget) {
-                    _this._renderTargets.push(_this.reflectionTexture);
-                }
-
-                return _this._renderTargets;
-            };
-        }
-        StandardMaterial.prototype.needAlphaBlending = function () {
-            return (this.alpha < 1.0) || (this.opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture() || this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled;
-        };
-
-        StandardMaterial.prototype.needAlphaTesting = function () {
-            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && !this.diffuseTexture.getAlphaFromRGB;
-        };
-
-        StandardMaterial.prototype._shouldUseAlphaFromDiffuseTexture = function () {
-            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture;
-        };
-
-        StandardMaterial.prototype.getAlphaTestTexture = function () {
-            return this.diffuseTexture;
-        };
-
-        // Methods
-        StandardMaterial.prototype.isReady = function (mesh, useInstances) {
-            if (this.checkReadyOnlyOnce) {
-                if (this._wasPreviouslyReady) {
-                    return true;
-                }
-            }
-
-            var scene = this.getScene();
-
-            if (!this.checkReadyOnEveryCall) {
-                if (this._renderId === scene.getRenderId()) {
-                    return true;
-                }
-            }
-
-            var engine = scene.getEngine();
-            var defines = [];
-            var fallbacks = new BABYLON.EffectFallbacks();
-
-            // Textures
-            if (scene.texturesEnabled) {
-                if (this.diffuseTexture && BABYLON.StandardMaterial.DiffuseTextureEnabled) {
-                    if (!this.diffuseTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define DIFFUSE");
-                    }
-                }
-
-                if (this.ambientTexture && BABYLON.StandardMaterial.AmbientTextureEnabled) {
-                    if (!this.ambientTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define AMBIENT");
-                    }
-                }
-
-                if (this.opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
-                    if (!this.opacityTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define OPACITY");
-
-                        if (this.opacityTexture.getAlphaFromRGB) {
-                            defines.push("#define OPACITYRGB");
-                        }
-                    }
-                }
-
-                if (this.reflectionTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
-                    if (!this.reflectionTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define REFLECTION");
-                        fallbacks.addFallback(0, "REFLECTION");
-                    }
-                }
-
-                if (this.emissiveTexture && BABYLON.StandardMaterial.EmissiveTextureEnabled) {
-                    if (!this.emissiveTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define EMISSIVE");
-                    }
-                }
-
-                if (this.specularTexture && BABYLON.StandardMaterial.SpecularTextureEnabled) {
-                    if (!this.specularTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define SPECULAR");
-                        fallbacks.addFallback(0, "SPECULAR");
-                    }
-                }
-            }
-
-            if (scene.getEngine().getCaps().standardDerivatives && this.bumpTexture && BABYLON.StandardMaterial.BumpTextureEnabled) {
-                if (!this.bumpTexture.isReady()) {
-                    return false;
-                } else {
-                    defines.push("#define BUMP");
-                    fallbacks.addFallback(0, "BUMP");
-                }
-            }
-
-            // Effect
-            if (this.useSpecularOverAlpha) {
-                defines.push("#define SPECULAROVERALPHA");
-                fallbacks.addFallback(0, "SPECULAROVERALPHA");
-            }
-
-            if (scene.clipPlane) {
-                defines.push("#define CLIPPLANE");
-            }
-
-            if (engine.getAlphaTesting()) {
-                defines.push("#define ALPHATEST");
-            }
-
-            if (this._shouldUseAlphaFromDiffuseTexture()) {
-                defines.push("#define ALPHAFROMDIFFUSE");
-            }
-
-            // Point size
-            if (this.pointsCloud) {
-                defines.push("#define POINTSIZE");
-            }
-
-            // Fog
-            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
-                defines.push("#define FOG");
-                fallbacks.addFallback(1, "FOG");
-            }
-
-            var shadowsActivated = false;
-            var lightIndex = 0;
-            if (scene.lightsEnabled) {
-                for (var index = 0; index < scene.lights.length; index++) {
-                    var light = scene.lights[index];
-
-                    if (!light.isEnabled()) {
-                        continue;
-                    }
-
-                    // Excluded check
-                    if (light._excludedMeshesIds.length > 0) {
-                        for (var excludedIndex = 0; excludedIndex < light._excludedMeshesIds.length; excludedIndex++) {
-                            var excludedMesh = scene.getMeshByID(light._excludedMeshesIds[excludedIndex]);
-
-                            if (excludedMesh) {
-                                light.excludedMeshes.push(excludedMesh);
-                            }
-                        }
-
-                        light._excludedMeshesIds = [];
-                    }
-
-                    // Included check
-                    if (light._includedOnlyMeshesIds.length > 0) {
-                        for (var includedOnlyIndex = 0; includedOnlyIndex < light._includedOnlyMeshesIds.length; includedOnlyIndex++) {
-                            var includedOnlyMesh = scene.getMeshByID(light._includedOnlyMeshesIds[includedOnlyIndex]);
-
-                            if (includedOnlyMesh) {
-                                light.includedOnlyMeshes.push(includedOnlyMesh);
-                            }
-                        }
-
-                        light._includedOnlyMeshesIds = [];
-                    }
-
-                    if (!light.canAffectMesh(mesh)) {
-                        continue;
-                    }
-
-                    defines.push("#define LIGHT" + lightIndex);
-
-                    if (lightIndex > 0) {
-                        fallbacks.addFallback(lightIndex, "LIGHT" + lightIndex);
-                    }
-
-                    var type;
-                    if (light instanceof BABYLON.SpotLight) {
-                        type = "#define SPOTLIGHT" + lightIndex;
-                    } else if (light instanceof BABYLON.HemisphericLight) {
-                        type = "#define HEMILIGHT" + lightIndex;
-                    } else {
-                        type = "#define POINTDIRLIGHT" + lightIndex;
-                    }
-
-                    defines.push(type);
-                    if (lightIndex > 0) {
-                        fallbacks.addFallback(lightIndex, type.replace("#define ", ""));
-                    }
-
-                    // Shadows
-                    if (scene.shadowsEnabled) {
-                        var shadowGenerator = light.getShadowGenerator();
-                        if (mesh && mesh.receiveShadows && shadowGenerator) {
-                            defines.push("#define SHADOW" + lightIndex);
-                            fallbacks.addFallback(0, "SHADOW" + lightIndex);
-
-                            if (!shadowsActivated) {
-                                defines.push("#define SHADOWS");
-                                shadowsActivated = true;
-                            }
-
-                            if (shadowGenerator.useVarianceShadowMap) {
-                                defines.push("#define SHADOWVSM" + lightIndex);
-                                if (lightIndex > 0) {
-                                    fallbacks.addFallback(0, "SHADOWVSM" + lightIndex);
-                                }
-                            }
-
-                            if (shadowGenerator.usePoissonSampling) {
-                                defines.push("#define SHADOWPCF" + lightIndex);
-                                if (lightIndex > 0) {
-                                    fallbacks.addFallback(0, "SHADOWPCF" + lightIndex);
-                                }
-                            }
-                        }
-                    }
-
-                    lightIndex++;
-                    if (lightIndex == maxSimultaneousLights)
-                        break;
-                }
-            }
-
-            // Fresnel
-            if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled || this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled || this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled || this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
-                var fresnelRank = 1;
-
-                if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
-                    defines.push("#define DIFFUSEFRESNEL");
-                    fallbacks.addFallback(fresnelRank, "DIFFUSEFRESNEL");
-                    fresnelRank++;
-                }
-
-                if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
-                    defines.push("#define OPACITYFRESNEL");
-                    fallbacks.addFallback(fresnelRank, "OPACITYFRESNEL");
-                    fresnelRank++;
-                }
-
-                if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
-                    defines.push("#define REFLECTIONFRESNEL");
-                    fallbacks.addFallback(fresnelRank, "REFLECTIONFRESNEL");
-                    fresnelRank++;
-                }
-
-                if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
-                    defines.push("#define EMISSIVEFRESNEL");
-                    fallbacks.addFallback(fresnelRank, "EMISSIVEFRESNEL");
-                    fresnelRank++;
-                }
-
-                defines.push("#define FRESNEL");
-                fallbacks.addFallback(fresnelRank - 1, "FRESNEL");
-            }
-
-            // Attribs
-            var attribs = [BABYLON.VertexBuffer.PositionKind, BABYLON.VertexBuffer.NormalKind];
-            if (mesh) {
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                    attribs.push(BABYLON.VertexBuffer.UVKind);
-                    defines.push("#define UV1");
-                }
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind)) {
-                    attribs.push(BABYLON.VertexBuffer.UV2Kind);
-                    defines.push("#define UV2");
-                }
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.ColorKind)) {
-                    attribs.push(BABYLON.VertexBuffer.ColorKind);
-                    defines.push("#define VERTEXCOLOR");
-
-                    if (mesh.hasVertexAlpha) {
-                        defines.push("#define VERTEXALPHA");
-                    }
-                }
-                if (mesh.skeleton && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind) && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
-                    attribs.push(BABYLON.VertexBuffer.MatricesIndicesKind);
-                    attribs.push(BABYLON.VertexBuffer.MatricesWeightsKind);
-                    defines.push("#define BONES");
-                    defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
-                    defines.push("#define BONES4");
-                    fallbacks.addFallback(0, "BONES4");
-                }
-
-                // Instances
-                if (useInstances) {
-                    defines.push("#define INSTANCES");
-                    attribs.push("world0");
-                    attribs.push("world1");
-                    attribs.push("world2");
-                    attribs.push("world3");
-                }
-            }
-
-            // Get correct effect
-            var join = defines.join("\n");
-            if (this._cachedDefines != join) {
-                this._cachedDefines = join;
-
-                // Legacy browser patch
-                var shaderName = "default";
-                if (!scene.getEngine().getCaps().standardDerivatives) {
-                    shaderName = "legacydefault";
-                }
-
-                this._effect = scene.getEngine().createEffect(shaderName, attribs, [
-                    "world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vDiffuseColor", "vSpecularColor", "vEmissiveColor",
-                    "vLightData0", "vLightDiffuse0", "vLightSpecular0", "vLightDirection0", "vLightGround0", "lightMatrix0",
-                    "vLightData1", "vLightDiffuse1", "vLightSpecular1", "vLightDirection1", "vLightGround1", "lightMatrix1",
-                    "vLightData2", "vLightDiffuse2", "vLightSpecular2", "vLightDirection2", "vLightGround2", "lightMatrix2",
-                    "vLightData3", "vLightDiffuse3", "vLightSpecular3", "vLightDirection3", "vLightGround3", "lightMatrix3",
-                    "vFogInfos", "vFogColor", "pointSize",
-                    "vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos",
-                    "mBones",
-                    "vClipPlane", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix",
-                    "darkness0", "darkness1", "darkness2", "darkness3",
-                    "diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor"
-                ], [
-                    "diffuseSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "specularSampler", "bumpSampler",
-                    "shadowSampler0", "shadowSampler1", "shadowSampler2", "shadowSampler3"
-                ], join, fallbacks, this.onCompiled, this.onError);
-            }
-            if (!this._effect.isReady()) {
-                return false;
-            }
-
-            this._renderId = scene.getRenderId();
-            this._wasPreviouslyReady = true;
-            return true;
-        };
-
-        StandardMaterial.prototype.unbind = function () {
-            if (this.reflectionTexture && this.reflectionTexture.isRenderTarget) {
-                this._effect.setTexture("reflection2DSampler", null);
-            }
-        };
-
-        StandardMaterial.prototype.bindOnlyWorldMatrix = function (world) {
-            this._effect.setMatrix("world", world);
-        };
-
-        StandardMaterial.prototype.bind = function (world, mesh) {
-            var scene = this.getScene();
-
-            // Matrices
-            this.bindOnlyWorldMatrix(world);
-            this._effect.setMatrix("viewProjection", scene.getTransformMatrix());
-
-            // Bones
-            if (mesh.skeleton && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind) && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
-                this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices());
-            }
-
-            // Fresnel
-            if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
-                this._effect.setColor4("diffuseLeftColor", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);
-                this._effect.setColor4("diffuseRightColor", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);
-            }
-
-            if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
-                this._effect.setColor4("opacityParts", new BABYLON.Color3(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);
-            }
-
-            if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
-                this._effect.setColor4("reflectionLeftColor", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);
-                this._effect.setColor4("reflectionRightColor", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);
-            }
-
-            if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
-                this._effect.setColor4("emissiveLeftColor", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);
-                this._effect.setColor4("emissiveRightColor", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);
-            }
-
-            // Textures
-            if (this.diffuseTexture && BABYLON.StandardMaterial.DiffuseTextureEnabled) {
-                this._effect.setTexture("diffuseSampler", this.diffuseTexture);
-
-                this._effect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
-                this._effect.setMatrix("diffuseMatrix", this.diffuseTexture.getTextureMatrix());
-            }
-
-            if (this.ambientTexture && BABYLON.StandardMaterial.AmbientTextureEnabled) {
-                this._effect.setTexture("ambientSampler", this.ambientTexture);
-
-                this._effect.setFloat2("vAmbientInfos", this.ambientTexture.coordinatesIndex, this.ambientTexture.level);
-                this._effect.setMatrix("ambientMatrix", this.ambientTexture.getTextureMatrix());
-            }
-
-            if (this.opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
-                this._effect.setTexture("opacitySampler", this.opacityTexture);
-
-                this._effect.setFloat2("vOpacityInfos", this.opacityTexture.coordinatesIndex, this.opacityTexture.level);
-                this._effect.setMatrix("opacityMatrix", this.opacityTexture.getTextureMatrix());
-            }
-
-            if (this.reflectionTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
-                if (this.reflectionTexture.isCube) {
-                    this._effect.setTexture("reflectionCubeSampler", this.reflectionTexture);
-                } else {
-                    this._effect.setTexture("reflection2DSampler", this.reflectionTexture);
-                }
-
-                this._effect.setMatrix("reflectionMatrix", this.reflectionTexture.getReflectionTextureMatrix());
-                this._effect.setFloat3("vReflectionInfos", this.reflectionTexture.coordinatesMode, this.reflectionTexture.level, this.reflectionTexture.isCube ? 1 : 0);
-            }
-
-            if (this.emissiveTexture && BABYLON.StandardMaterial.EmissiveTextureEnabled) {
-                this._effect.setTexture("emissiveSampler", this.emissiveTexture);
-
-                this._effect.setFloat2("vEmissiveInfos", this.emissiveTexture.coordinatesIndex, this.emissiveTexture.level);
-                this._effect.setMatrix("emissiveMatrix", this.emissiveTexture.getTextureMatrix());
-            }
-
-            if (this.specularTexture && BABYLON.StandardMaterial.SpecularTextureEnabled) {
-                this._effect.setTexture("specularSampler", this.specularTexture);
-
-                this._effect.setFloat2("vSpecularInfos", this.specularTexture.coordinatesIndex, this.specularTexture.level);
-                this._effect.setMatrix("specularMatrix", this.specularTexture.getTextureMatrix());
-            }
-
-            if (this.bumpTexture && scene.getEngine().getCaps().standardDerivatives && BABYLON.StandardMaterial.BumpTextureEnabled) {
-                this._effect.setTexture("bumpSampler", this.bumpTexture);
-
-                this._effect.setFloat2("vBumpInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
-                this._effect.setMatrix("bumpMatrix", this.bumpTexture.getTextureMatrix());
-            }
-
-            // Colors
-            scene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);
-
-            this._effect.setVector3("vEyePosition", scene.activeCamera.position);
-            this._effect.setColor3("vAmbientColor", this._globalAmbientColor);
-            this._effect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
-            this._effect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
-            this._effect.setColor3("vEmissiveColor", this.emissiveColor);
-
-            if (scene.lightsEnabled) {
-                var lightIndex = 0;
-                for (var index = 0; index < scene.lights.length; index++) {
-                    var light = scene.lights[index];
-
-                    if (!light.isEnabled()) {
-                        continue;
-                    }
-
-                    if (!light.canAffectMesh(mesh)) {
-                        continue;
-                    }
-
-                    if (light instanceof BABYLON.PointLight) {
-                        // Point Light
-                        light.transferToEffect(this._effect, "vLightData" + lightIndex);
-                    } else if (light instanceof BABYLON.DirectionalLight) {
-                        // Directional Light
-                        light.transferToEffect(this._effect, "vLightData" + lightIndex);
-                    } else if (light instanceof BABYLON.SpotLight) {
-                        // Spot Light
-                        light.transferToEffect(this._effect, "vLightData" + lightIndex, "vLightDirection" + lightIndex);
-                    } else if (light instanceof BABYLON.HemisphericLight) {
-                        // Hemispheric Light
-                        light.transferToEffect(this._effect, "vLightData" + lightIndex, "vLightGround" + lightIndex);
-                    }
-
-                    light.diffuse.scaleToRef(light.intensity, this._scaledDiffuse);
-                    light.specular.scaleToRef(light.intensity, this._scaledSpecular);
-                    this._effect.setColor4("vLightDiffuse" + lightIndex, this._scaledDiffuse, light.range);
-                    this._effect.setColor3("vLightSpecular" + lightIndex, this._scaledSpecular);
-
-                    // Shadows
-                    if (scene.shadowsEnabled) {
-                        var shadowGenerator = light.getShadowGenerator();
-                        if (mesh.receiveShadows && shadowGenerator) {
-                            this._effect.setMatrix("lightMatrix" + lightIndex, shadowGenerator.getTransformMatrix());
-                            this._effect.setTexture("shadowSampler" + lightIndex, shadowGenerator.getShadowMap());
-                            this._effect.setFloat("darkness" + lightIndex, shadowGenerator.getDarkness());
-                        }
-                    }
-
-                    lightIndex++;
-
-                    if (lightIndex == maxSimultaneousLights)
-                        break;
-                }
-            }
-
-            if (scene.clipPlane) {
-                var clipPlane = scene.clipPlane;
-                this._effect.setFloat4("vClipPlane", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
-            }
-
-            // View
-            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE || this.reflectionTexture) {
-                this._effect.setMatrix("view", scene.getViewMatrix());
-            }
-
-            // Fog
-            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
-                this._effect.setFloat4("vFogInfos", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);
-                this._effect.setColor3("vFogColor", scene.fogColor);
-            }
-
-            // Point size
-            if (this.pointsCloud) {
-                this._effect.setFloat("pointSize", this.pointSize);
-            }
-        };
-
-        StandardMaterial.prototype.getAnimatables = function () {
-            var results = [];
-
-            if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
-                results.push(this.diffuseTexture);
-            }
-
-            if (this.ambientTexture && this.ambientTexture.animations && this.ambientTexture.animations.length > 0) {
-                results.push(this.ambientTexture);
-            }
-
-            if (this.opacityTexture && this.opacityTexture.animations && this.opacityTexture.animations.length > 0) {
-                results.push(this.opacityTexture);
-            }
-
-            if (this.reflectionTexture && this.reflectionTexture.animations && this.reflectionTexture.animations.length > 0) {
-                results.push(this.reflectionTexture);
-            }
-
-            if (this.emissiveTexture && this.emissiveTexture.animations && this.emissiveTexture.animations.length > 0) {
-                results.push(this.emissiveTexture);
-            }
-
-            if (this.specularTexture && this.specularTexture.animations && this.specularTexture.animations.length > 0) {
-                results.push(this.specularTexture);
-            }
-
-            if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
-                results.push(this.bumpTexture);
-            }
-
-            return results;
-        };
-
-        StandardMaterial.prototype.dispose = function (forceDisposeEffect) {
-            if (this.diffuseTexture) {
-                this.diffuseTexture.dispose();
-            }
-
-            if (this.ambientTexture) {
-                this.ambientTexture.dispose();
-            }
-
-            if (this.opacityTexture) {
-                this.opacityTexture.dispose();
-            }
-
-            if (this.reflectionTexture) {
-                this.reflectionTexture.dispose();
-            }
-
-            if (this.emissiveTexture) {
-                this.emissiveTexture.dispose();
-            }
-
-            if (this.specularTexture) {
-                this.specularTexture.dispose();
-            }
-
-            if (this.bumpTexture) {
-                this.bumpTexture.dispose();
-            }
-
-            _super.prototype.dispose.call(this, forceDisposeEffect);
-        };
-
-        StandardMaterial.prototype.clone = function (name) {
-            var newStandardMaterial = new BABYLON.StandardMaterial(name, this.getScene());
-
-            // Base material
-            newStandardMaterial.checkReadyOnEveryCall = this.checkReadyOnEveryCall;
-            newStandardMaterial.alpha = this.alpha;
-            newStandardMaterial.fillMode = this.fillMode;
-            newStandardMaterial.backFaceCulling = this.backFaceCulling;
-
-            // Standard material
-            if (this.diffuseTexture && this.diffuseTexture.clone) {
-                newStandardMaterial.diffuseTexture = this.diffuseTexture.clone();
-            }
-            if (this.ambientTexture && this.ambientTexture.clone) {
-                newStandardMaterial.ambientTexture = this.ambientTexture.clone();
-            }
-            if (this.opacityTexture && this.opacityTexture.clone) {
-                newStandardMaterial.opacityTexture = this.opacityTexture.clone();
-            }
-            if (this.reflectionTexture && this.reflectionTexture.clone) {
-                newStandardMaterial.reflectionTexture = this.reflectionTexture.clone();
-            }
-            if (this.emissiveTexture && this.emissiveTexture.clone) {
-                newStandardMaterial.emissiveTexture = this.emissiveTexture.clone();
-            }
-            if (this.specularTexture && this.specularTexture.clone) {
-                newStandardMaterial.specularTexture = this.specularTexture.clone();
-            }
-            if (this.bumpTexture && this.bumpTexture.clone) {
-                newStandardMaterial.bumpTexture = this.bumpTexture.clone();
-            }
-
-            newStandardMaterial.ambientColor = this.ambientColor.clone();
-            newStandardMaterial.diffuseColor = this.diffuseColor.clone();
-            newStandardMaterial.specularColor = this.specularColor.clone();
-            newStandardMaterial.specularPower = this.specularPower;
-            newStandardMaterial.emissiveColor = this.emissiveColor.clone();
-
-            return newStandardMaterial;
-        };
-
-        StandardMaterial.DiffuseTextureEnabled = true;
-        StandardMaterial.AmbientTextureEnabled = true;
-        StandardMaterial.OpacityTextureEnabled = true;
-        StandardMaterial.ReflectionTextureEnabled = true;
-        StandardMaterial.EmissiveTextureEnabled = true;
-        StandardMaterial.SpecularTextureEnabled = true;
-        StandardMaterial.BumpTextureEnabled = true;
-        return StandardMaterial;
-    })(BABYLON.Material);
-    BABYLON.StandardMaterial = StandardMaterial;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.standardMaterial.js.map

+ 0 - 690
Babylon/Materials/babylon.standardMaterial.ts

@@ -1,690 +0,0 @@
-module BABYLON {
-    var maxSimultaneousLights = 4;
-
-    export class FresnelParameters {
-        public isEnabled = true;
-        public leftColor = Color3.White();
-        public rightColor = Color3.Black();
-        public bias = 0;
-        public power = 1;
-    }
-
-    export class StandardMaterial extends Material {
-        public diffuseTexture: BaseTexture;
-        public ambientTexture: BaseTexture;
-        public opacityTexture: BaseTexture;
-        public reflectionTexture: BaseTexture;
-        public emissiveTexture: BaseTexture;
-        public specularTexture: BaseTexture;
-        public bumpTexture: BaseTexture;
-
-        public ambientColor = new BABYLON.Color3(0, 0, 0);
-        public diffuseColor = new BABYLON.Color3(1, 1, 1);
-        public specularColor = new BABYLON.Color3(1, 1, 1);
-        public specularPower = 64;
-        public emissiveColor = new BABYLON.Color3(0, 0, 0);
-        public useAlphaFromDiffuseTexture = false;
-        public useSpecularOverAlpha = true;
-		public fogEnabled = true;
-
-        public diffuseFresnelParameters: FresnelParameters;
-        public opacityFresnelParameters: FresnelParameters;
-        public reflectionFresnelParameters: FresnelParameters;
-        public emissiveFresnelParameters: FresnelParameters;
-
-        private _cachedDefines = null;
-        private _renderTargets = new BABYLON.SmartArray<RenderTargetTexture>(16);
-        private _worldViewProjectionMatrix = BABYLON.Matrix.Zero();
-        private _globalAmbientColor = new BABYLON.Color3(0, 0, 0);
-        private _scaledDiffuse = new BABYLON.Color3();
-        private _scaledSpecular = new BABYLON.Color3();
-        private _renderId: number;
-
-        constructor(name: string, scene: Scene) {
-            super(name, scene);
-
-            this.getRenderTargetTextures = (): SmartArray<RenderTargetTexture> => {
-                this._renderTargets.reset();
-
-                if (this.reflectionTexture && this.reflectionTexture.isRenderTarget) {
-                    this._renderTargets.push(this.reflectionTexture);
-                }
-
-                return this._renderTargets;
-            }
-        }
-
-        public needAlphaBlending(): boolean {
-            return (this.alpha < 1.0) || (this.opacityTexture != null) || this._shouldUseAlphaFromDiffuseTexture() || this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled;
-        }
-
-        public needAlphaTesting(): boolean {
-            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && !this.diffuseTexture.getAlphaFromRGB;
-        }
-
-        private _shouldUseAlphaFromDiffuseTexture(): boolean {
-            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture;
-        }
-
-        public getAlphaTestTexture(): BaseTexture {
-            return this.diffuseTexture;
-        }
-
-        // Methods   
-        public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean {
-            if (this.checkReadyOnlyOnce) {
-                if (this._wasPreviouslyReady) {
-                    return true;
-                }
-            }
-
-            var scene = this.getScene();
-
-            if (!this.checkReadyOnEveryCall) {
-                if (this._renderId === scene.getRenderId()) {
-                    return true;
-                }
-            }
-
-            var engine = scene.getEngine();
-            var defines = [];
-            var fallbacks = new EffectFallbacks();
-
-            // Textures
-            if (scene.texturesEnabled) {
-                if (this.diffuseTexture && BABYLON.StandardMaterial.DiffuseTextureEnabled) {
-                    if (!this.diffuseTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define DIFFUSE");
-                    }
-                }
-
-                if (this.ambientTexture && BABYLON.StandardMaterial.AmbientTextureEnabled) {
-                    if (!this.ambientTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define AMBIENT");
-                    }
-                }
-
-                if (this.opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
-                    if (!this.opacityTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define OPACITY");
-
-                        if (this.opacityTexture.getAlphaFromRGB) {
-                            defines.push("#define OPACITYRGB");
-                        }
-                    }
-                }
-
-                if (this.reflectionTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
-                    if (!this.reflectionTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define REFLECTION");
-                        fallbacks.addFallback(0, "REFLECTION");
-                    }
-                }
-
-                if (this.emissiveTexture && BABYLON.StandardMaterial.EmissiveTextureEnabled) {
-                    if (!this.emissiveTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define EMISSIVE");
-                    }
-                }
-
-                if (this.specularTexture && BABYLON.StandardMaterial.SpecularTextureEnabled) {
-                    if (!this.specularTexture.isReady()) {
-                        return false;
-                    } else {
-                        defines.push("#define SPECULAR");
-                        fallbacks.addFallback(0, "SPECULAR");
-                    }
-                }
-            }
-
-            if (scene.getEngine().getCaps().standardDerivatives && this.bumpTexture && BABYLON.StandardMaterial.BumpTextureEnabled) {
-                if (!this.bumpTexture.isReady()) {
-                    return false;
-                } else {
-                    defines.push("#define BUMP");
-                    fallbacks.addFallback(0, "BUMP");
-                }
-            }
-
-            // Effect
-            if (this.useSpecularOverAlpha) {
-                defines.push("#define SPECULAROVERALPHA");
-                fallbacks.addFallback(0, "SPECULAROVERALPHA");
-            }
-
-            if (scene.clipPlane) {
-                defines.push("#define CLIPPLANE");
-            }
-
-            if (engine.getAlphaTesting()) {
-                defines.push("#define ALPHATEST");
-            }
-
-            if (this._shouldUseAlphaFromDiffuseTexture()) {
-                defines.push("#define ALPHAFROMDIFFUSE");
-            }
-
-            // Point size
-            if (this.pointsCloud) {
-                defines.push("#define POINTSIZE");
-            }
-
-            // Fog
-            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
-                defines.push("#define FOG");
-                fallbacks.addFallback(1, "FOG");
-            }
-
-            var shadowsActivated = false;
-            var lightIndex = 0;
-            if (scene.lightsEnabled) {
-                for (var index = 0; index < scene.lights.length; index++) {
-                    var light = scene.lights[index];
-
-                    if (!light.isEnabled()) {
-                        continue;
-                    }
-
-                    // Excluded check
-                    if (light._excludedMeshesIds.length > 0) {
-                        for (var excludedIndex = 0; excludedIndex < light._excludedMeshesIds.length; excludedIndex++) {
-                            var excludedMesh = scene.getMeshByID(light._excludedMeshesIds[excludedIndex]);
-
-                            if (excludedMesh) {
-                                light.excludedMeshes.push(excludedMesh);
-                            }
-                        }
-
-                        light._excludedMeshesIds = [];
-                    }
-
-                    // Included check
-                    if (light._includedOnlyMeshesIds.length > 0) {
-                        for (var includedOnlyIndex = 0; includedOnlyIndex < light._includedOnlyMeshesIds.length; includedOnlyIndex++) {
-                            var includedOnlyMesh = scene.getMeshByID(light._includedOnlyMeshesIds[includedOnlyIndex]);
-
-                            if (includedOnlyMesh) {
-                                light.includedOnlyMeshes.push(includedOnlyMesh);
-                            }
-                        }
-
-                        light._includedOnlyMeshesIds = [];
-                    }
-
-                    if (!light.canAffectMesh(mesh)) {
-                        continue;
-                    }
-
-                    defines.push("#define LIGHT" + lightIndex);
-
-                    if (lightIndex > 0) {
-                        fallbacks.addFallback(lightIndex, "LIGHT" + lightIndex);
-                    }
-
-                    var type;
-                    if (light instanceof BABYLON.SpotLight) {
-                        type = "#define SPOTLIGHT" + lightIndex;
-                    } else if (light instanceof BABYLON.HemisphericLight) {
-                        type = "#define HEMILIGHT" + lightIndex;
-                    } else {
-                        type = "#define POINTDIRLIGHT" + lightIndex;
-                    }
-
-                    defines.push(type);
-                    if (lightIndex > 0) {
-                        fallbacks.addFallback(lightIndex, type.replace("#define ", ""));
-                    }
-
-                    // Shadows
-                    if (scene.shadowsEnabled) {
-                        var shadowGenerator = light.getShadowGenerator();
-                        if (mesh && mesh.receiveShadows && shadowGenerator) {
-                            defines.push("#define SHADOW" + lightIndex);
-                            fallbacks.addFallback(0, "SHADOW" + lightIndex);
-
-                            if (!shadowsActivated) {
-                                defines.push("#define SHADOWS");
-                                shadowsActivated = true;
-                            }
-
-                            if (shadowGenerator.useVarianceShadowMap) {
-                                defines.push("#define SHADOWVSM" + lightIndex);
-                                if (lightIndex > 0) {
-                                    fallbacks.addFallback(0, "SHADOWVSM" + lightIndex);
-                                }
-                            }
-
-                            if (shadowGenerator.usePoissonSampling) {
-                                defines.push("#define SHADOWPCF" + lightIndex);
-                                if (lightIndex > 0) {
-                                    fallbacks.addFallback(0, "SHADOWPCF" + lightIndex);
-                                }
-                            }
-                        }
-                    }
-
-                    lightIndex++;
-                    if (lightIndex == maxSimultaneousLights)
-                        break;
-                }
-            }
-
-            // Fresnel
-            if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled ||
-                this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled ||
-                this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled ||
-                this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
-
-                var fresnelRank = 1;
-
-                if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
-                    defines.push("#define DIFFUSEFRESNEL");
-                    fallbacks.addFallback(fresnelRank, "DIFFUSEFRESNEL");
-                    fresnelRank++;
-                }
-
-                if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
-                    defines.push("#define OPACITYFRESNEL");
-                    fallbacks.addFallback(fresnelRank, "OPACITYFRESNEL");
-                    fresnelRank++;
-                }
-
-                if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
-                    defines.push("#define REFLECTIONFRESNEL");
-                    fallbacks.addFallback(fresnelRank, "REFLECTIONFRESNEL");
-                    fresnelRank++;
-                }
-
-                if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
-                    defines.push("#define EMISSIVEFRESNEL");
-                    fallbacks.addFallback(fresnelRank, "EMISSIVEFRESNEL");
-                    fresnelRank++;
-                }
-
-                defines.push("#define FRESNEL");
-                fallbacks.addFallback(fresnelRank - 1, "FRESNEL");
-            }
-
-
-            // Attribs
-            var attribs = [BABYLON.VertexBuffer.PositionKind, BABYLON.VertexBuffer.NormalKind];
-            if (mesh) {
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                    attribs.push(BABYLON.VertexBuffer.UVKind);
-                    defines.push("#define UV1");
-                }
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind)) {
-                    attribs.push(BABYLON.VertexBuffer.UV2Kind);
-                    defines.push("#define UV2");
-                }
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.ColorKind)) {
-                    attribs.push(BABYLON.VertexBuffer.ColorKind);
-                    defines.push("#define VERTEXCOLOR");
-
-                    if (mesh.hasVertexAlpha) {
-                        defines.push("#define VERTEXALPHA");
-                    }
-                }
-                if (mesh.skeleton && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind) && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
-                    attribs.push(BABYLON.VertexBuffer.MatricesIndicesKind);
-                    attribs.push(BABYLON.VertexBuffer.MatricesWeightsKind);
-                    defines.push("#define BONES");
-                    defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
-                    defines.push("#define BONES4");
-                    fallbacks.addFallback(0, "BONES4");
-                }
-
-                // Instances
-                if (useInstances) {
-                    defines.push("#define INSTANCES");
-                    attribs.push("world0");
-                    attribs.push("world1");
-                    attribs.push("world2");
-                    attribs.push("world3");
-                }
-            }
-
-            // Get correct effect      
-            var join = defines.join("\n");
-            if (this._cachedDefines != join) {
-                this._cachedDefines = join;
-
-                // Legacy browser patch
-                var shaderName = "default";
-                if (!scene.getEngine().getCaps().standardDerivatives) {
-                    shaderName = "legacydefault";
-                }
-
-                this._effect = scene.getEngine().createEffect(shaderName,
-                    attribs,
-                    ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vDiffuseColor", "vSpecularColor", "vEmissiveColor",
-                        "vLightData0", "vLightDiffuse0", "vLightSpecular0", "vLightDirection0", "vLightGround0", "lightMatrix0",
-                        "vLightData1", "vLightDiffuse1", "vLightSpecular1", "vLightDirection1", "vLightGround1", "lightMatrix1",
-                        "vLightData2", "vLightDiffuse2", "vLightSpecular2", "vLightDirection2", "vLightGround2", "lightMatrix2",
-                        "vLightData3", "vLightDiffuse3", "vLightSpecular3", "vLightDirection3", "vLightGround3", "lightMatrix3",
-                        "vFogInfos", "vFogColor", "pointSize",
-                        "vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos",
-                        "mBones",
-                        "vClipPlane", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix",
-                        "darkness0", "darkness1", "darkness2", "darkness3",
-                        "diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor"
-                    ],
-                    ["diffuseSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "specularSampler", "bumpSampler",
-                        "shadowSampler0", "shadowSampler1", "shadowSampler2", "shadowSampler3"
-                    ],
-                    join, fallbacks, this.onCompiled, this.onError);
-            }
-            if (!this._effect.isReady()) {
-                return false;
-            }
-
-            this._renderId = scene.getRenderId();
-            this._wasPreviouslyReady = true;
-            return true;
-        }
-
-
-        public unbind(): void {
-            if (this.reflectionTexture && this.reflectionTexture.isRenderTarget) {
-                this._effect.setTexture("reflection2DSampler", null);
-            }
-        }
-
-        public bindOnlyWorldMatrix(world: Matrix): void {
-            this._effect.setMatrix("world", world);
-        }
-
-        public bind(world: Matrix, mesh: Mesh): void {
-            var scene = this.getScene();
-
-            // Matrices        
-            this.bindOnlyWorldMatrix(world);
-            this._effect.setMatrix("viewProjection", scene.getTransformMatrix());
-
-            // Bones
-            if (mesh.skeleton && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind) && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
-                this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices());
-            }
-
-            // Fresnel
-            if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
-                this._effect.setColor4("diffuseLeftColor", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);
-                this._effect.setColor4("diffuseRightColor", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);
-            }
-
-            if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
-                this._effect.setColor4("opacityParts", new BABYLON.Color3(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);
-            }
-
-            if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
-                this._effect.setColor4("reflectionLeftColor", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);
-                this._effect.setColor4("reflectionRightColor", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);
-            }
-
-            if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
-                this._effect.setColor4("emissiveLeftColor", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);
-                this._effect.setColor4("emissiveRightColor", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);
-            }
-
-            // Textures        
-            if (this.diffuseTexture && BABYLON.StandardMaterial.DiffuseTextureEnabled) {
-                this._effect.setTexture("diffuseSampler", this.diffuseTexture);
-
-                this._effect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
-                this._effect.setMatrix("diffuseMatrix", this.diffuseTexture.getTextureMatrix());
-            }
-
-            if (this.ambientTexture && BABYLON.StandardMaterial.AmbientTextureEnabled) {
-                this._effect.setTexture("ambientSampler", this.ambientTexture);
-
-                this._effect.setFloat2("vAmbientInfos", this.ambientTexture.coordinatesIndex, this.ambientTexture.level);
-                this._effect.setMatrix("ambientMatrix", this.ambientTexture.getTextureMatrix());
-            }
-
-            if (this.opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
-                this._effect.setTexture("opacitySampler", this.opacityTexture);
-
-                this._effect.setFloat2("vOpacityInfos", this.opacityTexture.coordinatesIndex, this.opacityTexture.level);
-                this._effect.setMatrix("opacityMatrix", this.opacityTexture.getTextureMatrix());
-            }
-
-            if (this.reflectionTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
-                if (this.reflectionTexture.isCube) {
-                    this._effect.setTexture("reflectionCubeSampler", this.reflectionTexture);
-                } else {
-                    this._effect.setTexture("reflection2DSampler", this.reflectionTexture);
-                }
-
-                this._effect.setMatrix("reflectionMatrix", this.reflectionTexture.getReflectionTextureMatrix());
-                this._effect.setFloat3("vReflectionInfos", this.reflectionTexture.coordinatesMode, this.reflectionTexture.level, this.reflectionTexture.isCube ? 1 : 0);
-            }
-
-            if (this.emissiveTexture && BABYLON.StandardMaterial.EmissiveTextureEnabled) {
-                this._effect.setTexture("emissiveSampler", this.emissiveTexture);
-
-                this._effect.setFloat2("vEmissiveInfos", this.emissiveTexture.coordinatesIndex, this.emissiveTexture.level);
-                this._effect.setMatrix("emissiveMatrix", this.emissiveTexture.getTextureMatrix());
-            }
-
-            if (this.specularTexture && BABYLON.StandardMaterial.SpecularTextureEnabled) {
-                this._effect.setTexture("specularSampler", this.specularTexture);
-
-                this._effect.setFloat2("vSpecularInfos", this.specularTexture.coordinatesIndex, this.specularTexture.level);
-                this._effect.setMatrix("specularMatrix", this.specularTexture.getTextureMatrix());
-            }
-
-            if (this.bumpTexture && scene.getEngine().getCaps().standardDerivatives && BABYLON.StandardMaterial.BumpTextureEnabled) {
-                this._effect.setTexture("bumpSampler", this.bumpTexture);
-
-                this._effect.setFloat2("vBumpInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
-                this._effect.setMatrix("bumpMatrix", this.bumpTexture.getTextureMatrix());
-            }
-
-            // Colors
-            scene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);
-
-            this._effect.setVector3("vEyePosition", scene.activeCamera.position);
-            this._effect.setColor3("vAmbientColor", this._globalAmbientColor);
-            this._effect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
-            this._effect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
-            this._effect.setColor3("vEmissiveColor", this.emissiveColor);
-
-            if (scene.lightsEnabled) {
-                var lightIndex = 0;
-                for (var index = 0; index < scene.lights.length; index++) {
-                    var light = scene.lights[index];
-
-                    if (!light.isEnabled()) {
-                        continue;
-                    }
-
-                    if (!light.canAffectMesh(mesh)) {
-                        continue;
-                    }
-
-                    if (light instanceof BABYLON.PointLight) {
-                        // Point Light
-                        light.transferToEffect(this._effect, "vLightData" + lightIndex);
-                    } else if (light instanceof BABYLON.DirectionalLight) {
-                        // Directional Light
-                        light.transferToEffect(this._effect, "vLightData" + lightIndex);
-                    } else if (light instanceof BABYLON.SpotLight) {
-                        // Spot Light
-                        light.transferToEffect(this._effect, "vLightData" + lightIndex, "vLightDirection" + lightIndex);
-                    } else if (light instanceof BABYLON.HemisphericLight) {
-                        // Hemispheric Light
-                        light.transferToEffect(this._effect, "vLightData" + lightIndex, "vLightGround" + lightIndex);
-                    }
-
-                    light.diffuse.scaleToRef(light.intensity, this._scaledDiffuse);
-                    light.specular.scaleToRef(light.intensity, this._scaledSpecular);
-                    this._effect.setColor4("vLightDiffuse" + lightIndex, this._scaledDiffuse, light.range);
-                    this._effect.setColor3("vLightSpecular" + lightIndex, this._scaledSpecular);
-
-                    // Shadows
-                    if (scene.shadowsEnabled) {
-                        var shadowGenerator = light.getShadowGenerator();
-                        if (mesh.receiveShadows && shadowGenerator) {
-                            this._effect.setMatrix("lightMatrix" + lightIndex, shadowGenerator.getTransformMatrix());
-                            this._effect.setTexture("shadowSampler" + lightIndex, shadowGenerator.getShadowMap());
-                            this._effect.setFloat("darkness" + lightIndex, shadowGenerator.getDarkness());
-                        }
-                    }
-
-                    lightIndex++;
-
-                    if (lightIndex == maxSimultaneousLights)
-                        break;
-                }
-            }
-
-            if (scene.clipPlane) {
-                var clipPlane = scene.clipPlane;
-                this._effect.setFloat4("vClipPlane", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
-            }
-
-            // View
-            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE || this.reflectionTexture) {
-                this._effect.setMatrix("view", scene.getViewMatrix());
-            }
-
-            // Fog
-            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
-                this._effect.setFloat4("vFogInfos", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);
-                this._effect.setColor3("vFogColor", scene.fogColor);
-            }
-
-            // Point size
-            if (this.pointsCloud) {
-                this._effect.setFloat("pointSize", this.pointSize);
-            }
-        }
-
-        public getAnimatables(): IAnimatable[] {
-            var results = [];
-
-            if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {
-                results.push(this.diffuseTexture);
-            }
-
-            if (this.ambientTexture && this.ambientTexture.animations && this.ambientTexture.animations.length > 0) {
-                results.push(this.ambientTexture);
-            }
-
-            if (this.opacityTexture && this.opacityTexture.animations && this.opacityTexture.animations.length > 0) {
-                results.push(this.opacityTexture);
-            }
-
-            if (this.reflectionTexture && this.reflectionTexture.animations && this.reflectionTexture.animations.length > 0) {
-                results.push(this.reflectionTexture);
-            }
-
-            if (this.emissiveTexture && this.emissiveTexture.animations && this.emissiveTexture.animations.length > 0) {
-                results.push(this.emissiveTexture);
-            }
-
-            if (this.specularTexture && this.specularTexture.animations && this.specularTexture.animations.length > 0) {
-                results.push(this.specularTexture);
-            }
-
-            if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
-                results.push(this.bumpTexture);
-            }
-
-            return results;
-        }
-
-        public dispose(forceDisposeEffect?: boolean): void {
-            if (this.diffuseTexture) {
-                this.diffuseTexture.dispose();
-            }
-
-            if (this.ambientTexture) {
-                this.ambientTexture.dispose();
-            }
-
-            if (this.opacityTexture) {
-                this.opacityTexture.dispose();
-            }
-
-            if (this.reflectionTexture) {
-                this.reflectionTexture.dispose();
-            }
-
-            if (this.emissiveTexture) {
-                this.emissiveTexture.dispose();
-            }
-
-            if (this.specularTexture) {
-                this.specularTexture.dispose();
-            }
-
-            if (this.bumpTexture) {
-                this.bumpTexture.dispose();
-            }
-
-            super.dispose(forceDisposeEffect);
-        }
-
-        public clone(name: string): StandardMaterial {
-            var newStandardMaterial = new BABYLON.StandardMaterial(name, this.getScene());
-
-            // Base material
-            newStandardMaterial.checkReadyOnEveryCall = this.checkReadyOnEveryCall;
-            newStandardMaterial.alpha = this.alpha;
-            newStandardMaterial.fillMode = this.fillMode;
-            newStandardMaterial.backFaceCulling = this.backFaceCulling;
-
-            // Standard material
-            if (this.diffuseTexture && this.diffuseTexture.clone) {
-                newStandardMaterial.diffuseTexture = this.diffuseTexture.clone();
-            }
-            if (this.ambientTexture && this.ambientTexture.clone) {
-                newStandardMaterial.ambientTexture = this.ambientTexture.clone();
-            }
-            if (this.opacityTexture && this.opacityTexture.clone) {
-                newStandardMaterial.opacityTexture = this.opacityTexture.clone();
-            }
-            if (this.reflectionTexture && this.reflectionTexture.clone) {
-                newStandardMaterial.reflectionTexture = this.reflectionTexture.clone();
-            }
-            if (this.emissiveTexture && this.emissiveTexture.clone) {
-                newStandardMaterial.emissiveTexture = this.emissiveTexture.clone();
-            }
-            if (this.specularTexture && this.specularTexture.clone) {
-                newStandardMaterial.specularTexture = this.specularTexture.clone();
-            }
-            if (this.bumpTexture && this.bumpTexture.clone) {
-                newStandardMaterial.bumpTexture = this.bumpTexture.clone();
-            }
-
-            newStandardMaterial.ambientColor = this.ambientColor.clone();
-            newStandardMaterial.diffuseColor = this.diffuseColor.clone();
-            newStandardMaterial.specularColor = this.specularColor.clone();
-            newStandardMaterial.specularPower = this.specularPower;
-            newStandardMaterial.emissiveColor = this.emissiveColor.clone();
-
-            return newStandardMaterial;
-        }
-
-        // Statics
-        // Flags used to enable or disable a type of texture for all Standard Materials
-        public static DiffuseTextureEnabled = true;
-        public static AmbientTextureEnabled = true;
-        public static OpacityTextureEnabled = true;
-        public static ReflectionTextureEnabled = true;
-        public static EmissiveTextureEnabled = true;
-        public static SpecularTextureEnabled = true;
-        public static BumpTextureEnabled = true;
-    }
-} 

+ 0 - 133
Babylon/Materials/textures/Procedurals/babylon.customProceduralTexture.js

@@ -1,133 +0,0 @@
-var __extends = this.__extends || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    __.prototype = b.prototype;
-    d.prototype = new __();
-};
-var BABYLON;
-(function (BABYLON) {
-    var CustomProceduralTexture = (function (_super) {
-        __extends(CustomProceduralTexture, _super);
-        function CustomProceduralTexture(name, texturePath, size, scene, fallbackTexture, generateMipMaps) {
-            _super.call(this, name, size, "empty", scene, fallbackTexture, generateMipMaps);
-            this._animate = true;
-            this._time = 0;
-            this._shaderLoaded = false;
-            this._updateTexture = false;
-
-            this._texturePath = texturePath;
-
-            //readJson
-            this.loadJson(texturePath);
-
-            // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
-            this.refreshRate = 1;
-        }
-        CustomProceduralTexture.prototype.loadJson = function (jsonUrl) {
-            function noConfigFile() {
-                BABYLON.Tools.Log("No config file found in " + jsonUrl);
-            }
-
-            var that = this;
-            var configFileUrl = jsonUrl + "/config.json";
-            var xhr = new XMLHttpRequest();
-
-            xhr.open("GET", configFileUrl, true);
-            xhr.addEventListener("load", function () {
-                if (xhr.status === 200 || BABYLON.Tools.ValidateXHRData(xhr, 1)) {
-                    try  {
-                        that._config = JSON.parse(xhr.response);
-                        that._updateTexture = true;
-                        that._shaderLoaded = true;
-                    } catch (ex) {
-                        noConfigFile();
-                    }
-                } else {
-                    noConfigFile();
-                }
-            }, false);
-
-            xhr.addEventListener("error", function (event) {
-                noConfigFile();
-            }, false);
-
-            try  {
-                xhr.send();
-            } catch (ex) {
-                BABYLON.Tools.Error("Error on XHR send request.");
-            }
-        };
-
-        CustomProceduralTexture.prototype.render = function (useCameraPostProcess) {
-            //if config and shader not loaded, do not render
-            if (!this._shaderLoaded)
-                return;
-
-            if (this._updateTexture) {
-                this.reset();
-                this.setFragment(this._texturePath + "/custom");
-                this.updateTextures();
-                this.updateShaderUniforms();
-                this._shaderLoaded = true;
-                this._animate = this._config.animate;
-                this.refreshRate = this._config.refreshrate;
-                this.isReady();
-                this._updateTexture = false;
-                return;
-            }
-
-            if (this._animate) {
-                this._time += this.getScene().getAnimationRatio() * 0.03;
-                this.updateShaderUniforms();
-            }
-
-            _super.prototype.render.call(this, useCameraPostProcess);
-        };
-
-        CustomProceduralTexture.prototype.updateTextures = function () {
-            for (var i = 0; i < this._config.texture2Ds.length; i++) {
-                this.setTexture(this._config.texture2Ds[i].textureName, new BABYLON.Texture(this._texturePath + "/" + this._config.texture2Ds[i].textureRelativeUrl, this.getScene(), false, false, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, null, null, null, true));
-            }
-        };
-
-        CustomProceduralTexture.prototype.updateShaderUniforms = function () {
-            for (var j = 0; j < this._config.uniforms.length; j++) {
-                var uniform = this._config.uniforms[j];
-
-                switch (uniform.type) {
-                    case "float":
-                        this.setFloat(uniform.name, uniform.value);
-                        break;
-                    case "color3":
-                        this.setColor3(uniform.name, new BABYLON.Color3(uniform.r, uniform.g, uniform.b));
-                        break;
-                    case "color4":
-                        this.setColor4(uniform.name, new BABYLON.Color4(uniform.r, uniform.g, uniform.b, uniform.a));
-                        break;
-                    case "vector2":
-                        this.setVector2(uniform.name, new BABYLON.Vector2(uniform.x, uniform.y));
-                        break;
-                    case "vector3":
-                        this.setVector3(uniform.name, new BABYLON.Vector3(uniform.x, uniform.y, uniform.z));
-                        break;
-                }
-            }
-        };
-
-        Object.defineProperty(CustomProceduralTexture.prototype, "animate", {
-            get: function () {
-                return this._animate;
-            },
-            set: function (value) {
-                this._animate = value;
-                this.updateShaderUniforms();
-            },
-            enumerable: true,
-            configurable: true
-        });
-
-        return CustomProceduralTexture;
-    })(BABYLON.ProceduralTexture);
-    BABYLON.CustomProceduralTexture = CustomProceduralTexture;
-})(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.customProceduralTexture.js.map

+ 0 - 0
Babylon/Materials/textures/Procedurals/babylon.customProceduralTexture.ts


Някои файлове не бяха показани, защото твърде много файлове са промени