소스 검색

Removed javascript files from src folder
updated all pg files to support dat.gui

David Catuhe 8 년 전
부모
커밋
40aeca4230
100개의 변경된 파일8개의 추가작업 그리고 24364개의 파일을 삭제
  1. 3 0
      .gitignore
  2. 2 1
      Playground/debug.html
  3. 1 1
      Playground/frame.html
  4. 1 0
      Playground/index-local.html
  5. 1 1
      Playground/index.html
  6. 0 131
      src/Actions/babylon.action.js
  7. 0 528
      src/Actions/babylon.actionManager.js
  8. 0 157
      src/Actions/babylon.condition.js
  9. 0 303
      src/Actions/babylon.directActions.js
  10. 0 77
      src/Actions/babylon.interpolateValueAction.js
  11. 0 147
      src/Animations/babylon.animatable.js
  12. 0 743
      src/Animations/babylon.animation.js
  13. 0 249
      src/Animations/babylon.easing.js
  14. 0 111
      src/Audio/babylon.analyser.js
  15. 0 115
      src/Audio/babylon.audioEngine.js
  16. 0 635
      src/Audio/babylon.sound.js
  17. 0 101
      src/Audio/babylon.soundtrack.js
  18. 0 526
      src/Bones/babylon.bone.js
  19. 0 140
      src/Bones/babylon.boneIKController.js
  20. 0 51
      src/Bones/babylon.boneLookController.js
  21. 0 355
      src/Bones/babylon.skeleton.js
  22. 0 71
      src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js
  23. 0 116
      src/Cameras/Inputs/babylon.arcrotatecamera.input.keyboard.js
  24. 0 57
      src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.js
  25. 0 219
      src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.js
  26. 0 48
      src/Cameras/Inputs/babylon.arcrotatecamera.input.vrdeviceorientation.js
  27. 0 69
      src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.js
  28. 0 66
      src/Cameras/Inputs/babylon.freecamera.input.gamepad.js
  29. 0 121
      src/Cameras/Inputs/babylon.freecamera.input.keyboard.js
  30. 0 123
      src/Cameras/Inputs/babylon.freecamera.input.mouse.js
  31. 0 122
      src/Cameras/Inputs/babylon.freecamera.input.touch.js
  32. 0 54
      src/Cameras/Inputs/babylon.freecamera.input.virtualjoystick.js
  33. 0 72
      src/Cameras/VR/babylon.vrCameraMetrics.js
  34. 0 39
      src/Cameras/VR/babylon.vrDeviceOrientationCamera.js
  35. 0 132
      src/Cameras/VR/babylon.webVRCamera.js
  36. 0 566
      src/Cameras/babylon.arcRotateCamera.js
  37. 0 36
      src/Cameras/babylon.arcRotateCameraInputsManager.js
  38. 0 722
      src/Cameras/babylon.camera.js
  39. 0 133
      src/Cameras/babylon.cameraInputsManager.js
  40. 0 51
      src/Cameras/babylon.deviceOrientationCamera.js
  41. 0 117
      src/Cameras/babylon.followCamera.js
  42. 0 185
      src/Cameras/babylon.freeCamera.js
  43. 0 41
      src/Cameras/babylon.freeCameraInputsManager.js
  44. 0 51
      src/Cameras/babylon.gamepadCamera.js
  45. 0 116
      src/Cameras/babylon.stereoscopicCameras.js
  46. 0 274
      src/Cameras/babylon.targetCamera.js
  47. 0 58
      src/Cameras/babylon.touchCamera.js
  48. 0 51
      src/Cameras/babylon.universalCamera.js
  49. 0 18
      src/Cameras/babylon.virtualJoysticksCamera.js
  50. 0 276
      src/Collisions/babylon.collider.js
  51. 0 273
      src/Collisions/babylon.collisionCoordinator.js
  52. 0 243
      src/Collisions/babylon.collisionWorker.js
  53. 0 76
      src/Collisions/babylon.pickingInfo.js
  54. 0 88
      src/Culling/Octrees/babylon.octree.js
  55. 0 122
      src/Culling/Octrees/babylon.octreeBlock.js
  56. 0 143
      src/Culling/babylon.boundingBox.js
  57. 0 119
      src/Culling/babylon.boundingInfo.js
  58. 0 49
      src/Culling/babylon.boundingSphere.js
  59. 0 274
      src/Culling/babylon.ray.js
  60. 0 682
      src/Debug/babylon.debugLayer.js
  61. 0 127
      src/Debug/babylon.skeletonViewer.js
  62. 0 624
      src/Layer/babylon.highlightlayer.js
  63. 0 140
      src/Layer/babylon.layer.js
  64. 0 24
      src/LensFlare/babylon.lensFlare.js
  65. 0 235
      src/LensFlare/babylon.lensFlareSystem.js
  66. 0 425
      src/Lights/Shadows/babylon.shadowGenerator.js
  67. 0 129
      src/Lights/babylon.directionalLight.js
  68. 0 51
      src/Lights/babylon.hemisphericLight.js
  69. 0 239
      src/Lights/babylon.light.js
  70. 0 87
      src/Lights/babylon.pointLight.js
  71. 0 104
      src/Lights/babylon.spotLight.js
  72. 0 495
      src/Loading/Plugins/babylon.babylonFileLoader.js
  73. 0 290
      src/Loading/babylon.sceneLoader.js
  74. 0 124
      src/Materials/Textures/Procedurals/babylon.customProceduralTexture.js
  75. 0 284
      src/Materials/Textures/Procedurals/babylon.proceduralTexture.js
  76. 0 198
      src/Materials/Textures/babylon.baseTexture.js
  77. 0 212
      src/Materials/Textures/babylon.colorGradingTexture.js
  78. 0 92
      src/Materials/Textures/babylon.cubeTexture.js
  79. 0 93
      src/Materials/Textures/babylon.dynamicTexture.js
  80. 0 482
      src/Materials/Textures/babylon.fontTexture.js
  81. 0 448
      src/Materials/Textures/babylon.hdrCubeTexture.js
  82. 0 111
      src/Materials/Textures/babylon.mapTexture.js
  83. 0 54
      src/Materials/Textures/babylon.mirrorTexture.js
  84. 0 57
      src/Materials/Textures/babylon.rawTexture.js
  85. 0 52
      src/Materials/Textures/babylon.refractionTexture.js
  86. 0 372
      src/Materials/Textures/babylon.renderTargetTexture.js
  87. 0 321
      src/Materials/Textures/babylon.texture.js
  88. 0 83
      src/Materials/Textures/babylon.videoTexture.js
  89. 0 545
      src/Materials/babylon.colorCurves.js
  90. 0 580
      src/Materials/babylon.effect.js
  91. 0 37
      src/Materials/babylon.fresnelParameters.js
  92. 0 379
      src/Materials/babylon.material.js
  93. 0 267
      src/Materials/babylon.materialHelper.js
  94. 0 68
      src/Materials/babylon.multiMaterial.js
  95. 0 1268
      src/Materials/babylon.pbrMaterial.js
  96. 0 402
      src/Materials/babylon.shaderMaterial.js
  97. 0 897
      src/Materials/babylon.standardMaterial.js
  98. 0 240
      src/Math/babylon.math.SIMD.js
  99. 0 3283
      src/Math/babylon.math.js
  100. 0 0
      src/Mesh/babylon.abstractMesh.js

+ 3 - 0
.gitignore

@@ -14,6 +14,9 @@ TestResults
 *.sln.docstates
 *.map
 
+# javascript files
+src/**/*.js
+
 # Build results
 [Dd]ebug/
 [Rr]elease/

+ 2 - 1
Playground/debug.html

@@ -2,7 +2,8 @@
 <html>
 <head>
     <title>Babylon.js Playground</title>
-    <script src="http://www.babylonjs.com/poly2tri.js"></script>
+    <script src="http://www.babylonjs.com/poly2tri.js"></script>    
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
     <!--x-tag-->
     <script src="xtag.min.js"></script>
     <script src="splitbox.js"></script>

+ 1 - 1
Playground/frame.html

@@ -3,7 +3,7 @@
 <head>
     <title>Babylon.js Playground</title>
     <script src="hand.minified-1.2.js"></script>
-    <script src="http://www.babylonjs.com/poly2tri.js"></script>
+    <script src="http://www.babylonjs.com/poly2tri.js"></script>    
     <!-- Babylon.js -->    
     <script src="http://www.babylonjs.com/cannon.js"></script>
     <script src="http://www.babylonjs.com/Oimo.js"></script>

+ 1 - 0
Playground/index-local.html

@@ -3,6 +3,7 @@
 <head>
     <title>Babylon.js Playground</title>
     <script src="http://www.babylonjs.com/poly2tri.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
     <!--x-tag-->
     <script src="xtag.min.js"></script>
     <script src="splitbox.js"></script>

+ 1 - 1
Playground/index.html

@@ -13,6 +13,7 @@
     <!-- Bootstrap -->
     <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
     <script src="node_modules/monaco-editor/min/vs/loader.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
     <!-- Babylon.js -->
     <script src="http://www.babylonjs.com/cannon.js"></script>
     <script src="http://www.babylonjs.com/Oimo.js"></script>
@@ -39,7 +40,6 @@
     <script src="http://www.babylonjs.com/lib/babylon.roadProceduralTexture.min.js"></script>
     <script src="http://www.babylonjs.com/lib/babylon.starfieldProceduralTexture.min.js"></script>
     <script src="http://www.babylonjs.com/lib/babylon.woodProceduralTexture.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
     <link href="index.css" rel="stylesheet" />
 </head>
 <body>

+ 0 - 131
src/Actions/babylon.action.js

@@ -1,131 +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._nextActiveAction._condition) {
-                var condition = this._nextActiveAction._condition;
-                var currentRenderId = this._actionManager.getScene().getRenderId();
-                // We cache the current evaluation for the current frame
-                if (condition._evaluationId === currentRenderId) {
-                    if (!condition._currentResult) {
-                        return;
-                    }
-                }
-                else {
-                    condition._evaluationId = currentRenderId;
-                    if (!condition.isValid()) {
-                        condition._currentResult = false;
-                        return;
-                    }
-                    condition._currentResult = true;
-                }
-            }
-            this._nextActiveAction.execute(evt);
-            this.skipToNextActiveAction();
-        };
-        Action.prototype.execute = function (evt) {
-        };
-        Action.prototype.skipToNextActiveAction = function () {
-            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.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);
-        };
-        Action.prototype.serialize = function (parent) {
-        };
-        // Called by BABYLON.Action objects in serialize(...). Internal use
-        Action.prototype._serialize = function (serializedAction, parent) {
-            var serializationObject = {
-                type: 1,
-                children: [],
-                name: serializedAction.name,
-                properties: serializedAction.properties || []
-            };
-            // Serialize child
-            if (this._child) {
-                this._child.serialize(serializationObject);
-            }
-            // Check if "this" has a condition
-            if (this._condition) {
-                var serializedCondition = this._condition.serialize();
-                serializedCondition.children.push(serializationObject);
-                if (parent) {
-                    parent.children.push(serializedCondition);
-                }
-                return serializedCondition;
-            }
-            if (parent) {
-                parent.children.push(serializationObject);
-            }
-            return serializationObject;
-        };
-        Action._SerializeValueAsString = function (value) {
-            if (typeof value === "number") {
-                return value.toString();
-            }
-            if (typeof value === "boolean") {
-                return value ? "true" : "false";
-            }
-            if (value instanceof BABYLON.Vector2) {
-                return value.x + ", " + value.y;
-            }
-            if (value instanceof BABYLON.Vector3) {
-                return value.x + ", " + value.y + ", " + value.z;
-            }
-            if (value instanceof BABYLON.Color3) {
-                return value.r + ", " + value.g + ", " + value.b;
-            }
-            if (value instanceof BABYLON.Color4) {
-                return value.r + ", " + value.g + ", " + value.b + ", " + value.a;
-            }
-            return value; // string
-        };
-        Action._GetTargetProperty = function (target) {
-            return {
-                name: "target",
-                targetType: target instanceof BABYLON.Mesh ? "MeshProperties"
-                    : target instanceof BABYLON.Light ? "LightProperties"
-                        : target instanceof BABYLON.Camera ? "CameraProperties"
-                            : "SceneProperties",
-                value: target instanceof BABYLON.Scene ? "Scene" : target.name
-            };
-        };
-        return Action;
-    }());
-    BABYLON.Action = Action;
-})(BABYLON || (BABYLON = {}));

+ 0 - 528
src/Actions/babylon.actionManager.js

@@ -1,528 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    /**
-     * ActionEvent is the event beint sent when an action is triggered.
-     */
-    var ActionEvent = (function () {
-        /**
-         * @constructor
-         * @param source The mesh or sprite that triggered the action.
-         * @param pointerX The X mouse cursor position at the time of the event
-         * @param pointerY The Y mouse cursor position at the time of the event
-         * @param meshUnderPointer The mesh that is currently pointed at (can be null)
-         * @param sourceEvent the original (browser) event that triggered the ActionEvent
-         */
-        function ActionEvent(source, pointerX, pointerY, meshUnderPointer, sourceEvent, additionalData) {
-            this.source = source;
-            this.pointerX = pointerX;
-            this.pointerY = pointerY;
-            this.meshUnderPointer = meshUnderPointer;
-            this.sourceEvent = sourceEvent;
-            this.additionalData = additionalData;
-        }
-        /**
-         * Helper function to auto-create an ActionEvent from a source mesh.
-         * @param source The source mesh that triggered the event
-         * @param evt {Event} The original (browser) event
-         */
-        ActionEvent.CreateNew = function (source, evt, additionalData) {
-            var scene = source.getScene();
-            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
-        };
-        /**
-         * Helper function to auto-create an ActionEvent from a source mesh.
-         * @param source The source sprite that triggered the event
-         * @param scene Scene associated with the sprite
-         * @param evt {Event} The original (browser) event
-         */
-        ActionEvent.CreateNewFromSprite = function (source, scene, evt, additionalData) {
-            return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
-        };
-        /**
-         * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
-         * @param scene the scene where the event occurred
-         * @param evt {Event} The original (browser) event
-         */
-        ActionEvent.CreateNewFromScene = function (scene, evt) {
-            return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
-        };
-        ActionEvent.CreateNewFromPrimitive = function (prim, pointerPos, evt, additionalData) {
-            return new ActionEvent(prim, pointerPos.x, pointerPos.y, null, evt, additionalData);
-        };
-        return ActionEvent;
-    }());
-    BABYLON.ActionEvent = ActionEvent;
-    /**
-     * Action Manager manages all events to be triggered on a given mesh or the global scene.
-     * A single scene can have many Action Managers to handle predefined actions on specific meshes.
-     */
-    var ActionManager = (function () {
-        function ActionManager(scene) {
-            // Members
-            this.actions = new Array();
-            this.hoverCursor = '';
-            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, "OnPickDownTrigger", {
-            get: function () {
-                return ActionManager._OnPickDownTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ActionManager, "OnPickUpTrigger", {
-            get: function () {
-                return ActionManager._OnPickUpTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ActionManager, "OnPickOutTrigger", {
-            /// This trigger will only be raised if you also declared a OnPickDown
-            get: function () {
-                return ActionManager._OnPickOutTrigger;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ActionManager, "OnLongPressTrigger", {
-            get: function () {
-                return ActionManager._OnLongPressTrigger;
-            },
-            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;
-        };
-        /**
-         * Does this action manager handles actions of any of the given triggers
-         * @param {number[]} triggers - the triggers to be tested
-         * @return {boolean} whether one (or more) of the triggers is handeled
-         */
-        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;
-        };
-        /**
-         * Does this action manager handles actions of a given trigger
-         * @param {number} trigger - the trigger to be tested
-         * @return {boolean} whether the trigger is handeled
-         */
-        ActionManager.prototype.hasSpecificTrigger = function (trigger) {
-            for (var index = 0; index < this.actions.length; index++) {
-                var action = this.actions[index];
-                if (action.trigger === trigger) {
-                    return true;
-                }
-            }
-            return false;
-        };
-        Object.defineProperty(ActionManager.prototype, "hasPointerTriggers", {
-            /**
-             * Does this action manager has pointer triggers
-             * @return {boolean} whether or not it has pointer triggers
-             */
-            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", {
-            /**
-             * Does this action manager has pick triggers
-             * @return {boolean} whether or not it has pick triggers
-             */
-            get: function () {
-                for (var index = 0; index < this.actions.length; index++) {
-                    var action = this.actions[index];
-                    if (action.trigger >= ActionManager._OnPickTrigger && action.trigger <= ActionManager._OnPickUpTrigger) {
-                        return true;
-                    }
-                }
-                return false;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
-         * Registers an action to this action manager
-         * @param {BABYLON.Action} action - the action to be registered
-         * @return {BABYLON.Action} the action amended (prepared) after registration
-         */
-        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;
-        };
-        /**
-         * Process a specific trigger
-         * @param {number} trigger - the trigger to process
-         * @param evt {BABYLON.ActionEvent} the event details to be processed
-         */
-        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) {
-                            var unicode = evt.sourceEvent.charCode ? evt.sourceEvent.charCode : evt.sourceEvent.keyCode;
-                            var actualkey = String.fromCharCode(unicode).toLowerCase();
-                            if (actualkey !== parameter.toLowerCase()) {
-                                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.prototype.serialize = function (name) {
-            var root = {
-                children: [],
-                name: name,
-                type: 3,
-                properties: [] // Empty for root but required
-            };
-            for (var i = 0; i < this.actions.length; i++) {
-                var triggerObject = {
-                    type: 0,
-                    children: [],
-                    name: ActionManager.GetTriggerName(this.actions[i].trigger),
-                    properties: []
-                };
-                var triggerOptions = this.actions[i].triggerOptions;
-                if (triggerOptions && typeof triggerOptions !== "number") {
-                    if (triggerOptions.parameter instanceof BABYLON.Node) {
-                        triggerObject.properties.push(BABYLON.Action._GetTargetProperty(triggerOptions.parameter));
-                    }
-                    else {
-                        triggerObject.properties.push({ name: "parameter", targetType: null, value: triggerOptions.parameter });
-                    }
-                }
-                // Serialize child action, recursively
-                this.actions[i].serialize(triggerObject);
-                // Add serialized trigger
-                root.children.push(triggerObject);
-            }
-            return root;
-        };
-        ActionManager.Parse = function (parsedActions, object, scene) {
-            var actionManager = new BABYLON.ActionManager(scene);
-            if (object === null)
-                scene.actionManager = actionManager;
-            else
-                object.actionManager = actionManager;
-            // instanciate a new object
-            var instanciate = function (name, params) {
-                var newInstance = Object.create(BABYLON[name].prototype);
-                newInstance.constructor.apply(newInstance, params);
-                return newInstance;
-            };
-            var parseParameter = function (name, value, target, propertyPath) {
-                if (propertyPath === null) {
-                    // String, boolean or float
-                    var floatValue = parseFloat(value);
-                    if (value === "true" || value === "false")
-                        return value === "true";
-                    else
-                        return isNaN(floatValue) ? value : floatValue;
-                }
-                var effectiveTarget = propertyPath.split(".");
-                var values = value.split(",");
-                // Get effective Target
-                for (var i = 0; i < effectiveTarget.length; i++) {
-                    target = target[effectiveTarget[i]];
-                }
-                // Return appropriate value with its type
-                if (typeof (target) === "boolean")
-                    return values[0] === "true";
-                if (typeof (target) === "string")
-                    return values[0];
-                // Parameters with multiple values such as Vector3 etc.
-                var split = new Array();
-                for (var i = 0; i < values.length; i++)
-                    split.push(parseFloat(values[i]));
-                if (target instanceof BABYLON.Vector3)
-                    return BABYLON.Vector3.FromArray(split);
-                if (target instanceof BABYLON.Vector4)
-                    return BABYLON.Vector4.FromArray(split);
-                if (target instanceof BABYLON.Color3)
-                    return BABYLON.Color3.FromArray(split);
-                if (target instanceof BABYLON.Color4)
-                    return BABYLON.Color4.FromArray(split);
-                return parseFloat(values[0]);
-            };
-            // traverse graph per trigger
-            var traverse = function (parsedAction, trigger, condition, action, combineArray) {
-                if (combineArray === void 0) { combineArray = null; }
-                if (parsedAction.detached)
-                    return;
-                var parameters = new Array();
-                var target = null;
-                var propertyPath = null;
-                var combine = parsedAction.combine && parsedAction.combine.length > 0;
-                // Parameters
-                if (parsedAction.type === 2)
-                    parameters.push(actionManager);
-                else
-                    parameters.push(trigger);
-                if (combine) {
-                    var actions = new Array();
-                    for (var j = 0; j < parsedAction.combine.length; j++) {
-                        traverse(parsedAction.combine[j], ActionManager.NothingTrigger, condition, action, actions);
-                    }
-                    parameters.push(actions);
-                }
-                else {
-                    for (var i = 0; i < parsedAction.properties.length; i++) {
-                        var value = parsedAction.properties[i].value;
-                        var name = parsedAction.properties[i].name;
-                        var targetType = parsedAction.properties[i].targetType;
-                        if (name === "target")
-                            if (targetType !== null && targetType === "SceneProperties")
-                                value = target = scene;
-                            else
-                                value = target = scene.getNodeByName(value);
-                        else if (name === "parent")
-                            value = scene.getNodeByName(value);
-                        else if (name === "sound")
-                            value = scene.getSoundByName(value);
-                        else if (name !== "propertyPath") {
-                            if (parsedAction.type === 2 && name === "operator")
-                                value = BABYLON.ValueCondition[value];
-                            else
-                                value = parseParameter(name, value, target, name === "value" ? propertyPath : null);
-                        }
-                        else {
-                            propertyPath = value;
-                        }
-                        parameters.push(value);
-                    }
-                }
-                if (combineArray === null) {
-                    parameters.push(condition);
-                }
-                else {
-                    parameters.push(null);
-                }
-                // If interpolate value action
-                if (parsedAction.name === "InterpolateValueAction") {
-                    var param = parameters[parameters.length - 2];
-                    parameters[parameters.length - 1] = param;
-                    parameters[parameters.length - 2] = condition;
-                }
-                // Action or condition(s) and not CombineAction
-                var newAction = instanciate(parsedAction.name, parameters);
-                if (newAction instanceof BABYLON.Condition && condition !== null) {
-                    var nothing = new BABYLON.DoNothingAction(trigger, condition);
-                    if (action)
-                        action.then(nothing);
-                    else
-                        actionManager.registerAction(nothing);
-                    action = nothing;
-                }
-                if (combineArray === null) {
-                    if (newAction instanceof BABYLON.Condition) {
-                        condition = newAction;
-                        newAction = action;
-                    }
-                    else {
-                        condition = null;
-                        if (action)
-                            action.then(newAction);
-                        else
-                            actionManager.registerAction(newAction);
-                    }
-                }
-                else {
-                    combineArray.push(newAction);
-                }
-                for (var i = 0; i < parsedAction.children.length; i++)
-                    traverse(parsedAction.children[i], trigger, condition, newAction, null);
-            };
-            // triggers
-            for (var i = 0; i < parsedActions.children.length; i++) {
-                var triggerParams;
-                var trigger = parsedActions.children[i];
-                if (trigger.properties.length > 0) {
-                    var param = trigger.properties[0].value;
-                    var value = trigger.properties[0].targetType === null ? param : scene.getMeshByName(param);
-                    triggerParams = { trigger: BABYLON.ActionManager[trigger.name], parameter: value };
-                }
-                else
-                    triggerParams = BABYLON.ActionManager[trigger.name];
-                for (var j = 0; j < trigger.children.length; j++) {
-                    if (!trigger.detached)
-                        traverse(trigger.children[j], triggerParams, null, null);
-                }
-            }
-        };
-        ActionManager.GetTriggerName = function (trigger) {
-            switch (trigger) {
-                case 0: return "NothingTrigger";
-                case 1: return "OnPickTrigger";
-                case 2: return "OnLeftPickTrigger";
-                case 3: return "OnRightPickTrigger";
-                case 4: return "OnCenterPickTrigger";
-                case 5: return "OnPickDownTrigger";
-                case 6: return "OnPickUpTrigger";
-                case 7: return "OnLongPressTrigger";
-                case 8: return "OnPointerOverTrigger";
-                case 9: return "OnPointerOutTrigger";
-                case 10: return "OnEveryFrameTrigger";
-                case 11: return "OnIntersectionEnterTrigger";
-                case 12: return "OnIntersectionExitTrigger";
-                case 13: return "OnKeyDownTrigger";
-                case 14: return "OnKeyUpTrigger";
-                case 15: return "OnPickOutTrigger";
-                default: return "";
-            }
-        };
-        // Statics
-        ActionManager._NothingTrigger = 0;
-        ActionManager._OnPickTrigger = 1;
-        ActionManager._OnLeftPickTrigger = 2;
-        ActionManager._OnRightPickTrigger = 3;
-        ActionManager._OnCenterPickTrigger = 4;
-        ActionManager._OnPickDownTrigger = 5;
-        ActionManager._OnPickUpTrigger = 6;
-        ActionManager._OnLongPressTrigger = 7;
-        ActionManager._OnPointerOverTrigger = 8;
-        ActionManager._OnPointerOutTrigger = 9;
-        ActionManager._OnEveryFrameTrigger = 10;
-        ActionManager._OnIntersectionEnterTrigger = 11;
-        ActionManager._OnIntersectionExitTrigger = 12;
-        ActionManager._OnKeyDownTrigger = 13;
-        ActionManager._OnKeyUpTrigger = 14;
-        ActionManager._OnPickOutTrigger = 15;
-        ActionManager.DragMovementThreshold = 10; // in pixels
-        ActionManager.LongPressDelay = 500; // in milliseconds
-        return ActionManager;
-    }());
-    BABYLON.ActionManager = ActionManager;
-})(BABYLON || (BABYLON = {}));

+ 0 - 157
src/Actions/babylon.condition.js

@@ -1,157 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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);
-        };
-        Condition.prototype.serialize = function () {
-        };
-        Condition.prototype._serialize = function (serializedCondition) {
-            return {
-                type: 2,
-                children: [],
-                name: serializedCondition.name,
-                properties: serializedCondition.properties
-            };
-        };
-        return Condition;
-    }());
-    BABYLON.Condition = Condition;
-    var ValueCondition = (function (_super) {
-        __extends(ValueCondition, _super);
-        function ValueCondition(actionManager, target, propertyPath, value, operator) {
-            if (operator === void 0) { operator = ValueCondition.IsEqual; }
-            _super.call(this, actionManager);
-            this.propertyPath = propertyPath;
-            this.value = value;
-            this.operator = operator;
-            this._target = target;
-            this._effectiveTarget = 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._effectiveTarget[this._property] > this.value;
-                case ValueCondition.IsLesser:
-                    return this._effectiveTarget[this._property] < this.value;
-                case ValueCondition.IsEqual:
-                case ValueCondition.IsDifferent:
-                    var check;
-                    if (this.value.equals) {
-                        check = this.value.equals(this._effectiveTarget[this._property]);
-                    }
-                    else {
-                        check = this.value === this._effectiveTarget[this._property];
-                    }
-                    return this.operator === ValueCondition.IsEqual ? check : !check;
-            }
-            return false;
-        };
-        ValueCondition.prototype.serialize = function () {
-            return this._serialize({
-                name: "ValueCondition",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    { name: "propertyPath", value: this.propertyPath },
-                    { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) },
-                    { name: "operator", value: ValueCondition.GetOperatorName(this.operator) }
-                ]
-            });
-        };
-        ValueCondition.GetOperatorName = function (operator) {
-            switch (operator) {
-                case ValueCondition._IsEqual: return "IsEqual";
-                case ValueCondition._IsDifferent: return "IsDifferent";
-                case ValueCondition._IsGreater: return "IsGreater";
-                case ValueCondition._IsLesser: return "IsLesser";
-                default: return "";
-            }
-        };
-        // Statics
-        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;
-        };
-        StateCondition.prototype.serialize = function () {
-            return this._serialize({
-                name: "StateCondition",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    { name: "value", value: this.value }
-                ]
-            });
-        };
-        return StateCondition;
-    }(Condition));
-    BABYLON.StateCondition = StateCondition;
-})(BABYLON || (BABYLON = {}));

+ 0 - 303
src/Actions/babylon.directActions.js

@@ -1,303 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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 = this._effectiveTarget = target;
-        }
-        SwitchBooleanAction.prototype._prepare = function () {
-            this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        };
-        SwitchBooleanAction.prototype.execute = function () {
-            this._effectiveTarget[this._property] = !this._effectiveTarget[this._property];
-        };
-        SwitchBooleanAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "SwitchBooleanAction",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    { name: "propertyPath", value: this.propertyPath }
-                ]
-            }, parent);
-        };
-        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;
-        };
-        SetStateAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "SetStateAction",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    { name: "value", value: this.value }
-                ]
-            }, parent);
-        };
-        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 = this._effectiveTarget = target;
-        }
-        SetValueAction.prototype._prepare = function () {
-            this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        };
-        SetValueAction.prototype.execute = function () {
-            this._effectiveTarget[this._property] = this.value;
-            if (this._target.markAsDirty) {
-                this._target.markAsDirty(this._property);
-            }
-        };
-        SetValueAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "SetValueAction",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    { name: "propertyPath", value: this.propertyPath },
-                    { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) }
-                ]
-            }, parent);
-        };
-        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 = this._effectiveTarget = target;
-        }
-        IncrementValueAction.prototype._prepare = function () {
-            this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-            if (typeof this._effectiveTarget[this._property] !== "number") {
-                BABYLON.Tools.Warn("Warning: IncrementValueAction can only be used with number values");
-            }
-        };
-        IncrementValueAction.prototype.execute = function () {
-            this._effectiveTarget[this._property] += this.value;
-            if (this._target.markAsDirty) {
-                this._target.markAsDirty(this._property);
-            }
-        };
-        IncrementValueAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "IncrementValueAction",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    { name: "propertyPath", value: this.propertyPath },
-                    { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) }
-                ]
-            }, parent);
-        };
-        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);
-        };
-        PlayAnimationAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "PlayAnimationAction",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    { name: "from", value: String(this.from) },
-                    { name: "to", value: String(this.to) },
-                    { name: "loop", value: BABYLON.Action._SerializeValueAsString(this.loop) || false }
-                ]
-            }, parent);
-        };
-        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);
-        };
-        StopAnimationAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "StopAnimationAction",
-                properties: [BABYLON.Action._GetTargetProperty(this._target)]
-            }, parent);
-        };
-        return StopAnimationAction;
-    }(BABYLON.Action));
-    BABYLON.StopAnimationAction = StopAnimationAction;
-    var DoNothingAction = (function (_super) {
-        __extends(DoNothingAction, _super);
-        function DoNothingAction(triggerOptions, condition) {
-            if (triggerOptions === void 0) { triggerOptions = BABYLON.ActionManager.NothingTrigger; }
-            _super.call(this, triggerOptions, condition);
-        }
-        DoNothingAction.prototype.execute = function () {
-        };
-        DoNothingAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "DoNothingAction",
-                properties: []
-            }, parent);
-        };
-        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);
-            }
-        };
-        CombineAction.prototype.serialize = function (parent) {
-            var serializationObject = _super.prototype._serialize.call(this, {
-                name: "CombineAction",
-                properties: [],
-                combine: []
-            }, parent);
-            for (var i = 0; i < this.children.length; i++) {
-                serializationObject.combine.push(this.children[i].serialize(null));
-            }
-            return serializationObject;
-        };
-        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;
-        };
-        SetParentAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "SetParentAction",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    BABYLON.Action._GetTargetProperty(this._parent),
-                ]
-            }, parent);
-        };
-        return SetParentAction;
-    }(BABYLON.Action));
-    BABYLON.SetParentAction = SetParentAction;
-    var PlaySoundAction = (function (_super) {
-        __extends(PlaySoundAction, _super);
-        function PlaySoundAction(triggerOptions, sound, condition) {
-            _super.call(this, triggerOptions, condition);
-            this._sound = sound;
-        }
-        PlaySoundAction.prototype._prepare = function () {
-        };
-        PlaySoundAction.prototype.execute = function () {
-            if (this._sound !== undefined)
-                this._sound.play();
-        };
-        PlaySoundAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "PlaySoundAction",
-                properties: [{ name: "sound", value: this._sound.name }]
-            }, parent);
-        };
-        return PlaySoundAction;
-    }(BABYLON.Action));
-    BABYLON.PlaySoundAction = PlaySoundAction;
-    var StopSoundAction = (function (_super) {
-        __extends(StopSoundAction, _super);
-        function StopSoundAction(triggerOptions, sound, condition) {
-            _super.call(this, triggerOptions, condition);
-            this._sound = sound;
-        }
-        StopSoundAction.prototype._prepare = function () {
-        };
-        StopSoundAction.prototype.execute = function () {
-            if (this._sound !== undefined)
-                this._sound.stop();
-        };
-        StopSoundAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "StopSoundAction",
-                properties: [{ name: "sound", value: this._sound.name }]
-            }, parent);
-        };
-        return StopSoundAction;
-    }(BABYLON.Action));
-    BABYLON.StopSoundAction = StopSoundAction;
-})(BABYLON || (BABYLON = {}));

+ 0 - 77
src/Actions/babylon.interpolateValueAction.js

@@ -1,77 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var InterpolateValueAction = (function (_super) {
-        __extends(InterpolateValueAction, _super);
-        function InterpolateValueAction(triggerOptions, target, propertyPath, value, duration, condition, stopOtherAnimations, onInterpolationDone) {
-            if (duration === void 0) { duration = 1000; }
-            _super.call(this, triggerOptions, condition);
-            this.propertyPath = propertyPath;
-            this.value = value;
-            this.duration = duration;
-            this.stopOtherAnimations = stopOtherAnimations;
-            this.onInterpolationDone = onInterpolationDone;
-            this._target = this._effectiveTarget = target;
-        }
-        InterpolateValueAction.prototype._prepare = function () {
-            this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
-            this._property = this._getProperty(this.propertyPath);
-        };
-        InterpolateValueAction.prototype.execute = function () {
-            var scene = this._actionManager.getScene();
-            var keys = [
-                {
-                    frame: 0,
-                    value: this._effectiveTarget[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._effectiveTarget);
-            }
-            scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, this.onInterpolationDone);
-        };
-        InterpolateValueAction.prototype.serialize = function (parent) {
-            return _super.prototype._serialize.call(this, {
-                name: "InterpolateValueAction",
-                properties: [
-                    BABYLON.Action._GetTargetProperty(this._target),
-                    { name: "propertyPath", value: this.propertyPath },
-                    { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) },
-                    { name: "duration", value: BABYLON.Action._SerializeValueAsString(this.duration) },
-                    { name: "stopOtherAnimations", value: BABYLON.Action._SerializeValueAsString(this.stopOtherAnimations) || false }
-                ]
-            }, parent);
-        };
-        return InterpolateValueAction;
-    }(BABYLON.Action));
-    BABYLON.InterpolateValueAction = InterpolateValueAction;
-})(BABYLON || (BABYLON = {}));

+ 0 - 147
src/Animations/babylon.animatable.js

@@ -1,147 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Animatable = (function () {
-        function Animatable(scene, target, fromFrame, toFrame, loopAnimation, speedRatio, onAnimationEnd, animations) {
-            if (fromFrame === void 0) { fromFrame = 0; }
-            if (toFrame === void 0) { toFrame = 100; }
-            if (loopAnimation === void 0) { loopAnimation = false; }
-            if (speedRatio === void 0) { 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.getAnimations = function () {
-            return this._animations;
-        };
-        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.reset = function () {
-            var animations = this._animations;
-            for (var index = 0; index < animations.length; index++) {
-                animations[index].reset();
-            }
-            this._localDelayOffset = null;
-            this._pausedDelay = null;
-        };
-        Animatable.prototype.enableBlending = function (blendingSpeed) {
-            var animations = this._animations;
-            for (var index = 0; index < animations.length; index++) {
-                animations[index].enableBlending = true;
-                animations[index].blendingSpeed = blendingSpeed;
-            }
-        };
-        Animatable.prototype.disableBlending = function () {
-            var animations = this._animations;
-            for (var index = 0; index < animations.length; index++) {
-                animations[index].enableBlending = false;
-            }
-        };
-        Animatable.prototype.goToFrame = function (frame) {
-            var animations = this._animations;
-            if (animations[0]) {
-                var fps = animations[0].framePerSecond;
-                var currentFrame = animations[0].currentFrame;
-                var adjustTime = frame - currentFrame;
-                var delay = adjustTime * 1000 / fps;
-                this._localDelayOffset -= delay;
-            }
-            for (var index = 0; index < animations.length; index++) {
-                animations[index].goToFrame(frame);
-            }
-        };
-        Animatable.prototype.pause = function () {
-            if (this._paused) {
-                return;
-            }
-            this._paused = true;
-        };
-        Animatable.prototype.restart = function () {
-            this._paused = false;
-        };
-        Animatable.prototype.stop = function (animationName) {
-            var index = this._scene._activeAnimatables.indexOf(this);
-            if (index > -1) {
-                var animations = this._animations;
-                var numberOfAnimationsStopped = 0;
-                for (var index = animations.length - 1; index >= 0; index--) {
-                    if (typeof animationName === "string" && animations[index].name != animationName) {
-                        continue;
-                    }
-                    animations[index].reset();
-                    animations.splice(index, 1);
-                    numberOfAnimationsStopped++;
-                }
-                if (animations.length == numberOfAnimationsStopped) {
-                    this._scene._activeAnimatables.splice(index, 1);
-                    if (this.onAnimationEnd) {
-                        this.onAnimationEnd();
-                    }
-                }
-            }
-        };
-        Animatable.prototype._animate = function (delay) {
-            if (this._paused) {
-                this.animationStarted = false;
-                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;
-            var index;
-            for (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;
-            }
-            this.animationStarted = running;
-            if (!running) {
-                // Remove from active animatables
-                index = this._scene._activeAnimatables.indexOf(this);
-                this._scene._activeAnimatables.splice(index, 1);
-            }
-            if (!running && this.onAnimationEnd) {
-                this.onAnimationEnd();
-                this.onAnimationEnd = null;
-            }
-            return running;
-        };
-        return Animatable;
-    }());
-    BABYLON.Animatable = Animatable;
-})(BABYLON || (BABYLON = {}));

+ 0 - 743
src/Animations/babylon.animation.js

@@ -1,743 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var AnimationRange = (function () {
-        function AnimationRange(name, from, to) {
-            this.name = name;
-            this.from = from;
-            this.to = to;
-        }
-        AnimationRange.prototype.clone = function () {
-            return new AnimationRange(this.name, this.from, this.to);
-        };
-        return AnimationRange;
-    }());
-    BABYLON.AnimationRange = AnimationRange;
-    /**
-     * Composed of a frame, and an action function
-     */
-    var AnimationEvent = (function () {
-        function AnimationEvent(frame, action, onlyOnce) {
-            this.frame = frame;
-            this.action = action;
-            this.onlyOnce = onlyOnce;
-            this.isDone = false;
-        }
-        return AnimationEvent;
-    }());
-    BABYLON.AnimationEvent = AnimationEvent;
-    var PathCursor = (function () {
-        function PathCursor(path) {
-            this.path = path;
-            this._onchange = new Array();
-            this.value = 0;
-            this.animations = new Array();
-        }
-        PathCursor.prototype.getPoint = function () {
-            var point = this.path.getPointAtLengthPosition(this.value);
-            return new BABYLON.Vector3(point.x, 0, point.y);
-        };
-        PathCursor.prototype.moveAhead = function (step) {
-            if (step === void 0) { step = 0.002; }
-            this.move(step);
-            return this;
-        };
-        PathCursor.prototype.moveBack = function (step) {
-            if (step === void 0) { step = 0.002; }
-            this.move(-step);
-            return this;
-        };
-        PathCursor.prototype.move = function (step) {
-            if (Math.abs(step) > 1) {
-                throw "step size should be less than 1.";
-            }
-            this.value += step;
-            this.ensureLimits();
-            this.raiseOnChange();
-            return this;
-        };
-        PathCursor.prototype.ensureLimits = function () {
-            while (this.value > 1) {
-                this.value -= 1;
-            }
-            while (this.value < 0) {
-                this.value += 1;
-            }
-            return this;
-        };
-        // used by animation engine
-        PathCursor.prototype.markAsDirty = function (propertyName) {
-            this.ensureLimits();
-            this.raiseOnChange();
-            return this;
-        };
-        PathCursor.prototype.raiseOnChange = function () {
-            var _this = this;
-            this._onchange.forEach(function (f) { return f(_this); });
-            return this;
-        };
-        PathCursor.prototype.onchange = function (f) {
-            this._onchange.push(f);
-            return this;
-        };
-        return PathCursor;
-    }());
-    BABYLON.PathCursor = PathCursor;
-    var Animation = (function () {
-        function Animation(name, targetProperty, framePerSecond, dataType, loopMode, enableBlending) {
-            this.name = name;
-            this.targetProperty = targetProperty;
-            this.framePerSecond = framePerSecond;
-            this.dataType = dataType;
-            this.loopMode = loopMode;
-            this.enableBlending = enableBlending;
-            this._offsetsCache = {};
-            this._highLimitsCache = {};
-            this._stopped = false;
-            this._blendingFactor = 0;
-            // The set of event that will be linked to this animation
-            this._events = new Array();
-            this.allowMatricesInterpolation = false;
-            this.blendingSpeed = 0.01;
-            this._ranges = {};
-            this.targetPropertyPath = targetProperty.split(".");
-            this.dataType = dataType;
-            this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;
-        }
-        Animation._PrepareAnimation = function (name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction) {
-            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;
-            }
-            else if (from instanceof BABYLON.Size) {
-                dataType = Animation.ANIMATIONTYPE_SIZE;
-            }
-            if (dataType == undefined) {
-                return null;
-            }
-            var animation = new Animation(name, targetProperty, framePerSecond, dataType, loopMode);
-            var keys = [{ frame: 0, value: from }, { frame: totalFrame, value: to }];
-            animation.setKeys(keys);
-            if (easingFunction !== undefined) {
-                animation.setEasingFunction(easingFunction);
-            }
-            return animation;
-        };
-        Animation.CreateAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
-            var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);
-            return node.getScene().beginDirectAnimation(node, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);
-        };
-        Animation.CreateMergeAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
-            var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);
-            node.animations.push(animation);
-            return node.getScene().beginAnimation(node, 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);
-        };
-        // Methods
-        /**
-         * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
-         */
-        Animation.prototype.toString = function (fullDetails) {
-            var ret = "Name: " + this.name + ", property: " + this.targetProperty;
-            ret += ", datatype: " + (["Float", "Vector3", "Quaternion", "Matrix", "Color3", "Vector2"])[this.dataType];
-            ret += ", nKeys: " + (this._keys ? this._keys.length : "none");
-            ret += ", nRanges: " + (this._ranges ? Object.keys(this._ranges).length : "none");
-            if (fullDetails) {
-                ret += ", Ranges: {";
-                var first = true;
-                for (var name in this._ranges) {
-                    if (first) {
-                        ret += ", ";
-                        first = false;
-                    }
-                    ret += name;
-                }
-                ret += "}";
-            }
-            return ret;
-        };
-        /**
-         * Add an event to this animation.
-         */
-        Animation.prototype.addEvent = function (event) {
-            this._events.push(event);
-        };
-        /**
-         * Remove all events found at the given frame
-         * @param frame
-         */
-        Animation.prototype.removeEvents = function (frame) {
-            for (var index = 0; index < this._events.length; index++) {
-                if (this._events[index].frame === frame) {
-                    this._events.splice(index, 1);
-                    index--;
-                }
-            }
-        };
-        Animation.prototype.createRange = function (name, from, to) {
-            // check name not already in use; could happen for bones after serialized
-            if (!this._ranges[name]) {
-                this._ranges[name] = new AnimationRange(name, from, to);
-            }
-        };
-        Animation.prototype.deleteRange = function (name, deleteFrames) {
-            if (deleteFrames === void 0) { deleteFrames = true; }
-            if (this._ranges[name]) {
-                if (deleteFrames) {
-                    var from = this._ranges[name].from;
-                    var to = this._ranges[name].to;
-                    // this loop MUST go high to low for multiple splices to work
-                    for (var key = this._keys.length - 1; key >= 0; key--) {
-                        if (this._keys[key].frame >= from && this._keys[key].frame <= to) {
-                            this._keys.splice(key, 1);
-                        }
-                    }
-                }
-                this._ranges[name] = undefined; // said much faster than 'delete this._range[name]' 
-            }
-        };
-        Animation.prototype.getRange = function (name) {
-            return this._ranges[name];
-        };
-        Animation.prototype.reset = function () {
-            this._offsetsCache = {};
-            this._highLimitsCache = {};
-            this.currentFrame = 0;
-            this._blendingFactor = 0;
-            this._originalBlendValue = null;
-        };
-        Animation.prototype.isStopped = function () {
-            return this._stopped;
-        };
-        Animation.prototype.getKeys = function () {
-            return this._keys;
-        };
-        Animation.prototype.getHighestFrame = function () {
-            var ret = 0;
-            for (var key = 0, nKeys = this._keys.length; key < nKeys; key++) {
-                if (ret < this._keys[key].frame) {
-                    ret = this._keys[key].frame;
-                }
-            }
-            return ret;
-        };
-        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.sizeInterpolateFunction = function (startValue, endValue, gradient) {
-            return BABYLON.Size.Lerp(startValue, endValue, gradient);
-        };
-        Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {
-            return BABYLON.Color3.Lerp(startValue, endValue, gradient);
-        };
-        Animation.prototype.matrixInterpolateFunction = function (startValue, endValue, gradient) {
-            return BABYLON.Matrix.Lerp(startValue, endValue, gradient);
-        };
-        Animation.prototype.clone = function () {
-            var clone = new Animation(this.name, this.targetPropertyPath.join("."), this.framePerSecond, this.dataType, this.loopMode);
-            if (this._keys) {
-                clone.setKeys(this._keys);
-            }
-            if (this._ranges) {
-                clone._ranges = {};
-                for (var name in this._ranges) {
-                    clone._ranges[name] = this._ranges[name].clone();
-                }
-            }
-            return clone;
-        };
-        Animation.prototype.setKeys = function (values) {
-            this._keys = values.slice(0);
-            this._offsetsCache = {};
-            this._highLimitsCache = {};
-        };
-        Animation.prototype._getKeyValue = function (value) {
-            if (typeof value === "function") {
-                return value();
-            }
-            return value;
-        };
-        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;
-            // Try to get a hash to find the right key
-            var startKey = Math.max(0, Math.min(this._keys.length - 1, Math.floor(this._keys.length * (currentFrame - this._keys[0].frame) / (this._keys[this._keys.length - 1].frame - this._keys[0].frame)) - 1));
-            if (this._keys[startKey].frame >= currentFrame) {
-                while (startKey - 1 >= 0 && this._keys[startKey].frame >= currentFrame) {
-                    startKey--;
-                }
-            }
-            for (var key = startKey; key < this._keys.length; key++) {
-                if (this._keys[key + 1].frame >= currentFrame) {
-                    var startValue = this._getKeyValue(this._keys[key].value);
-                    var endValue = this._getKeyValue(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));
-                            }
-                        // Size
-                        case Animation.ANIMATIONTYPE_SIZE:
-                            switch (loopMode) {
-                                case Animation.ANIMATIONLOOPMODE_CYCLE:
-                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
-                                    return this.sizeInterpolateFunction(startValue, endValue, gradient);
-                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
-                                    return this.sizeInterpolateFunction(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:
-                                    if (this.allowMatricesInterpolation) {
-                                        return this.matrixInterpolateFunction(startValue, endValue, gradient);
-                                    }
-                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
-                                    return startValue;
-                            }
-                        default:
-                            break;
-                    }
-                    break;
-                }
-            }
-            return this._getKeyValue(this._keys[this._keys.length - 1].value);
-        };
-        Animation.prototype.setValue = function (currentValue, blend) {
-            if (blend === void 0) { blend = false; }
-            // Set value
-            var path;
-            var destination;
-            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]];
-                }
-                path = this.targetPropertyPath[this.targetPropertyPath.length - 1];
-                destination = property;
-            }
-            else {
-                path = this.targetPropertyPath[0];
-                destination = this._target;
-            }
-            // Blending
-            if (this.enableBlending && this._blendingFactor <= 1.0) {
-                if (!this._originalBlendValue) {
-                    if (destination[path].clone) {
-                        this._originalBlendValue = destination[path].clone();
-                    }
-                    else {
-                        this._originalBlendValue = destination[path];
-                    }
-                }
-                if (this._originalBlendValue.prototype) {
-                    if (this._originalBlendValue.prototype.Lerp) {
-                        destination[path] = this._originalBlendValue.construtor.prototype.Lerp(currentValue, this._originalBlendValue, this._blendingFactor);
-                    }
-                    else {
-                        destination[path] = currentValue;
-                    }
-                }
-                else if (this._originalBlendValue.m) {
-                    destination[path] = BABYLON.Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
-                }
-                else {
-                    destination[path] = this._originalBlendValue * (1.0 - this._blendingFactor) + this._blendingFactor * currentValue;
-                }
-                this._blendingFactor += this.blendingSpeed;
-            }
-            else {
-                destination[path] = currentValue;
-            }
-            if (this._target.markAsDirty) {
-                this._target.markAsDirty(this.targetProperty);
-            }
-        };
-        Animation.prototype.goToFrame = function (frame) {
-            if (frame < this._keys[0].frame) {
-                frame = this._keys[0].frame;
-            }
-            else if (frame > this._keys[this._keys.length - 1].frame) {
-                frame = this._keys[this._keys.length - 1].frame;
-            }
-            var currentValue = this._interpolate(frame, 0, this.loopMode);
-            this.setValue(currentValue);
-        };
-        Animation.prototype.animate = function (delay, from, to, loop, speedRatio, blend) {
-            if (blend === void 0) { blend = false; }
-            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;
-            }
-            //to and from cannot be the same key
-            if (from === to) {
-                from++;
-            }
-            // 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;
-            var highLimitValue = 0;
-            if (ratio > range && !loop) {
-                returnValue = false;
-                highLimitValue = this._getKeyValue(this._keys[this._keys.length - 1].value);
-            }
-            else {
-                // Get max value if required
-                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);
-                            // Size
-                            case Animation.ANIMATIONTYPE_SIZE:
-                                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 BABYLON.Quaternion(0, 0, 0, 0);
-                        break;
-                    // Vector3
-                    case Animation.ANIMATIONTYPE_VECTOR3:
-                        offsetValue = BABYLON.Vector3.Zero();
-                        break;
-                    // Vector2
-                    case Animation.ANIMATIONTYPE_VECTOR2:
-                        offsetValue = BABYLON.Vector2.Zero();
-                        break;
-                    // Size
-                    case Animation.ANIMATIONTYPE_SIZE:
-                        offsetValue = BABYLON.Size.Zero();
-                        break;
-                    // Color3
-                    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
-            this.setValue(currentValue);
-            // Check events
-            for (var index = 0; index < this._events.length; index++) {
-                if (currentFrame >= this._events[index].frame) {
-                    var event = this._events[index];
-                    if (!event.isDone) {
-                        // If event should be done only once, remove it.
-                        if (event.onlyOnce) {
-                            this._events.splice(index, 1);
-                            index--;
-                        }
-                        event.isDone = true;
-                        event.action();
-                    } // Don't do anything if the event has already be done.
-                }
-                else if (this._events[index].isDone && !this._events[index].onlyOnce) {
-                    // reset event, the animation is looping
-                    this._events[index].isDone = false;
-                }
-            }
-            if (!returnValue) {
-                this._stopped = true;
-            }
-            return returnValue;
-        };
-        Animation.prototype.serialize = function () {
-            var serializationObject = {};
-            serializationObject.name = this.name;
-            serializationObject.property = this.targetProperty;
-            serializationObject.framePerSecond = this.framePerSecond;
-            serializationObject.dataType = this.dataType;
-            serializationObject.loopBehavior = this.loopMode;
-            var dataType = this.dataType;
-            serializationObject.keys = [];
-            var keys = this.getKeys();
-            for (var index = 0; index < keys.length; index++) {
-                var animationKey = keys[index];
-                var key = {};
-                key.frame = animationKey.frame;
-                switch (dataType) {
-                    case Animation.ANIMATIONTYPE_FLOAT:
-                        key.values = [animationKey.value];
-                        break;
-                    case Animation.ANIMATIONTYPE_QUATERNION:
-                    case Animation.ANIMATIONTYPE_MATRIX:
-                    case Animation.ANIMATIONTYPE_VECTOR3:
-                    case Animation.ANIMATIONTYPE_COLOR3:
-                        key.values = animationKey.value.asArray();
-                        break;
-                }
-                serializationObject.keys.push(key);
-            }
-            serializationObject.ranges = [];
-            for (var name in this._ranges) {
-                var range = {};
-                range.name = name;
-                range.from = this._ranges[name].from;
-                range.to = this._ranges[name].to;
-                serializationObject.ranges.push(range);
-            }
-            return serializationObject;
-        };
-        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_SIZE", {
-            get: function () {
-                return Animation._ANIMATIONTYPE_SIZE;
-            },
-            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.Parse = function (parsedAnimation) {
-            var animation = new Animation(parsedAnimation.name, parsedAnimation.property, parsedAnimation.framePerSecond, parsedAnimation.dataType, parsedAnimation.loopBehavior);
-            var dataType = parsedAnimation.dataType;
-            var keys = [];
-            var data;
-            var index;
-            for (index = 0; index < parsedAnimation.keys.length; index++) {
-                var key = parsedAnimation.keys[index];
-                switch (dataType) {
-                    case Animation.ANIMATIONTYPE_FLOAT:
-                        data = key.values[0];
-                        break;
-                    case Animation.ANIMATIONTYPE_QUATERNION:
-                        data = BABYLON.Quaternion.FromArray(key.values);
-                        break;
-                    case Animation.ANIMATIONTYPE_MATRIX:
-                        data = BABYLON.Matrix.FromArray(key.values);
-                        break;
-                    case Animation.ANIMATIONTYPE_COLOR3:
-                        data = BABYLON.Color3.FromArray(key.values);
-                        break;
-                    case Animation.ANIMATIONTYPE_VECTOR3:
-                    default:
-                        data = BABYLON.Vector3.FromArray(key.values);
-                        break;
-                }
-                keys.push({
-                    frame: key.frame,
-                    value: data
-                });
-            }
-            animation.setKeys(keys);
-            if (parsedAnimation.ranges) {
-                for (index = 0; index < parsedAnimation.ranges.length; index++) {
-                    data = parsedAnimation.ranges[index];
-                    animation.createRange(data.name, data.from, data.to);
-                }
-            }
-            return animation;
-        };
-        Animation.AppendSerializedAnimations = function (source, destination) {
-            if (source.animations) {
-                destination.animations = [];
-                for (var animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {
-                    var animation = source.animations[animationIndex];
-                    destination.animations.push(animation.serialize());
-                }
-            }
-        };
-        // Statics
-        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._ANIMATIONTYPE_SIZE = 6;
-        Animation._ANIMATIONLOOPMODE_RELATIVE = 0;
-        Animation._ANIMATIONLOOPMODE_CYCLE = 1;
-        Animation._ANIMATIONLOOPMODE_CONSTANT = 2;
-        return Animation;
-    }());
-    BABYLON.Animation = Animation;
-})(BABYLON || (BABYLON = {}));

+ 0 - 249
src/Animations/babylon.easing.js

@@ -1,249 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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);
-        };
-        //Statics
-        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 (amplitude === void 0) { 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 (bounces === void 0) { bounces = 3; }
-            if (bounciness === void 0) { 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 (oscillations === void 0) { oscillations = 3; }
-            if (springiness === void 0) { 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 (exponent === void 0) { 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 (power === void 0) { 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 (x1 === void 0) { x1 = 0; }
-            if (y1 === void 0) { y1 = 0; }
-            if (x2 === void 0) { x2 = 1; }
-            if (y2 === void 0) { 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 = {}));

+ 0 - 111
src/Audio/babylon.analyser.js

@@ -1,111 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Analyser = (function () {
-        function Analyser(scene) {
-            this.SMOOTHING = 0.75;
-            this.FFT_SIZE = 512;
-            this.BARGRAPHAMPLITUDE = 256;
-            this.DEBUGCANVASPOS = { x: 20, y: 20 };
-            this.DEBUGCANVASSIZE = { width: 320, height: 200 };
-            this._scene = scene;
-            this._audioEngine = BABYLON.Engine.audioEngine;
-            if (this._audioEngine.canUseWebAudio) {
-                this._webAudioAnalyser = this._audioEngine.audioContext.createAnalyser();
-                this._webAudioAnalyser.minDecibels = -140;
-                this._webAudioAnalyser.maxDecibels = 0;
-                this._byteFreqs = new Uint8Array(this._webAudioAnalyser.frequencyBinCount);
-                this._byteTime = new Uint8Array(this._webAudioAnalyser.frequencyBinCount);
-                this._floatFreqs = new Float32Array(this._webAudioAnalyser.frequencyBinCount);
-            }
-        }
-        Analyser.prototype.getFrequencyBinCount = function () {
-            if (this._audioEngine.canUseWebAudio) {
-                return this._webAudioAnalyser.frequencyBinCount;
-            }
-            else {
-                return 0;
-            }
-        };
-        Analyser.prototype.getByteFrequencyData = function () {
-            if (this._audioEngine.canUseWebAudio) {
-                this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;
-                this._webAudioAnalyser.fftSize = this.FFT_SIZE;
-                this._webAudioAnalyser.getByteFrequencyData(this._byteFreqs);
-            }
-            return this._byteFreqs;
-        };
-        Analyser.prototype.getByteTimeDomainData = function () {
-            if (this._audioEngine.canUseWebAudio) {
-                this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;
-                this._webAudioAnalyser.fftSize = this.FFT_SIZE;
-                this._webAudioAnalyser.getByteTimeDomainData(this._byteTime);
-            }
-            return this._byteTime;
-        };
-        Analyser.prototype.getFloatFrequencyData = function () {
-            if (this._audioEngine.canUseWebAudio) {
-                this._webAudioAnalyser.smoothingTimeConstant = this.SMOOTHING;
-                this._webAudioAnalyser.fftSize = this.FFT_SIZE;
-                this._webAudioAnalyser.getFloatFrequencyData(this._floatFreqs);
-            }
-            return this._floatFreqs;
-        };
-        Analyser.prototype.drawDebugCanvas = function () {
-            var _this = this;
-            if (this._audioEngine.canUseWebAudio) {
-                if (!this._debugCanvas) {
-                    this._debugCanvas = document.createElement("canvas");
-                    this._debugCanvas.width = this.DEBUGCANVASSIZE.width;
-                    this._debugCanvas.height = this.DEBUGCANVASSIZE.height;
-                    this._debugCanvas.style.position = "absolute";
-                    this._debugCanvas.style.top = this.DEBUGCANVASPOS.y + "px";
-                    this._debugCanvas.style.left = this.DEBUGCANVASPOS.x + "px";
-                    this._debugCanvasContext = this._debugCanvas.getContext("2d");
-                    document.body.appendChild(this._debugCanvas);
-                    this._registerFunc = function () {
-                        _this.drawDebugCanvas();
-                    };
-                    this._scene.registerBeforeRender(this._registerFunc);
-                }
-                if (this._registerFunc) {
-                    var workingArray = this.getByteFrequencyData();
-                    this._debugCanvasContext.fillStyle = 'rgb(0, 0, 0)';
-                    this._debugCanvasContext.fillRect(0, 0, this.DEBUGCANVASSIZE.width, this.DEBUGCANVASSIZE.height);
-                    // Draw the frequency domain chart.
-                    for (var i = 0; i < this.getFrequencyBinCount(); i++) {
-                        var value = workingArray[i];
-                        var percent = value / this.BARGRAPHAMPLITUDE;
-                        var height = this.DEBUGCANVASSIZE.height * percent;
-                        var offset = this.DEBUGCANVASSIZE.height - height - 1;
-                        var barWidth = this.DEBUGCANVASSIZE.width / this.getFrequencyBinCount();
-                        var hue = i / this.getFrequencyBinCount() * 360;
-                        this._debugCanvasContext.fillStyle = 'hsl(' + hue + ', 100%, 50%)';
-                        this._debugCanvasContext.fillRect(i * barWidth, offset, barWidth, height);
-                    }
-                }
-            }
-        };
-        Analyser.prototype.stopDebugCanvas = function () {
-            if (this._debugCanvas) {
-                this._scene.unregisterBeforeRender(this._registerFunc);
-                this._registerFunc = null;
-                document.body.removeChild(this._debugCanvas);
-                this._debugCanvas = null;
-                this._debugCanvasContext = null;
-            }
-        };
-        Analyser.prototype.connectAudioNodes = function (inputAudioNode, outputAudioNode) {
-            if (this._audioEngine.canUseWebAudio) {
-                inputAudioNode.connect(this._webAudioAnalyser);
-                this._webAudioAnalyser.connect(outputAudioNode);
-            }
-        };
-        Analyser.prototype.dispose = function () {
-            if (this._audioEngine.canUseWebAudio) {
-                this._webAudioAnalyser.disconnect();
-            }
-        };
-        return Analyser;
-    }());
-    BABYLON.Analyser = Analyser;
-})(BABYLON || (BABYLON = {}));

+ 0 - 115
src/Audio/babylon.audioEngine.js

@@ -1,115 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var AudioEngine = (function () {
-        function AudioEngine() {
-            this._audioContext = null;
-            this._audioContextInitialized = false;
-            this.canUseWebAudio = false;
-            this.WarnedWebAudioUnsupported = false;
-            this.unlocked = false;
-            this.isMP3supported = false;
-            this.isOGGsupported = false;
-            if (typeof window.AudioContext !== 'undefined' || typeof window.webkitAudioContext !== 'undefined') {
-                window.AudioContext = window.AudioContext || window.webkitAudioContext;
-                this.canUseWebAudio = true;
-            }
-            var audioElem = document.createElement('audio');
-            if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, '')) {
-                this.isMP3supported = true;
-            }
-            if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, '')) {
-                this.isOGGsupported = true;
-            }
-            if (/iPad|iPhone|iPod/.test(navigator.platform)) {
-                this._unlockiOSaudio();
-            }
-            else {
-                this.unlocked = true;
-            }
-        }
-        Object.defineProperty(AudioEngine.prototype, "audioContext", {
-            get: function () {
-                if (!this._audioContextInitialized) {
-                    this._initializeAudioContext();
-                }
-                return this._audioContext;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        AudioEngine.prototype._unlockiOSaudio = function () {
-            var _this = this;
-            var unlockaudio = function () {
-                var buffer = _this.audioContext.createBuffer(1, 1, 22050);
-                var source = _this.audioContext.createBufferSource();
-                source.buffer = buffer;
-                source.connect(_this.audioContext.destination);
-                source.start(0);
-                setTimeout(function () {
-                    if ((source.playbackState === source.PLAYING_STATE || source.playbackState === source.FINISHED_STATE)) {
-                        _this.unlocked = true;
-                        window.removeEventListener('touchend', unlockaudio, false);
-                        if (_this.onAudioUnlocked) {
-                            _this.onAudioUnlocked();
-                        }
-                    }
-                }, 0);
-            };
-            window.addEventListener('touchend', unlockaudio, false);
-        };
-        AudioEngine.prototype._initializeAudioContext = function () {
-            try {
-                if (this.canUseWebAudio) {
-                    this._audioContext = new AudioContext();
-                    // create a global volume gain node 
-                    this.masterGain = this._audioContext.createGain();
-                    this.masterGain.gain.value = 1;
-                    this.masterGain.connect(this._audioContext.destination);
-                    this._audioContextInitialized = true;
-                }
-            }
-            catch (e) {
-                this.canUseWebAudio = false;
-                BABYLON.Tools.Error("Web Audio: " + e.message);
-            }
-        };
-        AudioEngine.prototype.dispose = function () {
-            if (this.canUseWebAudio && this._audioContextInitialized) {
-                if (this._connectedAnalyser) {
-                    this._connectedAnalyser.stopDebugCanvas();
-                    this._connectedAnalyser.dispose();
-                    this.masterGain.disconnect();
-                    this.masterGain.connect(this._audioContext.destination);
-                    this._connectedAnalyser = null;
-                }
-                this.masterGain.gain.value = 1;
-            }
-            this.WarnedWebAudioUnsupported = false;
-        };
-        AudioEngine.prototype.getGlobalVolume = function () {
-            if (this.canUseWebAudio && this._audioContextInitialized) {
-                return this.masterGain.gain.value;
-            }
-            else {
-                return -1;
-            }
-        };
-        AudioEngine.prototype.setGlobalVolume = function (newVolume) {
-            if (this.canUseWebAudio && this._audioContextInitialized) {
-                this.masterGain.gain.value = newVolume;
-            }
-        };
-        AudioEngine.prototype.connectToAnalyser = function (analyser) {
-            if (this._connectedAnalyser) {
-                this._connectedAnalyser.stopDebugCanvas();
-            }
-            if (this.canUseWebAudio && this._audioContextInitialized) {
-                this._connectedAnalyser = analyser;
-                this.masterGain.disconnect();
-                this._connectedAnalyser.connectAudioNodes(this.masterGain, this._audioContext.destination);
-            }
-        };
-        return AudioEngine;
-    }());
-    BABYLON.AudioEngine = AudioEngine;
-})(BABYLON || (BABYLON = {}));

+ 0 - 635
src/Audio/babylon.sound.js

@@ -1,635 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Sound = (function () {
-        /**
-        * Create a sound and attach it to a scene
-        * @param name Name of your sound
-        * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer
-        * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played
-        * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming
-        */
-        function Sound(name, urlOrArrayBuffer, scene, readyToPlayCallback, options) {
-            var _this = this;
-            this.autoplay = false;
-            this.loop = false;
-            this.useCustomAttenuation = false;
-            this.spatialSound = false;
-            this.refDistance = 1;
-            this.rolloffFactor = 1;
-            this.maxDistance = 100;
-            this.distanceModel = "linear";
-            this._panningModel = "equalpower";
-            this._playbackRate = 1;
-            this._streaming = false;
-            this._startTime = 0;
-            this._startOffset = 0;
-            this._position = BABYLON.Vector3.Zero();
-            this._localDirection = new BABYLON.Vector3(1, 0, 0);
-            this._volume = 1;
-            this._isLoaded = false;
-            this._isReadyToPlay = false;
-            this.isPlaying = false;
-            this.isPaused = false;
-            this._isDirectional = false;
-            // Used if you'd like to create a directional sound.
-            // If not set, the sound will be omnidirectional
-            this._coneInnerAngle = 360;
-            this._coneOuterAngle = 360;
-            this._coneOuterGain = 0;
-            this._isOutputConnected = false;
-            this._urlType = "Unknown";
-            this.name = name;
-            this._scene = scene;
-            this._readyToPlayCallback = readyToPlayCallback;
-            // Default custom attenuation function is a linear attenuation
-            this._customAttenuationFunction = function (currentVolume, currentDistance, maxDistance, refDistance, rolloffFactor) {
-                if (currentDistance < maxDistance) {
-                    return currentVolume * (1 - currentDistance / maxDistance);
-                }
-                else {
-                    return 0;
-                }
-            };
-            if (options) {
-                this.autoplay = options.autoplay || false;
-                this.loop = options.loop || false;
-                // if volume === 0, we need another way to check this option
-                if (options.volume !== undefined) {
-                    this._volume = options.volume;
-                }
-                this.spatialSound = options.spatialSound || false;
-                this.maxDistance = options.maxDistance || 100;
-                this.useCustomAttenuation = options.useCustomAttenuation || false;
-                this.rolloffFactor = options.rolloffFactor || 1;
-                this.refDistance = options.refDistance || 1;
-                this.distanceModel = options.distanceModel || "linear";
-                this._playbackRate = options.playbackRate || 1;
-                this._streaming = options.streaming || false;
-            }
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                this._soundGain = BABYLON.Engine.audioEngine.audioContext.createGain();
-                this._soundGain.gain.value = this._volume;
-                this._inputAudioNode = this._soundGain;
-                this._ouputAudioNode = this._soundGain;
-                if (this.spatialSound) {
-                    this._createSpatialParameters();
-                }
-                this._scene.mainSoundTrack.AddSound(this);
-                var validParameter = true;
-                // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound
-                if (urlOrArrayBuffer) {
-                    if (typeof (urlOrArrayBuffer) === "string")
-                        this._urlType = "String";
-                    if (Array.isArray(urlOrArrayBuffer))
-                        this._urlType = "Array";
-                    if (urlOrArrayBuffer instanceof ArrayBuffer)
-                        this._urlType = "ArrayBuffer";
-                    var urls = [];
-                    var codecSupportedFound = false;
-                    switch (this._urlType) {
-                        case "ArrayBuffer":
-                            if (urlOrArrayBuffer.byteLength > 0) {
-                                codecSupportedFound = true;
-                                this._soundLoaded(urlOrArrayBuffer);
-                            }
-                            break;
-                        case "String":
-                            urls.push(urlOrArrayBuffer);
-                        case "Array":
-                            if (urls.length === 0)
-                                urls = urlOrArrayBuffer;
-                            // If we found a supported format, we load it immediately and stop the loop
-                            for (var i = 0; i < urls.length; i++) {
-                                var url = urls[i];
-                                if (url.indexOf(".mp3", url.length - 4) !== -1 && BABYLON.Engine.audioEngine.isMP3supported) {
-                                    codecSupportedFound = true;
-                                }
-                                if (url.indexOf(".ogg", url.length - 4) !== -1 && BABYLON.Engine.audioEngine.isOGGsupported) {
-                                    codecSupportedFound = true;
-                                }
-                                if (url.indexOf(".wav", url.length - 4) !== -1) {
-                                    codecSupportedFound = true;
-                                }
-                                if (codecSupportedFound) {
-                                    // Loading sound using XHR2
-                                    if (!this._streaming) {
-                                        BABYLON.Tools.LoadFile(url, function (data) { _this._soundLoaded(data); }, null, this._scene.database, true);
-                                    }
-                                    else {
-                                        this._htmlAudioElement = new Audio(url);
-                                        this._htmlAudioElement.controls = false;
-                                        this._htmlAudioElement.loop = this.loop;
-                                        this._htmlAudioElement.crossOrigin = "anonymous";
-                                        this._htmlAudioElement.preload = "auto";
-                                        this._htmlAudioElement.addEventListener("canplaythrough", function () {
-                                            _this._isReadyToPlay = true;
-                                            if (_this.autoplay) {
-                                                _this.play();
-                                            }
-                                            if (_this._readyToPlayCallback) {
-                                                _this._readyToPlayCallback();
-                                            }
-                                        });
-                                        document.body.appendChild(this._htmlAudioElement);
-                                    }
-                                    break;
-                                }
-                            }
-                            break;
-                        default:
-                            validParameter = false;
-                            break;
-                    }
-                    if (!validParameter) {
-                        BABYLON.Tools.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.");
-                    }
-                    else {
-                        if (!codecSupportedFound) {
-                            this._isReadyToPlay = true;
-                            // Simulating a ready to play event to avoid breaking code path
-                            if (this._readyToPlayCallback) {
-                                window.setTimeout(function () {
-                                    _this._readyToPlayCallback();
-                                }, 1000);
-                            }
-                        }
-                    }
-                }
-            }
-            else {
-                // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers
-                this._scene.mainSoundTrack.AddSound(this);
-                if (!BABYLON.Engine.audioEngine.WarnedWebAudioUnsupported) {
-                    BABYLON.Tools.Error("Web Audio is not supported by your browser.");
-                    BABYLON.Engine.audioEngine.WarnedWebAudioUnsupported = true;
-                }
-                // Simulating a ready to play event to avoid breaking code for non web audio browsers
-                if (this._readyToPlayCallback) {
-                    window.setTimeout(function () {
-                        _this._readyToPlayCallback();
-                    }, 1000);
-                }
-            }
-        }
-        Sound.prototype.dispose = function () {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio && this._isReadyToPlay) {
-                if (this.isPlaying) {
-                    this.stop();
-                }
-                this._isReadyToPlay = false;
-                if (this.soundTrackId === -1) {
-                    this._scene.mainSoundTrack.RemoveSound(this);
-                }
-                else {
-                    this._scene.soundTracks[this.soundTrackId].RemoveSound(this);
-                }
-                if (this._soundGain) {
-                    this._soundGain.disconnect();
-                    this._soundGain = null;
-                }
-                if (this._soundPanner) {
-                    this._soundPanner.disconnect();
-                    this._soundPanner = null;
-                }
-                if (this._soundSource) {
-                    this._soundSource.disconnect();
-                    this._soundSource = null;
-                }
-                this._audioBuffer = null;
-                if (this._htmlAudioElement) {
-                    this._htmlAudioElement.pause();
-                    this._htmlAudioElement.src = "";
-                    document.body.removeChild(this._htmlAudioElement);
-                }
-                if (this._connectedMesh) {
-                    this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc);
-                    this._connectedMesh = null;
-                }
-            }
-        };
-        Sound.prototype._soundLoaded = function (audioData) {
-            var _this = this;
-            this._isLoaded = true;
-            BABYLON.Engine.audioEngine.audioContext.decodeAudioData(audioData, function (buffer) {
-                _this._audioBuffer = buffer;
-                _this._isReadyToPlay = true;
-                if (_this.autoplay) {
-                    _this.play();
-                }
-                if (_this._readyToPlayCallback) {
-                    _this._readyToPlayCallback();
-                }
-            }, function (err) { BABYLON.Tools.Error("Error while decoding audio data for: " + _this.name + " / Error: " + err); });
-        };
-        Sound.prototype.setAudioBuffer = function (audioBuffer) {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                this._audioBuffer = audioBuffer;
-                this._isReadyToPlay = true;
-            }
-        };
-        Sound.prototype.updateOptions = function (options) {
-            if (options) {
-                this.loop = options.loop || this.loop;
-                this.maxDistance = options.maxDistance || this.maxDistance;
-                this.useCustomAttenuation = options.useCustomAttenuation || this.useCustomAttenuation;
-                this.rolloffFactor = options.rolloffFactor || this.rolloffFactor;
-                this.refDistance = options.refDistance || this.refDistance;
-                this.distanceModel = options.distanceModel || this.distanceModel;
-                this._playbackRate = options.playbackRate || this._playbackRate;
-                this._updateSpatialParameters();
-                if (this.isPlaying) {
-                    if (this._streaming) {
-                        this._htmlAudioElement.playbackRate = this._playbackRate;
-                    }
-                    else {
-                        this._soundSource.playbackRate.value = this._playbackRate;
-                    }
-                }
-            }
-        };
-        Sound.prototype._createSpatialParameters = function () {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                if (this._scene.headphone) {
-                    this._panningModel = "HRTF";
-                }
-                this._soundPanner = BABYLON.Engine.audioEngine.audioContext.createPanner();
-                this._updateSpatialParameters();
-                this._soundPanner.connect(this._ouputAudioNode);
-                this._inputAudioNode = this._soundPanner;
-            }
-        };
-        Sound.prototype._updateSpatialParameters = function () {
-            if (this.spatialSound) {
-                if (this.useCustomAttenuation) {
-                    // Tricks to disable in a way embedded Web Audio attenuation 
-                    this._soundPanner.distanceModel = "linear";
-                    this._soundPanner.maxDistance = Number.MAX_VALUE;
-                    this._soundPanner.refDistance = 1;
-                    this._soundPanner.rolloffFactor = 1;
-                    this._soundPanner.panningModel = this._panningModel;
-                }
-                else {
-                    this._soundPanner.distanceModel = this.distanceModel;
-                    this._soundPanner.maxDistance = this.maxDistance;
-                    this._soundPanner.refDistance = this.refDistance;
-                    this._soundPanner.rolloffFactor = this.rolloffFactor;
-                    this._soundPanner.panningModel = this._panningModel;
-                }
-            }
-        };
-        Sound.prototype.switchPanningModelToHRTF = function () {
-            this._panningModel = "HRTF";
-            this._switchPanningModel();
-        };
-        Sound.prototype.switchPanningModelToEqualPower = function () {
-            this._panningModel = "equalpower";
-            this._switchPanningModel();
-        };
-        Sound.prototype._switchPanningModel = function () {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio && this.spatialSound) {
-                this._soundPanner.panningModel = this._panningModel;
-            }
-        };
-        Sound.prototype.connectToSoundTrackAudioNode = function (soundTrackAudioNode) {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                if (this._isOutputConnected) {
-                    this._ouputAudioNode.disconnect();
-                }
-                this._ouputAudioNode.connect(soundTrackAudioNode);
-                this._isOutputConnected = true;
-            }
-        };
-        /**
-        * Transform this sound into a directional source
-        * @param coneInnerAngle Size of the inner cone in degree
-        * @param coneOuterAngle Size of the outer cone in degree
-        * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)
-        */
-        Sound.prototype.setDirectionalCone = function (coneInnerAngle, coneOuterAngle, coneOuterGain) {
-            if (coneOuterAngle < coneInnerAngle) {
-                BABYLON.Tools.Error("setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.");
-                return;
-            }
-            this._coneInnerAngle = coneInnerAngle;
-            this._coneOuterAngle = coneOuterAngle;
-            this._coneOuterGain = coneOuterGain;
-            this._isDirectional = true;
-            if (this.isPlaying && this.loop) {
-                this.stop();
-                this.play();
-            }
-        };
-        Sound.prototype.setPosition = function (newPosition) {
-            this._position = newPosition;
-            if (BABYLON.Engine.audioEngine.canUseWebAudio && this.spatialSound) {
-                this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
-            }
-        };
-        Sound.prototype.setLocalDirectionToMesh = function (newLocalDirection) {
-            this._localDirection = newLocalDirection;
-            if (BABYLON.Engine.audioEngine.canUseWebAudio && this._connectedMesh && this.isPlaying) {
-                this._updateDirection();
-            }
-        };
-        Sound.prototype._updateDirection = function () {
-            var mat = this._connectedMesh.getWorldMatrix();
-            var direction = BABYLON.Vector3.TransformNormal(this._localDirection, mat);
-            direction.normalize();
-            this._soundPanner.setOrientation(direction.x, direction.y, direction.z);
-        };
-        Sound.prototype.updateDistanceFromListener = function () {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio && this._connectedMesh && this.useCustomAttenuation) {
-                var distance = this._connectedMesh.getDistanceToCamera(this._scene.activeCamera);
-                this._soundGain.gain.value = this._customAttenuationFunction(this._volume, distance, this.maxDistance, this.refDistance, this.rolloffFactor);
-            }
-        };
-        Sound.prototype.setAttenuationFunction = function (callback) {
-            this._customAttenuationFunction = callback;
-        };
-        /**
-        * Play the sound
-        * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
-        * @param offset (optional) Start the sound setting it at a specific time
-        */
-        Sound.prototype.play = function (time, offset) {
-            var _this = this;
-            if (this._isReadyToPlay && this._scene.audioEnabled) {
-                try {
-                    if (this._startOffset < 0) {
-                        time = -this._startOffset;
-                        this._startOffset = 0;
-                    }
-                    var startTime = time ? BABYLON.Engine.audioEngine.audioContext.currentTime + time : BABYLON.Engine.audioEngine.audioContext.currentTime;
-                    if (!this._soundSource || !this._streamingSource) {
-                        if (this.spatialSound) {
-                            this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
-                            if (this._isDirectional) {
-                                this._soundPanner.coneInnerAngle = this._coneInnerAngle;
-                                this._soundPanner.coneOuterAngle = this._coneOuterAngle;
-                                this._soundPanner.coneOuterGain = this._coneOuterGain;
-                                if (this._connectedMesh) {
-                                    this._updateDirection();
-                                }
-                                else {
-                                    this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z);
-                                }
-                            }
-                        }
-                    }
-                    if (this._streaming) {
-                        if (!this._streamingSource) {
-                            this._streamingSource = BABYLON.Engine.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement);
-                            this._htmlAudioElement.onended = function () { _this._onended(); };
-                            this._htmlAudioElement.playbackRate = this._playbackRate;
-                        }
-                        this._streamingSource.disconnect();
-                        this._streamingSource.connect(this._inputAudioNode);
-                        this._htmlAudioElement.play();
-                    }
-                    else {
-                        this._soundSource = BABYLON.Engine.audioEngine.audioContext.createBufferSource();
-                        this._soundSource.buffer = this._audioBuffer;
-                        this._soundSource.connect(this._inputAudioNode);
-                        this._soundSource.loop = this.loop;
-                        this._soundSource.playbackRate.value = this._playbackRate;
-                        this._soundSource.onended = function () { _this._onended(); };
-                        this._soundSource.start(startTime, this.isPaused ? this._startOffset % this._soundSource.buffer.duration : offset ? offset : 0);
-                    }
-                    this._startTime = startTime;
-                    this.isPlaying = true;
-                    this.isPaused = false;
-                }
-                catch (ex) {
-                    BABYLON.Tools.Error("Error while trying to play audio: " + this.name + ", " + ex.message);
-                }
-            }
-        };
-        Sound.prototype._onended = function () {
-            this.isPlaying = false;
-            if (this.onended) {
-                this.onended();
-            }
-        };
-        /**
-        * Stop the sound
-        * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.
-        */
-        Sound.prototype.stop = function (time) {
-            if (this.isPlaying) {
-                if (this._streaming) {
-                    this._htmlAudioElement.pause();
-                    // Test needed for Firefox or it will generate an Invalid State Error
-                    if (this._htmlAudioElement.currentTime > 0) {
-                        this._htmlAudioElement.currentTime = 0;
-                    }
-                }
-                else {
-                    var stopTime = time ? BABYLON.Engine.audioEngine.audioContext.currentTime + time : BABYLON.Engine.audioEngine.audioContext.currentTime;
-                    this._soundSource.stop(stopTime);
-                    this._soundSource.onended = null;
-                    if (!this.isPaused) {
-                        this._startOffset = 0;
-                    }
-                }
-                this.isPlaying = false;
-            }
-        };
-        Sound.prototype.pause = function () {
-            if (this.isPlaying) {
-                this.isPaused = true;
-                if (this._streaming) {
-                    this._htmlAudioElement.pause();
-                }
-                else {
-                    this.stop(0);
-                    this._startOffset += BABYLON.Engine.audioEngine.audioContext.currentTime - this._startTime;
-                }
-            }
-        };
-        Sound.prototype.setVolume = function (newVolume, time) {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                if (time) {
-                    this._soundGain.gain.cancelScheduledValues(BABYLON.Engine.audioEngine.audioContext.currentTime);
-                    this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, BABYLON.Engine.audioEngine.audioContext.currentTime);
-                    this._soundGain.gain.linearRampToValueAtTime(newVolume, BABYLON.Engine.audioEngine.audioContext.currentTime + time);
-                }
-                else {
-                    this._soundGain.gain.value = newVolume;
-                }
-            }
-            this._volume = newVolume;
-        };
-        Sound.prototype.setPlaybackRate = function (newPlaybackRate) {
-            this._playbackRate = newPlaybackRate;
-            if (this.isPlaying) {
-                if (this._streaming) {
-                    this._htmlAudioElement.playbackRate = this._playbackRate;
-                }
-                else {
-                    this._soundSource.playbackRate.value = this._playbackRate;
-                }
-            }
-        };
-        Sound.prototype.getVolume = function () {
-            return this._volume;
-        };
-        Sound.prototype.attachToMesh = function (meshToConnectTo) {
-            var _this = this;
-            if (this._connectedMesh) {
-                this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc);
-                this._registerFunc = null;
-            }
-            this._connectedMesh = meshToConnectTo;
-            if (!this.spatialSound) {
-                this.spatialSound = true;
-                this._createSpatialParameters();
-                if (this.isPlaying && this.loop) {
-                    this.stop();
-                    this.play();
-                }
-            }
-            this._onRegisterAfterWorldMatrixUpdate(this._connectedMesh);
-            this._registerFunc = function (connectedMesh) { return _this._onRegisterAfterWorldMatrixUpdate(connectedMesh); };
-            meshToConnectTo.registerAfterWorldMatrixUpdate(this._registerFunc);
-        };
-        Sound.prototype.detachFromMesh = function () {
-            if (this._connectedMesh) {
-                this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc);
-                this._registerFunc = null;
-                this._connectedMesh = null;
-            }
-        };
-        Sound.prototype._onRegisterAfterWorldMatrixUpdate = function (connectedMesh) {
-            this.setPosition(connectedMesh.getBoundingInfo().boundingSphere.centerWorld);
-            if (BABYLON.Engine.audioEngine.canUseWebAudio && this._isDirectional && this.isPlaying) {
-                this._updateDirection();
-            }
-        };
-        Sound.prototype.clone = function () {
-            var _this = this;
-            if (!this._streaming) {
-                var setBufferAndRun = function () {
-                    if (_this._isReadyToPlay) {
-                        clonedSound._audioBuffer = _this.getAudioBuffer();
-                        clonedSound._isReadyToPlay = true;
-                        if (clonedSound.autoplay) {
-                            clonedSound.play();
-                        }
-                    }
-                    else {
-                        window.setTimeout(setBufferAndRun, 300);
-                    }
-                };
-                var currentOptions = {
-                    autoplay: this.autoplay, loop: this.loop,
-                    volume: this._volume, spatialSound: this.spatialSound, maxDistance: this.maxDistance,
-                    useCustomAttenuation: this.useCustomAttenuation, rolloffFactor: this.rolloffFactor,
-                    refDistance: this.refDistance, distanceModel: this.distanceModel
-                };
-                var clonedSound = new Sound(this.name + "_cloned", new ArrayBuffer(0), this._scene, null, currentOptions);
-                if (this.useCustomAttenuation) {
-                    clonedSound.setAttenuationFunction(this._customAttenuationFunction);
-                }
-                clonedSound.setPosition(this._position);
-                clonedSound.setPlaybackRate(this._playbackRate);
-                setBufferAndRun();
-                return clonedSound;
-            }
-            else {
-                return null;
-            }
-        };
-        Sound.prototype.getAudioBuffer = function () {
-            return this._audioBuffer;
-        };
-        Sound.prototype.serialize = function () {
-            var serializationObject = {
-                name: this.name,
-                url: this.name,
-                autoplay: this.autoplay,
-                loop: this.loop,
-                volume: this._volume,
-                spatialSound: this.spatialSound,
-                maxDistance: this.maxDistance,
-                rolloffFactor: this.rolloffFactor,
-                refDistance: this.refDistance,
-                distanceModel: this.distanceModel,
-                playbackRate: this._playbackRate,
-                panningModel: this._panningModel,
-                soundTrackId: this.soundTrackId
-            };
-            if (this.spatialSound) {
-                if (this._connectedMesh)
-                    serializationObject.connectedMeshId = this._connectedMesh.id;
-                serializationObject.position = this._position.asArray();
-                serializationObject.refDistance = this.refDistance;
-                serializationObject.distanceModel = this.distanceModel;
-                serializationObject.isDirectional = this._isDirectional;
-                serializationObject.localDirectionToMesh = this._localDirection.asArray();
-                serializationObject.coneInnerAngle = this._coneInnerAngle;
-                serializationObject.coneOuterAngle = this._coneOuterAngle;
-                serializationObject.coneOuterGain = this._coneOuterGain;
-            }
-            return serializationObject;
-        };
-        Sound.Parse = function (parsedSound, scene, rootUrl, sourceSound) {
-            var soundName = parsedSound.name;
-            var soundUrl;
-            if (parsedSound.url) {
-                soundUrl = rootUrl + parsedSound.url;
-            }
-            else {
-                soundUrl = rootUrl + soundName;
-            }
-            var options = {
-                autoplay: parsedSound.autoplay, loop: parsedSound.loop, volume: parsedSound.volume,
-                spatialSound: parsedSound.spatialSound, maxDistance: parsedSound.maxDistance,
-                rolloffFactor: parsedSound.rolloffFactor,
-                refDistance: parsedSound.refDistance,
-                distanceModel: parsedSound.distanceModel,
-                playbackRate: parsedSound.playbackRate
-            };
-            var newSound;
-            if (!sourceSound) {
-                newSound = new Sound(soundName, soundUrl, scene, function () { scene._removePendingData(newSound); }, options);
-                scene._addPendingData(newSound);
-            }
-            else {
-                var setBufferAndRun = function () {
-                    if (sourceSound._isReadyToPlay) {
-                        newSound._audioBuffer = sourceSound.getAudioBuffer();
-                        newSound._isReadyToPlay = true;
-                        if (newSound.autoplay) {
-                            newSound.play();
-                        }
-                    }
-                    else {
-                        window.setTimeout(setBufferAndRun, 300);
-                    }
-                };
-                newSound = new Sound(soundName, new ArrayBuffer(0), scene, null, options);
-                setBufferAndRun();
-            }
-            if (parsedSound.position) {
-                var soundPosition = BABYLON.Vector3.FromArray(parsedSound.position);
-                newSound.setPosition(soundPosition);
-            }
-            if (parsedSound.isDirectional) {
-                newSound.setDirectionalCone(parsedSound.coneInnerAngle || 360, parsedSound.coneOuterAngle || 360, parsedSound.coneOuterGain || 0);
-                if (parsedSound.localDirectionToMesh) {
-                    var localDirectionToMesh = BABYLON.Vector3.FromArray(parsedSound.localDirectionToMesh);
-                    newSound.setLocalDirectionToMesh(localDirectionToMesh);
-                }
-            }
-            if (parsedSound.connectedMeshId) {
-                var connectedMesh = scene.getMeshByID(parsedSound.connectedMeshId);
-                if (connectedMesh) {
-                    newSound.attachToMesh(connectedMesh);
-                }
-            }
-            return newSound;
-        };
-        return Sound;
-    }());
-    BABYLON.Sound = Sound;
-})(BABYLON || (BABYLON = {}));

+ 0 - 101
src/Audio/babylon.soundtrack.js

@@ -1,101 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var SoundTrack = (function () {
-        function SoundTrack(scene, options) {
-            this.id = -1;
-            this._isMainTrack = false;
-            this._isInitialized = false;
-            this._scene = scene;
-            this.soundCollection = new Array();
-            this._options = options;
-            if (!this._isMainTrack) {
-                this._scene.soundTracks.push(this);
-                this.id = this._scene.soundTracks.length - 1;
-            }
-        }
-        SoundTrack.prototype._initializeSoundTrackAudioGraph = function () {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                this._outputAudioNode = BABYLON.Engine.audioEngine.audioContext.createGain();
-                this._outputAudioNode.connect(BABYLON.Engine.audioEngine.masterGain);
-                if (this._options) {
-                    if (this._options.volume) {
-                        this._outputAudioNode.gain.value = this._options.volume;
-                    }
-                    if (this._options.mainTrack) {
-                        this._isMainTrack = this._options.mainTrack;
-                    }
-                }
-                this._isInitialized = true;
-            }
-        };
-        SoundTrack.prototype.dispose = function () {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                if (this._connectedAnalyser) {
-                    this._connectedAnalyser.stopDebugCanvas();
-                }
-                while (this.soundCollection.length) {
-                    this.soundCollection[0].dispose();
-                }
-                if (this._outputAudioNode) {
-                    this._outputAudioNode.disconnect();
-                }
-                this._outputAudioNode = null;
-            }
-        };
-        SoundTrack.prototype.AddSound = function (sound) {
-            if (!this._isInitialized) {
-                this._initializeSoundTrackAudioGraph();
-            }
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                sound.connectToSoundTrackAudioNode(this._outputAudioNode);
-            }
-            if (sound.soundTrackId) {
-                if (sound.soundTrackId === -1) {
-                    this._scene.mainSoundTrack.RemoveSound(sound);
-                }
-                else {
-                    this._scene.soundTracks[sound.soundTrackId].RemoveSound(sound);
-                }
-            }
-            this.soundCollection.push(sound);
-            sound.soundTrackId = this.id;
-        };
-        SoundTrack.prototype.RemoveSound = function (sound) {
-            var index = this.soundCollection.indexOf(sound);
-            if (index !== -1) {
-                this.soundCollection.splice(index, 1);
-            }
-        };
-        SoundTrack.prototype.setVolume = function (newVolume) {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                this._outputAudioNode.gain.value = newVolume;
-            }
-        };
-        SoundTrack.prototype.switchPanningModelToHRTF = function () {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                for (var i = 0; i < this.soundCollection.length; i++) {
-                    this.soundCollection[i].switchPanningModelToHRTF();
-                }
-            }
-        };
-        SoundTrack.prototype.switchPanningModelToEqualPower = function () {
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                for (var i = 0; i < this.soundCollection.length; i++) {
-                    this.soundCollection[i].switchPanningModelToEqualPower();
-                }
-            }
-        };
-        SoundTrack.prototype.connectToAnalyser = function (analyser) {
-            if (this._connectedAnalyser) {
-                this._connectedAnalyser.stopDebugCanvas();
-            }
-            this._connectedAnalyser = analyser;
-            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                this._outputAudioNode.disconnect();
-                this._connectedAnalyser.connectAudioNodes(this._outputAudioNode, BABYLON.Engine.audioEngine.masterGain);
-            }
-        };
-        return SoundTrack;
-    }());
-    BABYLON.SoundTrack = SoundTrack;
-})(BABYLON || (BABYLON = {}));

+ 0 - 526
src/Bones/babylon.bone.js

@@ -1,526 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var Bone = (function (_super) {
-        __extends(Bone, _super);
-        function Bone(name, skeleton, parentBone, matrix, restPose) {
-            _super.call(this, name, skeleton.getScene());
-            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._scaleMatrix = BABYLON.Matrix.Identity();
-            this._scaleVector = new BABYLON.Vector3(1, 1, 1);
-            this._negateScaleChildren = new BABYLON.Vector3(1, 1, 1);
-            this._scalingDeterminant = 1;
-            this._syncScaleVector = function () {
-                var lm = this.getLocalMatrix();
-                var xsq = (lm.m[0] * lm.m[0] + lm.m[1] * lm.m[1] + lm.m[2] * lm.m[2]);
-                var ysq = (lm.m[4] * lm.m[4] + lm.m[5] * lm.m[5] + lm.m[6] * lm.m[6]);
-                var zsq = (lm.m[8] * lm.m[8] + lm.m[9] * lm.m[9] + lm.m[10] * lm.m[10]);
-                var xs = lm.m[0] * lm.m[1] * lm.m[2] * lm.m[3] < 0 ? -1 : 1;
-                var ys = lm.m[4] * lm.m[5] * lm.m[6] * lm.m[7] < 0 ? -1 : 1;
-                var zs = lm.m[8] * lm.m[9] * lm.m[10] * lm.m[11] < 0 ? -1 : 1;
-                this._scaleVector.x = xs * Math.sqrt(xsq);
-                this._scaleVector.y = ys * Math.sqrt(ysq);
-                this._scaleVector.z = zs * Math.sqrt(zsq);
-                if (this._parent) {
-                    this._scaleVector.x /= this._parent._negateScaleChildren.x;
-                    this._scaleVector.y /= this._parent._negateScaleChildren.y;
-                    this._scaleVector.z /= this._parent._negateScaleChildren.z;
-                }
-                BABYLON.Matrix.FromValuesToRef(this._scaleVector.x, 0, 0, 0, 0, this._scaleVector.y, 0, 0, 0, 0, this._scaleVector.z, 0, 0, 0, 0, 1, this._scaleMatrix);
-            };
-            this._skeleton = skeleton;
-            this._matrix = matrix;
-            this._baseMatrix = matrix;
-            this._restPose = restPose ? restPose : matrix.clone();
-            skeleton.bones.push(this);
-            if (parentBone) {
-                this._parent = parentBone;
-                parentBone.children.push(this);
-            }
-            else {
-                this._parent = null;
-            }
-            this._updateDifferenceMatrix();
-            if (this.getAbsoluteTransform().determinant() < 0) {
-                this._scalingDeterminant *= -1;
-            }
-        }
-        // Members
-        Bone.prototype.getParent = function () {
-            return this._parent;
-        };
-        Bone.prototype.getLocalMatrix = function () {
-            return this._matrix;
-        };
-        Bone.prototype.getBaseMatrix = function () {
-            return this._baseMatrix;
-        };
-        Bone.prototype.getRestPose = function () {
-            return this._restPose;
-        };
-        Bone.prototype.returnToRest = function () {
-            this.updateMatrix(this._restPose.clone());
-        };
-        Bone.prototype.getWorldMatrix = function () {
-            return this._worldTransform;
-        };
-        Bone.prototype.getInvertedAbsoluteTransform = function () {
-            return this._invertedAbsoluteTransform;
-        };
-        Bone.prototype.getAbsoluteTransform = function () {
-            return this._absoluteTransform;
-        };
-        // Methods
-        Bone.prototype.updateMatrix = function (matrix, updateDifferenceMatrix) {
-            if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }
-            this._baseMatrix = matrix.clone();
-            this._matrix = matrix.clone();
-            this._skeleton._markAsDirty();
-            if (updateDifferenceMatrix) {
-                this._updateDifferenceMatrix();
-            }
-        };
-        Bone.prototype._updateDifferenceMatrix = function (rootMatrix) {
-            if (!rootMatrix) {
-                rootMatrix = this._baseMatrix;
-            }
-            if (this._parent) {
-                rootMatrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);
-            }
-            else {
-                this._absoluteTransform.copyFrom(rootMatrix);
-            }
-            this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform);
-            for (var index = 0; index < this.children.length; index++) {
-                this.children[index]._updateDifferenceMatrix();
-            }
-        };
-        Bone.prototype.markAsDirty = function () {
-            this._currentRenderId++;
-            this._skeleton._markAsDirty();
-        };
-        Bone.prototype.copyAnimationRange = function (source, rangeName, frameOffset, rescaleAsRequired, skelDimensionsRatio) {
-            if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }
-            if (skelDimensionsRatio === void 0) { skelDimensionsRatio = null; }
-            // all animation may be coming from a library skeleton, so may need to create animation
-            if (this.animations.length === 0) {
-                this.animations.push(new BABYLON.Animation(this.name, "_matrix", source.animations[0].framePerSecond, BABYLON.Animation.ANIMATIONTYPE_MATRIX, 0));
-                this.animations[0].setKeys([]);
-            }
-            // get animation info / verify there is such a range from the source bone
-            var sourceRange = source.animations[0].getRange(rangeName);
-            if (!sourceRange) {
-                return false;
-            }
-            var from = sourceRange.from;
-            var to = sourceRange.to;
-            var sourceKeys = source.animations[0].getKeys();
-            // rescaling prep
-            var sourceBoneLength = source.length;
-            var sourceParent = source.getParent();
-            var parent = this.getParent();
-            var parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;
-            var parentRatio = parentScalingReqd ? parent.length / sourceParent.length : null;
-            var dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);
-            var destKeys = this.animations[0].getKeys();
-            // loop vars declaration
-            var orig;
-            var origTranslation;
-            var mat;
-            for (var key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {
-                orig = sourceKeys[key];
-                if (orig.frame >= from && orig.frame <= to) {
-                    if (rescaleAsRequired) {
-                        mat = orig.value.clone();
-                        // scale based on parent ratio, when bone has parent
-                        if (parentScalingReqd) {
-                            origTranslation = mat.getTranslation();
-                            mat.setTranslation(origTranslation.scaleInPlace(parentRatio));
-                        }
-                        else if (dimensionsScalingReqd) {
-                            origTranslation = mat.getTranslation();
-                            mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));
-                        }
-                        else {
-                            mat = orig.value;
-                        }
-                    }
-                    else {
-                        mat = orig.value;
-                    }
-                    destKeys.push({ frame: orig.frame + frameOffset, value: mat });
-                }
-            }
-            this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);
-            return true;
-        };
-        Bone.prototype.translate = function (vec, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var lm = this.getLocalMatrix();
-            if (space == BABYLON.Space.LOCAL) {
-                lm.m[12] += vec.x;
-                lm.m[13] += vec.y;
-                lm.m[14] += vec.z;
-            }
-            else {
-                this._skeleton.computeAbsoluteTransforms();
-                var tmat = BABYLON.Tmp.Matrix[0];
-                var tvec = BABYLON.Tmp.Vector3[0];
-                if (mesh) {
-                    tmat.copyFrom(this._parent.getAbsoluteTransform());
-                    tmat.multiplyToRef(mesh.getWorldMatrix(), tmat);
-                }
-                else {
-                    tmat.copyFrom(this._parent.getAbsoluteTransform());
-                }
-                tmat.m[12] = 0;
-                tmat.m[13] = 0;
-                tmat.m[14] = 0;
-                tmat.invert();
-                BABYLON.Vector3.TransformCoordinatesToRef(vec, tmat, tvec);
-                lm.m[12] += tvec.x;
-                lm.m[13] += tvec.y;
-                lm.m[14] += tvec.z;
-            }
-            this.markAsDirty();
-        };
-        Bone.prototype.setPosition = function (position, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var lm = this.getLocalMatrix();
-            if (space == BABYLON.Space.LOCAL) {
-                lm.m[12] = position.x;
-                lm.m[13] = position.y;
-                lm.m[14] = position.z;
-            }
-            else {
-                this._skeleton.computeAbsoluteTransforms();
-                var tmat = BABYLON.Tmp.Matrix[0];
-                var vec = BABYLON.Tmp.Vector3[0];
-                if (mesh) {
-                    tmat.copyFrom(this._parent.getAbsoluteTransform());
-                    tmat.multiplyToRef(mesh.getWorldMatrix(), tmat);
-                }
-                else {
-                    tmat.copyFrom(this._parent.getAbsoluteTransform());
-                }
-                tmat.invert();
-                BABYLON.Vector3.TransformCoordinatesToRef(position, tmat, vec);
-                lm.m[12] = vec.x;
-                lm.m[13] = vec.y;
-                lm.m[14] = vec.z;
-            }
-            this.markAsDirty();
-        };
-        Bone.prototype.setAbsolutePosition = function (position, mesh) {
-            this.setPosition(position, BABYLON.Space.WORLD, mesh);
-        };
-        Bone.prototype.setScale = function (x, y, z, scaleChildren) {
-            if (scaleChildren === void 0) { scaleChildren = false; }
-            if (this.animations[0] && !this.animations[0].isStopped()) {
-                if (!scaleChildren) {
-                    this._negateScaleChildren.x = 1 / x;
-                    this._negateScaleChildren.y = 1 / y;
-                    this._negateScaleChildren.z = 1 / z;
-                }
-                this._syncScaleVector();
-            }
-            this.scale(x / this._scaleVector.x, y / this._scaleVector.y, z / this._scaleVector.z, scaleChildren);
-        };
-        Bone.prototype.scale = function (x, y, z, scaleChildren) {
-            if (scaleChildren === void 0) { scaleChildren = false; }
-            var locMat = this.getLocalMatrix();
-            var origLocMat = BABYLON.Tmp.Matrix[0];
-            origLocMat.copyFrom(locMat);
-            var origLocMatInv = BABYLON.Tmp.Matrix[1];
-            origLocMatInv.copyFrom(origLocMat);
-            origLocMatInv.invert();
-            var scaleMat = BABYLON.Tmp.Matrix[2];
-            BABYLON.Matrix.FromValuesToRef(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1, scaleMat);
-            this._scaleMatrix.multiplyToRef(scaleMat, this._scaleMatrix);
-            this._scaleVector.x *= x;
-            this._scaleVector.y *= y;
-            this._scaleVector.z *= z;
-            locMat.multiplyToRef(origLocMatInv, locMat);
-            locMat.multiplyToRef(scaleMat, locMat);
-            locMat.multiplyToRef(origLocMat, locMat);
-            var parent = this.getParent();
-            if (parent) {
-                locMat.multiplyToRef(parent.getAbsoluteTransform(), this.getAbsoluteTransform());
-            }
-            else {
-                this.getAbsoluteTransform().copyFrom(locMat);
-            }
-            var len = this.children.length;
-            scaleMat.invert();
-            for (var i = 0; i < len; i++) {
-                var child = this.children[i];
-                var cm = child.getLocalMatrix();
-                cm.multiplyToRef(scaleMat, cm);
-                var lm = child.getLocalMatrix();
-                lm.m[12] *= x;
-                lm.m[13] *= y;
-                lm.m[14] *= z;
-            }
-            this.computeAbsoluteTransforms();
-            if (scaleChildren) {
-                for (var i = 0; i < len; i++) {
-                    this.children[i].scale(x, y, z, scaleChildren);
-                }
-            }
-            this.markAsDirty();
-        };
-        Bone.prototype.setYawPitchRoll = function (yaw, pitch, roll, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var rotMat = BABYLON.Tmp.Matrix[0];
-            BABYLON.Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);
-            var rotMatInv = BABYLON.Tmp.Matrix[1];
-            this._getNegativeRotationToRef(rotMatInv, space, mesh);
-            rotMatInv.multiplyToRef(rotMat, rotMat);
-            this._rotateWithMatrix(rotMat, space, mesh);
-        };
-        Bone.prototype.rotate = function (axis, amount, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var rmat = BABYLON.Tmp.Matrix[0];
-            rmat.m[12] = 0;
-            rmat.m[13] = 0;
-            rmat.m[14] = 0;
-            BABYLON.Matrix.RotationAxisToRef(axis, amount, rmat);
-            this._rotateWithMatrix(rmat, space, mesh);
-        };
-        Bone.prototype.setAxisAngle = function (axis, angle, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var rotMat = BABYLON.Tmp.Matrix[0];
-            BABYLON.Matrix.RotationAxisToRef(axis, angle, rotMat);
-            var rotMatInv = BABYLON.Tmp.Matrix[1];
-            this._getNegativeRotationToRef(rotMatInv, space, mesh);
-            rotMatInv.multiplyToRef(rotMat, rotMat);
-            this._rotateWithMatrix(rotMat, space, mesh);
-        };
-        Bone.prototype.setRotation = function (rotation, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, mesh);
-        };
-        Bone.prototype.setRotationQuaternion = function (quat, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var rotMatInv = BABYLON.Tmp.Matrix[0];
-            this._getNegativeRotationToRef(rotMatInv, space, mesh);
-            var rotMat = BABYLON.Tmp.Matrix[1];
-            BABYLON.Matrix.FromQuaternionToRef(quat, rotMat);
-            rotMatInv.multiplyToRef(rotMat, rotMat);
-            this._rotateWithMatrix(rotMat, space, mesh);
-        };
-        Bone.prototype.setRotationMatrix = function (rotMat, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var rotMatInv = BABYLON.Tmp.Matrix[0];
-            this._getNegativeRotationToRef(rotMatInv, space, mesh);
-            var rotMat2 = BABYLON.Tmp.Matrix[1];
-            rotMat2.copyFrom(rotMat);
-            rotMatInv.multiplyToRef(rotMat, rotMat2);
-            this._rotateWithMatrix(rotMat2, space, mesh);
-        };
-        Bone.prototype._rotateWithMatrix = function (rmat, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var lmat = this.getLocalMatrix();
-            var lx = lmat.m[12];
-            var ly = lmat.m[13];
-            var lz = lmat.m[14];
-            var parent = this.getParent();
-            var parentScale = BABYLON.Tmp.Matrix[3];
-            var parentScaleInv = BABYLON.Tmp.Matrix[4];
-            if (parent) {
-                if (space == BABYLON.Space.WORLD) {
-                    if (mesh) {
-                        parentScale.copyFrom(mesh.getWorldMatrix());
-                        parent.getAbsoluteTransform().multiplyToRef(parentScale, parentScale);
-                    }
-                    else {
-                        parentScale.copyFrom(parent.getAbsoluteTransform());
-                    }
-                }
-                else {
-                    parentScale = parent._scaleMatrix;
-                }
-                parentScaleInv.copyFrom(parentScale);
-                parentScaleInv.invert();
-                lmat.multiplyToRef(parentScale, lmat);
-                lmat.multiplyToRef(rmat, lmat);
-                lmat.multiplyToRef(parentScaleInv, lmat);
-            }
-            else {
-                if (space == BABYLON.Space.WORLD && mesh) {
-                    parentScale.copyFrom(mesh.getWorldMatrix());
-                    parentScaleInv.copyFrom(parentScale);
-                    parentScaleInv.invert();
-                    lmat.multiplyToRef(parentScale, lmat);
-                    lmat.multiplyToRef(rmat, lmat);
-                    lmat.multiplyToRef(parentScaleInv, lmat);
-                }
-                else {
-                    lmat.multiplyToRef(rmat, lmat);
-                }
-            }
-            lmat.m[12] = lx;
-            lmat.m[13] = ly;
-            lmat.m[14] = lz;
-            this.computeAbsoluteTransforms();
-            this.markAsDirty();
-        };
-        Bone.prototype._getNegativeRotationToRef = function (rotMatInv, space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            if (space == BABYLON.Space.WORLD) {
-                var scaleMatrix = BABYLON.Tmp.Matrix[2];
-                scaleMatrix.copyFrom(this._scaleMatrix);
-                rotMatInv.copyFrom(this.getAbsoluteTransform());
-                if (mesh) {
-                    rotMatInv.multiplyToRef(mesh.getWorldMatrix(), rotMatInv);
-                    var meshScale = BABYLON.Tmp.Matrix[3];
-                    BABYLON.Matrix.ScalingToRef(mesh.scaling.x, mesh.scaling.y, mesh.scaling.z, meshScale);
-                    scaleMatrix.multiplyToRef(meshScale, scaleMatrix);
-                }
-                rotMatInv.invert();
-                scaleMatrix.m[0] *= this._scalingDeterminant;
-                rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);
-            }
-            else {
-                rotMatInv.copyFrom(this.getLocalMatrix());
-                rotMatInv.invert();
-                var scaleMatrix = BABYLON.Tmp.Matrix[2];
-                scaleMatrix.copyFrom(this._scaleMatrix);
-                if (this._parent) {
-                    var pscaleMatrix = BABYLON.Tmp.Matrix[3];
-                    pscaleMatrix.copyFrom(this._parent._scaleMatrix);
-                    pscaleMatrix.invert();
-                    pscaleMatrix.multiplyToRef(rotMatInv, rotMatInv);
-                }
-                else {
-                    scaleMatrix.m[0] *= this._scalingDeterminant;
-                }
-                rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);
-            }
-        };
-        Bone.prototype.getScale = function () {
-            return this._scaleVector.clone();
-        };
-        Bone.prototype.getScaleToRef = function (result) {
-            result.copyFrom(this._scaleVector);
-        };
-        Bone.prototype.getPosition = function (space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var pos = BABYLON.Vector3.Zero();
-            this.getPositionToRef(space, mesh, pos);
-            return pos;
-        };
-        Bone.prototype.getPositionToRef = function (space, mesh, result) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            if (space == BABYLON.Space.LOCAL) {
-                var lm = this.getLocalMatrix();
-                result.x = lm.m[12];
-                result.y = lm.m[13];
-                result.z = lm.m[14];
-            }
-            else {
-                this._skeleton.computeAbsoluteTransforms();
-                var tmat = BABYLON.Tmp.Matrix[0];
-                if (mesh) {
-                    tmat.copyFrom(this.getAbsoluteTransform());
-                    tmat.multiplyToRef(mesh.getWorldMatrix(), tmat);
-                }
-                else {
-                    tmat = this.getAbsoluteTransform();
-                }
-                result.x = tmat.m[12];
-                result.y = tmat.m[13];
-                result.z = tmat.m[14];
-            }
-        };
-        Bone.prototype.getAbsolutePosition = function (mesh) {
-            var pos = BABYLON.Vector3.Zero();
-            this.getPositionToRef(BABYLON.Space.WORLD, mesh, pos);
-            return pos;
-        };
-        Bone.prototype.getAbsolutePositionToRef = function (mesh, result) {
-            this.getPositionToRef(BABYLON.Space.WORLD, mesh, result);
-        };
-        Bone.prototype.computeAbsoluteTransforms = function () {
-            if (this._parent) {
-                this._matrix.multiplyToRef(this._parent._absoluteTransform, this._absoluteTransform);
-            }
-            else {
-                this._absoluteTransform.copyFrom(this._matrix);
-                var poseMatrix = this._skeleton.getPoseMatrix();
-                if (poseMatrix) {
-                    this._absoluteTransform.multiplyToRef(poseMatrix, this._absoluteTransform);
-                }
-            }
-            var children = this.children;
-            var len = children.length;
-            for (var i = 0; i < len; i++) {
-                children[i].computeAbsoluteTransforms();
-            }
-        };
-        Bone.prototype.getDirection = function (localAxis, mesh) {
-            var result = BABYLON.Vector3.Zero();
-            this.getDirectionToRef(localAxis, result, mesh);
-            return result;
-        };
-        Bone.prototype.getDirectionToRef = function (localAxis, result, mesh) {
-            this._skeleton.computeAbsoluteTransforms();
-            var mat = BABYLON.Tmp.Matrix[0];
-            mat.copyFrom(this.getAbsoluteTransform());
-            if (mesh) {
-                mat.multiplyToRef(mesh.getWorldMatrix(), mat);
-            }
-            BABYLON.Vector3.TransformNormalToRef(localAxis, mat, result);
-            result.normalize();
-        };
-        Bone.prototype.getRotation = function (space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var result = BABYLON.Vector3.Zero();
-            this.getRotationToRef(space, mesh, result);
-            return result;
-        };
-        Bone.prototype.getRotationToRef = function (space, mesh, result) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var quat = BABYLON.Tmp.Quaternion[0];
-            this.getRotationQuaternionToRef(space, mesh, quat);
-            quat.toEulerAnglesToRef(result);
-        };
-        Bone.prototype.getRotationQuaternion = function (space, mesh) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            var result = BABYLON.Quaternion.Identity();
-            this.getRotationQuaternionToRef(space, mesh, result);
-            return result;
-        };
-        Bone.prototype.getRotationQuaternionToRef = function (space, mesh, result) {
-            if (space === void 0) { space = BABYLON.Space.LOCAL; }
-            if (space == BABYLON.Space.LOCAL) {
-                this.getLocalMatrix().decompose(BABYLON.Tmp.Vector3[0], result, BABYLON.Tmp.Vector3[1]);
-            }
-            else {
-                var mat = BABYLON.Tmp.Matrix[0];
-                var amat = this.getAbsoluteTransform();
-                if (mesh) {
-                    amat.multiplyToRef(mesh.getWorldMatrix(), mat);
-                }
-                else {
-                    mat.copyFrom(amat);
-                }
-                mat.m[0] *= this._scalingDeterminant;
-                mat.m[1] *= this._scalingDeterminant;
-                mat.m[2] *= this._scalingDeterminant;
-                mat.decompose(BABYLON.Tmp.Vector3[0], result, BABYLON.Tmp.Vector3[1]);
-            }
-        };
-        return Bone;
-    }(BABYLON.Node));
-    BABYLON.Bone = Bone;
-})(BABYLON || (BABYLON = {}));

+ 0 - 140
src/Bones/babylon.boneIKController.js

@@ -1,140 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var BoneIKController = (function () {
-        function BoneIKController(mesh, bone, target, poleTarget, poleAngle) {
-            if (poleAngle === void 0) { poleAngle = 0; }
-            this.poleAngle = 0;
-            this._maxAngle = Math.PI;
-            this._tmpVec1 = BABYLON.Vector3.Zero();
-            this._tmpVec2 = BABYLON.Vector3.Zero();
-            this._tmpVec3 = BABYLON.Vector3.Zero();
-            this._tmpVec4 = BABYLON.Vector3.Zero();
-            this._tmpVec5 = BABYLON.Vector3.Zero();
-            this._tmpMat1 = BABYLON.Matrix.Identity();
-            this._tmpMat2 = BABYLON.Matrix.Identity();
-            this._rightHandedSystem = false;
-            target.computeWorldMatrix(true);
-            poleTarget.computeWorldMatrix(true);
-            this._bone2 = bone;
-            this._bone1 = bone.getParent();
-            this.target = target;
-            this.poleTarget = poleTarget;
-            this.poleAngle = poleAngle;
-            this.mesh = mesh;
-            if (bone.getAbsoluteTransform().determinant() > 0) {
-                this._rightHandedSystem = true;
-            }
-            if (this._bone1.length) {
-                var boneScale1 = this._bone1.getScale();
-                var boneScale2 = this._bone2.getScale();
-                this._bone1Length = this._bone1.length * boneScale1.y;
-                this._bone2Length = this._bone2.length * boneScale2.y;
-            }
-            else if (this._bone1.children[0]) {
-                mesh.computeWorldMatrix(true);
-                var pos1 = this._bone2.children[0].getAbsolutePosition(mesh);
-                var pos2 = this._bone2.getAbsolutePosition(mesh);
-                var pos3 = this._bone1.getAbsolutePosition(mesh);
-                this._bone1Length = BABYLON.Vector3.Distance(pos1, pos2);
-                this._bone2Length = BABYLON.Vector3.Distance(pos2, pos3);
-            }
-            this.maxAngle = Math.PI;
-        }
-        Object.defineProperty(BoneIKController.prototype, "maxAngle", {
-            get: function () {
-                return this._maxAngle;
-            },
-            set: function (value) {
-                this._setMaxAngle(value);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        BoneIKController.prototype._setMaxAngle = function (ang) {
-            if (ang < 0) {
-                ang = 0;
-            }
-            if (ang > Math.PI || ang == undefined) {
-                ang = Math.PI;
-            }
-            this._maxAngle = ang;
-            var a = this._bone1Length;
-            var b = this._bone2Length;
-            this._maxReach = Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(ang));
-        };
-        BoneIKController.prototype.update = function () {
-            var bone1 = this._bone1;
-            var target = this.target.getAbsolutePosition();
-            var poleTarget = this.poleTarget.getAbsolutePosition();
-            var bonePos = this._tmpVec1;
-            var zaxis = this._tmpVec2;
-            var xaxis = this._tmpVec3;
-            var yaxis = this._tmpVec4;
-            var upAxis = this._tmpVec5;
-            var mat1 = this._tmpMat1;
-            var mat2 = this._tmpMat2;
-            bone1.getAbsolutePositionToRef(this.mesh, bonePos);
-            poleTarget.subtractToRef(bonePos, upAxis);
-            if (upAxis.x == 0 && upAxis.y == 0 && upAxis.z == 0) {
-                upAxis.y = 1;
-            }
-            else {
-                upAxis.normalize();
-            }
-            target.subtractToRef(bonePos, yaxis);
-            yaxis.normalize();
-            BABYLON.Vector3.CrossToRef(yaxis, upAxis, zaxis);
-            zaxis.normalize();
-            BABYLON.Vector3.CrossToRef(yaxis, zaxis, xaxis);
-            xaxis.normalize();
-            BABYLON.Matrix.FromXYZAxesToRef(xaxis, yaxis, zaxis, mat1);
-            var a = this._bone1Length;
-            var b = this._bone2Length;
-            var c = BABYLON.Vector3.Distance(bonePos, target);
-            if (this._maxReach > 0) {
-                c = Math.min(this._maxReach, c);
-            }
-            var acosa = (b * b + c * c - a * a) / (2 * b * c);
-            var acosb = (c * c + a * a - b * b) / (2 * c * a);
-            if (acosa > 1) {
-                acosa = 1;
-            }
-            if (acosb > 1) {
-                acosb = 1;
-            }
-            if (acosa < -1) {
-                acosa = -1;
-            }
-            if (acosb < -1) {
-                acosb = -1;
-            }
-            var angA = Math.acos(acosa);
-            var angB = Math.acos(acosb);
-            var angC = -angA - angB;
-            var bendAxis = this._tmpVec1;
-            bendAxis.x = 0;
-            bendAxis.y = 0;
-            bendAxis.z = 0;
-            if (this._rightHandedSystem) {
-                bendAxis.z = 1;
-                BABYLON.Matrix.RotationYawPitchRollToRef(0, 0, angB + Math.PI * .5, mat2);
-                mat2.multiplyToRef(mat1, mat1);
-                BABYLON.Matrix.RotationAxisToRef(yaxis, this.poleAngle + Math.PI, mat2);
-                mat1.multiplyToRef(mat2, mat1);
-            }
-            else {
-                bendAxis.x = 1;
-                BABYLON.Matrix.RotationYawPitchRollToRef(0, angB, 0, mat2);
-                mat2.multiplyToRef(mat1, mat1);
-                if (this.poleAngle) {
-                    BABYLON.Matrix.RotationAxisToRef(yaxis, this.poleAngle, mat2);
-                    mat1.multiplyToRef(mat2, mat1);
-                }
-            }
-            this._bone1.setRotationMatrix(mat1, BABYLON.Space.WORLD, this.mesh);
-            this._bone2.setAxisAngle(bendAxis, angC, BABYLON.Space.LOCAL);
-        };
-        return BoneIKController;
-    }());
-    BABYLON.BoneIKController = BoneIKController;
-})(BABYLON || (BABYLON = {}));

+ 0 - 51
src/Bones/babylon.boneLookController.js

@@ -1,51 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var BoneLookController = (function () {
-        function BoneLookController(mesh, bone, target, adjustYaw, adjustPitch, adjustRoll) {
-            if (adjustYaw === void 0) { adjustYaw = 0; }
-            if (adjustPitch === void 0) { adjustPitch = 0; }
-            if (adjustRoll === void 0) { adjustRoll = 0; }
-            this.upAxis = BABYLON.Vector3.Up();
-            this.adjustYaw = 0;
-            this.adjustPitch = 0;
-            this.adjustRoll = 0;
-            this._tmpVec1 = BABYLON.Vector3.Zero();
-            this._tmpVec2 = BABYLON.Vector3.Zero();
-            this._tmpVec3 = BABYLON.Vector3.Zero();
-            this._tmpVec4 = BABYLON.Vector3.Zero();
-            this._tmpMat1 = BABYLON.Matrix.Identity();
-            this._tmpMat2 = BABYLON.Matrix.Identity();
-            this.mesh = mesh;
-            this.bone = bone;
-            this.target = target;
-            this.adjustYaw = adjustYaw;
-            this.adjustPitch = adjustPitch;
-            this.adjustRoll = adjustRoll;
-        }
-        BoneLookController.prototype.update = function () {
-            var bone = this.bone;
-            var target = this.target;
-            var bonePos = this._tmpVec1;
-            var zaxis = this._tmpVec2;
-            var xaxis = this._tmpVec3;
-            var yaxis = this._tmpVec4;
-            var mat1 = this._tmpMat1;
-            var mat2 = this._tmpMat2;
-            bone.getAbsolutePositionToRef(this.mesh, bonePos);
-            target.subtractToRef(bonePos, zaxis);
-            zaxis.normalize();
-            BABYLON.Vector3.CrossToRef(this.upAxis, zaxis, xaxis);
-            xaxis.normalize();
-            BABYLON.Vector3.CrossToRef(zaxis, xaxis, yaxis);
-            yaxis.normalize();
-            BABYLON.Matrix.FromXYZAxesToRef(xaxis, yaxis, zaxis, mat1);
-            if (this.adjustYaw || this.adjustPitch || this.adjustRoll) {
-                BABYLON.Matrix.RotationYawPitchRollToRef(this.adjustYaw, this.adjustPitch, this.adjustRoll, mat2);
-                mat2.multiplyToRef(mat1, mat1);
-            }
-            this.bone.setRotationMatrix(mat1, BABYLON.Space.WORLD, this.mesh);
-        };
-        return BoneLookController;
-    }());
-    BABYLON.BoneLookController = BoneLookController;
-})(BABYLON || (BABYLON = {}));

+ 0 - 355
src/Bones/babylon.skeleton.js

@@ -1,355 +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.needInitialSkinMatrix = false;
-            this._isDirty = true;
-            this._meshesWithPoseMatrix = new Array();
-            this._identity = BABYLON.Matrix.Identity();
-            this._ranges = {};
-            this._lastAbsoluteTransformsUpdateId = -1;
-            this.bones = [];
-            this._scene = scene;
-            scene.skeletons.push(this);
-            //make sure it will recalculate the matrix next time prepare is called.
-            this._isDirty = true;
-        }
-        // Members
-        Skeleton.prototype.getTransformMatrices = function (mesh) {
-            if (this.needInitialSkinMatrix && mesh._bonesTransformMatrices) {
-                return mesh._bonesTransformMatrices;
-            }
-            return this._transformMatrices;
-        };
-        Skeleton.prototype.getScene = function () {
-            return this._scene;
-        };
-        // Methods
-        /**
-         * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
-         */
-        Skeleton.prototype.toString = function (fullDetails) {
-            var ret = "Name: " + this.name + ", nBones: " + this.bones.length;
-            ret += ", nAnimationRanges: " + (this._ranges ? Object.keys(this._ranges).length : "none");
-            if (fullDetails) {
-                ret += ", Ranges: {";
-                var first = true;
-                for (var name_1 in this._ranges) {
-                    if (first) {
-                        ret += ", ";
-                        first = false;
-                    }
-                    ret += name_1;
-                }
-                ret += "}";
-            }
-            return ret;
-        };
-        /**
-        * Get bone's index searching by name
-        * @param {string} name is bone's name to search for
-        * @return {number} Indice of the bone. Returns -1 if not found
-        */
-        Skeleton.prototype.getBoneIndexByName = function (name) {
-            for (var boneIndex = 0, cache = this.bones.length; boneIndex < cache; boneIndex++) {
-                if (this.bones[boneIndex].name === name) {
-                    return boneIndex;
-                }
-            }
-            return -1;
-        };
-        Skeleton.prototype.createAnimationRange = function (name, from, to) {
-            // check name not already in use
-            if (!this._ranges[name]) {
-                this._ranges[name] = new BABYLON.AnimationRange(name, from, to);
-                for (var i = 0, nBones = this.bones.length; i < nBones; i++) {
-                    if (this.bones[i].animations[0]) {
-                        this.bones[i].animations[0].createRange(name, from, to);
-                    }
-                }
-            }
-        };
-        Skeleton.prototype.deleteAnimationRange = function (name, deleteFrames) {
-            if (deleteFrames === void 0) { deleteFrames = true; }
-            for (var i = 0, nBones = this.bones.length; i < nBones; i++) {
-                if (this.bones[i].animations[0]) {
-                    this.bones[i].animations[0].deleteRange(name, deleteFrames);
-                }
-            }
-            this._ranges[name] = undefined; // said much faster than 'delete this._range[name]' 
-        };
-        Skeleton.prototype.getAnimationRange = function (name) {
-            return this._ranges[name];
-        };
-        /**
-         *  Returns as an Array, all AnimationRanges defined on this skeleton
-         */
-        Skeleton.prototype.getAnimationRanges = function () {
-            var animationRanges = [];
-            var name;
-            var i = 0;
-            for (name in this._ranges) {
-                animationRanges[i] = this._ranges[name];
-                i++;
-            }
-            return animationRanges;
-        };
-        /**
-         *  note: This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences
-         */
-        Skeleton.prototype.copyAnimationRange = function (source, name, rescaleAsRequired) {
-            if (rescaleAsRequired === void 0) { rescaleAsRequired = false; }
-            if (this._ranges[name] || !source.getAnimationRange(name)) {
-                return false;
-            }
-            var ret = true;
-            var frameOffset = this._getHighestAnimationFrame() + 1;
-            // make a dictionary of source skeleton's bones, so exact same order or doublely nested loop is not required
-            var boneDict = {};
-            var sourceBones = source.bones;
-            var nBones;
-            var i;
-            for (i = 0, nBones = sourceBones.length; i < nBones; i++) {
-                boneDict[sourceBones[i].name] = sourceBones[i];
-            }
-            if (this.bones.length !== sourceBones.length) {
-                BABYLON.Tools.Warn("copyAnimationRange: this rig has " + this.bones.length + " bones, while source as " + sourceBones.length);
-                ret = false;
-            }
-            var skelDimensionsRatio = (rescaleAsRequired && this.dimensionsAtRest && source.dimensionsAtRest) ? this.dimensionsAtRest.divide(source.dimensionsAtRest) : null;
-            for (i = 0, nBones = this.bones.length; i < nBones; i++) {
-                var boneName = this.bones[i].name;
-                var sourceBone = boneDict[boneName];
-                if (sourceBone) {
-                    ret = ret && this.bones[i].copyAnimationRange(sourceBone, name, frameOffset, rescaleAsRequired, skelDimensionsRatio);
-                }
-                else {
-                    BABYLON.Tools.Warn("copyAnimationRange: not same rig, missing source bone " + boneName);
-                    ret = false;
-                }
-            }
-            // do not call createAnimationRange(), since it also is done to bones, which was already done
-            var range = source.getAnimationRange(name);
-            this._ranges[name] = new BABYLON.AnimationRange(name, range.from + frameOffset, range.to + frameOffset);
-            return ret;
-        };
-        Skeleton.prototype.returnToRest = function () {
-            for (var index = 0; index < this.bones.length; index++) {
-                this.bones[index].returnToRest();
-            }
-        };
-        Skeleton.prototype._getHighestAnimationFrame = function () {
-            var ret = 0;
-            for (var i = 0, nBones = this.bones.length; i < nBones; i++) {
-                if (this.bones[i].animations[0]) {
-                    var highest = this.bones[i].animations[0].getHighestFrame();
-                    if (ret < highest) {
-                        ret = highest;
-                    }
-                }
-            }
-            return ret;
-        };
-        Skeleton.prototype.beginAnimation = function (name, loop, speedRatio, onAnimationEnd) {
-            var range = this.getAnimationRange(name);
-            if (!range) {
-                return null;
-            }
-            return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);
-        };
-        Skeleton.prototype._markAsDirty = function () {
-            this._isDirty = true;
-        };
-        Skeleton.prototype._registerMeshWithPoseMatrix = function (mesh) {
-            this._meshesWithPoseMatrix.push(mesh);
-        };
-        Skeleton.prototype._unregisterMeshWithPoseMatrix = function (mesh) {
-            var index = this._meshesWithPoseMatrix.indexOf(mesh);
-            if (index > -1) {
-                this._meshesWithPoseMatrix.splice(index, 1);
-            }
-        };
-        Skeleton.prototype._computeTransformMatrices = function (targetMatrix, initialSkinMatrix) {
-            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 {
-                    if (initialSkinMatrix) {
-                        bone.getLocalMatrix().multiplyToRef(initialSkinMatrix, bone.getWorldMatrix());
-                    }
-                    else {
-                        bone.getWorldMatrix().copyFrom(bone.getLocalMatrix());
-                    }
-                }
-                bone.getInvertedAbsoluteTransform().multiplyToArray(bone.getWorldMatrix(), targetMatrix, index * 16);
-            }
-            this._identity.copyToArray(targetMatrix, this.bones.length * 16);
-        };
-        Skeleton.prototype.prepare = function () {
-            if (!this._isDirty) {
-                return;
-            }
-            if (this.needInitialSkinMatrix) {
-                for (var index = 0; index < this._meshesWithPoseMatrix.length; index++) {
-                    var mesh = this._meshesWithPoseMatrix[index];
-                    if (!mesh._bonesTransformMatrices || mesh._bonesTransformMatrices.length !== 16 * (this.bones.length + 1)) {
-                        mesh._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1));
-                    }
-                    var poseMatrix = mesh.getPoseMatrix();
-                    // Prepare bones
-                    for (var boneIndex = 0; boneIndex < this.bones.length; boneIndex++) {
-                        var bone = this.bones[boneIndex];
-                        if (!bone.getParent()) {
-                            var matrix = bone.getBaseMatrix();
-                            matrix.multiplyToRef(poseMatrix, BABYLON.Tmp.Matrix[0]);
-                            bone._updateDifferenceMatrix(BABYLON.Tmp.Matrix[0]);
-                        }
-                    }
-                    this._computeTransformMatrices(mesh._bonesTransformMatrices, poseMatrix);
-                }
-            }
-            else {
-                if (!this._transformMatrices || this._transformMatrices.length !== 16 * (this.bones.length + 1)) {
-                    this._transformMatrices = new Float32Array(16 * (this.bones.length + 1));
-                }
-                this._computeTransformMatrices(this._transformMatrices, null);
-            }
-            this._isDirty = false;
-            this._scene._activeBones.addCount(this.bones.length, 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 Skeleton(name, id || name, this._scene);
-            result.needInitialSkinMatrix = this.needInitialSkinMatrix;
-            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().clone(), source.getRestPose().clone());
-                BABYLON.Tools.DeepCopy(source.animations, bone.animations);
-            }
-            if (this._ranges) {
-                result._ranges = {};
-                for (var rangeName in this._ranges) {
-                    result._ranges[rangeName] = this._ranges[rangeName].clone();
-                }
-            }
-            this._isDirty = true;
-            return result;
-        };
-        Skeleton.prototype.enableBlending = function (blendingSpeed) {
-            if (blendingSpeed === void 0) { blendingSpeed = 0.01; }
-            this.bones.forEach(function (bone) {
-                bone.animations.forEach(function (animation) {
-                    animation.enableBlending = true;
-                    animation.blendingSpeed = blendingSpeed;
-                });
-            });
-        };
-        Skeleton.prototype.dispose = function () {
-            this._meshesWithPoseMatrix = [];
-            // Animations
-            this.getScene().stopAnimation(this);
-            // Remove from scene
-            this.getScene().removeSkeleton(this);
-        };
-        Skeleton.prototype.serialize = function () {
-            var serializationObject = {};
-            serializationObject.name = this.name;
-            serializationObject.id = this.id;
-            serializationObject.dimensionsAtRest = this.dimensionsAtRest;
-            serializationObject.bones = [];
-            serializationObject.needInitialSkinMatrix = this.needInitialSkinMatrix;
-            for (var index = 0; index < this.bones.length; index++) {
-                var bone = this.bones[index];
-                var serializedBone = {
-                    parentBoneIndex: bone.getParent() ? this.bones.indexOf(bone.getParent()) : -1,
-                    name: bone.name,
-                    matrix: bone.getLocalMatrix().toArray(),
-                    rest: bone.getRestPose().toArray()
-                };
-                serializationObject.bones.push(serializedBone);
-                if (bone.length) {
-                    serializedBone.length = bone.length;
-                }
-                if (bone.animations && bone.animations.length > 0) {
-                    serializedBone.animation = bone.animations[0].serialize();
-                }
-                serializationObject.ranges = [];
-                for (var name in this._ranges) {
-                    var range = {};
-                    range.name = name;
-                    range.from = this._ranges[name].from;
-                    range.to = this._ranges[name].to;
-                    serializationObject.ranges.push(range);
-                }
-            }
-            return serializationObject;
-        };
-        Skeleton.Parse = function (parsedSkeleton, scene) {
-            var skeleton = new Skeleton(parsedSkeleton.name, parsedSkeleton.id, scene);
-            if (parsedSkeleton.dimensionsAtRest) {
-                skeleton.dimensionsAtRest = BABYLON.Vector3.FromArray(parsedSkeleton.dimensionsAtRest);
-            }
-            skeleton.needInitialSkinMatrix = parsedSkeleton.needInitialSkinMatrix;
-            var index;
-            for (index = 0; index < parsedSkeleton.bones.length; index++) {
-                var parsedBone = parsedSkeleton.bones[index];
-                var parentBone = null;
-                if (parsedBone.parentBoneIndex > -1) {
-                    parentBone = skeleton.bones[parsedBone.parentBoneIndex];
-                }
-                var rest = parsedBone.rest ? BABYLON.Matrix.FromArray(parsedBone.rest) : null;
-                var bone = new BABYLON.Bone(parsedBone.name, skeleton, parentBone, BABYLON.Matrix.FromArray(parsedBone.matrix), rest);
-                if (parsedBone.length) {
-                    bone.length = parsedBone.length;
-                }
-                if (parsedBone.animation) {
-                    bone.animations.push(BABYLON.Animation.Parse(parsedBone.animation));
-                }
-            }
-            // placed after bones, so createAnimationRange can cascade down
-            if (parsedSkeleton.ranges) {
-                for (index = 0; index < parsedSkeleton.ranges.length; index++) {
-                    var data = parsedSkeleton.ranges[index];
-                    skeleton.createAnimationRange(data.name, data.from, data.to);
-                }
-            }
-            return skeleton;
-        };
-        Skeleton.prototype.computeAbsoluteTransforms = function (forceUpdate) {
-            if (forceUpdate === void 0) { forceUpdate = false; }
-            var renderId = this._scene.getRenderId();
-            if (this._lastAbsoluteTransformsUpdateId != renderId || forceUpdate) {
-                this.bones[0].computeAbsoluteTransforms();
-                this._lastAbsoluteTransformsUpdateId = renderId;
-            }
-        };
-        Skeleton.prototype.getPoseMatrix = function () {
-            var poseMatrix;
-            if (this._meshesWithPoseMatrix.length > 0) {
-                poseMatrix = this._meshesWithPoseMatrix[0].getPoseMatrix();
-            }
-            return poseMatrix;
-        };
-        return Skeleton;
-    }());
-    BABYLON.Skeleton = Skeleton;
-})(BABYLON || (BABYLON = {}));

+ 0 - 71
src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js

@@ -1,71 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var ArcRotateCameraGamepadInput = (function () {
-        function ArcRotateCameraGamepadInput() {
-            this.gamepadRotationSensibility = 80;
-            this.gamepadMoveSensibility = 40;
-        }
-        ArcRotateCameraGamepadInput.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            this._gamepads = new BABYLON.Gamepads(function (gamepad) { _this._onNewGameConnected(gamepad); });
-        };
-        ArcRotateCameraGamepadInput.prototype.detachControl = function (element) {
-            if (this._gamepads) {
-                this._gamepads.dispose();
-            }
-            this.gamepad = null;
-        };
-        ArcRotateCameraGamepadInput.prototype.checkInputs = function () {
-            if (this.gamepad) {
-                var camera = this.camera;
-                var RSValues = this.gamepad.rightStick;
-                if (RSValues.x != 0) {
-                    var normalizedRX = RSValues.x / this.gamepadRotationSensibility;
-                    if (normalizedRX != 0 && Math.abs(normalizedRX) > 0.005) {
-                        camera.inertialAlphaOffset += normalizedRX;
-                    }
-                }
-                if (RSValues.y != 0) {
-                    var normalizedRY = RSValues.y / this.gamepadRotationSensibility;
-                    if (normalizedRY != 0 && Math.abs(normalizedRY) > 0.005) {
-                        camera.inertialBetaOffset += normalizedRY;
-                    }
-                }
-                var LSValues = this.gamepad.leftStick;
-                if (LSValues.y != 0) {
-                    var normalizedLY = LSValues.y / this.gamepadMoveSensibility;
-                    if (normalizedLY != 0 && Math.abs(normalizedLY) > 0.005) {
-                        this.camera.inertialRadiusOffset -= normalizedLY;
-                    }
-                }
-            }
-        };
-        ArcRotateCameraGamepadInput.prototype._onNewGameConnected = function (gamepad) {
-            // Only the first gamepad can control the camera
-            if (gamepad.index === 0) {
-                this.gamepad = gamepad;
-            }
-        };
-        ArcRotateCameraGamepadInput.prototype.getTypeName = function () {
-            return "ArcRotateCameraGamepadInput";
-        };
-        ArcRotateCameraGamepadInput.prototype.getSimpleName = function () {
-            return "gamepad";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraGamepadInput.prototype, "gamepadRotationSensibility", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraGamepadInput.prototype, "gamepadMoveSensibility", void 0);
-        return ArcRotateCameraGamepadInput;
-    }());
-    BABYLON.ArcRotateCameraGamepadInput = ArcRotateCameraGamepadInput;
-    BABYLON.CameraInputTypes["ArcRotateCameraGamepadInput"] = ArcRotateCameraGamepadInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 116
src/Cameras/Inputs/babylon.arcrotatecamera.input.keyboard.js

@@ -1,116 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var ArcRotateCameraKeyboardMoveInput = (function () {
-        function ArcRotateCameraKeyboardMoveInput() {
-            this._keys = [];
-            this.keysUp = [38];
-            this.keysDown = [40];
-            this.keysLeft = [37];
-            this.keysRight = [39];
-        }
-        ArcRotateCameraKeyboardMoveInput.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            element.tabIndex = 1;
-            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 = [];
-            };
-            element.addEventListener("keydown", this._onKeyDown, false);
-            element.addEventListener("keyup", this._onKeyUp, false);
-            BABYLON.Tools.RegisterTopRootEvents([
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        };
-        ArcRotateCameraKeyboardMoveInput.prototype.detachControl = function (element) {
-            if (element) {
-                element.removeEventListener("keydown", this._onKeyDown);
-                element.removeEventListener("keyup", this._onKeyUp);
-            }
-            BABYLON.Tools.UnregisterTopRootEvents([
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-            this._keys = [];
-            this._onKeyDown = null;
-            this._onKeyUp = null;
-            this._onLostFocus = null;
-        };
-        ArcRotateCameraKeyboardMoveInput.prototype.checkInputs = function () {
-            if (this._onKeyDown) {
-                var camera = this.camera;
-                for (var index = 0; index < this._keys.length; index++) {
-                    var keyCode = this._keys[index];
-                    if (this.keysLeft.indexOf(keyCode) !== -1) {
-                        camera.inertialAlphaOffset -= 0.01;
-                    }
-                    else if (this.keysUp.indexOf(keyCode) !== -1) {
-                        camera.inertialBetaOffset -= 0.01;
-                    }
-                    else if (this.keysRight.indexOf(keyCode) !== -1) {
-                        camera.inertialAlphaOffset += 0.01;
-                    }
-                    else if (this.keysDown.indexOf(keyCode) !== -1) {
-                        camera.inertialBetaOffset += 0.01;
-                    }
-                }
-            }
-        };
-        ArcRotateCameraKeyboardMoveInput.prototype.getTypeName = function () {
-            return "ArcRotateCameraKeyboardMoveInput";
-        };
-        ArcRotateCameraKeyboardMoveInput.prototype.getSimpleName = function () {
-            return "keyboard";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraKeyboardMoveInput.prototype, "keysUp", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraKeyboardMoveInput.prototype, "keysDown", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraKeyboardMoveInput.prototype, "keysLeft", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraKeyboardMoveInput.prototype, "keysRight", void 0);
-        return ArcRotateCameraKeyboardMoveInput;
-    }());
-    BABYLON.ArcRotateCameraKeyboardMoveInput = ArcRotateCameraKeyboardMoveInput;
-    BABYLON.CameraInputTypes["ArcRotateCameraKeyboardMoveInput"] = ArcRotateCameraKeyboardMoveInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 57
src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.js

@@ -1,57 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var ArcRotateCameraMouseWheelInput = (function () {
-        function ArcRotateCameraMouseWheelInput() {
-            this.wheelPrecision = 3.0;
-        }
-        ArcRotateCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            this._wheel = function (p, s) {
-                //sanity check - this should be a PointerWheel event.
-                if (p.type !== BABYLON.PointerEventTypes.POINTERWHEEL)
-                    return;
-                var event = p.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.camera.inertialRadiusOffset += delta;
-                if (event.preventDefault) {
-                    if (!noPreventDefault) {
-                        event.preventDefault();
-                    }
-                }
-            };
-            this._observer = this.camera.getScene().onPointerObservable.add(this._wheel, BABYLON.PointerEventTypes.POINTERWHEEL);
-        };
-        ArcRotateCameraMouseWheelInput.prototype.detachControl = function (element) {
-            if (this._observer && element) {
-                this.camera.getScene().onPointerObservable.remove(this._observer);
-                this._observer = null;
-                this._wheel = null;
-            }
-        };
-        ArcRotateCameraMouseWheelInput.prototype.getTypeName = function () {
-            return "ArcRotateCameraMouseWheelInput";
-        };
-        ArcRotateCameraMouseWheelInput.prototype.getSimpleName = function () {
-            return "mousewheel";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecision", void 0);
-        return ArcRotateCameraMouseWheelInput;
-    }());
-    BABYLON.ArcRotateCameraMouseWheelInput = ArcRotateCameraMouseWheelInput;
-    BABYLON.CameraInputTypes["ArcRotateCameraMouseWheelInput"] = ArcRotateCameraMouseWheelInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 219
src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.js

@@ -1,219 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var eventPrefix = BABYLON.Tools.GetPointerPrefix();
-    var ArcRotateCameraPointersInput = (function () {
-        function ArcRotateCameraPointersInput() {
-            this.buttons = [0, 1, 2];
-            this.angularSensibilityX = 1000.0;
-            this.angularSensibilityY = 1000.0;
-            this.pinchPrecision = 6.0;
-            this.panningSensibility = 50.0;
-            this._isPanClick = false;
-            this.pinchInwards = true;
-        }
-        ArcRotateCameraPointersInput.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            var engine = this.camera.getEngine();
-            var cacheSoloPointer; // cache pointer object for better perf on camera rotation
-            var pointA, pointB;
-            var previousPinchDistance = 0;
-            this._pointerInput = function (p, s) {
-                var evt = p.event;
-                if (p.type !== BABYLON.PointerEventTypes.POINTERMOVE && _this.buttons.indexOf(evt.button) === -1) {
-                    return;
-                }
-                if (p.type === BABYLON.PointerEventTypes.POINTERDOWN) {
-                    try {
-                        evt.srcElement.setPointerCapture(evt.pointerId);
-                    }
-                    catch (e) {
-                    }
-                    // Manage panning with pan button click
-                    _this._isPanClick = evt.button === _this.camera._panningMouseButton;
-                    // manage pointers
-                    cacheSoloPointer = { x: evt.clientX, y: evt.clientY, pointerId: evt.pointerId, type: evt.pointerType };
-                    if (pointA === undefined) {
-                        pointA = cacheSoloPointer;
-                    }
-                    else if (pointB === undefined) {
-                        pointB = cacheSoloPointer;
-                    }
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                        element.focus();
-                    }
-                }
-                else if (p.type === BABYLON.PointerEventTypes.POINTERUP) {
-                    try {
-                        evt.srcElement.releasePointerCapture(evt.pointerId);
-                    }
-                    catch (e) {
-                    }
-                    cacheSoloPointer = null;
-                    previousPinchDistance = 0;
-                    //would be better to use pointers.remove(evt.pointerId) for multitouch gestures, 
-                    //but emptying completly pointers collection is required to fix a bug on iPhone : 
-                    //when changing orientation while pinching camera, one pointer stay pressed forever if we don't release all pointers  
-                    //will be ok to put back pointers.remove(evt.pointerId); when iPhone bug corrected
-                    pointA = pointB = undefined;
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                }
-                else if (p.type === BABYLON.PointerEventTypes.POINTERMOVE) {
-                    if (!noPreventDefault) {
-                        evt.preventDefault();
-                    }
-                    // One button down
-                    if (pointA && pointB === undefined) {
-                        if (_this.panningSensibility !== 0 &&
-                            ((evt.ctrlKey && _this.camera._useCtrlForPanning) ||
-                                (!_this.camera._useCtrlForPanning && _this._isPanClick))) {
-                            _this.camera
-                                .inertialPanningX += -(evt.clientX - cacheSoloPointer.x) / _this.panningSensibility;
-                            _this.camera
-                                .inertialPanningY += (evt.clientY - cacheSoloPointer.y) / _this.panningSensibility;
-                        }
-                        else {
-                            var offsetX = evt.clientX - cacheSoloPointer.x;
-                            var offsetY = evt.clientY - cacheSoloPointer.y;
-                            _this.camera.inertialAlphaOffset -= offsetX / _this.angularSensibilityX;
-                            _this.camera.inertialBetaOffset -= offsetY / _this.angularSensibilityY;
-                        }
-                        cacheSoloPointer.x = evt.clientX;
-                        cacheSoloPointer.y = evt.clientY;
-                    }
-                    else if (pointA && pointB) {
-                        //if (noPreventDefault) { evt.preventDefault(); } //if pinch gesture, could be useful to force preventDefault to avoid html page scroll/zoom in some mobile browsers
-                        var ed = (pointA.pointerId === evt.pointerId) ? pointA : pointB;
-                        ed.x = evt.clientX;
-                        ed.y = evt.clientY;
-                        var direction = _this.pinchInwards ? 1 : -1;
-                        var distX = pointA.x - pointB.x;
-                        var distY = pointA.y - pointB.y;
-                        var pinchSquaredDistance = (distX * distX) + (distY * distY);
-                        if (previousPinchDistance === 0) {
-                            previousPinchDistance = pinchSquaredDistance;
-                            return;
-                        }
-                        if (pinchSquaredDistance !== previousPinchDistance) {
-                            _this.camera
-                                .inertialRadiusOffset += (pinchSquaredDistance - previousPinchDistance) /
-                                (_this.pinchPrecision *
-                                    ((_this.angularSensibilityX + _this.angularSensibilityY) / 2) *
-                                    direction);
-                            previousPinchDistance = pinchSquaredDistance;
-                        }
-                    }
-                }
-            };
-            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, BABYLON.PointerEventTypes.POINTERDOWN | BABYLON.PointerEventTypes.POINTERUP | BABYLON.PointerEventTypes.POINTERMOVE);
-            this._onContextMenu = function (evt) {
-                evt.preventDefault();
-            };
-            if (!this.camera._useCtrlForPanning) {
-                element.addEventListener("contextmenu", this._onContextMenu, false);
-            }
-            this._onLostFocus = function () {
-                //this._keys = [];
-                pointA = pointB = undefined;
-                previousPinchDistance = 0;
-                cacheSoloPointer = null;
-            };
-            this._onMouseMove = function (evt) {
-                if (!engine.isPointerLock) {
-                    return;
-                }
-                var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-                _this.camera.inertialAlphaOffset -= offsetX / _this.angularSensibilityX;
-                _this.camera.inertialBetaOffset -= offsetY / _this.angularSensibilityY;
-                if (!noPreventDefault) {
-                    evt.preventDefault();
-                }
-            };
-            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.camera.radius *= e.scale;
-                if (e.preventDefault) {
-                    if (!noPreventDefault) {
-                        e.stopPropagation();
-                        e.preventDefault();
-                    }
-                }
-            };
-            element.addEventListener("mousemove", this._onMouseMove, false);
-            element.addEventListener("MSPointerDown", this._onGestureStart, false);
-            element.addEventListener("MSGestureChange", this._onGesture, false);
-            element.addEventListener("keydown", this._onKeyDown, false);
-            element.addEventListener("keyup", this._onKeyUp, false);
-            BABYLON.Tools.RegisterTopRootEvents([
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        };
-        ArcRotateCameraPointersInput.prototype.detachControl = function (element) {
-            if (element && this._observer) {
-                this.camera.getScene().onPointerObservable.remove(this._observer);
-                this._observer = null;
-                element.removeEventListener("contextmenu", this._onContextMenu);
-                element.removeEventListener("mousemove", this._onMouseMove);
-                element.removeEventListener("MSPointerDown", this._onGestureStart);
-                element.removeEventListener("MSGestureChange", this._onGesture);
-                element.removeEventListener("keydown", this._onKeyDown);
-                element.removeEventListener("keyup", this._onKeyUp);
-                this._isPanClick = false;
-                this.pinchInwards = true;
-                this._onKeyDown = null;
-                this._onKeyUp = null;
-                this._onMouseMove = null;
-                this._onGestureStart = null;
-                this._onGesture = null;
-                this._MSGestureHandler = null;
-                this._onLostFocus = null;
-                this._onContextMenu = null;
-            }
-            BABYLON.Tools.UnregisterTopRootEvents([
-                { name: "blur", handler: this._onLostFocus }
-            ]);
-        };
-        ArcRotateCameraPointersInput.prototype.getTypeName = function () {
-            return "ArcRotateCameraPointersInput";
-        };
-        ArcRotateCameraPointersInput.prototype.getSimpleName = function () {
-            return "pointers";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraPointersInput.prototype, "buttons", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraPointersInput.prototype, "angularSensibilityX", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraPointersInput.prototype, "angularSensibilityY", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraPointersInput.prototype, "pinchPrecision", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCameraPointersInput.prototype, "panningSensibility", void 0);
-        return ArcRotateCameraPointersInput;
-    }());
-    BABYLON.ArcRotateCameraPointersInput = ArcRotateCameraPointersInput;
-    BABYLON.CameraInputTypes["ArcRotateCameraPointersInput"] = ArcRotateCameraPointersInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 48
src/Cameras/Inputs/babylon.arcrotatecamera.input.vrdeviceorientation.js

@@ -1,48 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var ArcRotateCameraVRDeviceOrientationInput = (function () {
-        function ArcRotateCameraVRDeviceOrientationInput() {
-            this.alphaCorrection = 1;
-            this.betaCorrection = 1;
-            this.gammaCorrection = 1;
-            this._alpha = 0;
-            this._beta = 0;
-            this._gamma = 0;
-            this._dirty = false;
-            this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
-        }
-        ArcRotateCameraVRDeviceOrientationInput.prototype.attachControl = function (element, noPreventDefault) {
-            this.camera.attachControl(element, noPreventDefault);
-            window.addEventListener("deviceorientation", this._deviceOrientationHandler);
-        };
-        ArcRotateCameraVRDeviceOrientationInput.prototype._onOrientationEvent = function (evt) {
-            var camera = this.camera;
-            this._alpha = +evt.alpha | 0;
-            this._beta = +evt.beta | 0;
-            this._gamma = +evt.gamma | 0;
-            this._dirty = true;
-        };
-        ArcRotateCameraVRDeviceOrientationInput.prototype.checkInputs = function () {
-            if (this._dirty) {
-                this._dirty = false;
-                if (this._gamma < 0) {
-                    this._gamma = 180 + this._gamma;
-                }
-                this.camera.alpha = (-this._alpha / 180.0 * Math.PI) % Math.PI * 2;
-                this.camera.beta = (this._gamma / 180.0 * Math.PI);
-            }
-        };
-        ArcRotateCameraVRDeviceOrientationInput.prototype.detachControl = function (element) {
-            window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
-        };
-        ArcRotateCameraVRDeviceOrientationInput.prototype.getTypeName = function () {
-            return "ArcRotateCameraVRDeviceOrientationInput";
-        };
-        ArcRotateCameraVRDeviceOrientationInput.prototype.getSimpleName = function () {
-            return "VRDeviceOrientation";
-        };
-        return ArcRotateCameraVRDeviceOrientationInput;
-    }());
-    BABYLON.ArcRotateCameraVRDeviceOrientationInput = ArcRotateCameraVRDeviceOrientationInput;
-    BABYLON.CameraInputTypes["ArcRotateCameraVRDeviceOrientationInput"] = ArcRotateCameraVRDeviceOrientationInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 69
src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.js

@@ -1,69 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var FreeCameraDeviceOrientationInput = (function () {
-        function FreeCameraDeviceOrientationInput() {
-            var _this = this;
-            this._screenOrientationAngle = 0;
-            this._screenQuaternion = new BABYLON.Quaternion();
-            this._alpha = 0;
-            this._beta = 0;
-            this._gamma = 0;
-            this._orientationChanged = function () {
-                _this._screenOrientationAngle = (window.orientation !== undefined ? +window.orientation : (window.screen.orientation && window.screen.orientation['angle'] ? window.screen.orientation.angle : 0));
-                _this._screenOrientationAngle = -BABYLON.Tools.ToRadians(_this._screenOrientationAngle / 2);
-                _this._screenQuaternion.copyFromFloats(0, Math.sin(_this._screenOrientationAngle), 0, Math.cos(_this._screenOrientationAngle));
-            };
-            this._deviceOrientation = function (evt) {
-                _this._alpha = evt.alpha;
-                _this._beta = evt.beta;
-                _this._gamma = evt.gamma;
-            };
-            this._constantTranform = new BABYLON.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5));
-            this._orientationChanged();
-        }
-        Object.defineProperty(FreeCameraDeviceOrientationInput.prototype, "camera", {
-            get: function () {
-                return this._camera;
-            },
-            set: function (camera) {
-                this._camera = camera;
-                if (!this._camera.rotationQuaternion)
-                    this._camera.rotationQuaternion = new BABYLON.Quaternion();
-            },
-            enumerable: true,
-            configurable: true
-        });
-        FreeCameraDeviceOrientationInput.prototype.attachControl = function (element, noPreventDefault) {
-            window.addEventListener("orientationchange", this._orientationChanged);
-            window.addEventListener("deviceorientation", this._deviceOrientation);
-            //In certain cases, the attach control is called AFTER orientation was changed,
-            //So this is needed.
-            this._orientationChanged();
-        };
-        FreeCameraDeviceOrientationInput.prototype.detachControl = function (element) {
-            window.removeEventListener("orientationchange", this._orientationChanged);
-            window.removeEventListener("deviceorientation", this._deviceOrientation);
-        };
-        FreeCameraDeviceOrientationInput.prototype.checkInputs = function () {
-            //if no device orientation provided, don't update the rotation.
-            //Only testing against alpha under the assumption thatnorientation will never be so exact when set.
-            if (!this._alpha)
-                return;
-            BABYLON.Quaternion.RotationYawPitchRollToRef(BABYLON.Tools.ToRadians(this._alpha), BABYLON.Tools.ToRadians(this._beta), -BABYLON.Tools.ToRadians(this._gamma), this.camera.rotationQuaternion);
-            this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion);
-            this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform);
-            //Mirror on XY Plane
-            this._camera.rotationQuaternion.z *= -1;
-            this._camera.rotationQuaternion.w *= -1;
-        };
-        FreeCameraDeviceOrientationInput.prototype.getTypeName = function () {
-            return "FreeCameraDeviceOrientationInput";
-        };
-        FreeCameraDeviceOrientationInput.prototype.getSimpleName = function () {
-            return "deviceOrientation";
-        };
-        return FreeCameraDeviceOrientationInput;
-    }());
-    BABYLON.FreeCameraDeviceOrientationInput = FreeCameraDeviceOrientationInput;
-    BABYLON.CameraInputTypes["FreeCameraDeviceOrientationInput"] = FreeCameraDeviceOrientationInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 66
src/Cameras/Inputs/babylon.freecamera.input.gamepad.js

@@ -1,66 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var FreeCameraGamepadInput = (function () {
-        function FreeCameraGamepadInput() {
-            this.gamepadAngularSensibility = 200;
-            this.gamepadMoveSensibility = 40;
-        }
-        FreeCameraGamepadInput.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            this._gamepads = new BABYLON.Gamepads(function (gamepad) { _this._onNewGameConnected(gamepad); });
-        };
-        FreeCameraGamepadInput.prototype.detachControl = function (element) {
-            if (this._gamepads) {
-                this._gamepads.dispose();
-            }
-            this.gamepad = null;
-        };
-        FreeCameraGamepadInput.prototype.checkInputs = function () {
-            if (this.gamepad) {
-                var camera = this.camera;
-                var LSValues = this.gamepad.leftStick;
-                var normalizedLX = LSValues.x / this.gamepadMoveSensibility;
-                var normalizedLY = LSValues.y / this.gamepadMoveSensibility;
-                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.gamepadAngularSensibility;
-                var normalizedRY = RSValues.y / this.gamepadAngularSensibility;
-                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(camera.rotation.y, camera.rotation.x, 0);
-                var speed = camera._computeLocalCameraSpeed() * 50.0;
-                var deltaTransform = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(LSValues.x * speed, 0, -LSValues.y * speed), cameraTransform);
-                camera.cameraDirection = camera.cameraDirection.add(deltaTransform);
-                camera.cameraRotation = camera.cameraRotation.add(new BABYLON.Vector2(RSValues.y, RSValues.x));
-            }
-        };
-        FreeCameraGamepadInput.prototype._onNewGameConnected = function (gamepad) {
-            // Only the first gamepad can control the camera
-            if (gamepad.index === 0) {
-                this.gamepad = gamepad;
-            }
-        };
-        FreeCameraGamepadInput.prototype.getTypeName = function () {
-            return "FreeCameraGamepadInput";
-        };
-        FreeCameraGamepadInput.prototype.getSimpleName = function () {
-            return "gamepad";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraGamepadInput.prototype, "gamepadAngularSensibility", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraGamepadInput.prototype, "gamepadMoveSensibility", void 0);
-        return FreeCameraGamepadInput;
-    }());
-    BABYLON.FreeCameraGamepadInput = FreeCameraGamepadInput;
-    BABYLON.CameraInputTypes["FreeCameraGamepadInput"] = FreeCameraGamepadInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 121
src/Cameras/Inputs/babylon.freecamera.input.keyboard.js

@@ -1,121 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var FreeCameraKeyboardMoveInput = (function () {
-        function FreeCameraKeyboardMoveInput() {
-            this._keys = [];
-            this.keysUp = [38];
-            this.keysDown = [40];
-            this.keysLeft = [37];
-            this.keysRight = [39];
-        }
-        FreeCameraKeyboardMoveInput.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            if (!this._onKeyDown) {
-                element.tabIndex = 1;
-                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();
-                        }
-                    }
-                };
-                element.addEventListener("keydown", this._onKeyDown, false);
-                element.addEventListener("keyup", this._onKeyUp, false);
-                BABYLON.Tools.RegisterTopRootEvents([
-                    { name: "blur", handler: this._onLostFocus }
-                ]);
-            }
-        };
-        FreeCameraKeyboardMoveInput.prototype.detachControl = function (element) {
-            if (this._onKeyDown) {
-                element.removeEventListener("keydown", this._onKeyDown);
-                element.removeEventListener("keyup", this._onKeyUp);
-                BABYLON.Tools.UnregisterTopRootEvents([
-                    { name: "blur", handler: this._onLostFocus }
-                ]);
-                this._keys = [];
-                this._onKeyDown = null;
-                this._onKeyUp = null;
-            }
-        };
-        FreeCameraKeyboardMoveInput.prototype.checkInputs = function () {
-            if (this._onKeyDown) {
-                var camera = this.camera;
-                // Keyboard
-                for (var index = 0; index < this._keys.length; index++) {
-                    var keyCode = this._keys[index];
-                    var speed = camera._computeLocalCameraSpeed();
-                    if (this.keysLeft.indexOf(keyCode) !== -1) {
-                        camera._localDirection.copyFromFloats(-speed, 0, 0);
-                    }
-                    else if (this.keysUp.indexOf(keyCode) !== -1) {
-                        camera._localDirection.copyFromFloats(0, 0, speed);
-                    }
-                    else if (this.keysRight.indexOf(keyCode) !== -1) {
-                        camera._localDirection.copyFromFloats(speed, 0, 0);
-                    }
-                    else if (this.keysDown.indexOf(keyCode) !== -1) {
-                        camera._localDirection.copyFromFloats(0, 0, -speed);
-                    }
-                    if (camera.getScene().useRightHandedSystem) {
-                        camera._localDirection.z *= -1;
-                    }
-                    camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);
-                    BABYLON.Vector3.TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);
-                    camera.cameraDirection.addInPlace(camera._transformedDirection);
-                }
-            }
-        };
-        FreeCameraKeyboardMoveInput.prototype.getTypeName = function () {
-            return "FreeCameraKeyboardMoveInput";
-        };
-        FreeCameraKeyboardMoveInput.prototype._onLostFocus = function (e) {
-            this._keys = [];
-        };
-        FreeCameraKeyboardMoveInput.prototype.getSimpleName = function () {
-            return "keyboard";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraKeyboardMoveInput.prototype, "keysUp", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraKeyboardMoveInput.prototype, "keysDown", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraKeyboardMoveInput.prototype, "keysLeft", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraKeyboardMoveInput.prototype, "keysRight", void 0);
-        return FreeCameraKeyboardMoveInput;
-    }());
-    BABYLON.FreeCameraKeyboardMoveInput = FreeCameraKeyboardMoveInput;
-    BABYLON.CameraInputTypes["FreeCameraKeyboardMoveInput"] = FreeCameraKeyboardMoveInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 123
src/Cameras/Inputs/babylon.freecamera.input.mouse.js

@@ -1,123 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var FreeCameraMouseInput = (function () {
-        function FreeCameraMouseInput(touchEnabled) {
-            if (touchEnabled === void 0) { touchEnabled = true; }
-            this.touchEnabled = touchEnabled;
-            this.buttons = [0, 1, 2];
-            this.angularSensibility = 2000.0;
-        }
-        FreeCameraMouseInput.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            var engine = this.camera.getEngine();
-            if (!this._pointerInput) {
-                this._pointerInput = function (p, s) {
-                    var evt = p.event;
-                    if (!_this.touchEnabled && evt.pointerType === "touch") {
-                        return;
-                    }
-                    if (p.type !== BABYLON.PointerEventTypes.POINTERMOVE && _this.buttons.indexOf(evt.button) === -1) {
-                        return;
-                    }
-                    if (p.type === BABYLON.PointerEventTypes.POINTERDOWN) {
-                        try {
-                            evt.srcElement.setPointerCapture(evt.pointerId);
-                        }
-                        catch (e) {
-                        }
-                        _this.previousPosition = {
-                            x: evt.clientX,
-                            y: evt.clientY
-                        };
-                        if (!noPreventDefault) {
-                            evt.preventDefault();
-                            element.focus();
-                        }
-                    }
-                    else if (p.type === BABYLON.PointerEventTypes.POINTERUP) {
-                        try {
-                            evt.srcElement.releasePointerCapture(evt.pointerId);
-                        }
-                        catch (e) {
-                        }
-                        _this.previousPosition = null;
-                        if (!noPreventDefault) {
-                            evt.preventDefault();
-                        }
-                    }
-                    else if (p.type === BABYLON.PointerEventTypes.POINTERMOVE) {
-                        if (!_this.previousPosition || engine.isPointerLock) {
-                            return;
-                        }
-                        var offsetX = evt.clientX - _this.previousPosition.x;
-                        var offsetY = evt.clientY - _this.previousPosition.y;
-                        if (_this.camera.getScene().useRightHandedSystem) {
-                            _this.camera.cameraRotation.y -= offsetX / _this.angularSensibility;
-                        }
-                        else {
-                            _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;
-                        }
-                        _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;
-                        _this.previousPosition = {
-                            x: evt.clientX,
-                            y: evt.clientY
-                        };
-                        if (!noPreventDefault) {
-                            evt.preventDefault();
-                        }
-                    }
-                };
-            }
-            this._onMouseMove = function (evt) {
-                if (!engine.isPointerLock) {
-                    return;
-                }
-                var offsetX = evt.movementX || evt.mozMovementX || evt.webkitMovementX || evt.msMovementX || 0;
-                var offsetY = evt.movementY || evt.mozMovementY || evt.webkitMovementY || evt.msMovementY || 0;
-                if (_this.camera.getScene().useRightHandedSystem) {
-                    _this.camera.cameraRotation.y -= offsetX / _this.angularSensibility;
-                }
-                else {
-                    _this.camera.cameraRotation.y += offsetX / _this.angularSensibility;
-                }
-                _this.camera.cameraRotation.x += offsetY / _this.angularSensibility;
-                _this.previousPosition = null;
-                if (!noPreventDefault) {
-                    evt.preventDefault();
-                }
-            };
-            this._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, BABYLON.PointerEventTypes.POINTERDOWN | BABYLON.PointerEventTypes.POINTERUP | BABYLON.PointerEventTypes.POINTERMOVE);
-            element.addEventListener("mousemove", this._onMouseMove, false);
-        };
-        FreeCameraMouseInput.prototype.detachControl = function (element) {
-            if (this._observer && element) {
-                this.camera.getScene().onPointerObservable.remove(this._observer);
-                element.removeEventListener("mousemove", this._onMouseMove);
-                this._observer = null;
-                this._onMouseMove = null;
-                this.previousPosition = null;
-            }
-        };
-        FreeCameraMouseInput.prototype.getTypeName = function () {
-            return "FreeCameraMouseInput";
-        };
-        FreeCameraMouseInput.prototype.getSimpleName = function () {
-            return "mouse";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraMouseInput.prototype, "buttons", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraMouseInput.prototype, "angularSensibility", void 0);
-        return FreeCameraMouseInput;
-    }());
-    BABYLON.FreeCameraMouseInput = FreeCameraMouseInput;
-    BABYLON.CameraInputTypes["FreeCameraMouseInput"] = FreeCameraMouseInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 122
src/Cameras/Inputs/babylon.freecamera.input.touch.js

@@ -1,122 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var FreeCameraTouchInput = (function () {
-        function FreeCameraTouchInput() {
-            this._offsetX = null;
-            this._offsetY = null;
-            this._pointerCount = 0;
-            this._pointerPressed = [];
-            this.touchAngularSensibility = 200000.0;
-            this.touchMoveSensibility = 250.0;
-        }
-        FreeCameraTouchInput.prototype.attachControl = function (element, noPreventDefault) {
-            var _this = this;
-            var previousPosition;
-            if (this._pointerInput === undefined) {
-                this._onLostFocus = function (evt) {
-                    _this._offsetX = null;
-                    _this._offsetY = null;
-                };
-                this._pointerInput = function (p, s) {
-                    var evt = p.event;
-                    if (evt.pointerType === "mouse") {
-                        return;
-                    }
-                    if (p.type === BABYLON.PointerEventTypes.POINTERDOWN) {
-                        if (!noPreventDefault) {
-                            evt.preventDefault();
-                        }
-                        _this._pointerPressed.push(evt.pointerId);
-                        if (_this._pointerPressed.length !== 1) {
-                            return;
-                        }
-                        previousPosition = {
-                            x: evt.clientX,
-                            y: evt.clientY
-                        };
-                    }
-                    else if (p.type === BABYLON.PointerEventTypes.POINTERUP) {
-                        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;
-                    }
-                    else if (p.type === BABYLON.PointerEventTypes.POINTERMOVE) {
-                        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._observer = this.camera.getScene().onPointerObservable.add(this._pointerInput, BABYLON.PointerEventTypes.POINTERDOWN | BABYLON.PointerEventTypes.POINTERUP | BABYLON.PointerEventTypes.POINTERMOVE);
-            element.addEventListener("blur", this._onLostFocus);
-        };
-        FreeCameraTouchInput.prototype.detachControl = function (element) {
-            if (this._pointerInput && element) {
-                this.camera.getScene().onPointerObservable.remove(this._observer);
-                this._observer = null;
-                element.removeEventListener("blur", this._onLostFocus);
-                this._onLostFocus = null;
-                this._pointerPressed = [];
-                this._offsetX = null;
-                this._offsetY = null;
-                this._pointerCount = 0;
-            }
-        };
-        FreeCameraTouchInput.prototype.checkInputs = function () {
-            if (this._offsetX) {
-                var camera = this.camera;
-                camera.cameraRotation.y += this._offsetX / this.touchAngularSensibility;
-                if (this._pointerPressed.length > 1) {
-                    camera.cameraRotation.x += -this._offsetY / this.touchAngularSensibility;
-                }
-                else {
-                    var speed = camera._computeLocalCameraSpeed();
-                    var direction = new BABYLON.Vector3(0, 0, speed * this._offsetY / this.touchMoveSensibility);
-                    BABYLON.Matrix.RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, camera._cameraRotationMatrix);
-                    camera.cameraDirection.addInPlace(BABYLON.Vector3.TransformCoordinates(direction, camera._cameraRotationMatrix));
-                }
-            }
-        };
-        FreeCameraTouchInput.prototype.getTypeName = function () {
-            return "FreeCameraTouchInput";
-        };
-        FreeCameraTouchInput.prototype.getSimpleName = function () {
-            return "touch";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraTouchInput.prototype, "touchAngularSensibility", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCameraTouchInput.prototype, "touchMoveSensibility", void 0);
-        return FreeCameraTouchInput;
-    }());
-    BABYLON.FreeCameraTouchInput = FreeCameraTouchInput;
-    BABYLON.CameraInputTypes["FreeCameraTouchInput"] = FreeCameraTouchInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 54
src/Cameras/Inputs/babylon.freecamera.input.virtualjoystick.js

@@ -1,54 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var FreeCameraVirtualJoystickInput = (function () {
-        function FreeCameraVirtualJoystickInput() {
-        }
-        FreeCameraVirtualJoystickInput.prototype.getLeftJoystick = function () {
-            return this._leftjoystick;
-        };
-        FreeCameraVirtualJoystickInput.prototype.getRightJoystick = function () {
-            return this._rightjoystick;
-        };
-        FreeCameraVirtualJoystickInput.prototype.checkInputs = function () {
-            if (this._leftjoystick) {
-                var camera = this.camera;
-                var speed = camera._computeLocalCameraSpeed() * 50;
-                var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, 0);
-                var deltaTransform = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(this._leftjoystick.deltaPosition.x * speed, this._leftjoystick.deltaPosition.y * speed, this._leftjoystick.deltaPosition.z * speed), cameraTransform);
-                camera.cameraDirection = camera.cameraDirection.add(deltaTransform);
-                camera.cameraRotation = camera.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);
-                }
-            }
-        };
-        FreeCameraVirtualJoystickInput.prototype.attachControl = function (element, noPreventDefault) {
-            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");
-        };
-        FreeCameraVirtualJoystickInput.prototype.detachControl = function (element) {
-            this._leftjoystick.releaseCanvas();
-            this._rightjoystick.releaseCanvas();
-        };
-        FreeCameraVirtualJoystickInput.prototype.getTypeName = function () {
-            return "FreeCameraVirtualJoystickInput";
-        };
-        FreeCameraVirtualJoystickInput.prototype.getSimpleName = function () {
-            return "virtualJoystick";
-        };
-        return FreeCameraVirtualJoystickInput;
-    }());
-    BABYLON.FreeCameraVirtualJoystickInput = FreeCameraVirtualJoystickInput;
-    BABYLON.CameraInputTypes["FreeCameraVirtualJoystickInput"] = FreeCameraVirtualJoystickInput;
-})(BABYLON || (BABYLON = {}));

+ 0 - 72
src/Cameras/VR/babylon.vrCameraMetrics.js

@@ -1,72 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var VRCameraMetrics = (function () {
-        function VRCameraMetrics() {
-            this.compensateDistortion = true;
-        }
-        Object.defineProperty(VRCameraMetrics.prototype, "aspectRatio", {
-            get: function () {
-                return this.hResolution / (2 * this.vResolution);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(VRCameraMetrics.prototype, "aspectRatioFov", {
-            get: function () {
-                return (2 * Math.atan((this.postProcessScaleFactor * this.vScreenSize) / (2 * this.eyeToScreenDistance)));
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(VRCameraMetrics.prototype, "leftHMatrix", {
-            get: function () {
-                var meters = (this.hScreenSize / 4) - (this.lensSeparationDistance / 2);
-                var h = (4 * meters) / this.hScreenSize;
-                return BABYLON.Matrix.Translation(h, 0, 0);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(VRCameraMetrics.prototype, "rightHMatrix", {
-            get: function () {
-                var meters = (this.hScreenSize / 4) - (this.lensSeparationDistance / 2);
-                var h = (4 * meters) / this.hScreenSize;
-                return BABYLON.Matrix.Translation(-h, 0, 0);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(VRCameraMetrics.prototype, "leftPreViewMatrix", {
-            get: function () {
-                return BABYLON.Matrix.Translation(0.5 * this.interpupillaryDistance, 0, 0);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(VRCameraMetrics.prototype, "rightPreViewMatrix", {
-            get: function () {
-                return BABYLON.Matrix.Translation(-0.5 * this.interpupillaryDistance, 0, 0);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        VRCameraMetrics.GetDefault = function () {
-            var result = new VRCameraMetrics();
-            result.hResolution = 1280;
-            result.vResolution = 800;
-            result.hScreenSize = 0.149759993;
-            result.vScreenSize = 0.0935999975;
-            result.vScreenCenter = 0.0467999987,
-                result.eyeToScreenDistance = 0.0410000011;
-            result.lensSeparationDistance = 0.0635000020;
-            result.interpupillaryDistance = 0.0640000030;
-            result.distortionK = [1.0, 0.219999999, 0.239999995, 0.0];
-            result.chromaAbCorrection = [0.995999992, -0.00400000019, 1.01400006, 0.0];
-            result.postProcessScaleFactor = 1.714605507808412;
-            result.lensCenterOffset = 0.151976421;
-            return result;
-        };
-        return VRCameraMetrics;
-    }());
-    BABYLON.VRCameraMetrics = VRCameraMetrics;
-})(BABYLON || (BABYLON = {}));

+ 0 - 39
src/Cameras/VR/babylon.vrDeviceOrientationCamera.js

@@ -1,39 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var VRDeviceOrientationFreeCamera = (function (_super) {
-        __extends(VRDeviceOrientationFreeCamera, _super);
-        function VRDeviceOrientationFreeCamera(name, position, scene, compensateDistortion, vrCameraMetrics) {
-            if (compensateDistortion === void 0) { compensateDistortion = true; }
-            if (vrCameraMetrics === void 0) { vrCameraMetrics = BABYLON.VRCameraMetrics.GetDefault(); }
-            _super.call(this, name, position, scene);
-            vrCameraMetrics.compensateDistortion = compensateDistortion;
-            this.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });
-        }
-        VRDeviceOrientationFreeCamera.prototype.getTypeName = function () {
-            return "VRDeviceOrientationFreeCamera";
-        };
-        return VRDeviceOrientationFreeCamera;
-    }(BABYLON.DeviceOrientationCamera));
-    BABYLON.VRDeviceOrientationFreeCamera = VRDeviceOrientationFreeCamera;
-    var VRDeviceOrientationArcRotateCamera = (function (_super) {
-        __extends(VRDeviceOrientationArcRotateCamera, _super);
-        function VRDeviceOrientationArcRotateCamera(name, alpha, beta, radius, target, scene, compensateDistortion, vrCameraMetrics) {
-            if (compensateDistortion === void 0) { compensateDistortion = true; }
-            if (vrCameraMetrics === void 0) { vrCameraMetrics = BABYLON.VRCameraMetrics.GetDefault(); }
-            _super.call(this, name, alpha, beta, radius, target, scene);
-            vrCameraMetrics.compensateDistortion = compensateDistortion;
-            this.setCameraRigMode(BABYLON.Camera.RIG_MODE_VR, { vrCameraMetrics: vrCameraMetrics });
-            this.inputs.addVRDeviceOrientation();
-        }
-        VRDeviceOrientationArcRotateCamera.prototype.getTypeName = function () {
-            return "VRDeviceOrientationArcRotateCamera";
-        };
-        return VRDeviceOrientationArcRotateCamera;
-    }(BABYLON.ArcRotateCamera));
-    BABYLON.VRDeviceOrientationArcRotateCamera = VRDeviceOrientationArcRotateCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 132
src/Cameras/VR/babylon.webVRCamera.js

@@ -1,132 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var WebVRFreeCamera = (function (_super) {
-        __extends(WebVRFreeCamera, _super);
-        function WebVRFreeCamera(name, position, scene, compensateDistortion, webVROptions) {
-            var _this = this;
-            if (compensateDistortion === void 0) { compensateDistortion = false; }
-            if (webVROptions === void 0) { webVROptions = {}; }
-            _super.call(this, name, position, scene);
-            this.webVROptions = webVROptions;
-            this._vrDevice = null;
-            this._cacheState = null;
-            this._vrEnabled = false;
-            this._attached = false;
-            //using the position provided as the current position offset
-            this._positionOffset = position;
-            //enable VR
-            this.getEngine().initWebVR();
-            if (!this.getEngine().vrDisplaysPromise) {
-                BABYLON.Tools.Error("WebVR is not enabled on your browser");
-            }
-            else {
-                //TODO get the metrics updated using the device's eye parameters!
-                //TODO also check that the device has the right capabilities!
-                this._frameData = new VRFrameData();
-                this.getEngine().vrDisplaysPromise.then(function (devices) {
-                    if (devices.length > 0) {
-                        _this._vrEnabled = true;
-                        if (_this.webVROptions.displayName) {
-                            var found = devices.some(function (device) {
-                                if (device.displayName === _this.webVROptions.displayName) {
-                                    _this._vrDevice = device;
-                                    return true;
-                                }
-                                else {
-                                    return false;
-                                }
-                            });
-                            if (!found) {
-                                _this._vrDevice = devices[0];
-                                BABYLON.Tools.Warn("Display " + _this.webVROptions.displayName + " was not found. Using " + _this._vrDevice.displayName);
-                            }
-                        }
-                        else {
-                            //choose the first one
-                            _this._vrDevice = devices[0];
-                        }
-                        //reset the rig parameters.
-                        _this.setCameraRigMode(BABYLON.Camera.RIG_MODE_WEBVR, { vrDisplay: _this._vrDevice, frameData: _this._frameData });
-                        if (_this._attached) {
-                            _this.getEngine().enableVR(_this._vrDevice);
-                        }
-                    }
-                    else {
-                        BABYLON.Tools.Error("No WebVR devices found!");
-                    }
-                });
-            }
-            this.rotationQuaternion = new BABYLON.Quaternion();
-            this._quaternionCache = new BABYLON.Quaternion();
-        }
-        WebVRFreeCamera.prototype._checkInputs = function () {
-            if (this._vrEnabled && this._vrDevice.getFrameData(this._frameData)) {
-                var currentPost = this._frameData.pose;
-                //make sure we have data
-                if (currentPost && currentPost.orientation) {
-                    this._cacheState = currentPost;
-                    this.rotationQuaternion.copyFromFloats(this._cacheState.orientation[0], this._cacheState.orientation[1], -this._cacheState.orientation[2], -this._cacheState.orientation[3]);
-                    if (this.webVROptions.trackPosition && this._cacheState.position) {
-                        this.position.copyFromFloats(this._cacheState.position[0], this._cacheState.position[1], -this._cacheState.position[2]);
-                        //scale the position accordingly
-                        this.webVROptions.positionScale && this.position.scaleInPlace(this.webVROptions.positionScale);
-                        //add the position offset
-                        this.position.addInPlace(this._positionOffset);
-                    }
-                }
-            }
-            _super.prototype._checkInputs.call(this);
-        };
-        WebVRFreeCamera.prototype.attachControl = function (element, noPreventDefault) {
-            _super.prototype.attachControl.call(this, element, noPreventDefault);
-            this._attached = true;
-            noPreventDefault = BABYLON.Camera.ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;
-            if (this._vrEnabled) {
-                this.getEngine().enableVR(this._vrDevice);
-            }
-        };
-        WebVRFreeCamera.prototype.detachControl = function (element) {
-            _super.prototype.detachControl.call(this, element);
-            this._vrEnabled = false;
-            this._attached = false;
-            this.getEngine().disableVR();
-        };
-        WebVRFreeCamera.prototype.requestVRFullscreen = function (requestPointerlock) {
-            //Backwards comp.
-            BABYLON.Tools.Warn("requestVRFullscreen is deprecated. call attachControl() to start sending frames to the VR display.");
-            //this.getEngine().switchFullscreen(requestPointerlock);
-        };
-        WebVRFreeCamera.prototype.getTypeName = function () {
-            return "WebVRFreeCamera";
-        };
-        WebVRFreeCamera.prototype.resetToCurrentRotation = function () {
-            //uses the vrDisplay's "resetPose()".
-            //pitch and roll won't be affected.
-            this._vrDevice.resetPose();
-        };
-        /**
-         *
-         * Set the position offset of the VR camera
-         * The offset will be added to the WebVR pose, after scaling it (if set).
-         *
-         * @param {Vector3} [newPosition] an optional new position. if not provided, the current camera position will be used.
-         *
-         * @memberOf WebVRFreeCamera
-         */
-        WebVRFreeCamera.prototype.setPositionOffset = function (newPosition) {
-            if (newPosition) {
-                this._positionOffset = newPosition;
-            }
-            else {
-                this._positionOffset.copyFrom(this.position);
-            }
-        };
-        return WebVRFreeCamera;
-    }(BABYLON.FreeCamera));
-    BABYLON.WebVRFreeCamera = WebVRFreeCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 566
src/Cameras/babylon.arcRotateCamera.js

@@ -1,566 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var ArcRotateCamera = (function (_super) {
-        __extends(ArcRotateCamera, _super);
-        function ArcRotateCamera(name, alpha, beta, radius, target, scene) {
-            var _this = this;
-            _super.call(this, name, BABYLON.Vector3.Zero(), scene);
-            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.inertialPanningX = 0;
-            this.inertialPanningY = 0;
-            //-- end properties for backward compatibility for inputs        
-            this.zoomOnFactor = 1;
-            this.targetScreenOffset = BABYLON.Vector2.Zero();
-            this.allowUpsideDown = true;
-            this._viewMatrix = new BABYLON.Matrix();
-            // Panning
-            this.panningAxis = new BABYLON.Vector3(1, 1, 0);
-            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();
-            this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {
-                if (collidedMesh === void 0) { collidedMesh = null; }
-                if (_this.getScene().workerCollisions && _this.checkCollisions) {
-                    newPosition.multiplyInPlace(_this._collider.radius);
-                }
-                if (!collidedMesh) {
-                    _this._previousPosition.copyFrom(_this.position);
-                }
-                else {
-                    _this.setPosition(newPosition);
-                    if (_this.onCollide) {
-                        _this.onCollide(collidedMesh);
-                    }
-                }
-                // Recompute because of constraints
-                var cosa = Math.cos(_this.alpha);
-                var sina = Math.sin(_this.alpha);
-                var cosb = Math.cos(_this.beta);
-                var sinb = Math.sin(_this.beta);
-                if (sinb === 0) {
-                    sinb = 0.0001;
-                }
-                var target = _this._getTargetPosition();
-                target.addToRef(new BABYLON.Vector3(_this.radius * cosa * sinb, _this.radius * cosb, _this.radius * sina * sinb), _this._newPosition);
-                _this.position.copyFrom(_this._newPosition);
-                var up = _this.upVector;
-                if (_this.allowUpsideDown && _this.beta < 0) {
-                    up = up.clone();
-                    up = up.negate();
-                }
-                BABYLON.Matrix.LookAtLHToRef(_this.position, target, up, _this._viewMatrix);
-                _this._viewMatrix.m[12] += _this.targetScreenOffset.x;
-                _this._viewMatrix.m[13] += _this.targetScreenOffset.y;
-                _this._collisionTriggered = false;
-            };
-            if (!target) {
-                this.target = BABYLON.Vector3.Zero();
-            }
-            else {
-                this.target = target;
-            }
-            this.alpha = alpha;
-            this.beta = beta;
-            this.radius = radius;
-            this.getViewMatrix();
-            this.inputs = new BABYLON.ArcRotateCameraInputsManager(this);
-            this.inputs.addKeyboard().addMouseWheel().addPointers().addGamepad();
-        }
-        Object.defineProperty(ArcRotateCamera.prototype, "angularSensibilityX", {
-            //-- begin properties for backward compatibility for inputs       
-            get: function () {
-                var pointers = this.inputs.attached["pointers"];
-                if (pointers)
-                    return pointers.angularSensibilityX;
-            },
-            set: function (value) {
-                var pointers = this.inputs.attached["pointers"];
-                if (pointers) {
-                    pointers.angularSensibilityX = value;
-                }
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ArcRotateCamera.prototype, "angularSensibilityY", {
-            get: function () {
-                var pointers = this.inputs.attached["pointers"];
-                if (pointers)
-                    return pointers.angularSensibilityY;
-            },
-            set: function (value) {
-                var pointers = this.inputs.attached["pointers"];
-                if (pointers) {
-                    pointers.angularSensibilityY = value;
-                }
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ArcRotateCamera.prototype, "pinchPrecision", {
-            get: function () {
-                var pointers = this.inputs.attached["pointers"];
-                if (pointers)
-                    return pointers.pinchPrecision;
-            },
-            set: function (value) {
-                var pointers = this.inputs.attached["pointers"];
-                if (pointers) {
-                    pointers.pinchPrecision = value;
-                }
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ArcRotateCamera.prototype, "panningSensibility", {
-            get: function () {
-                var pointers = this.inputs.attached["pointers"];
-                if (pointers)
-                    return pointers.panningSensibility;
-            },
-            set: function (value) {
-                var pointers = this.inputs.attached["pointers"];
-                if (pointers) {
-                    pointers.panningSensibility = value;
-                }
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ArcRotateCamera.prototype, "keysUp", {
-            get: function () {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    return keyboard.keysUp;
-            },
-            set: function (value) {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    keyboard.keysUp = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ArcRotateCamera.prototype, "keysDown", {
-            get: function () {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    return keyboard.keysDown;
-            },
-            set: function (value) {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    keyboard.keysDown = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ArcRotateCamera.prototype, "keysLeft", {
-            get: function () {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    return keyboard.keysLeft;
-            },
-            set: function (value) {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    keyboard.keysLeft = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ArcRotateCamera.prototype, "keysRight", {
-            get: function () {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    return keyboard.keysRight;
-            },
-            set: function (value) {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    keyboard.keysRight = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ArcRotateCamera.prototype, "wheelPrecision", {
-            get: function () {
-                var mousewheel = this.inputs.attached["mousewheel"];
-                if (mousewheel)
-                    return mousewheel.wheelPrecision;
-            },
-            set: function (value) {
-                var mousewheel = this.inputs.attached["mousewheel"];
-                if (mousewheel)
-                    mousewheel.wheelPrecision = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        // 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 = BABYLON.Vector2.Zero();
-        };
-        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.copyFrom(this.targetScreenOffset);
-        };
-        ArcRotateCamera.prototype._getTargetPosition = function () {
-            if (this.target.getAbsolutePosition) {
-                var pos = this.target.getAbsolutePosition();
-                return this._targetBoundingCenter ? pos.add(this._targetBoundingCenter) : pos;
-            }
-            return this.target;
-        };
-        // Synchronized
-        ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {
-            if (!_super.prototype._isSynchronizedViewMatrix.call(this))
-                return false;
-            return this._cache.target.equals(this.target)
-                && 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, useCtrlForPanning, panningMouseButton) {
-            var _this = this;
-            if (useCtrlForPanning === void 0) { useCtrlForPanning = true; }
-            if (panningMouseButton === void 0) { panningMouseButton = 2; }
-            this._useCtrlForPanning = useCtrlForPanning;
-            this._panningMouseButton = panningMouseButton;
-            this.inputs.attachElement(element, noPreventDefault);
-            this._reset = function () {
-                _this.inertialAlphaOffset = 0;
-                _this.inertialBetaOffset = 0;
-                _this.inertialRadiusOffset = 0;
-            };
-        };
-        ArcRotateCamera.prototype.detachControl = function (element) {
-            this.inputs.detachElement(element);
-            if (this._reset) {
-                this._reset();
-            }
-        };
-        ArcRotateCamera.prototype._checkInputs = function () {
-            //if (async) collision inspection was triggered, don't update the camera's position - until the collision callback was called.
-            if (this._collisionTriggered) {
-                return;
-            }
-            this.inputs.checkInputs();
-            // Inertia
-            if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {
-                this.beta += this.inertialBetaOffset;
-                if (this.getScene().useRightHandedSystem) {
-                    this.alpha -= this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset;
-                }
-                else {
-                    this.alpha += this.beta <= 0 ? -this.inertialAlphaOffset : this.inertialAlphaOffset;
-                }
-                this.radius -= this.inertialRadiusOffset;
-                this.inertialAlphaOffset *= this.inertia;
-                this.inertialBetaOffset *= this.inertia;
-                this.inertialRadiusOffset *= this.inertia;
-                if (Math.abs(this.inertialAlphaOffset) < BABYLON.Epsilon)
-                    this.inertialAlphaOffset = 0;
-                if (Math.abs(this.inertialBetaOffset) < BABYLON.Epsilon)
-                    this.inertialBetaOffset = 0;
-                if (Math.abs(this.inertialRadiusOffset) < BABYLON.Epsilon)
-                    this.inertialRadiusOffset = 0;
-            }
-            // Panning inertia
-            if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) {
-                if (!this._localDirection) {
-                    this._localDirection = BABYLON.Vector3.Zero();
-                    this._transformedDirection = BABYLON.Vector3.Zero();
-                }
-                this.inertialPanningX *= this.inertia;
-                this.inertialPanningY *= this.inertia;
-                if (Math.abs(this.inertialPanningX) < BABYLON.Epsilon)
-                    this.inertialPanningX = 0;
-                if (Math.abs(this.inertialPanningY) < BABYLON.Epsilon)
-                    this.inertialPanningY = 0;
-                this._localDirection.copyFromFloats(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);
-                this._localDirection.multiplyInPlace(this.panningAxis);
-                this._viewMatrix.invertToRef(this._cameraTransformMatrix);
-                BABYLON.Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);
-                //Eliminate y if map panning is enabled (panningAxis == 1,0,1)
-                if (!this.panningAxis.y) {
-                    this._transformedDirection.y = 0;
-                }
-                if (!this.target.getAbsolutePosition) {
-                    this.target.addInPlace(this._transformedDirection);
-                }
-            }
-            // Limits
-            this._checkLimits();
-            _super.prototype._checkInputs.call(this);
-        };
-        ArcRotateCamera.prototype._checkLimits = function () {
-            if (this.lowerBetaLimit === null || this.lowerBetaLimit === undefined) {
-                if (this.allowUpsideDown && this.beta > Math.PI) {
-                    this.beta = this.beta - (2 * Math.PI);
-                }
-            }
-            else {
-                if (this.beta < this.lowerBetaLimit) {
-                    this.beta = this.lowerBetaLimit;
-                }
-            }
-            if (this.upperBetaLimit === null || this.upperBetaLimit === undefined) {
-                if (this.allowUpsideDown && this.beta < -Math.PI) {
-                    this.beta = this.beta + (2 * Math.PI);
-                }
-            }
-            else {
-                if (this.beta > this.upperBetaLimit) {
-                    this.beta = this.upperBetaLimit;
-                }
-            }
-            if (this.lowerAlphaLimit && this.alpha < this.lowerAlphaLimit) {
-                this.alpha = this.lowerAlphaLimit;
-            }
-            if (this.upperAlphaLimit && this.alpha > this.upperAlphaLimit) {
-                this.alpha = this.upperAlphaLimit;
-            }
-            if (this.lowerRadiusLimit && this.radius < this.lowerRadiusLimit) {
-                this.radius = this.lowerRadiusLimit;
-            }
-            if (this.upperRadiusLimit && this.radius > this.upperRadiusLimit) {
-                this.radius = this.upperRadiusLimit;
-            }
-        };
-        ArcRotateCamera.prototype.rebuildAnglesAndRadius = function () {
-            var radiusv3 = this.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);
-            this._checkLimits();
-        };
-        ArcRotateCamera.prototype.setPosition = function (position) {
-            if (this.position.equals(position)) {
-                return;
-            }
-            this.position.copyFrom(position);
-            this.rebuildAnglesAndRadius();
-        };
-        ArcRotateCamera.prototype.setTarget = function (target, toBoundingCenter) {
-            if (toBoundingCenter === void 0) { toBoundingCenter = false; }
-            if (this._getTargetPosition().equals(target)) {
-                return;
-            }
-            if (toBoundingCenter && target.getBoundingInfo) {
-                this._targetBoundingCenter = target.getBoundingInfo().boundingBox.center.clone();
-            }
-            else {
-                this._targetBoundingCenter = null;
-            }
-            this.target = target;
-            this.rebuildAnglesAndRadius();
-        };
-        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);
-            if (sinb === 0) {
-                sinb = 0.0001;
-            }
-            var target = this._getTargetPosition();
-            target.addToRef(new BABYLON.Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this._newPosition);
-            if (this.getScene().collisionsEnabled && this.checkCollisions) {
-                this._collider.radius = this.collisionRadius;
-                this._newPosition.subtractToRef(this.position, this._collisionVelocity);
-                this._collisionTriggered = true;
-                this.getScene().collisionCoordinator.getNewPosition(this.position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);
-            }
-            else {
-                this.position.copyFrom(this._newPosition);
-                var up = this.upVector;
-                if (this.allowUpsideDown && this.beta < 0) {
-                    up = up.clone();
-                    up = up.negate();
-                }
-                if (this.getScene().useRightHandedSystem) {
-                    BABYLON.Matrix.LookAtRHToRef(this.position, target, up, this._viewMatrix);
-                }
-                else {
-                    BABYLON.Matrix.LookAtLHToRef(this.position, target, up, this._viewMatrix);
-                }
-                this._viewMatrix.m[12] += this.targetScreenOffset.x;
-                this._viewMatrix.m[13] += this.targetScreenOffset.y;
-            }
-            return this._viewMatrix;
-        };
-        ArcRotateCamera.prototype.zoomOn = function (meshes, doNotUpdateMaxZ) {
-            if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }
-            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 }, doNotUpdateMaxZ);
-        };
-        ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance, doNotUpdateMaxZ) {
-            if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }
-            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);
-            if (!doNotUpdateMaxZ) {
-                this.maxZ = distance * 2;
-            }
-        };
-        /**
-         * @override
-         * Override Camera.createRigCamera
-         */
-        ArcRotateCamera.prototype.createRigCamera = function (name, cameraIndex) {
-            var alphaShift;
-            switch (this.cameraRigMode) {
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
-                case BABYLON.Camera.RIG_MODE_VR:
-                    alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);
-                    break;
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
-                    alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);
-                    break;
-            }
-            var rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this.target, this.getScene());
-            rigCam._cameraRigParams = {};
-            return rigCam;
-        };
-        /**
-         * @override
-         * Override Camera._updateRigCameras
-         */
-        ArcRotateCamera.prototype._updateRigCameras = function () {
-            var camLeft = this._rigCameras[0];
-            var camRight = this._rigCameras[1];
-            camLeft.beta = camRight.beta = this.beta;
-            camLeft.radius = camRight.radius = this.radius;
-            switch (this.cameraRigMode) {
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
-                case BABYLON.Camera.RIG_MODE_VR:
-                    camLeft.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;
-                    camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;
-                    break;
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
-                    camLeft.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;
-                    camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;
-                    break;
-            }
-            _super.prototype._updateRigCameras.call(this);
-        };
-        ArcRotateCamera.prototype.dispose = function () {
-            this.inputs.clear();
-            _super.prototype.dispose.call(this);
-        };
-        ArcRotateCamera.prototype.getTypeName = function () {
-            return "ArcRotateCamera";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "alpha", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "beta", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "radius", void 0);
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], ArcRotateCamera.prototype, "target", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "inertialAlphaOffset", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "inertialBetaOffset", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "inertialRadiusOffset", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "lowerAlphaLimit", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "upperAlphaLimit", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "lowerBetaLimit", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "upperBetaLimit", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "lowerRadiusLimit", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "upperRadiusLimit", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "inertialPanningX", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "inertialPanningY", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "zoomOnFactor", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ArcRotateCamera.prototype, "allowUpsideDown", void 0);
-        return ArcRotateCamera;
-    }(BABYLON.TargetCamera));
-    BABYLON.ArcRotateCamera = ArcRotateCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 36
src/Cameras/babylon.arcRotateCameraInputsManager.js

@@ -1,36 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var ArcRotateCameraInputsManager = (function (_super) {
-        __extends(ArcRotateCameraInputsManager, _super);
-        function ArcRotateCameraInputsManager(camera) {
-            _super.call(this, camera);
-        }
-        ArcRotateCameraInputsManager.prototype.addMouseWheel = function () {
-            this.add(new BABYLON.ArcRotateCameraMouseWheelInput());
-            return this;
-        };
-        ArcRotateCameraInputsManager.prototype.addPointers = function () {
-            this.add(new BABYLON.ArcRotateCameraPointersInput());
-            return this;
-        };
-        ArcRotateCameraInputsManager.prototype.addKeyboard = function () {
-            this.add(new BABYLON.ArcRotateCameraKeyboardMoveInput());
-            return this;
-        };
-        ArcRotateCameraInputsManager.prototype.addGamepad = function () {
-            this.add(new BABYLON.ArcRotateCameraGamepadInput());
-            return this;
-        };
-        ArcRotateCameraInputsManager.prototype.addVRDeviceOrientation = function () {
-            this.add(new BABYLON.ArcRotateCameraVRDeviceOrientationInput());
-            return this;
-        };
-        return ArcRotateCameraInputsManager;
-    }(BABYLON.CameraInputsManager));
-    BABYLON.ArcRotateCameraInputsManager = ArcRotateCameraInputsManager;
-})(BABYLON || (BABYLON = {}));

+ 0 - 722
src/Cameras/babylon.camera.js

@@ -1,722 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var Camera = (function (_super) {
-        __extends(Camera, _super);
-        function Camera(name, position, scene) {
-            _super.call(this, name, scene);
-            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.layerMask = 0x0FFFFFFF;
-            this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;
-            // Camera rig members
-            this.cameraRigMode = Camera.RIG_MODE_NONE;
-            this._rigCameras = new Array();
-            // Cache
-            this._computedViewMatrix = BABYLON.Matrix.Identity();
-            this._projectionMatrix = new BABYLON.Matrix();
-            this._doNotComputeProjectionMatrix = false;
-            this._postProcesses = new Array();
-            this._transformMatrix = BABYLON.Matrix.Zero();
-            this._webvrViewMatrix = BABYLON.Matrix.Identity();
-            this._activeMeshes = new BABYLON.SmartArray(256);
-            this._globalPosition = BABYLON.Vector3.Zero();
-            this._refreshFrustumPlanes = true;
-            scene.addCamera(this);
-            if (!scene.activeCamera) {
-                scene.activeCamera = this;
-            }
-            this.position = position;
-        }
-        Object.defineProperty(Camera, "PERSPECTIVE_CAMERA", {
-            get: function () {
-                return Camera._PERSPECTIVE_CAMERA;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "ORTHOGRAPHIC_CAMERA", {
-            get: function () {
-                return Camera._ORTHOGRAPHIC_CAMERA;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "FOVMODE_VERTICAL_FIXED", {
-            get: function () {
-                return Camera._FOVMODE_VERTICAL_FIXED;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "FOVMODE_HORIZONTAL_FIXED", {
-            get: function () {
-                return Camera._FOVMODE_HORIZONTAL_FIXED;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "RIG_MODE_NONE", {
-            get: function () {
-                return Camera._RIG_MODE_NONE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "RIG_MODE_STEREOSCOPIC_ANAGLYPH", {
-            get: function () {
-                return Camera._RIG_MODE_STEREOSCOPIC_ANAGLYPH;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL", {
-            get: function () {
-                return Camera._RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED", {
-            get: function () {
-                return Camera._RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "RIG_MODE_STEREOSCOPIC_OVERUNDER", {
-            get: function () {
-                return Camera._RIG_MODE_STEREOSCOPIC_OVERUNDER;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "RIG_MODE_VR", {
-            get: function () {
-                return Camera._RIG_MODE_VR;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Camera, "RIG_MODE_WEBVR", {
-            get: function () {
-                return Camera._RIG_MODE_WEBVR;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
-         * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
-         */
-        Camera.prototype.toString = function (fullDetails) {
-            var ret = "Name: " + this.name;
-            ret += ", type: " + this.getTypeName();
-            if (this.animations) {
-                for (var i = 0; i < this.animations.length; i++) {
-                    ret += ", animation[0]: " + this.animations[i].toString(fullDetails);
-                }
-            }
-            if (fullDetails) {
-            }
-            return ret;
-        };
-        Object.defineProperty(Camera.prototype, "globalPosition", {
-            get: function () {
-                return this._globalPosition;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Camera.prototype.getActiveMeshes = function () {
-            return this._activeMeshes;
-        };
-        Camera.prototype.isActiveMesh = function (mesh) {
-            return (this._activeMeshes.indexOf(mesh) !== -1);
-        };
-        //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.fovMode = 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.fovMode = this.fovMode;
-            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 === Camera.PERSPECTIVE_CAMERA) {
-                check = this._cache.fov === this.fov
-                    && this._cache.fovMode === this.fovMode
-                    && 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, noPreventDefault) {
-        };
-        Camera.prototype.detachControl = function (element) {
-        };
-        Camera.prototype.update = function () {
-            if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {
-                this._updateRigCameras();
-            }
-            this._checkInputs();
-        };
-        Camera.prototype._checkInputs = function () {
-        };
-        Camera.prototype._cascadePostProcessesToRigCams = function () {
-            // invalidate framebuffer
-            if (this._postProcesses.length > 0) {
-                this._postProcesses[0].markTextureDirty();
-            }
-            // glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera
-            for (var i = 0, len = this._rigCameras.length; i < len; i++) {
-                var cam = this._rigCameras[i];
-                var rigPostProcess = cam._rigPostProcess;
-                // for VR rig, there does not have to be a post process 
-                if (rigPostProcess) {
-                    var isPass = rigPostProcess instanceof BABYLON.PassPostProcess;
-                    if (isPass) {
-                        // any rig which has a PassPostProcess for rig[0], cannot be isIntermediate when there are also user postProcesses
-                        cam.isIntermediate = this._postProcesses.length === 0;
-                    }
-                    cam._postProcesses = this._postProcesses.slice(0).concat(rigPostProcess);
-                    rigPostProcess.markTextureDirty();
-                }
-                else {
-                    cam._postProcesses = this._postProcesses.slice(0);
-                }
-            }
-        };
-        Camera.prototype.attachPostProcess = function (postProcess, insertAt) {
-            if (insertAt === void 0) { 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);
-            }
-            else {
-                this._postProcesses.splice(insertAt, 0, postProcess);
-            }
-            this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated            
-            return this._postProcesses.indexOf(postProcess);
-        };
-        Camera.prototype.detachPostProcess = function (postProcess, atIndices) {
-            if (atIndices === void 0) { atIndices = null; }
-            var result = [];
-            var i;
-            var index;
-            if (!atIndices) {
-                var idx = this._postProcesses.indexOf(postProcess);
-                if (idx !== -1) {
-                    this._postProcesses.splice(idx, 1);
-                }
-            }
-            else {
-                atIndices = (atIndices instanceof Array) ? atIndices : [atIndices];
-                // iterate descending, so can just splice as we go
-                for (i = atIndices.length - 1; i >= 0; i--) {
-                    if (this._postProcesses[atIndices[i]] !== postProcess) {
-                        result.push(i);
-                        continue;
-                    }
-                    this._postProcesses.splice(index, 1);
-                }
-            }
-            this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated
-            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 (force) {
-            this._computedViewMatrix = this._computeViewMatrix(force);
-            if (!force && this._isSynchronizedViewMatrix()) {
-                return this._computedViewMatrix;
-            }
-            this._refreshFrustumPlanes = true;
-            if (!this.parent || !this.parent.getWorldMatrix) {
-                this._globalPosition.copyFrom(this.position);
-            }
-            else {
-                if (!this._worldMatrix) {
-                    this._worldMatrix = BABYLON.Matrix.Identity();
-                }
-                this._computedViewMatrix.invertToRef(this._worldMatrix);
-                this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
-                this._globalPosition.copyFromFloats(this._computedViewMatrix.m[12], this._computedViewMatrix.m[13], this._computedViewMatrix.m[14]);
-                this._computedViewMatrix.invert();
-                this._markSyncedWithParent();
-            }
-            this._currentRenderId = this.getScene().getRenderId();
-            return this._computedViewMatrix;
-        };
-        Camera.prototype._computeViewMatrix = function (force) {
-            if (!force && this._isSynchronizedViewMatrix()) {
-                return this._computedViewMatrix;
-            }
-            this._computedViewMatrix = this._getViewMatrix();
-            this._currentRenderId = this.getScene().getRenderId();
-            return this._computedViewMatrix;
-        };
-        Camera.prototype.freezeProjectionMatrix = function (projection) {
-            this._doNotComputeProjectionMatrix = true;
-            if (projection !== undefined) {
-                this._projectionMatrix = projection;
-            }
-        };
-        ;
-        Camera.prototype.unfreezeProjectionMatrix = function () {
-            this._doNotComputeProjectionMatrix = false;
-        };
-        ;
-        Camera.prototype.getProjectionMatrix = function (force) {
-            if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {
-                return this._projectionMatrix;
-            }
-            this._refreshFrustumPlanes = true;
-            var engine = this.getEngine();
-            var scene = this.getScene();
-            if (this.mode === Camera.PERSPECTIVE_CAMERA) {
-                if (this.minZ <= 0) {
-                    this.minZ = 0.1;
-                }
-                if (scene.useRightHandedSystem) {
-                    BABYLON.Matrix.PerspectiveFovRHToRef(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED);
-                }
-                else {
-                    BABYLON.Matrix.PerspectiveFovLHToRef(this.fov, engine.getAspectRatio(this), this.minZ, this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED);
-                }
-                return this._projectionMatrix;
-            }
-            var halfWidth = engine.getRenderWidth() / 2.0;
-            var halfHeight = engine.getRenderHeight() / 2.0;
-            if (scene.useRightHandedSystem) {
-                BABYLON.Matrix.OrthoOffCenterRHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);
-            }
-            else {
-                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.getTranformationMatrix = function () {
-            this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);
-            return this._transformMatrix;
-        };
-        Camera.prototype.updateFrustumPlanes = function () {
-            if (!this._refreshFrustumPlanes) {
-                return;
-            }
-            this.getTranformationMatrix();
-            if (!this._frustumPlanes) {
-                this._frustumPlanes = BABYLON.Frustum.GetPlanes(this._transformMatrix);
-            }
-            else {
-                BABYLON.Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);
-            }
-            this._refreshFrustumPlanes = false;
-        };
-        Camera.prototype.isInFrustum = function (target) {
-            this.updateFrustumPlanes();
-            return target.isInFrustum(this._frustumPlanes);
-        };
-        Camera.prototype.isCompletelyInFrustum = function (target) {
-            this.updateFrustumPlanes();
-            return target.isCompletelyInFrustum(this._frustumPlanes);
-        };
-        Camera.prototype.dispose = function () {
-            // Animations
-            this.getScene().stopAnimation(this);
-            // Remove from scene
-            this.getScene().removeCamera(this);
-            while (this._rigCameras.length > 0) {
-                this._rigCameras.pop().dispose();
-            }
-            // Postprocesses
-            for (var i = 0; i < this._postProcesses.length; ++i) {
-                this._postProcesses[i].dispose(this);
-            }
-            _super.prototype.dispose.call(this);
-        };
-        // ---- Camera rigs section ----
-        Camera.prototype.setCameraRigMode = function (mode, rigParams) {
-            while (this._rigCameras.length > 0) {
-                this._rigCameras.pop().dispose();
-            }
-            this.cameraRigMode = mode;
-            this._cameraRigParams = {};
-            //we have to implement stereo camera calcultating left and right viewpoints from interaxialDistance and target, 
-            //not from a given angle as it is now, but until that complete code rewriting provisional stereoHalfAngle value is introduced
-            this._cameraRigParams.interaxialDistance = rigParams.interaxialDistance || 0.0637;
-            this._cameraRigParams.stereoHalfAngle = BABYLON.Tools.ToRadians(this._cameraRigParams.interaxialDistance / 0.0637);
-            // create the rig cameras, unless none
-            if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {
-                this._rigCameras.push(this.createRigCamera(this.name + "_L", 0));
-                this._rigCameras.push(this.createRigCamera(this.name + "_R", 1));
-            }
-            switch (this.cameraRigMode) {
-                case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
-                    this._rigCameras[0]._rigPostProcess = new BABYLON.PassPostProcess(this.name + "_passthru", 1.0, this._rigCameras[0]);
-                    this._rigCameras[1]._rigPostProcess = new BABYLON.AnaglyphPostProcess(this.name + "_anaglyph", 1.0, this._rigCameras);
-                    break;
-                case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
-                case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
-                case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
-                    var isStereoscopicHoriz = this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL || this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;
-                    this._rigCameras[0]._rigPostProcess = new BABYLON.PassPostProcess(this.name + "_passthru", 1.0, this._rigCameras[0]);
-                    this._rigCameras[1]._rigPostProcess = new BABYLON.StereoscopicInterlacePostProcess(this.name + "_stereoInterlace", this._rigCameras, isStereoscopicHoriz);
-                    break;
-                case Camera.RIG_MODE_VR:
-                    var metrics = rigParams.vrCameraMetrics || BABYLON.VRCameraMetrics.GetDefault();
-                    this._rigCameras[0]._cameraRigParams.vrMetrics = metrics;
-                    this._rigCameras[0].viewport = new BABYLON.Viewport(0, 0, 0.5, 1.0);
-                    this._rigCameras[0]._cameraRigParams.vrWorkMatrix = new BABYLON.Matrix();
-                    this._rigCameras[0]._cameraRigParams.vrHMatrix = metrics.leftHMatrix;
-                    this._rigCameras[0]._cameraRigParams.vrPreViewMatrix = metrics.leftPreViewMatrix;
-                    this._rigCameras[0].getProjectionMatrix = this._rigCameras[0]._getVRProjectionMatrix;
-                    this._rigCameras[1]._cameraRigParams.vrMetrics = metrics;
-                    this._rigCameras[1].viewport = new BABYLON.Viewport(0.5, 0, 0.5, 1.0);
-                    this._rigCameras[1]._cameraRigParams.vrWorkMatrix = new BABYLON.Matrix();
-                    this._rigCameras[1]._cameraRigParams.vrHMatrix = metrics.rightHMatrix;
-                    this._rigCameras[1]._cameraRigParams.vrPreViewMatrix = metrics.rightPreViewMatrix;
-                    this._rigCameras[1].getProjectionMatrix = this._rigCameras[1]._getVRProjectionMatrix;
-                    if (metrics.compensateDistortion) {
-                        this._rigCameras[0]._rigPostProcess = new BABYLON.VRDistortionCorrectionPostProcess("VR_Distort_Compensation_Left", this._rigCameras[0], false, metrics);
-                        this._rigCameras[1]._rigPostProcess = new BABYLON.VRDistortionCorrectionPostProcess("VR_Distort_Compensation_Right", this._rigCameras[1], true, metrics);
-                    }
-                    break;
-                case Camera.RIG_MODE_WEBVR:
-                    if (rigParams.vrDisplay) {
-                        //var leftEye = rigParams.vrDisplay.getEyeParameters('left');
-                        //var rightEye = rigParams.vrDisplay.getEyeParameters('right');
-                        this._rigCameras[0].viewport = new BABYLON.Viewport(0, 0, 0.5, 1.0);
-                        this._rigCameras[0].setCameraRigParameter("left", true);
-                        this._rigCameras[0].setCameraRigParameter("frameData", rigParams.frameData);
-                        //this._rigCameras[0].setCameraRigParameter("vrOffsetMatrix", Matrix.Translation(-leftEye.offset[0], leftEye.offset[1], -leftEye.offset[2]));
-                        this._rigCameras[0]._cameraRigParams.vrWorkMatrix = new BABYLON.Matrix();
-                        this._rigCameras[0].getProjectionMatrix = this._getWebVRProjectionMatrix;
-                        //this._rigCameras[0]._getViewMatrix = this._getWebVRViewMatrix;
-                        this._rigCameras[1].viewport = new BABYLON.Viewport(0.5, 0, 0.5, 1.0);
-                        this._rigCameras[1].setCameraRigParameter("frameData", rigParams.frameData);
-                        //this._rigCameras[1].setCameraRigParameter("vrOffsetMatrix", Matrix.Translation(-rightEye.offset[0], rightEye.offset[1], -rightEye.offset[2]));
-                        this._rigCameras[1]._cameraRigParams.vrWorkMatrix = new BABYLON.Matrix();
-                        this._rigCameras[1].getProjectionMatrix = this._getWebVRProjectionMatrix;
-                    }
-                    break;
-            }
-            this._cascadePostProcessesToRigCams();
-            this.
-                update();
-        };
-        Camera.prototype._getVRProjectionMatrix = function () {
-            BABYLON.Matrix.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.maxZ, this._cameraRigParams.vrWorkMatrix);
-            this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix);
-            return this._projectionMatrix;
-        };
-        Camera.prototype._getWebVRProjectionMatrix = function () {
-            var projectionArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftProjectionMatrix : this._cameraRigParams["frameData"].rightProjectionMatrix;
-            //babylon compatible matrix
-            [8, 9, 10, 11].forEach(function (num) {
-                projectionArray[num] *= -1;
-            });
-            BABYLON.Matrix.FromArrayToRef(projectionArray, 0, this._projectionMatrix);
-            return this._projectionMatrix;
-        };
-        //Can be used, but we'll use the free camera's view matrix calculation
-        Camera.prototype._getWebVRViewMatrix = function () {
-            var projectionArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftViewMatrix : this._cameraRigParams["frameData"].rightViewMatrix;
-            //babylon compatible matrix
-            [8, 9, 10, 11].forEach(function (num) {
-                projectionArray[num] *= -1;
-            });
-            BABYLON.Matrix.FromArrayToRef(projectionArray, 0, this._webvrViewMatrix);
-            return this._webvrViewMatrix;
-        };
-        Camera.prototype.setCameraRigParameter = function (name, value) {
-            if (!this._cameraRigParams) {
-                this._cameraRigParams = {};
-            }
-            this._cameraRigParams[name] = value;
-            //provisionnally:
-            if (name === "interaxialDistance") {
-                this._cameraRigParams.stereoHalfAngle = BABYLON.Tools.ToRadians(value / 0.0637);
-            }
-        };
-        /**
-         * needs to be overridden by children so sub has required properties to be copied
-         */
-        Camera.prototype.createRigCamera = function (name, cameraIndex) {
-            return null;
-        };
-        /**
-         * May need to be overridden by children
-         */
-        Camera.prototype._updateRigCameras = function () {
-            for (var i = 0; i < this._rigCameras.length; i++) {
-                this._rigCameras[i].minZ = this.minZ;
-                this._rigCameras[i].maxZ = this.maxZ;
-                this._rigCameras[i].fov = this.fov;
-            }
-            // only update viewport when ANAGLYPH
-            if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {
-                this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport;
-            }
-        };
-        Camera.prototype._setupInputs = function () {
-        };
-        Camera.prototype.serialize = function () {
-            var serializationObject = BABYLON.SerializationHelper.Serialize(this);
-            // Type
-            serializationObject.type = this.getTypeName();
-            // Parent
-            if (this.parent) {
-                serializationObject.parentId = this.parent.id;
-            }
-            if (this.inputs) {
-                this.inputs.serialize(serializationObject);
-            }
-            // Animations
-            BABYLON.Animation.AppendSerializedAnimations(this, serializationObject);
-            serializationObject.ranges = this.serializeAnimationRanges();
-            return serializationObject;
-        };
-        Camera.prototype.getTypeName = function () {
-            return "Camera";
-        };
-        Camera.prototype.clone = function (name) {
-            return BABYLON.SerializationHelper.Clone(Camera.GetConstructorFromName(this.getTypeName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);
-        };
-        Camera.GetConstructorFromName = function (type, name, scene, interaxial_distance, isStereoscopicSideBySide) {
-            if (interaxial_distance === void 0) { interaxial_distance = 0; }
-            if (isStereoscopicSideBySide === void 0) { isStereoscopicSideBySide = true; }
-            switch (type) {
-                case "ArcRotateCamera":
-                    return function () { return new BABYLON.ArcRotateCamera(name, 0, 0, 1.0, BABYLON.Vector3.Zero(), scene); };
-                case "DeviceOrientationCamera":
-                    return function () { return new BABYLON.DeviceOrientationCamera(name, BABYLON.Vector3.Zero(), scene); };
-                case "FollowCamera":
-                    return function () { return new BABYLON.FollowCamera(name, BABYLON.Vector3.Zero(), scene); };
-                case "ArcFollowCamera":
-                    return function () { return new BABYLON.ArcFollowCamera(name, 0, 0, 1.0, null, scene); };
-                case "GamepadCamera":
-                    return function () { return new BABYLON.GamepadCamera(name, BABYLON.Vector3.Zero(), scene); };
-                case "TouchCamera":
-                    return function () { return new BABYLON.TouchCamera(name, BABYLON.Vector3.Zero(), scene); };
-                case "VirtualJoysticksCamera":
-                    return function () { return new BABYLON.VirtualJoysticksCamera(name, BABYLON.Vector3.Zero(), scene); };
-                case "WebVRFreeCamera":
-                    return function () { return new BABYLON.WebVRFreeCamera(name, BABYLON.Vector3.Zero(), scene); };
-                case "VRDeviceOrientationFreeCamera":
-                    return function () { return new BABYLON.VRDeviceOrientationFreeCamera(name, BABYLON.Vector3.Zero(), scene); };
-                case "AnaglyphArcRotateCamera":
-                    return function () { return new BABYLON.AnaglyphArcRotateCamera(name, 0, 0, 1.0, BABYLON.Vector3.Zero(), interaxial_distance, scene); };
-                case "AnaglyphFreeCamera":
-                    return function () { return new BABYLON.AnaglyphFreeCamera(name, BABYLON.Vector3.Zero(), interaxial_distance, scene); };
-                case "AnaglyphGamepadCamera":
-                    return function () { return new BABYLON.AnaglyphGamepadCamera(name, BABYLON.Vector3.Zero(), interaxial_distance, scene); };
-                case "AnaglyphUniversalCamera":
-                    return function () { return new BABYLON.AnaglyphUniversalCamera(name, BABYLON.Vector3.Zero(), interaxial_distance, scene); };
-                case "StereoscopicArcRotateCamera":
-                    return function () { return new BABYLON.StereoscopicArcRotateCamera(name, 0, 0, 1.0, BABYLON.Vector3.Zero(), interaxial_distance, isStereoscopicSideBySide, scene); };
-                case "StereoscopicFreeCamera":
-                    return function () { return new BABYLON.StereoscopicFreeCamera(name, BABYLON.Vector3.Zero(), interaxial_distance, isStereoscopicSideBySide, scene); };
-                case "StereoscopicGamepadCamera":
-                    return function () { return new BABYLON.StereoscopicGamepadCamera(name, BABYLON.Vector3.Zero(), interaxial_distance, isStereoscopicSideBySide, scene); };
-                case "StereoscopicUniversalCamera":
-                    return function () { return new BABYLON.StereoscopicUniversalCamera(name, BABYLON.Vector3.Zero(), interaxial_distance, isStereoscopicSideBySide, scene); };
-                case "FreeCamera":
-                    return function () { return new BABYLON.UniversalCamera(name, BABYLON.Vector3.Zero(), scene); };
-                default:
-                    return function () { return new BABYLON.UniversalCamera(name, BABYLON.Vector3.Zero(), scene); };
-            }
-        };
-        Camera.Parse = function (parsedCamera, scene) {
-            var type = parsedCamera.type;
-            var construct = Camera.GetConstructorFromName(type, parsedCamera.name, scene, parsedCamera.interaxial_distance, parsedCamera.isStereoscopicSideBySide);
-            var camera = BABYLON.SerializationHelper.Parse(construct, parsedCamera, scene);
-            // Parent
-            if (parsedCamera.parentId) {
-                camera._waitingParentId = parsedCamera.parentId;
-            }
-            //If camera has an input manager, let it parse inputs settings
-            if (camera.inputs) {
-                camera.inputs.parse(parsedCamera);
-                camera._setupInputs();
-            }
-            // Target
-            if (parsedCamera.target) {
-                if (camera.setTarget) {
-                    camera.setTarget(BABYLON.Vector3.FromArray(parsedCamera.target));
-                }
-            }
-            // Apply 3d rig, when found
-            if (parsedCamera.cameraRigMode) {
-                var rigParams = (parsedCamera.interaxial_distance) ? { interaxialDistance: parsedCamera.interaxial_distance } : {};
-                camera.setCameraRigMode(parsedCamera.cameraRigMode, rigParams);
-            }
-            // Animations
-            if (parsedCamera.animations) {
-                for (var animationIndex = 0; animationIndex < parsedCamera.animations.length; animationIndex++) {
-                    var parsedAnimation = parsedCamera.animations[animationIndex];
-                    camera.animations.push(BABYLON.Animation.Parse(parsedAnimation));
-                }
-                BABYLON.Node.ParseAnimationRanges(camera, parsedCamera, scene);
-            }
-            if (parsedCamera.autoAnimate) {
-                scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, parsedCamera.autoAnimateSpeed || 1.0);
-            }
-            return camera;
-        };
-        // Statics
-        Camera._PERSPECTIVE_CAMERA = 0;
-        Camera._ORTHOGRAPHIC_CAMERA = 1;
-        Camera._FOVMODE_VERTICAL_FIXED = 0;
-        Camera._FOVMODE_HORIZONTAL_FIXED = 1;
-        Camera._RIG_MODE_NONE = 0;
-        Camera._RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10;
-        Camera._RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11;
-        Camera._RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12;
-        Camera._RIG_MODE_STEREOSCOPIC_OVERUNDER = 13;
-        Camera._RIG_MODE_VR = 20;
-        Camera._RIG_MODE_WEBVR = 21;
-        Camera.ForceAttachControlToAlwaysPreventDefault = false;
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], Camera.prototype, "position", void 0);
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], Camera.prototype, "upVector", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "orthoLeft", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "orthoRight", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "orthoBottom", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "orthoTop", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "fov", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "minZ", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "maxZ", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "inertia", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "mode", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "layerMask", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "fovMode", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "cameraRigMode", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "interaxialDistance", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Camera.prototype, "isStereoscopicSideBySide", void 0);
-        return Camera;
-    }(BABYLON.Node));
-    BABYLON.Camera = Camera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 133
src/Cameras/babylon.cameraInputsManager.js

@@ -1,133 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    BABYLON.CameraInputTypes = {};
-    var CameraInputsManager = (function () {
-        function CameraInputsManager(camera) {
-            this.attached = {};
-            this.camera = camera;
-            this.checkInputs = function () { };
-        }
-        CameraInputsManager.prototype.add = function (input) {
-            var type = input.getSimpleName();
-            if (this.attached[type]) {
-                BABYLON.Tools.Warn("camera input of type " + type + " already exists on camera");
-                return;
-            }
-            this.attached[type] = input;
-            input.camera = this.camera;
-            //for checkInputs, we are dynamically creating a function
-            //the goal is to avoid the performance penalty of looping for inputs in the render loop
-            if (input.checkInputs) {
-                this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));
-            }
-            if (this.attachedElement) {
-                input.attachControl(this.attachedElement);
-            }
-        };
-        CameraInputsManager.prototype.remove = function (inputToRemove) {
-            for (var cam in this.attached) {
-                var input = this.attached[cam];
-                if (input === inputToRemove) {
-                    input.detachControl(this.attachedElement);
-                    delete this.attached[cam];
-                    this.rebuildInputCheck();
-                }
-            }
-        };
-        CameraInputsManager.prototype.removeByType = function (inputType) {
-            for (var cam in this.attached) {
-                var input = this.attached[cam];
-                if (input.getTypeName() === inputType) {
-                    input.detachControl(this.attachedElement);
-                    delete this.attached[cam];
-                    this.rebuildInputCheck();
-                }
-            }
-        };
-        CameraInputsManager.prototype._addCheckInputs = function (fn) {
-            var current = this.checkInputs;
-            return function () {
-                current();
-                fn();
-            };
-        };
-        CameraInputsManager.prototype.attachInput = function (input) {
-            input.attachControl(this.attachedElement, this.noPreventDefault);
-        };
-        CameraInputsManager.prototype.attachElement = function (element, noPreventDefault) {
-            if (this.attachedElement) {
-                return;
-            }
-            noPreventDefault = BABYLON.Camera.ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;
-            this.attachedElement = element;
-            this.noPreventDefault = noPreventDefault;
-            for (var cam in this.attached) {
-                var input = this.attached[cam];
-                this.attached[cam].attachControl(element, noPreventDefault);
-            }
-        };
-        CameraInputsManager.prototype.detachElement = function (element) {
-            if (this.attachedElement !== element) {
-                return;
-            }
-            for (var cam in this.attached) {
-                var input = this.attached[cam];
-                this.attached[cam].detachControl(element);
-            }
-            this.attachedElement = null;
-        };
-        CameraInputsManager.prototype.rebuildInputCheck = function () {
-            this.checkInputs = function () { };
-            for (var cam in this.attached) {
-                var input = this.attached[cam];
-                if (input.checkInputs) {
-                    this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));
-                }
-            }
-        };
-        CameraInputsManager.prototype.clear = function () {
-            if (this.attachedElement) {
-                this.detachElement(this.attachedElement);
-            }
-            this.attached = {};
-            this.attachedElement = null;
-            this.checkInputs = function () { };
-        };
-        CameraInputsManager.prototype.serialize = function (serializedCamera) {
-            var inputs = {};
-            for (var cam in this.attached) {
-                var input = this.attached[cam];
-                var res = BABYLON.SerializationHelper.Serialize(input);
-                inputs[input.getTypeName()] = res;
-            }
-            serializedCamera.inputsmgr = inputs;
-        };
-        CameraInputsManager.prototype.parse = function (parsedCamera) {
-            var parsedInputs = parsedCamera.inputsmgr;
-            if (parsedInputs) {
-                this.clear();
-                for (var n in parsedInputs) {
-                    var construct = BABYLON.CameraInputTypes[n];
-                    if (construct) {
-                        var parsedinput = parsedInputs[n];
-                        var input = BABYLON.SerializationHelper.Parse(function () { return new construct(); }, parsedinput, null);
-                        this.add(input);
-                    }
-                }
-            }
-            else {
-                //2016-03-08 this part is for managing backward compatibility
-                for (var n in this.attached) {
-                    var construct = BABYLON.CameraInputTypes[this.attached[n].getTypeName()];
-                    if (construct) {
-                        var input = BABYLON.SerializationHelper.Parse(function () { return new construct(); }, parsedCamera, null);
-                        this.remove(this.attached[n]);
-                        this.add(input);
-                    }
-                }
-            }
-        };
-        return CameraInputsManager;
-    }());
-    BABYLON.CameraInputsManager = CameraInputsManager;
-})(BABYLON || (BABYLON = {}));

+ 0 - 51
src/Cameras/babylon.deviceOrientationCamera.js

@@ -1,51 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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) {
-            _super.call(this, name, position, scene);
-            this._quaternionCache = new BABYLON.Quaternion();
-            this.inputs.addDeviceOrientation();
-        }
-        DeviceOrientationCamera.prototype.getTypeName = function () {
-            return "DeviceOrientationCamera";
-        };
-        DeviceOrientationCamera.prototype._checkInputs = function () {
-            _super.prototype._checkInputs.call(this);
-            this._quaternionCache.copyFrom(this.rotationQuaternion);
-            if (this._initialQuaternion) {
-                this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
-            }
-        };
-        DeviceOrientationCamera.prototype.resetToCurrentRotation = function (axis) {
-            var _this = this;
-            if (axis === void 0) { axis = BABYLON.Axis.Y; }
-            //can only work if this camera has a rotation quaternion already.
-            if (!this.rotationQuaternion)
-                return;
-            if (!this._initialQuaternion) {
-                this._initialQuaternion = new BABYLON.Quaternion();
-            }
-            this._initialQuaternion.copyFrom(this._quaternionCache || this.rotationQuaternion);
-            ['x', 'y', 'z'].forEach(function (axisName) {
-                if (!axis[axisName]) {
-                    _this._initialQuaternion[axisName] = 0;
-                }
-                else {
-                    _this._initialQuaternion[axisName] *= -1;
-                }
-            });
-            this._initialQuaternion.normalize();
-            //force rotation update
-            this._initialQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);
-        };
-        return DeviceOrientationCamera;
-    }(BABYLON.FreeCamera));
-    BABYLON.DeviceOrientationCamera = DeviceOrientationCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 117
src/Cameras/babylon.followCamera.js

@@ -1,117 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var FollowCamera = (function (_super) {
-        __extends(FollowCamera, _super);
-        function FollowCamera(name, position, scene, target) {
-            _super.call(this, name, position, scene);
-            this.radius = 12;
-            this.rotationOffset = 0;
-            this.heightOffset = 4;
-            this.cameraAcceleration = 0.05;
-            this.maxCameraSpeed = 20;
-            this.target = target;
-        }
-        FollowCamera.prototype.getRadians = function (degrees) {
-            return degrees * Math.PI / 180;
-        };
-        FollowCamera.prototype.follow = function (cameraTarget) {
-            if (!cameraTarget)
-                return;
-            var yRotation;
-            if (cameraTarget.rotationQuaternion) {
-                var rotMatrix = new BABYLON.Matrix();
-                cameraTarget.rotationQuaternion.toRotationMatrix(rotMatrix);
-                yRotation = Math.atan2(rotMatrix.m[8], rotMatrix.m[10]);
-            }
-            else {
-                yRotation = cameraTarget.rotation.y;
-            }
-            var radians = this.getRadians(this.rotationOffset) + yRotation;
-            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; //this is set to .05
-            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._checkInputs = function () {
-            _super.prototype._checkInputs.call(this);
-            this.follow(this.target);
-        };
-        FollowCamera.prototype.getTypeName = function () {
-            return "FollowCamera";
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], FollowCamera.prototype, "radius", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FollowCamera.prototype, "rotationOffset", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FollowCamera.prototype, "heightOffset", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FollowCamera.prototype, "cameraAcceleration", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FollowCamera.prototype, "maxCameraSpeed", void 0);
-        __decorate([
-            BABYLON.serializeAsMeshReference("lockedTargetId")
-        ], FollowCamera.prototype, "target", void 0);
-        return FollowCamera;
-    }(BABYLON.TargetCamera));
-    BABYLON.FollowCamera = FollowCamera;
-    var ArcFollowCamera = (function (_super) {
-        __extends(ArcFollowCamera, _super);
-        function ArcFollowCamera(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._cartesianCoordinates = BABYLON.Vector3.Zero();
-            this.follow();
-        }
-        ArcFollowCamera.prototype.follow = function () {
-            this._cartesianCoordinates.x = this.radius * Math.cos(this.alpha) * Math.cos(this.beta);
-            this._cartesianCoordinates.y = this.radius * Math.sin(this.beta);
-            this._cartesianCoordinates.z = this.radius * Math.sin(this.alpha) * Math.cos(this.beta);
-            this.position = this.target.position.add(this._cartesianCoordinates);
-            this.setTarget(this.target.position);
-        };
-        ArcFollowCamera.prototype._checkInputs = function () {
-            _super.prototype._checkInputs.call(this);
-            this.follow();
-        };
-        ArcFollowCamera.prototype.getTypeName = function () {
-            return "ArcFollowCamera";
-        };
-        return ArcFollowCamera;
-    }(BABYLON.TargetCamera));
-    BABYLON.ArcFollowCamera = ArcFollowCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 185
src/Cameras/babylon.freeCamera.js

@@ -1,185 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var FreeCamera = (function (_super) {
-        __extends(FreeCamera, _super);
-        function FreeCamera(name, position, scene) {
-            var _this = this;
-            _super.call(this, name, position, scene);
-            this.ellipsoid = new BABYLON.Vector3(0.5, 1, 0.5);
-            this.checkCollisions = false;
-            this.applyGravity = false;
-            this._collider = new BABYLON.Collider();
-            this._needMoveForGravity = false;
-            this._oldPosition = BABYLON.Vector3.Zero();
-            this._diffPosition = BABYLON.Vector3.Zero();
-            this._newPosition = BABYLON.Vector3.Zero();
-            this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {
-                if (collidedMesh === void 0) { collidedMesh = null; }
-                //TODO move this to the collision coordinator!
-                if (_this.getScene().workerCollisions)
-                    newPosition.multiplyInPlace(_this._collider.radius);
-                var updatePosition = function (newPos) {
-                    _this._newPosition.copyFrom(newPos);
-                    _this._newPosition.subtractToRef(_this._oldPosition, _this._diffPosition);
-                    var oldPosition = _this.position.clone();
-                    if (_this._diffPosition.length() > BABYLON.Engine.CollisionsEpsilon) {
-                        _this.position.addInPlace(_this._diffPosition);
-                        if (_this.onCollide && collidedMesh) {
-                            _this.onCollide(collidedMesh);
-                        }
-                    }
-                };
-                updatePosition(newPosition);
-            };
-            this.inputs = new BABYLON.FreeCameraInputsManager(this);
-            this.inputs.addKeyboard().addMouse();
-        }
-        Object.defineProperty(FreeCamera.prototype, "angularSensibility", {
-            //-- begin properties for backward compatibility for inputs
-            get: function () {
-                var mouse = this.inputs.attached["mouse"];
-                if (mouse)
-                    return mouse.angularSensibility;
-            },
-            set: function (value) {
-                var mouse = this.inputs.attached["mouse"];
-                if (mouse)
-                    mouse.angularSensibility = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(FreeCamera.prototype, "keysUp", {
-            get: function () {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    return keyboard.keysUp;
-            },
-            set: function (value) {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    keyboard.keysUp = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(FreeCamera.prototype, "keysDown", {
-            get: function () {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    return keyboard.keysDown;
-            },
-            set: function (value) {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    keyboard.keysDown = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(FreeCamera.prototype, "keysLeft", {
-            get: function () {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    return keyboard.keysLeft;
-            },
-            set: function (value) {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    keyboard.keysLeft = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(FreeCamera.prototype, "keysRight", {
-            get: function () {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    return keyboard.keysRight;
-            },
-            set: function (value) {
-                var keyboard = this.inputs.attached["keyboard"];
-                if (keyboard)
-                    keyboard.keysRight = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        // Controls
-        FreeCamera.prototype.attachControl = function (element, noPreventDefault) {
-            this.inputs.attachElement(element, noPreventDefault);
-        };
-        FreeCamera.prototype.detachControl = function (element) {
-            this.inputs.detachElement(element);
-            this.cameraDirection = new BABYLON.Vector3(0, 0, 0);
-            this.cameraRotation = new BABYLON.Vector2(0, 0);
-        };
-        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;
-            //no need for clone, as long as gravity is not on.
-            var actualVelocity = velocity;
-            //add gravity to the velocity to prevent the dual-collision checking
-            if (this.applyGravity) {
-                //this prevents mending with cameraDirection, a global variable of the free camera class.
-                actualVelocity = velocity.add(this.getScene().gravity);
-            }
-            this.getScene().collisionCoordinator.getNewPosition(this._oldPosition, actualVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);
-        };
-        FreeCamera.prototype._checkInputs = function () {
-            if (!this._localDirection) {
-                this._localDirection = BABYLON.Vector3.Zero();
-                this._transformedDirection = BABYLON.Vector3.Zero();
-            }
-            this.inputs.checkInputs();
-            _super.prototype._checkInputs.call(this);
-        };
-        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);
-            }
-            else {
-                this.position.addInPlace(this.cameraDirection);
-            }
-        };
-        FreeCamera.prototype.dispose = function () {
-            this.inputs.clear();
-            _super.prototype.dispose.call(this);
-        };
-        FreeCamera.prototype.getTypeName = function () {
-            return "FreeCamera";
-        };
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], FreeCamera.prototype, "ellipsoid", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCamera.prototype, "checkCollisions", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], FreeCamera.prototype, "applyGravity", void 0);
-        return FreeCamera;
-    }(BABYLON.TargetCamera));
-    BABYLON.FreeCamera = FreeCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 41
src/Cameras/babylon.freeCameraInputsManager.js

@@ -1,41 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var FreeCameraInputsManager = (function (_super) {
-        __extends(FreeCameraInputsManager, _super);
-        function FreeCameraInputsManager(camera) {
-            _super.call(this, camera);
-        }
-        FreeCameraInputsManager.prototype.addKeyboard = function () {
-            this.add(new BABYLON.FreeCameraKeyboardMoveInput());
-            return this;
-        };
-        FreeCameraInputsManager.prototype.addMouse = function (touchEnabled) {
-            if (touchEnabled === void 0) { touchEnabled = true; }
-            this.add(new BABYLON.FreeCameraMouseInput(touchEnabled));
-            return this;
-        };
-        FreeCameraInputsManager.prototype.addGamepad = function () {
-            this.add(new BABYLON.FreeCameraGamepadInput());
-            return this;
-        };
-        FreeCameraInputsManager.prototype.addDeviceOrientation = function () {
-            this.add(new BABYLON.FreeCameraDeviceOrientationInput());
-            return this;
-        };
-        FreeCameraInputsManager.prototype.addTouch = function () {
-            this.add(new BABYLON.FreeCameraTouchInput());
-            return this;
-        };
-        FreeCameraInputsManager.prototype.addVirtualJoystick = function () {
-            this.add(new BABYLON.FreeCameraVirtualJoystickInput());
-            return this;
-        };
-        return FreeCameraInputsManager;
-    }(BABYLON.CameraInputsManager));
-    BABYLON.FreeCameraInputsManager = FreeCameraInputsManager;
-})(BABYLON || (BABYLON = {}));

+ 0 - 51
src/Cameras/babylon.gamepadCamera.js

@@ -1,51 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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);
-        //-- end properties for backward compatibility for inputs
-        function GamepadCamera(name, position, scene) {
-            BABYLON.Tools.Warn("Deprecated. Please use Universal Camera instead.");
-            _super.call(this, name, position, scene);
-        }
-        Object.defineProperty(GamepadCamera.prototype, "gamepadAngularSensibility", {
-            //-- Begin properties for backward compatibility for inputs
-            get: function () {
-                var gamepad = this.inputs.attached["gamepad"];
-                if (gamepad)
-                    return gamepad.gamepadAngularSensibility;
-            },
-            set: function (value) {
-                var gamepad = this.inputs.attached["gamepad"];
-                if (gamepad)
-                    gamepad.gamepadAngularSensibility = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(GamepadCamera.prototype, "gamepadMoveSensibility", {
-            get: function () {
-                var gamepad = this.inputs.attached["gamepad"];
-                if (gamepad)
-                    return gamepad.gamepadMoveSensibility;
-            },
-            set: function (value) {
-                var gamepad = this.inputs.attached["gamepad"];
-                if (gamepad)
-                    gamepad.gamepadMoveSensibility = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        GamepadCamera.prototype.getTypeName = function () {
-            return "GamepadCamera";
-        };
-        return GamepadCamera;
-    }(BABYLON.UniversalCamera));
-    BABYLON.GamepadCamera = GamepadCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 116
src/Cameras/babylon.stereoscopicCameras.js

@@ -1,116 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var AnaglyphFreeCamera = (function (_super) {
-        __extends(AnaglyphFreeCamera, _super);
-        function AnaglyphFreeCamera(name, position, interaxialDistance, scene) {
-            _super.call(this, name, position, scene);
-            this.interaxialDistance = interaxialDistance;
-            this.setCameraRigMode(BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });
-        }
-        AnaglyphFreeCamera.prototype.getTypeName = function () {
-            return "AnaglyphFreeCamera";
-        };
-        return AnaglyphFreeCamera;
-    }(BABYLON.FreeCamera));
-    BABYLON.AnaglyphFreeCamera = AnaglyphFreeCamera;
-    var AnaglyphArcRotateCamera = (function (_super) {
-        __extends(AnaglyphArcRotateCamera, _super);
-        function AnaglyphArcRotateCamera(name, alpha, beta, radius, target, interaxialDistance, scene) {
-            _super.call(this, name, alpha, beta, radius, target, scene);
-            this.interaxialDistance = interaxialDistance;
-            this.setCameraRigMode(BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });
-        }
-        AnaglyphArcRotateCamera.prototype.getTypeName = function () {
-            return "AnaglyphArcRotateCamera";
-        };
-        return AnaglyphArcRotateCamera;
-    }(BABYLON.ArcRotateCamera));
-    BABYLON.AnaglyphArcRotateCamera = AnaglyphArcRotateCamera;
-    var AnaglyphGamepadCamera = (function (_super) {
-        __extends(AnaglyphGamepadCamera, _super);
-        function AnaglyphGamepadCamera(name, position, interaxialDistance, scene) {
-            _super.call(this, name, position, scene);
-            this.interaxialDistance = interaxialDistance;
-            this.setCameraRigMode(BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });
-        }
-        AnaglyphGamepadCamera.prototype.getTypeName = function () {
-            return "AnaglyphGamepadCamera";
-        };
-        return AnaglyphGamepadCamera;
-    }(BABYLON.GamepadCamera));
-    BABYLON.AnaglyphGamepadCamera = AnaglyphGamepadCamera;
-    var AnaglyphUniversalCamera = (function (_super) {
-        __extends(AnaglyphUniversalCamera, _super);
-        function AnaglyphUniversalCamera(name, position, interaxialDistance, scene) {
-            _super.call(this, name, position, scene);
-            this.interaxialDistance = interaxialDistance;
-            this.setCameraRigMode(BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH, { interaxialDistance: interaxialDistance });
-        }
-        AnaglyphUniversalCamera.prototype.getTypeName = function () {
-            return "AnaglyphUniversalCamera";
-        };
-        return AnaglyphUniversalCamera;
-    }(BABYLON.UniversalCamera));
-    BABYLON.AnaglyphUniversalCamera = AnaglyphUniversalCamera;
-    var StereoscopicFreeCamera = (function (_super) {
-        __extends(StereoscopicFreeCamera, _super);
-        function StereoscopicFreeCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {
-            _super.call(this, name, position, scene);
-            this.interaxialDistance = interaxialDistance;
-            this.isStereoscopicSideBySide = isStereoscopicSideBySide;
-            this.setCameraRigMode(isStereoscopicSideBySide ? BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : BABYLON.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });
-        }
-        StereoscopicFreeCamera.prototype.getTypeName = function () {
-            return "StereoscopicFreeCamera";
-        };
-        return StereoscopicFreeCamera;
-    }(BABYLON.FreeCamera));
-    BABYLON.StereoscopicFreeCamera = StereoscopicFreeCamera;
-    var StereoscopicArcRotateCamera = (function (_super) {
-        __extends(StereoscopicArcRotateCamera, _super);
-        function StereoscopicArcRotateCamera(name, alpha, beta, radius, target, interaxialDistance, isStereoscopicSideBySide, scene) {
-            _super.call(this, name, alpha, beta, radius, target, scene);
-            this.interaxialDistance = interaxialDistance;
-            this.isStereoscopicSideBySide = isStereoscopicSideBySide;
-            this.setCameraRigMode(isStereoscopicSideBySide ? BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : BABYLON.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });
-        }
-        StereoscopicArcRotateCamera.prototype.getTypeName = function () {
-            return "StereoscopicArcRotateCamera";
-        };
-        return StereoscopicArcRotateCamera;
-    }(BABYLON.ArcRotateCamera));
-    BABYLON.StereoscopicArcRotateCamera = StereoscopicArcRotateCamera;
-    var StereoscopicGamepadCamera = (function (_super) {
-        __extends(StereoscopicGamepadCamera, _super);
-        function StereoscopicGamepadCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {
-            _super.call(this, name, position, scene);
-            this.interaxialDistance = interaxialDistance;
-            this.isStereoscopicSideBySide = isStereoscopicSideBySide;
-            this.setCameraRigMode(isStereoscopicSideBySide ? BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : BABYLON.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });
-        }
-        StereoscopicGamepadCamera.prototype.getTypeName = function () {
-            return "StereoscopicGamepadCamera";
-        };
-        return StereoscopicGamepadCamera;
-    }(BABYLON.GamepadCamera));
-    BABYLON.StereoscopicGamepadCamera = StereoscopicGamepadCamera;
-    var StereoscopicUniversalCamera = (function (_super) {
-        __extends(StereoscopicUniversalCamera, _super);
-        function StereoscopicUniversalCamera(name, position, interaxialDistance, isStereoscopicSideBySide, scene) {
-            _super.call(this, name, position, scene);
-            this.interaxialDistance = interaxialDistance;
-            this.isStereoscopicSideBySide = isStereoscopicSideBySide;
-            this.setCameraRigMode(isStereoscopicSideBySide ? BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL : BABYLON.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER, { interaxialDistance: interaxialDistance });
-        }
-        StereoscopicUniversalCamera.prototype.getTypeName = function () {
-            return "StereoscopicUniversalCamera";
-        };
-        return StereoscopicUniversalCamera;
-    }(BABYLON.UniversalCamera));
-    BABYLON.StereoscopicUniversalCamera = StereoscopicUniversalCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 274
src/Cameras/babylon.targetCamera.js

@@ -1,274 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-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._defaultUpVector = new BABYLON.Vector3(0, 1, 0);
-            this._transformedReferencePoint = BABYLON.Vector3.Zero();
-            this._lookAtTemp = BABYLON.Matrix.Zero();
-            this._tempMatrix = BABYLON.Matrix.Zero();
-        }
-        TargetCamera.prototype.getFrontPosition = function (distance) {
-            var direction = this.getTarget().subtract(this.position);
-            direction.normalize();
-            direction.scaleInPlace(distance);
-            return this.globalPosition.add(direction);
-        };
-        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);
-            this._cache.rotationQuaternion = new BABYLON.Quaternion(Number.MAX_VALUE, 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);
-            if (this.rotationQuaternion)
-                this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);
-        };
-        // 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.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation));
-        };
-        // Methods
-        TargetCamera.prototype._computeLocalCameraSpeed = function () {
-            var engine = this.getEngine();
-            return this.speed * Math.sqrt((engine.getDeltaTime() / (engine.getFps() * 100.0)));
-        };
-        // Target
-        TargetCamera.prototype.setTarget = function (target) {
-            this.upVector.normalize();
-            BABYLON.Matrix.LookAtLHToRef(this.position, target, this._defaultUpVector, 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 = 0;
-            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;
-            }
-            if (this.rotationQuaternion) {
-                BABYLON.Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);
-            }
-        };
-        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._checkInputs = 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.Epsilon) {
-                    this.cameraDirection.x = 0;
-                }
-                if (Math.abs(this.cameraDirection.y) < BABYLON.Epsilon) {
-                    this.cameraDirection.y = 0;
-                }
-                if (Math.abs(this.cameraDirection.z) < BABYLON.Epsilon) {
-                    this.cameraDirection.z = 0;
-                }
-                this.cameraDirection.scaleInPlace(this.inertia);
-            }
-            if (needToRotate) {
-                if (Math.abs(this.cameraRotation.x) < BABYLON.Epsilon) {
-                    this.cameraRotation.x = 0;
-                }
-                if (Math.abs(this.cameraRotation.y) < BABYLON.Epsilon) {
-                    this.cameraRotation.y = 0;
-                }
-                this.cameraRotation.scaleInPlace(this.inertia);
-            }
-            _super.prototype._checkInputs.call(this);
-        };
-        TargetCamera.prototype._updateCameraRotationMatrix = function () {
-            if (this.rotationQuaternion) {
-                this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);
-                //update the up vector!
-                BABYLON.Vector3.TransformNormalToRef(this._defaultUpVector, this._cameraRotationMatrix, this.upVector);
-            }
-            else {
-                BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
-            }
-        };
-        TargetCamera.prototype._getViewMatrix = function () {
-            if (!this.lockedTarget) {
-                // Compute
-                this._updateCameraRotationMatrix();
-                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());
-            }
-            if (this.getScene().useRightHandedSystem) {
-                BABYLON.Matrix.LookAtRHToRef(this.position, this._currentTarget, this.upVector, this._viewMatrix);
-            }
-            else {
-                BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this.upVector, this._viewMatrix);
-            }
-            return this._viewMatrix;
-        };
-        /**
-         * @override
-         * Override Camera.createRigCamera
-         */
-        TargetCamera.prototype.createRigCamera = function (name, cameraIndex) {
-            if (this.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
-                var rigCamera = new TargetCamera(name, this.position.clone(), this.getScene());
-                if (this.cameraRigMode === BABYLON.Camera.RIG_MODE_VR || this.cameraRigMode === BABYLON.Camera.RIG_MODE_WEBVR) {
-                    if (!this.rotationQuaternion) {
-                        this.rotationQuaternion = new BABYLON.Quaternion();
-                    }
-                    rigCamera._cameraRigParams = {};
-                    rigCamera.rotationQuaternion = new BABYLON.Quaternion();
-                }
-                return rigCamera;
-            }
-            return null;
-        };
-        /**
-         * @override
-         * Override Camera._updateRigCameras
-         */
-        TargetCamera.prototype._updateRigCameras = function () {
-            var camLeft = this._rigCameras[0];
-            var camRight = this._rigCameras[1];
-            switch (this.cameraRigMode) {
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
-                case BABYLON.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
-                    //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:
-                    var leftSign = (this.cameraRigMode === BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;
-                    var rightSign = (this.cameraRigMode === BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;
-                    this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft.position);
-                    this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle * rightSign, camRight.position);
-                    camLeft.setTarget(this.getTarget());
-                    camRight.setTarget(this.getTarget());
-                    break;
-                case BABYLON.Camera.RIG_MODE_VR:
-                case BABYLON.Camera.RIG_MODE_WEBVR:
-                    if (camLeft.rotationQuaternion) {
-                        camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);
-                        camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);
-                    }
-                    else {
-                        camLeft.rotation.copyFrom(this.rotation);
-                        camRight.rotation.copyFrom(this.rotation);
-                    }
-                    camLeft.position.copyFrom(this.position);
-                    camRight.position.copyFrom(this.position);
-                    break;
-            }
-            _super.prototype._updateRigCameras.call(this);
-        };
-        TargetCamera.prototype._getRigCamPosition = function (halfSpace, result) {
-            if (!this._rigCamTransformMatrix) {
-                this._rigCamTransformMatrix = new BABYLON.Matrix();
-            }
-            var target = this.getTarget();
-            BABYLON.Matrix.Translation(-target.x, -target.y, -target.z).multiplyToRef(BABYLON.Matrix.RotationY(halfSpace), this._rigCamTransformMatrix);
-            this._rigCamTransformMatrix = this._rigCamTransformMatrix.multiply(BABYLON.Matrix.Translation(target.x, target.y, target.z));
-            BABYLON.Vector3.TransformCoordinatesToRef(this.position, this._rigCamTransformMatrix, result);
-        };
-        TargetCamera.prototype.getTypeName = function () {
-            return "TargetCamera";
-        };
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], TargetCamera.prototype, "rotation", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], TargetCamera.prototype, "speed", void 0);
-        __decorate([
-            BABYLON.serializeAsMeshReference("lockedTargetId")
-        ], TargetCamera.prototype, "lockedTarget", void 0);
-        return TargetCamera;
-    }(BABYLON.Camera));
-    BABYLON.TargetCamera = TargetCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 58
src/Cameras/babylon.touchCamera.js

@@ -1,58 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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);
-        //-- end properties for backward compatibility for inputs
-        function TouchCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this.inputs.addTouch();
-            this._setupInputs();
-        }
-        Object.defineProperty(TouchCamera.prototype, "touchAngularSensibility", {
-            //-- Begin properties for backward compatibility for inputs
-            get: function () {
-                var touch = this.inputs.attached["touch"];
-                if (touch)
-                    return touch.touchAngularSensibility;
-            },
-            set: function (value) {
-                var touch = this.inputs.attached["touch"];
-                if (touch)
-                    touch.touchAngularSensibility = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(TouchCamera.prototype, "touchMoveSensibility", {
-            get: function () {
-                var touch = this.inputs.attached["touch"];
-                if (touch)
-                    return touch.touchMoveSensibility;
-            },
-            set: function (value) {
-                var touch = this.inputs.attached["touch"];
-                if (touch)
-                    touch.touchMoveSensibility = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        TouchCamera.prototype.getTypeName = function () {
-            return "TouchCamera";
-        };
-        TouchCamera.prototype._setupInputs = function () {
-            var mouse = this.inputs.attached["mouse"];
-            if (mouse) {
-                mouse.touchEnabled = false;
-            }
-        };
-        return TouchCamera;
-    }(BABYLON.FreeCamera));
-    BABYLON.TouchCamera = TouchCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 51
src/Cameras/babylon.universalCamera.js

@@ -1,51 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    // We're mainly based on the logic defined into the FreeCamera code
-    var UniversalCamera = (function (_super) {
-        __extends(UniversalCamera, _super);
-        //-- end properties for backward compatibility for inputs
-        function UniversalCamera(name, position, scene) {
-            _super.call(this, name, position, scene);
-            this.inputs.addGamepad();
-        }
-        Object.defineProperty(UniversalCamera.prototype, "gamepadAngularSensibility", {
-            //-- Begin properties for backward compatibility for inputs
-            get: function () {
-                var gamepad = this.inputs.attached["gamepad"];
-                if (gamepad)
-                    return gamepad.gamepadAngularSensibility;
-            },
-            set: function (value) {
-                var gamepad = this.inputs.attached["gamepad"];
-                if (gamepad)
-                    gamepad.gamepadAngularSensibility = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(UniversalCamera.prototype, "gamepadMoveSensibility", {
-            get: function () {
-                var gamepad = this.inputs.attached["gamepad"];
-                if (gamepad)
-                    return gamepad.gamepadMoveSensibility;
-            },
-            set: function (value) {
-                var gamepad = this.inputs.attached["gamepad"];
-                if (gamepad)
-                    gamepad.gamepadMoveSensibility = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        UniversalCamera.prototype.getTypeName = function () {
-            return "UniversalCamera";
-        };
-        return UniversalCamera;
-    }(BABYLON.TouchCamera));
-    BABYLON.UniversalCamera = UniversalCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 18
src/Cameras/babylon.virtualJoysticksCamera.js

@@ -1,18 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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.inputs.addVirtualJoystick();
-        }
-        return VirtualJoysticksCamera;
-    }(BABYLON.FreeCamera));
-    BABYLON.VirtualJoysticksCamera = VirtualJoysticksCamera;
-})(BABYLON || (BABYLON = {}));

+ 0 - 276
src/Collisions/babylon.collider.js

@@ -1,276 +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 () {
-        var result = { root: 0, found: false };
-        return function (a, b, c, maxR) {
-            result.root = 0;
-            result.found = false;
-            var determinant = b * b - 4.0 * a * c;
-            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, trianglePlaneArray, p1, p2, p3, hasMaterial) {
-            var t0;
-            var embeddedInPlane = false;
-            //defensive programming, actually not needed.
-            if (!trianglePlaneArray) {
-                trianglePlaneArray = [];
-            }
-            if (!trianglePlaneArray[faceIndex]) {
-                trianglePlaneArray[faceIndex] = new BABYLON.Plane(0, 0, 0, 0);
-                trianglePlaneArray[faceIndex].copyFromPoints(p1, p2, p3);
-            }
-            var trianglePlane = trianglePlaneArray[faceIndex];
-            if ((!hasMaterial) && !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;
-                }
-            }
-        };
-        Collider.prototype._collide = function (trianglePlaneArray, pts, indices, indexStart, indexEnd, decal, hasMaterial) {
-            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, trianglePlaneArray, p3, p2, p1, hasMaterial);
-            }
-        };
-        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 = {}));

+ 0 - 273
src/Collisions/babylon.collisionCoordinator.js

@@ -1,273 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    //WebWorker code will be inserted to this variable.
-    BABYLON.CollisionWorker = "";
-    (function (WorkerTaskType) {
-        WorkerTaskType[WorkerTaskType["INIT"] = 0] = "INIT";
-        WorkerTaskType[WorkerTaskType["UPDATE"] = 1] = "UPDATE";
-        WorkerTaskType[WorkerTaskType["COLLIDE"] = 2] = "COLLIDE";
-    })(BABYLON.WorkerTaskType || (BABYLON.WorkerTaskType = {}));
-    var WorkerTaskType = BABYLON.WorkerTaskType;
-    (function (WorkerReplyType) {
-        WorkerReplyType[WorkerReplyType["SUCCESS"] = 0] = "SUCCESS";
-        WorkerReplyType[WorkerReplyType["UNKNOWN_ERROR"] = 1] = "UNKNOWN_ERROR";
-    })(BABYLON.WorkerReplyType || (BABYLON.WorkerReplyType = {}));
-    var WorkerReplyType = BABYLON.WorkerReplyType;
-    var CollisionCoordinatorWorker = (function () {
-        function CollisionCoordinatorWorker() {
-            var _this = this;
-            this._scaledPosition = BABYLON.Vector3.Zero();
-            this._scaledVelocity = BABYLON.Vector3.Zero();
-            this.onMeshUpdated = function (mesh) {
-                _this._addUpdateMeshesList[mesh.uniqueId] = CollisionCoordinatorWorker.SerializeMesh(mesh);
-            };
-            this.onGeometryUpdated = function (geometry) {
-                _this._addUpdateGeometriesList[geometry.id] = CollisionCoordinatorWorker.SerializeGeometry(geometry);
-            };
-            this._afterRender = function () {
-                if (!_this._init)
-                    return;
-                if (_this._toRemoveGeometryArray.length == 0 && _this._toRemoveMeshesArray.length == 0 && Object.keys(_this._addUpdateGeometriesList).length == 0 && Object.keys(_this._addUpdateMeshesList).length == 0) {
-                    return;
-                }
-                //5 concurrent updates were sent to the web worker and were not yet processed. Abort next update.
-                //TODO make sure update runs as fast as possible to be able to update 60 FPS.
-                if (_this._runningUpdated > 4) {
-                    return;
-                }
-                ++_this._runningUpdated;
-                var payload = {
-                    updatedMeshes: _this._addUpdateMeshesList,
-                    updatedGeometries: _this._addUpdateGeometriesList,
-                    removedGeometries: _this._toRemoveGeometryArray,
-                    removedMeshes: _this._toRemoveMeshesArray
-                };
-                var message = {
-                    payload: payload,
-                    taskType: WorkerTaskType.UPDATE
-                };
-                var serializable = [];
-                for (var id in payload.updatedGeometries) {
-                    if (payload.updatedGeometries.hasOwnProperty(id)) {
-                        //prepare transferables
-                        serializable.push(message.payload.updatedGeometries[id].indices.buffer);
-                        serializable.push(message.payload.updatedGeometries[id].normals.buffer);
-                        serializable.push(message.payload.updatedGeometries[id].positions.buffer);
-                    }
-                }
-                _this._worker.postMessage(message, serializable);
-                _this._addUpdateMeshesList = {};
-                _this._addUpdateGeometriesList = {};
-                _this._toRemoveGeometryArray = [];
-                _this._toRemoveMeshesArray = [];
-            };
-            this._onMessageFromWorker = function (e) {
-                var returnData = e.data;
-                if (returnData.error != WorkerReplyType.SUCCESS) {
-                    //TODO what errors can be returned from the worker?
-                    BABYLON.Tools.Warn("error returned from worker!");
-                    return;
-                }
-                switch (returnData.taskType) {
-                    case WorkerTaskType.INIT:
-                        _this._init = true;
-                        //Update the worked with ALL of the scene's current state
-                        _this._scene.meshes.forEach(function (mesh) {
-                            _this.onMeshAdded(mesh);
-                        });
-                        _this._scene.getGeometries().forEach(function (geometry) {
-                            _this.onGeometryAdded(geometry);
-                        });
-                        break;
-                    case WorkerTaskType.UPDATE:
-                        _this._runningUpdated--;
-                        break;
-                    case WorkerTaskType.COLLIDE:
-                        _this._runningCollisionTask = false;
-                        var returnPayload = returnData.payload;
-                        if (!_this._collisionsCallbackArray[returnPayload.collisionId])
-                            return;
-                        _this._collisionsCallbackArray[returnPayload.collisionId](returnPayload.collisionId, BABYLON.Vector3.FromArray(returnPayload.newPosition), _this._scene.getMeshByUniqueID(returnPayload.collidedMeshUniqueId));
-                        //cleanup
-                        _this._collisionsCallbackArray[returnPayload.collisionId] = undefined;
-                        break;
-                }
-            };
-            this._collisionsCallbackArray = [];
-            this._init = false;
-            this._runningUpdated = 0;
-            this._runningCollisionTask = false;
-            this._addUpdateMeshesList = {};
-            this._addUpdateGeometriesList = {};
-            this._toRemoveGeometryArray = [];
-            this._toRemoveMeshesArray = [];
-        }
-        CollisionCoordinatorWorker.prototype.getNewPosition = function (position, velocity, collider, maximumRetry, excludedMesh, onNewPosition, collisionIndex) {
-            if (!this._init)
-                return;
-            if (this._collisionsCallbackArray[collisionIndex] || this._collisionsCallbackArray[collisionIndex + 100000])
-                return;
-            position.divideToRef(collider.radius, this._scaledPosition);
-            velocity.divideToRef(collider.radius, this._scaledVelocity);
-            this._collisionsCallbackArray[collisionIndex] = onNewPosition;
-            var payload = {
-                collider: {
-                    position: this._scaledPosition.asArray(),
-                    velocity: this._scaledVelocity.asArray(),
-                    radius: collider.radius.asArray()
-                },
-                collisionId: collisionIndex,
-                excludedMeshUniqueId: excludedMesh ? excludedMesh.uniqueId : null,
-                maximumRetry: maximumRetry
-            };
-            var message = {
-                payload: payload,
-                taskType: WorkerTaskType.COLLIDE
-            };
-            this._worker.postMessage(message);
-        };
-        CollisionCoordinatorWorker.prototype.init = function (scene) {
-            this._scene = scene;
-            this._scene.registerAfterRender(this._afterRender);
-            var workerUrl = BABYLON.WorkerIncluded ? BABYLON.Engine.CodeRepository + "Collisions/babylon.collisionWorker.js" : URL.createObjectURL(new Blob([BABYLON.CollisionWorker], { type: 'application/javascript' }));
-            this._worker = new Worker(workerUrl);
-            this._worker.onmessage = this._onMessageFromWorker;
-            var message = {
-                payload: {},
-                taskType: WorkerTaskType.INIT
-            };
-            this._worker.postMessage(message);
-        };
-        CollisionCoordinatorWorker.prototype.destroy = function () {
-            this._scene.unregisterAfterRender(this._afterRender);
-            this._worker.terminate();
-        };
-        CollisionCoordinatorWorker.prototype.onMeshAdded = function (mesh) {
-            mesh.registerAfterWorldMatrixUpdate(this.onMeshUpdated);
-            this.onMeshUpdated(mesh);
-        };
-        CollisionCoordinatorWorker.prototype.onMeshRemoved = function (mesh) {
-            this._toRemoveMeshesArray.push(mesh.uniqueId);
-        };
-        CollisionCoordinatorWorker.prototype.onGeometryAdded = function (geometry) {
-            //TODO this will break if the user uses his own function. This should be an array of callbacks!
-            geometry.onGeometryUpdated = this.onGeometryUpdated;
-            this.onGeometryUpdated(geometry);
-        };
-        CollisionCoordinatorWorker.prototype.onGeometryDeleted = function (geometry) {
-            this._toRemoveGeometryArray.push(geometry.id);
-        };
-        CollisionCoordinatorWorker.SerializeMesh = function (mesh) {
-            var submeshes = [];
-            if (mesh.subMeshes) {
-                submeshes = mesh.subMeshes.map(function (sm, idx) {
-                    return {
-                        position: idx,
-                        verticesStart: sm.verticesStart,
-                        verticesCount: sm.verticesCount,
-                        indexStart: sm.indexStart,
-                        indexCount: sm.indexCount,
-                        hasMaterial: !!sm.getMaterial(),
-                        sphereCenter: sm.getBoundingInfo().boundingSphere.centerWorld.asArray(),
-                        sphereRadius: sm.getBoundingInfo().boundingSphere.radiusWorld,
-                        boxMinimum: sm.getBoundingInfo().boundingBox.minimumWorld.asArray(),
-                        boxMaximum: sm.getBoundingInfo().boundingBox.maximumWorld.asArray()
-                    };
-                });
-            }
-            var geometryId = null;
-            if (mesh instanceof BABYLON.Mesh) {
-                geometryId = mesh.geometry ? mesh.geometry.id : null;
-            }
-            else if (mesh instanceof BABYLON.InstancedMesh) {
-                geometryId = (mesh.sourceMesh && mesh.sourceMesh.geometry) ? mesh.sourceMesh.geometry.id : null;
-            }
-            return {
-                uniqueId: mesh.uniqueId,
-                id: mesh.id,
-                name: mesh.name,
-                geometryId: geometryId,
-                sphereCenter: mesh.getBoundingInfo().boundingSphere.centerWorld.asArray(),
-                sphereRadius: mesh.getBoundingInfo().boundingSphere.radiusWorld,
-                boxMinimum: mesh.getBoundingInfo().boundingBox.minimumWorld.asArray(),
-                boxMaximum: mesh.getBoundingInfo().boundingBox.maximumWorld.asArray(),
-                worldMatrixFromCache: mesh.worldMatrixFromCache.asArray(),
-                subMeshes: submeshes,
-                checkCollisions: mesh.checkCollisions
-            };
-        };
-        CollisionCoordinatorWorker.SerializeGeometry = function (geometry) {
-            return {
-                id: geometry.id,
-                positions: new Float32Array(geometry.getVerticesData(BABYLON.VertexBuffer.PositionKind) || []),
-                normals: new Float32Array(geometry.getVerticesData(BABYLON.VertexBuffer.NormalKind) || []),
-                indices: new Int32Array(geometry.getIndices() || []),
-            };
-        };
-        return CollisionCoordinatorWorker;
-    }());
-    BABYLON.CollisionCoordinatorWorker = CollisionCoordinatorWorker;
-    var CollisionCoordinatorLegacy = (function () {
-        function CollisionCoordinatorLegacy() {
-            this._scaledPosition = BABYLON.Vector3.Zero();
-            this._scaledVelocity = BABYLON.Vector3.Zero();
-            this._finalPosition = BABYLON.Vector3.Zero();
-        }
-        CollisionCoordinatorLegacy.prototype.getNewPosition = function (position, velocity, collider, maximumRetry, excludedMesh, onNewPosition, collisionIndex) {
-            position.divideToRef(collider.radius, this._scaledPosition);
-            velocity.divideToRef(collider.radius, this._scaledVelocity);
-            collider.collidedMesh = null;
-            collider.retry = 0;
-            collider.initialVelocity = this._scaledVelocity;
-            collider.initialPosition = this._scaledPosition;
-            this._collideWithWorld(this._scaledPosition, this._scaledVelocity, collider, maximumRetry, this._finalPosition, excludedMesh);
-            this._finalPosition.multiplyInPlace(collider.radius);
-            //run the callback
-            onNewPosition(collisionIndex, this._finalPosition, collider.collidedMesh);
-        };
-        CollisionCoordinatorLegacy.prototype.init = function (scene) {
-            this._scene = scene;
-        };
-        CollisionCoordinatorLegacy.prototype.destroy = function () {
-            //Legacy need no destruction method.
-        };
-        //No update in legacy mode
-        CollisionCoordinatorLegacy.prototype.onMeshAdded = function (mesh) { };
-        CollisionCoordinatorLegacy.prototype.onMeshUpdated = function (mesh) { };
-        CollisionCoordinatorLegacy.prototype.onMeshRemoved = function (mesh) { };
-        CollisionCoordinatorLegacy.prototype.onGeometryAdded = function (geometry) { };
-        CollisionCoordinatorLegacy.prototype.onGeometryUpdated = function (geometry) { };
-        CollisionCoordinatorLegacy.prototype.onGeometryDeleted = function (geometry) { };
-        CollisionCoordinatorLegacy.prototype._collideWithWorld = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {
-            if (excludedMesh === void 0) { excludedMesh = null; }
-            var closeDistance = BABYLON.Engine.CollisionsEpsilon * 10.0;
-            if (collider.retry >= maximumRetry) {
-                finalPosition.copyFrom(position);
-                return;
-            }
-            collider._initialize(position, velocity, closeDistance);
-            // Check all meshes
-            for (var index = 0; index < this._scene.meshes.length; index++) {
-                var mesh = this._scene.meshes[index];
-                if (mesh.isEnabled() && mesh.checkCollisions && mesh.subMeshes && mesh !== excludedMesh) {
-                    mesh._checkCollision(collider);
-                }
-            }
-            if (!collider.collisionFound) {
-                position.addToRef(velocity, finalPosition);
-                return;
-            }
-            if (velocity.x !== 0 || velocity.y !== 0 || velocity.z !== 0) {
-                collider._getResponse(position, velocity);
-            }
-            if (velocity.length() <= closeDistance) {
-                finalPosition.copyFrom(position);
-                return;
-            }
-            collider.retry++;
-            this._collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh);
-        };
-        return CollisionCoordinatorLegacy;
-    }());
-    BABYLON.CollisionCoordinatorLegacy = CollisionCoordinatorLegacy;
-})(BABYLON || (BABYLON = {}));

+ 0 - 243
src/Collisions/babylon.collisionWorker.js

@@ -1,243 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    //If this file is included in the main thread, this will be initialized.
-    BABYLON.WorkerIncluded = true;
-    var CollisionCache = (function () {
-        function CollisionCache() {
-            this._meshes = {};
-            this._geometries = {};
-        }
-        CollisionCache.prototype.getMeshes = function () {
-            return this._meshes;
-        };
-        CollisionCache.prototype.getGeometries = function () {
-            return this._geometries;
-        };
-        CollisionCache.prototype.getMesh = function (id) {
-            return this._meshes[id];
-        };
-        CollisionCache.prototype.addMesh = function (mesh) {
-            this._meshes[mesh.uniqueId] = mesh;
-        };
-        CollisionCache.prototype.removeMesh = function (uniqueId) {
-            delete this._meshes[uniqueId];
-        };
-        CollisionCache.prototype.getGeometry = function (id) {
-            return this._geometries[id];
-        };
-        CollisionCache.prototype.addGeometry = function (geometry) {
-            this._geometries[geometry.id] = geometry;
-        };
-        CollisionCache.prototype.removeGeometry = function (id) {
-            delete this._geometries[id];
-        };
-        return CollisionCache;
-    }());
-    BABYLON.CollisionCache = CollisionCache;
-    var CollideWorker = (function () {
-        function CollideWorker(collider, _collisionCache, finalPosition) {
-            this.collider = collider;
-            this._collisionCache = _collisionCache;
-            this.finalPosition = finalPosition;
-            this.collisionsScalingMatrix = BABYLON.Matrix.Zero();
-            this.collisionTranformationMatrix = BABYLON.Matrix.Zero();
-        }
-        CollideWorker.prototype.collideWithWorld = function (position, velocity, maximumRetry, excludedMeshUniqueId) {
-            //TODO CollisionsEpsilon should be defined here and not in the engine.
-            var closeDistance = 0.01; //is initializing here correct? A quick look - looks like it is fine.
-            if (this.collider.retry >= maximumRetry) {
-                this.finalPosition.copyFrom(position);
-                return;
-            }
-            this.collider._initialize(position, velocity, closeDistance);
-            // Check all meshes
-            var meshes = this._collisionCache.getMeshes();
-            var keys = Object.keys(meshes);
-            var len = keys.length;
-            var uniqueId;
-            for (var i = 0; i < len; ++i) {
-                uniqueId = keys[i];
-                if (parseInt(uniqueId) != excludedMeshUniqueId) {
-                    var mesh = meshes[uniqueId];
-                    if (mesh.checkCollisions)
-                        this.checkCollision(mesh);
-                }
-            }
-            if (!this.collider.collisionFound) {
-                position.addToRef(velocity, this.finalPosition);
-                return;
-            }
-            if (velocity.x !== 0 || velocity.y !== 0 || velocity.z !== 0) {
-                this.collider._getResponse(position, velocity);
-            }
-            if (velocity.length() <= closeDistance) {
-                this.finalPosition.copyFrom(position);
-                return;
-            }
-            this.collider.retry++;
-            this.collideWithWorld(position, velocity, maximumRetry, excludedMeshUniqueId);
-        };
-        CollideWorker.prototype.checkCollision = function (mesh) {
-            if (!this.collider._canDoCollision(BABYLON.Vector3.FromArray(mesh.sphereCenter), mesh.sphereRadius, BABYLON.Vector3.FromArray(mesh.boxMinimum), BABYLON.Vector3.FromArray(mesh.boxMaximum))) {
-                return;
-            }
-            ;
-            // Transformation matrix
-            BABYLON.Matrix.ScalingToRef(1.0 / this.collider.radius.x, 1.0 / this.collider.radius.y, 1.0 / this.collider.radius.z, this.collisionsScalingMatrix);
-            var worldFromCache = BABYLON.Matrix.FromArray(mesh.worldMatrixFromCache);
-            worldFromCache.multiplyToRef(this.collisionsScalingMatrix, this.collisionTranformationMatrix);
-            this.processCollisionsForSubMeshes(this.collisionTranformationMatrix, mesh);
-            //return colTransMat;
-        };
-        CollideWorker.prototype.processCollisionsForSubMeshes = function (transformMatrix, mesh) {
-            //if (this._submeshesOctree && this.useOctreeForCollisions) {
-            //    var radius = collider.velocityWorldLength + Math.max(collider.radius.x, collider.radius.y, collider.radius.z);
-            //    var intersections = this._submeshesOctree.intersects(collider.basePointWorld, radius);
-            //    len = intersections.length;
-            //    subMeshes = intersections.data;
-            //} else {
-            var subMeshes = mesh.subMeshes;
-            var len = subMeshes.length;
-            //}
-            if (!mesh.geometryId) {
-                console.log("no mesh geometry id");
-                return;
-            }
-            var meshGeometry = this._collisionCache.getGeometry(mesh.geometryId);
-            if (!meshGeometry) {
-                console.log("couldn't find geometry", mesh.geometryId);
-                return;
-            }
-            for (var index = 0; index < len; index++) {
-                var subMesh = subMeshes[index];
-                // Bounding test
-                if (len > 1 && !this.checkSubmeshCollision(subMesh))
-                    continue;
-                this.collideForSubMesh(subMesh, transformMatrix, meshGeometry);
-                if (this.collider.collisionFound) {
-                    this.collider.collidedMesh = mesh.uniqueId;
-                }
-            }
-        };
-        CollideWorker.prototype.collideForSubMesh = function (subMesh, transformMatrix, meshGeometry) {
-            if (!meshGeometry['positionsArray']) {
-                meshGeometry['positionsArray'] = [];
-                for (var i = 0, len = meshGeometry.positions.length; i < len; i = i + 3) {
-                    var p = BABYLON.Vector3.FromArray([meshGeometry.positions[i], meshGeometry.positions[i + 1], meshGeometry.positions[i + 2]]);
-                    meshGeometry['positionsArray'].push(p);
-                }
-            }
-            if (!subMesh['_lastColliderWorldVertices'] || !subMesh['_lastColliderTransformMatrix'].equals(transformMatrix)) {
-                subMesh['_lastColliderTransformMatrix'] = transformMatrix.clone();
-                subMesh['_lastColliderWorldVertices'] = [];
-                subMesh['_trianglePlanes'] = [];
-                var start = subMesh.verticesStart;
-                var end = (subMesh.verticesStart + subMesh.verticesCount);
-                for (var i = start; i < end; i++) {
-                    subMesh['_lastColliderWorldVertices'].push(BABYLON.Vector3.TransformCoordinates(meshGeometry['positionsArray'][i], transformMatrix));
-                }
-            }
-            // Collide
-            this.collider._collide(subMesh['_trianglePlanes'], subMesh['_lastColliderWorldVertices'], meshGeometry.indices, subMesh.indexStart, subMesh.indexStart + subMesh.indexCount, subMesh.verticesStart, subMesh.hasMaterial);
-        };
-        CollideWorker.prototype.checkSubmeshCollision = function (subMesh) {
-            return this.collider._canDoCollision(BABYLON.Vector3.FromArray(subMesh.sphereCenter), subMesh.sphereRadius, BABYLON.Vector3.FromArray(subMesh.boxMinimum), BABYLON.Vector3.FromArray(subMesh.boxMaximum));
-        };
-        return CollideWorker;
-    }());
-    BABYLON.CollideWorker = CollideWorker;
-    var CollisionDetectorTransferable = (function () {
-        function CollisionDetectorTransferable() {
-        }
-        CollisionDetectorTransferable.prototype.onInit = function (payload) {
-            this._collisionCache = new CollisionCache();
-            var reply = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.INIT
-            };
-            postMessage(reply, undefined);
-        };
-        CollisionDetectorTransferable.prototype.onUpdate = function (payload) {
-            var _this = this;
-            var replay = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.UPDATE
-            };
-            try {
-                for (var id in payload.updatedGeometries) {
-                    if (payload.updatedGeometries.hasOwnProperty(id)) {
-                        this._collisionCache.addGeometry(payload.updatedGeometries[id]);
-                    }
-                }
-                for (var uniqueId in payload.updatedMeshes) {
-                    if (payload.updatedMeshes.hasOwnProperty(uniqueId)) {
-                        this._collisionCache.addMesh(payload.updatedMeshes[uniqueId]);
-                    }
-                }
-                payload.removedGeometries.forEach(function (id) {
-                    _this._collisionCache.removeGeometry(id);
-                });
-                payload.removedMeshes.forEach(function (uniqueId) {
-                    _this._collisionCache.removeMesh(uniqueId);
-                });
-            }
-            catch (x) {
-                replay.error = BABYLON.WorkerReplyType.UNKNOWN_ERROR;
-            }
-            postMessage(replay, undefined);
-        };
-        CollisionDetectorTransferable.prototype.onCollision = function (payload) {
-            var finalPosition = BABYLON.Vector3.Zero();
-            //create a new collider
-            var collider = new BABYLON.Collider();
-            collider.radius = BABYLON.Vector3.FromArray(payload.collider.radius);
-            var colliderWorker = new CollideWorker(collider, this._collisionCache, finalPosition);
-            colliderWorker.collideWithWorld(BABYLON.Vector3.FromArray(payload.collider.position), BABYLON.Vector3.FromArray(payload.collider.velocity), payload.maximumRetry, payload.excludedMeshUniqueId);
-            var replyPayload = {
-                collidedMeshUniqueId: collider.collidedMesh,
-                collisionId: payload.collisionId,
-                newPosition: finalPosition.asArray()
-            };
-            var reply = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.COLLIDE,
-                payload: replyPayload
-            };
-            postMessage(reply, undefined);
-        };
-        return CollisionDetectorTransferable;
-    }());
-    BABYLON.CollisionDetectorTransferable = CollisionDetectorTransferable;
-    //check if we are in a web worker, as this code should NOT run on the main UI thread
-    try {
-        if (self && self instanceof WorkerGlobalScope) {
-            //Window hack to allow including babylonjs native code. the <any> is for typescript.
-            window = {};
-            //scripts were not included, standalone worker
-            if (!BABYLON.Collider) {
-                importScripts("./babylon.collisionCoordinator.js");
-                importScripts("./babylon.collider.js");
-                importScripts("../Math/babylon.math.js");
-            }
-            var collisionDetector = new CollisionDetectorTransferable();
-            var onNewMessage = function (event) {
-                var message = event.data;
-                switch (message.taskType) {
-                    case BABYLON.WorkerTaskType.INIT:
-                        collisionDetector.onInit(message.payload);
-                        break;
-                    case BABYLON.WorkerTaskType.COLLIDE:
-                        collisionDetector.onCollision(message.payload);
-                        break;
-                    case BABYLON.WorkerTaskType.UPDATE:
-                        collisionDetector.onUpdate(message.payload);
-                        break;
-                }
-            };
-            self.onmessage = onNewMessage;
-        }
-    }
-    catch (e) {
-        console.log("single worker init");
-    }
-})(BABYLON || (BABYLON = {}));

+ 0 - 76
src/Collisions/babylon.pickingInfo.js

@@ -1,76 +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;
-            this.subMeshId = 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;
-            this.subMeshId = 0;
-            this.pickedSprite = null;
-        }
-        // Methods
-        PickingInfo.prototype.getNormal = function (useWorldCoordinates, useVerticesNormals) {
-            if (useWorldCoordinates === void 0) { useWorldCoordinates = false; }
-            if (useVerticesNormals === void 0) { useVerticesNormals = true; }
-            if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
-                return null;
-            }
-            var indices = this.pickedMesh.getIndices();
-            var result;
-            if (useVerticesNormals) {
-                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);
-                result = new BABYLON.Vector3(normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);
-            }
-            else {
-                var positions = this.pickedMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
-                var vertex1 = BABYLON.Vector3.FromArray(positions, indices[this.faceId * 3] * 3);
-                var vertex2 = BABYLON.Vector3.FromArray(positions, indices[this.faceId * 3 + 1] * 3);
-                var vertex3 = BABYLON.Vector3.FromArray(positions, indices[this.faceId * 3 + 2] * 3);
-                var p1p2 = vertex1.subtract(vertex2);
-                var p3p2 = vertex3.subtract(vertex2);
-                result = BABYLON.Vector3.Cross(p1p2, p3p2);
-            }
-            if (useWorldCoordinates) {
-                result = BABYLON.Vector3.TransformNormal(result, this.pickedMesh.getWorldMatrix());
-            }
-            return BABYLON.Vector3.Normalize(result);
-        };
-        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(1.0 - this.bu - this.bv);
-            uv1 = uv1.scale(this.bu);
-            uv2 = uv2.scale(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 = {}));

+ 0 - 88
src/Culling/Octrees/babylon.octree.js

@@ -1,88 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Octree = (function () {
-        function Octree(creationFunc, maxBlockCapacity, maxDepth) {
-            if (maxDepth === void 0) { 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);
-            // Segmenting space
-            for (var x = 0; x < 2; x++) {
-                for (var y = 0; y < 2; y++) {
-                    for (var z = 0; z < 2; z++) {
-                        var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));
-                        var localMax = worldMin.add(blockSize.multiplyByFloats(x + 1, y + 1, z + 1));
-                        var block = new BABYLON.OctreeBlock(localMin, localMax, maxBlockCapacity, 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 = {}));

+ 0 - 122
src/Culling/Octrees/babylon.octreeBlock.js

@@ -1,122 +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 = {}));

+ 0 - 143
src/Culling/babylon.boundingBox.js

@@ -1,143 +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()];
-            // 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
-        BoundingBox.prototype.getWorldMatrix = function () {
-            return this._worldMatrix;
-        };
-        BoundingBox.prototype.setWorldMatrix = function (matrix) {
-            this._worldMatrix.copyFrom(matrix);
-            return this;
-        };
-        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.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 = {}));

+ 0 - 119
src/Culling/babylon.boundingInfo.js

@@ -1,119 +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._isLocked = false;
-            this.boundingBox = new BABYLON.BoundingBox(minimum, maximum);
-            this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum);
-        }
-        Object.defineProperty(BoundingInfo.prototype, "isLocked", {
-            get: function () {
-                return this._isLocked;
-            },
-            set: function (value) {
-                this._isLocked = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        // Methods
-        BoundingInfo.prototype.update = function (world) {
-            if (this._isLocked) {
-                return;
-            }
-            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 = {}));

+ 0 - 49
src/Culling/babylon.boundingSphere.js

@@ -1,49 +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.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 = {}));

+ 0 - 274
src/Culling/babylon.ray.js

@@ -1,274 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Ray = (function () {
-        function Ray(origin, direction, length) {
-            if (length === void 0) { length = Number.MAX_VALUE; }
-            this.origin = origin;
-            this.direction = direction;
-            this.length = length;
-        }
-        // Methods
-        Ray.prototype.intersectsBoxMinMax = function (minimum, maximum) {
-            var d = 0.0;
-            var maxValue = Number.MAX_VALUE;
-            var inv;
-            var min;
-            var max;
-            var temp;
-            if (Math.abs(this.direction.x) < 0.0000001) {
-                if (this.origin.x < minimum.x || this.origin.x > maximum.x) {
-                    return false;
-                }
-            }
-            else {
-                inv = 1.0 / this.direction.x;
-                min = (minimum.x - this.origin.x) * inv;
-                max = (maximum.x - this.origin.x) * inv;
-                if (max === -Infinity) {
-                    max = Infinity;
-                }
-                if (min > max) {
-                    temp = min;
-                    min = max;
-                    max = temp;
-                }
-                d = Math.max(min, d);
-                maxValue = Math.min(max, maxValue);
-                if (d > maxValue) {
-                    return false;
-                }
-            }
-            if (Math.abs(this.direction.y) < 0.0000001) {
-                if (this.origin.y < minimum.y || this.origin.y > maximum.y) {
-                    return false;
-                }
-            }
-            else {
-                inv = 1.0 / this.direction.y;
-                min = (minimum.y - this.origin.y) * inv;
-                max = (maximum.y - this.origin.y) * inv;
-                if (max === -Infinity) {
-                    max = Infinity;
-                }
-                if (min > max) {
-                    temp = min;
-                    min = max;
-                    max = temp;
-                }
-                d = Math.max(min, d);
-                maxValue = Math.min(max, maxValue);
-                if (d > maxValue) {
-                    return false;
-                }
-            }
-            if (Math.abs(this.direction.z) < 0.0000001) {
-                if (this.origin.z < minimum.z || this.origin.z > maximum.z) {
-                    return false;
-                }
-            }
-            else {
-                inv = 1.0 / this.direction.z;
-                min = (minimum.z - this.origin.z) * inv;
-                max = (maximum.z - this.origin.z) * inv;
-                if (max === -Infinity) {
-                    max = Infinity;
-                }
-                if (min > max) {
-                    temp = min;
-                    min = max;
-                    max = temp;
-                }
-                d = Math.max(min, d);
-                maxValue = Math.min(max, maxValue);
-                if (d > maxValue) {
-                    return false;
-                }
-            }
-            return true;
-        };
-        Ray.prototype.intersectsBox = function (box) {
-            return this.intersectsBoxMinMax(box.minimum, box.maximum);
-        };
-        Ray.prototype.intersectsSphere = function (sphere) {
-            var x = sphere.center.x - this.origin.x;
-            var y = sphere.center.y - this.origin.y;
-            var z = sphere.center.z - this.origin.z;
-            var pyth = (x * x) + (y * y) + (z * z);
-            var rr = sphere.radius * sphere.radius;
-            if (pyth <= rr) {
-                return true;
-            }
-            var dot = (x * this.direction.x) + (y * this.direction.y) + (z * this.direction.z);
-            if (dot < 0.0) {
-                return false;
-            }
-            var temp = pyth - (dot * dot);
-            return temp <= rr;
-        };
-        Ray.prototype.intersectsTriangle = function (vertex0, vertex1, vertex2) {
-            if (!this._edge1) {
-                this._edge1 = BABYLON.Vector3.Zero();
-                this._edge2 = BABYLON.Vector3.Zero();
-                this._pvec = BABYLON.Vector3.Zero();
-                this._tvec = BABYLON.Vector3.Zero();
-                this._qvec = BABYLON.Vector3.Zero();
-            }
-            vertex1.subtractToRef(vertex0, this._edge1);
-            vertex2.subtractToRef(vertex0, this._edge2);
-            BABYLON.Vector3.CrossToRef(this.direction, this._edge2, this._pvec);
-            var det = BABYLON.Vector3.Dot(this._edge1, this._pvec);
-            if (det === 0) {
-                return null;
-            }
-            var invdet = 1 / det;
-            this.origin.subtractToRef(vertex0, this._tvec);
-            var bu = BABYLON.Vector3.Dot(this._tvec, this._pvec) * invdet;
-            if (bu < 0 || bu > 1.0) {
-                return null;
-            }
-            BABYLON.Vector3.CrossToRef(this._tvec, this._edge1, this._qvec);
-            var bv = BABYLON.Vector3.Dot(this.direction, this._qvec) * invdet;
-            if (bv < 0 || bu + bv > 1.0) {
-                return null;
-            }
-            //check if the distance is longer than the predefined length.
-            var distance = BABYLON.Vector3.Dot(this._edge2, this._qvec) * invdet;
-            if (distance > this.length) {
-                return null;
-            }
-            return new BABYLON.IntersectionInfo(bu, bv, distance);
-        };
-        Ray.prototype.intersectsPlane = function (plane) {
-            var distance;
-            var result1 = BABYLON.Vector3.Dot(plane.normal, this.direction);
-            if (Math.abs(result1) < 9.99999997475243E-07) {
-                return null;
-            }
-            else {
-                var result2 = BABYLON.Vector3.Dot(plane.normal, this.origin);
-                distance = (-plane.d - result2) / result1;
-                if (distance < 0.0) {
-                    if (distance < -9.99999997475243E-07) {
-                        return null;
-                    }
-                    else {
-                        return 0;
-                    }
-                }
-                return distance;
-            }
-        };
-        /**
-         * Intersection test between the ray and a given segment whithin a given tolerance (threshold)
-         * @param sega the first point of the segment to test the intersection against
-         * @param segb the second point of the segment to test the intersection against
-         * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful
-         * @return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection
-         */
-        Ray.prototype.intersectionSegment = function (sega, segb, threshold) {
-            var rsegb = this.origin.add(this.direction.multiplyByFloats(Ray.rayl, Ray.rayl, Ray.rayl));
-            var u = segb.subtract(sega);
-            var v = rsegb.subtract(this.origin);
-            var w = sega.subtract(this.origin);
-            var a = BABYLON.Vector3.Dot(u, u); // always >= 0
-            var b = BABYLON.Vector3.Dot(u, v);
-            var c = BABYLON.Vector3.Dot(v, v); // always >= 0
-            var d = BABYLON.Vector3.Dot(u, w);
-            var e = BABYLON.Vector3.Dot(v, w);
-            var D = a * c - b * b; // always >= 0
-            var sc, sN, sD = D; // sc = sN / sD, default sD = D >= 0
-            var tc, tN, tD = D; // tc = tN / tD, default tD = D >= 0
-            // compute the line parameters of the two closest points
-            if (D < Ray.smallnum) {
-                sN = 0.0; // force using point P0 on segment S1
-                sD = 1.0; // to prevent possible division by 0.0 later
-                tN = e;
-                tD = c;
-            }
-            else {
-                sN = (b * e - c * d);
-                tN = (a * e - b * d);
-                if (sN < 0.0) {
-                    sN = 0.0;
-                    tN = e;
-                    tD = c;
-                }
-                else if (sN > sD) {
-                    sN = sD;
-                    tN = e + b;
-                    tD = c;
-                }
-            }
-            if (tN < 0.0) {
-                tN = 0.0;
-                // recompute sc for this edge
-                if (-d < 0.0) {
-                    sN = 0.0;
-                }
-                else if (-d > a)
-                    sN = sD;
-                else {
-                    sN = -d;
-                    sD = a;
-                }
-            }
-            else if (tN > tD) {
-                tN = tD;
-                // recompute sc for this edge
-                if ((-d + b) < 0.0) {
-                    sN = 0;
-                }
-                else if ((-d + b) > a) {
-                    sN = sD;
-                }
-                else {
-                    sN = (-d + b);
-                    sD = a;
-                }
-            }
-            // finally do the division to get sc and tc
-            sc = (Math.abs(sN) < Ray.smallnum ? 0.0 : sN / sD);
-            tc = (Math.abs(tN) < Ray.smallnum ? 0.0 : tN / tD);
-            // get the difference of the two closest points
-            var qtc = v.multiplyByFloats(tc, tc, tc);
-            var dP = w.add(u.multiplyByFloats(sc, sc, sc)).subtract(qtc); // = S1(sc) - S2(tc)
-            var isIntersected = (tc > 0) && (tc <= this.length) && (dP.lengthSquared() < (threshold * threshold)); // return intersection result
-            if (isIntersected) {
-                return qtc.length();
-            }
-            return -1;
-        };
-        // Statics
-        Ray.CreateNew = function (x, y, viewportWidth, viewportHeight, world, view, projection) {
-            var start = BABYLON.Vector3.Unproject(new BABYLON.Vector3(x, y, 0), viewportWidth, viewportHeight, world, view, projection);
-            var end = BABYLON.Vector3.Unproject(new BABYLON.Vector3(x, y, 1), viewportWidth, viewportHeight, world, view, projection);
-            var direction = end.subtract(start);
-            direction.normalize();
-            return new Ray(start, direction);
-        };
-        /**
-        * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be
-        * transformed to the given world matrix.
-        * @param origin The origin point
-        * @param end The end point
-        * @param world a matrix to transform the ray to. Default is the identity matrix.
-        */
-        Ray.CreateNewFromTo = function (origin, end, world) {
-            if (world === void 0) { world = BABYLON.Matrix.Identity(); }
-            var direction = end.subtract(origin);
-            var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
-            direction.normalize();
-            return Ray.Transform(new Ray(origin, direction, length), world);
-        };
-        Ray.Transform = function (ray, matrix) {
-            var newOrigin = BABYLON.Vector3.TransformCoordinates(ray.origin, matrix);
-            var newDirection = BABYLON.Vector3.TransformNormal(ray.direction, matrix);
-            newDirection.normalize();
-            return new Ray(newOrigin, newDirection, ray.length);
-        };
-        Ray.smallnum = 0.00000001;
-        Ray.rayl = 10e8;
-        return Ray;
-    }());
-    BABYLON.Ray = Ray;
-})(BABYLON || (BABYLON = {}));

+ 0 - 682
src/Debug/babylon.debugLayer.js

@@ -1,682 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var DebugLayer = (function () {
-        function DebugLayer(scene) {
-            var _this = this;
-            this._transformationMatrix = BABYLON.Matrix.Identity();
-            this._enabled = false;
-            this._labelsEnabled = false;
-            this._displayStatistics = true;
-            this._displayTree = false;
-            this._displayLogs = false;
-            this._skeletonViewers = new Array();
-            this._identityMatrix = BABYLON.Matrix.Identity();
-            this.axisRatio = 0.02;
-            this.accentColor = "orange";
-            this._scene = scene;
-            this._syncPositions = function () {
-                var engine = _this._scene.getEngine();
-                var canvasRect = engine.getRenderingCanvasClientRect();
-                if (_this._showUI) {
-                    _this._statsDiv.style.left = (canvasRect.width - 410) + "px";
-                    _this._statsDiv.style.top = (canvasRect.height - 290) + "px";
-                    _this._statsDiv.style.width = "400px";
-                    _this._statsDiv.style.height = "auto";
-                    _this._statsSubsetDiv.style.maxHeight = "240px";
-                    _this._optionsDiv.style.left = "0px";
-                    _this._optionsDiv.style.top = "10px";
-                    _this._optionsDiv.style.width = "200px";
-                    _this._optionsDiv.style.height = "auto";
-                    _this._optionsSubsetDiv.style.maxHeight = (canvasRect.height - 225) + "px";
-                    _this._logDiv.style.left = "0px";
-                    _this._logDiv.style.top = (canvasRect.height - 170) + "px";
-                    _this._logDiv.style.width = "600px";
-                    _this._logDiv.style.height = "160px";
-                    _this._treeDiv.style.left = (canvasRect.width - 310) + "px";
-                    _this._treeDiv.style.top = "10px";
-                    _this._treeDiv.style.width = "300px";
-                    _this._treeDiv.style.height = "auto";
-                    _this._treeSubsetDiv.style.maxHeight = (canvasRect.height - 340) + "px";
-                }
-                _this._globalDiv.style.left = canvasRect.left + "px";
-                _this._globalDiv.style.top = canvasRect.top + "px";
-                _this._drawingCanvas.style.left = "0px";
-                _this._drawingCanvas.style.top = "0px";
-                _this._drawingCanvas.style.width = engine.getRenderWidth() + "px";
-                _this._drawingCanvas.style.height = engine.getRenderHeight() + "px";
-                var devicePixelRatio = window.devicePixelRatio || 1;
-                var context = _this._drawingContext;
-                var backingStoreRatio = context.webkitBackingStorePixelRatio ||
-                    context.mozBackingStorePixelRatio ||
-                    context.msBackingStorePixelRatio ||
-                    context.oBackingStorePixelRatio ||
-                    context.backingStorePixelRatio || 1;
-                _this._ratio = devicePixelRatio / backingStoreRatio;
-                _this._drawingCanvas.width = engine.getRenderWidth() * _this._ratio;
-                _this._drawingCanvas.height = engine.getRenderHeight() * _this._ratio;
-            };
-            this._onCanvasClick = function (evt) {
-                _this._clickPosition = {
-                    x: evt.clientX * _this._ratio,
-                    y: evt.clientY * _this._ratio
-                };
-            };
-            this._syncUI = function () {
-                if (_this._showUI) {
-                    if (_this._displayStatistics) {
-                        _this._displayStats();
-                        _this._statsDiv.style.display = "";
-                    }
-                    else {
-                        _this._statsDiv.style.display = "none";
-                    }
-                    if (_this._displayLogs) {
-                        _this._logDiv.style.display = "";
-                    }
-                    else {
-                        _this._logDiv.style.display = "none";
-                    }
-                    if (_this._displayTree) {
-                        _this._treeDiv.style.display = "";
-                        if (_this._needToRefreshMeshesTree) {
-                            _this._needToRefreshMeshesTree = false;
-                            _this._refreshMeshesTreeContent();
-                        }
-                    }
-                    else {
-                        _this._treeDiv.style.display = "none";
-                    }
-                }
-            };
-            this._syncData = function () {
-                if (_this._labelsEnabled || !_this._showUI) {
-                    _this._camera.getViewMatrix().multiplyToRef(_this._camera.getProjectionMatrix(), _this._transformationMatrix);
-                    _this._drawingContext.clearRect(0, 0, _this._drawingCanvas.width, _this._drawingCanvas.height);
-                    var engine = _this._scene.getEngine();
-                    var viewport = _this._camera.viewport;
-                    var globalViewport = viewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());
-                    // Meshes
-                    var meshes = _this._camera.getActiveMeshes();
-                    var index;
-                    var projectedPosition;
-                    for (index = 0; index < meshes.length; index++) {
-                        var mesh = meshes.data[index];
-                        var position = mesh.getBoundingInfo().boundingSphere.center;
-                        projectedPosition = BABYLON.Vector3.Project(position, mesh.getWorldMatrix(), _this._transformationMatrix, globalViewport);
-                        if (mesh.renderOverlay || _this.shouldDisplayAxis && _this.shouldDisplayAxis(mesh)) {
-                            _this._renderAxis(projectedPosition, mesh, globalViewport);
-                        }
-                        if (!_this.shouldDisplayLabel || _this.shouldDisplayLabel(mesh)) {
-                            _this._renderLabel(mesh.name, projectedPosition, 12, function () { mesh.renderOverlay = !mesh.renderOverlay; }, function () { return mesh.renderOverlay ? 'red' : 'black'; });
-                        }
-                    }
-                    // Cameras
-                    var cameras = _this._scene.cameras;
-                    for (index = 0; index < cameras.length; index++) {
-                        var camera = cameras[index];
-                        if (camera === _this._camera) {
-                            continue;
-                        }
-                        projectedPosition = BABYLON.Vector3.Project(BABYLON.Vector3.Zero(), camera.getWorldMatrix(), _this._transformationMatrix, globalViewport);
-                        if (!_this.shouldDisplayLabel || _this.shouldDisplayLabel(camera)) {
-                            _this._renderLabel(camera.name, projectedPosition, 12, function () {
-                                _this._camera.detachControl(engine.getRenderingCanvas());
-                                _this._camera = camera;
-                                _this._camera.attachControl(engine.getRenderingCanvas());
-                            }, function () { return "purple"; });
-                        }
-                    }
-                    // Lights
-                    var lights = _this._scene.lights;
-                    for (index = 0; index < lights.length; index++) {
-                        var light = lights[index];
-                        if (light.position) {
-                            projectedPosition = BABYLON.Vector3.Project(light.getAbsolutePosition(), _this._identityMatrix, _this._transformationMatrix, globalViewport);
-                            if (!_this.shouldDisplayLabel || _this.shouldDisplayLabel(light)) {
-                                _this._renderLabel(light.name, projectedPosition, -20, function () {
-                                    light.setEnabled(!light.isEnabled());
-                                }, function () { return light.isEnabled() ? "orange" : "gray"; });
-                            }
-                        }
-                    }
-                }
-                _this._clickPosition = undefined;
-            };
-        }
-        DebugLayer.prototype._refreshMeshesTreeContent = function () {
-            while (this._treeSubsetDiv.hasChildNodes()) {
-                this._treeSubsetDiv.removeChild(this._treeSubsetDiv.lastChild);
-            }
-            // Add meshes
-            var sortedArray = this._scene.meshes.slice(0, this._scene.meshes.length);
-            sortedArray.sort(function (a, b) {
-                if (a.name === b.name) {
-                    return 0;
-                }
-                return (a.name > b.name) ? 1 : -1;
-            });
-            for (var index = 0; index < sortedArray.length; index++) {
-                var mesh = sortedArray[index];
-                if (!mesh.isEnabled()) {
-                    continue;
-                }
-                this._generateAdvancedCheckBox(this._treeSubsetDiv, mesh.name, mesh.getTotalVertices() + " verts", mesh.isVisible, function (element, m) {
-                    m.isVisible = element.checked;
-                }, mesh);
-            }
-        };
-        DebugLayer.prototype._renderSingleAxis = function (zero, unit, unitText, label, color) {
-            this._drawingContext.beginPath();
-            this._drawingContext.moveTo(zero.x, zero.y);
-            this._drawingContext.lineTo(unit.x, unit.y);
-            this._drawingContext.strokeStyle = color;
-            this._drawingContext.lineWidth = 4;
-            this._drawingContext.stroke();
-            this._drawingContext.font = "normal 14px Segoe UI";
-            this._drawingContext.fillStyle = color;
-            this._drawingContext.fillText(label, unitText.x, unitText.y);
-        };
-        DebugLayer.prototype._renderAxis = function (projectedPosition, mesh, globalViewport) {
-            var position = mesh.getBoundingInfo().boundingSphere.center;
-            var worldMatrix = mesh.getWorldMatrix();
-            var unprojectedVector = BABYLON.Vector3.UnprojectFromTransform(projectedPosition.add(new BABYLON.Vector3(this._drawingCanvas.width * this.axisRatio, 0, 0)), globalViewport.width, globalViewport.height, worldMatrix, this._transformationMatrix);
-            var unit = (unprojectedVector.subtract(position)).length();
-            var xAxis = BABYLON.Vector3.Project(position.add(new BABYLON.Vector3(unit, 0, 0)), worldMatrix, this._transformationMatrix, globalViewport);
-            var xAxisText = BABYLON.Vector3.Project(position.add(new BABYLON.Vector3(unit * 1.5, 0, 0)), worldMatrix, this._transformationMatrix, globalViewport);
-            this._renderSingleAxis(projectedPosition, xAxis, xAxisText, "x", "#FF0000");
-            var yAxis = BABYLON.Vector3.Project(position.add(new BABYLON.Vector3(0, unit, 0)), worldMatrix, this._transformationMatrix, globalViewport);
-            var yAxisText = BABYLON.Vector3.Project(position.add(new BABYLON.Vector3(0, unit * 1.5, 0)), worldMatrix, this._transformationMatrix, globalViewport);
-            this._renderSingleAxis(projectedPosition, yAxis, yAxisText, "y", "#00FF00");
-            var zAxis = BABYLON.Vector3.Project(position.add(new BABYLON.Vector3(0, 0, unit)), worldMatrix, this._transformationMatrix, globalViewport);
-            var zAxisText = BABYLON.Vector3.Project(position.add(new BABYLON.Vector3(0, 0, unit * 1.5)), worldMatrix, this._transformationMatrix, globalViewport);
-            this._renderSingleAxis(projectedPosition, zAxis, zAxisText, "z", "#0000FF");
-        };
-        DebugLayer.prototype._renderLabel = function (text, projectedPosition, labelOffset, onClick, getFillStyle) {
-            if (projectedPosition.z > 0 && projectedPosition.z < 1.0) {
-                this._drawingContext.font = "normal 12px Segoe UI";
-                var textMetrics = this._drawingContext.measureText(text);
-                var centerX = projectedPosition.x - textMetrics.width / 2;
-                var centerY = projectedPosition.y;
-                var clientRect = this._drawingCanvas.getBoundingClientRect();
-                if (this._showUI && this._isClickInsideRect(clientRect.left * this._ratio + centerX - 5, clientRect.top * this._ratio + centerY - labelOffset - 12, textMetrics.width + 10, 17)) {
-                    onClick();
-                }
-                this._drawingContext.beginPath();
-                this._drawingContext.rect(centerX - 5, centerY - labelOffset - 12, textMetrics.width + 10, 17);
-                this._drawingContext.fillStyle = getFillStyle();
-                this._drawingContext.globalAlpha = 0.5;
-                this._drawingContext.fill();
-                this._drawingContext.globalAlpha = 1.0;
-                this._drawingContext.strokeStyle = '#FFFFFF';
-                this._drawingContext.lineWidth = 1;
-                this._drawingContext.stroke();
-                this._drawingContext.fillStyle = "#FFFFFF";
-                this._drawingContext.fillText(text, centerX, centerY - labelOffset);
-                this._drawingContext.beginPath();
-                this._drawingContext.arc(projectedPosition.x, centerY, 5, 0, 2 * Math.PI, false);
-                this._drawingContext.fill();
-            }
-        };
-        DebugLayer.prototype._isClickInsideRect = function (x, y, width, height) {
-            if (!this._clickPosition) {
-                return false;
-            }
-            if (this._clickPosition.x < x || this._clickPosition.x > x + width) {
-                return false;
-            }
-            if (this._clickPosition.y < y || this._clickPosition.y > y + height) {
-                return false;
-            }
-            return true;
-        };
-        DebugLayer.prototype.isVisible = function () {
-            return this._enabled;
-        };
-        DebugLayer.prototype.hide = function () {
-            if (!this._enabled) {
-                return;
-            }
-            this._enabled = false;
-            var engine = this._scene.getEngine();
-            this._scene.unregisterBeforeRender(this._syncData);
-            this._scene.unregisterAfterRender(this._syncUI);
-            this._rootElement.removeChild(this._globalDiv);
-            this._scene.forceShowBoundingBoxes = false;
-            this._scene.forceWireframe = false;
-            BABYLON.StandardMaterial.DiffuseTextureEnabled = true;
-            BABYLON.StandardMaterial.AmbientTextureEnabled = true;
-            BABYLON.StandardMaterial.SpecularTextureEnabled = true;
-            BABYLON.StandardMaterial.EmissiveTextureEnabled = true;
-            BABYLON.StandardMaterial.BumpTextureEnabled = true;
-            BABYLON.StandardMaterial.OpacityTextureEnabled = true;
-            BABYLON.StandardMaterial.ReflectionTextureEnabled = true;
-            BABYLON.StandardMaterial.LightmapTextureEnabled = true;
-            BABYLON.StandardMaterial.RefractionTextureEnabled = true;
-            BABYLON.StandardMaterial.ColorGradingTextureEnabled = true;
-            this._scene.shadowsEnabled = true;
-            this._scene.particlesEnabled = true;
-            this._scene.postProcessesEnabled = true;
-            this._scene.collisionsEnabled = true;
-            this._scene.lightsEnabled = true;
-            this._scene.texturesEnabled = true;
-            this._scene.lensFlaresEnabled = true;
-            this._scene.proceduralTexturesEnabled = true;
-            this._scene.renderTargetsEnabled = true;
-            this._scene.probesEnabled = true;
-            engine.getRenderingCanvas().removeEventListener("click", this._onCanvasClick);
-            this._clearSkeletonViewers();
-        };
-        DebugLayer.prototype._clearSkeletonViewers = function () {
-            for (var index = 0; index < this._skeletonViewers.length; index++) {
-                this._skeletonViewers[index].dispose();
-            }
-            this._skeletonViewers = [];
-        };
-        DebugLayer.prototype.show = function (showUI, camera, rootElement) {
-            if (showUI === void 0) { showUI = true; }
-            if (camera === void 0) { camera = null; }
-            if (rootElement === void 0) { rootElement = null; }
-            if (this._enabled) {
-                return;
-            }
-            this._enabled = true;
-            if (camera) {
-                this._camera = camera;
-            }
-            else {
-                this._camera = this._scene.activeCamera;
-            }
-            this._showUI = showUI;
-            var engine = this._scene.getEngine();
-            this._globalDiv = document.createElement("div");
-            this._rootElement = rootElement || document.body;
-            this._rootElement.appendChild(this._globalDiv);
-            this._generateDOMelements();
-            engine.getRenderingCanvas().addEventListener("click", this._onCanvasClick);
-            this._syncPositions();
-            this._scene.registerBeforeRender(this._syncData);
-            this._scene.registerAfterRender(this._syncUI);
-        };
-        DebugLayer.prototype._clearLabels = function () {
-            this._drawingContext.clearRect(0, 0, this._drawingCanvas.width, this._drawingCanvas.height);
-            for (var index = 0; index < this._scene.meshes.length; index++) {
-                var mesh = this._scene.meshes[index];
-                mesh.renderOverlay = false;
-            }
-        };
-        DebugLayer.prototype._generateheader = function (root, text) {
-            var header = document.createElement("div");
-            header.innerHTML = text + "&nbsp;";
-            header.style.textAlign = "right";
-            header.style.width = "100%";
-            header.style.color = "white";
-            header.style.backgroundColor = "Black";
-            header.style.padding = "5px 5px 4px 0px";
-            header.style.marginLeft = "-5px";
-            header.style.fontWeight = "bold";
-            root.appendChild(header);
-        };
-        DebugLayer.prototype._generateTexBox = function (root, title, color) {
-            var label = document.createElement("label");
-            label.style.display = "inline";
-            label.innerHTML = title;
-            label.style.color = color;
-            root.appendChild(label);
-            root.appendChild(document.createElement("br"));
-        };
-        DebugLayer.prototype._generateAdvancedCheckBox = function (root, leftTitle, rightTitle, initialState, task, tag) {
-            if (tag === void 0) { tag = null; }
-            var label = document.createElement("label");
-            label.style.display = "inline";
-            var boundingBoxesCheckbox = document.createElement("input");
-            boundingBoxesCheckbox.type = "checkbox";
-            boundingBoxesCheckbox.checked = initialState;
-            boundingBoxesCheckbox.style.display = "inline";
-            boundingBoxesCheckbox.style.margin = "0px 5px 0px 0px";
-            boundingBoxesCheckbox.style.verticalAlign = "sub";
-            boundingBoxesCheckbox.addEventListener("change", function (evt) {
-                task(evt.target, tag);
-            });
-            label.appendChild(boundingBoxesCheckbox);
-            var container = document.createElement("span");
-            var leftPart = document.createElement("span");
-            var rightPart = document.createElement("span");
-            rightPart.style.cssFloat = "right";
-            leftPart.innerHTML = leftTitle;
-            rightPart.innerHTML = rightTitle;
-            rightPart.style.fontSize = "12px";
-            rightPart.style.maxWidth = "200px";
-            container.appendChild(leftPart);
-            container.appendChild(rightPart);
-            label.appendChild(container);
-            root.appendChild(label);
-            root.appendChild(document.createElement("br"));
-        };
-        DebugLayer.prototype._generateCheckBox = function (root, title, initialState, task, tag) {
-            if (tag === void 0) { tag = null; }
-            var label = document.createElement("label");
-            label.style.display = "inline";
-            var checkBox = document.createElement("input");
-            checkBox.type = "checkbox";
-            checkBox.checked = initialState;
-            checkBox.style.display = "inline";
-            checkBox.style.margin = "0px 5px 0px 0px";
-            checkBox.style.verticalAlign = "sub";
-            checkBox.addEventListener("change", function (evt) {
-                task(evt.target, tag);
-            });
-            label.appendChild(checkBox);
-            label.appendChild(document.createTextNode(title));
-            root.appendChild(label);
-            root.appendChild(document.createElement("br"));
-        };
-        DebugLayer.prototype._generateButton = function (root, title, task, tag) {
-            if (tag === void 0) { tag = null; }
-            var button = document.createElement("button");
-            button.innerHTML = title;
-            button.style.height = "24px";
-            button.style.width = "150px";
-            button.style.marginBottom = "5px";
-            button.style.color = "#444444";
-            button.style.border = "1px solid white";
-            button.className = "debugLayerButton";
-            button.addEventListener("click", function (evt) {
-                task(evt.target, tag);
-            });
-            root.appendChild(button);
-            root.appendChild(document.createElement("br"));
-        };
-        DebugLayer.prototype._generateRadio = function (root, title, name, initialState, task, tag) {
-            if (tag === void 0) { tag = null; }
-            var label = document.createElement("label");
-            label.style.display = "inline";
-            var boundingBoxesRadio = document.createElement("input");
-            boundingBoxesRadio.type = "radio";
-            boundingBoxesRadio.name = name;
-            boundingBoxesRadio.checked = initialState;
-            boundingBoxesRadio.style.display = "inline";
-            boundingBoxesRadio.style.margin = "0px 5px 0px 0px";
-            boundingBoxesRadio.style.verticalAlign = "sub";
-            boundingBoxesRadio.addEventListener("change", function (evt) {
-                task(evt.target, tag);
-            });
-            label.appendChild(boundingBoxesRadio);
-            label.appendChild(document.createTextNode(title));
-            root.appendChild(label);
-            root.appendChild(document.createElement("br"));
-        };
-        DebugLayer.prototype._generateDOMelements = function () {
-            var _this = this;
-            this._globalDiv.id = "DebugLayer";
-            this._globalDiv.style.position = "absolute";
-            this._globalDiv.style.fontFamily = "Segoe UI, Arial";
-            this._globalDiv.style.fontSize = "14px";
-            this._globalDiv.style.color = "white";
-            // Drawing canvas
-            this._drawingCanvas = document.createElement("canvas");
-            this._drawingCanvas.id = "DebugLayerDrawingCanvas";
-            this._drawingCanvas.style.position = "absolute";
-            this._drawingCanvas.style.pointerEvents = "none";
-            this._drawingCanvas.style.backgroundColor = "transparent";
-            this._drawingContext = this._drawingCanvas.getContext("2d");
-            this._globalDiv.appendChild(this._drawingCanvas);
-            if (this._showUI) {
-                var background = "rgba(128, 128, 128, 0.4)";
-                var border = "rgb(180, 180, 180) solid 1px";
-                // Stats
-                this._statsDiv = document.createElement("div");
-                this._statsDiv.id = "DebugLayerStats";
-                this._statsDiv.style.border = border;
-                this._statsDiv.style.position = "absolute";
-                this._statsDiv.style.background = background;
-                this._statsDiv.style.padding = "0px 0px 0px 5px";
-                this._generateheader(this._statsDiv, "STATISTICS");
-                this._statsSubsetDiv = document.createElement("div");
-                this._statsSubsetDiv.style.paddingTop = "5px";
-                this._statsSubsetDiv.style.paddingBottom = "5px";
-                this._statsSubsetDiv.style.overflowY = "auto";
-                this._statsDiv.appendChild(this._statsSubsetDiv);
-                // Tree
-                this._treeDiv = document.createElement("div");
-                this._treeDiv.id = "DebugLayerTree";
-                this._treeDiv.style.border = border;
-                this._treeDiv.style.position = "absolute";
-                this._treeDiv.style.background = background;
-                this._treeDiv.style.padding = "0px 0px 0px 5px";
-                this._treeDiv.style.display = "none";
-                this._generateheader(this._treeDiv, "MESHES TREE");
-                this._treeSubsetDiv = document.createElement("div");
-                this._treeSubsetDiv.style.paddingTop = "5px";
-                this._treeSubsetDiv.style.paddingRight = "5px";
-                this._treeSubsetDiv.style.overflowY = "auto";
-                this._treeSubsetDiv.style.maxHeight = "300px";
-                this._treeDiv.appendChild(this._treeSubsetDiv);
-                this._needToRefreshMeshesTree = true;
-                // Logs
-                this._logDiv = document.createElement("div");
-                this._logDiv.style.border = border;
-                this._logDiv.id = "DebugLayerLogs";
-                this._logDiv.style.position = "absolute";
-                this._logDiv.style.background = background;
-                this._logDiv.style.padding = "0px 0px 0px 5px";
-                this._logDiv.style.display = "none";
-                this._generateheader(this._logDiv, "LOGS");
-                this._logSubsetDiv = document.createElement("div");
-                this._logSubsetDiv.style.height = "127px";
-                this._logSubsetDiv.style.paddingTop = "5px";
-                this._logSubsetDiv.style.overflowY = "auto";
-                this._logSubsetDiv.style.fontSize = "12px";
-                this._logSubsetDiv.style.fontFamily = "consolas";
-                this._logSubsetDiv.innerHTML = BABYLON.Tools.LogCache;
-                this._logDiv.appendChild(this._logSubsetDiv);
-                BABYLON.Tools.OnNewCacheEntry = function (entry) {
-                    _this._logSubsetDiv.innerHTML = entry + _this._logSubsetDiv.innerHTML;
-                };
-                // Options
-                this._optionsDiv = document.createElement("div");
-                this._optionsDiv.id = "DebugLayerOptions";
-                this._optionsDiv.style.border = border;
-                this._optionsDiv.style.position = "absolute";
-                this._optionsDiv.style.background = background;
-                this._optionsDiv.style.padding = "0px 0px 0px 5px";
-                this._optionsDiv.style.overflowY = "auto";
-                this._generateheader(this._optionsDiv, "OPTIONS");
-                this._optionsSubsetDiv = document.createElement("div");
-                this._optionsSubsetDiv.style.paddingTop = "5px";
-                this._optionsSubsetDiv.style.paddingBottom = "5px";
-                this._optionsSubsetDiv.style.overflowY = "auto";
-                this._optionsSubsetDiv.style.maxHeight = "200px";
-                this._optionsDiv.appendChild(this._optionsSubsetDiv);
-                this._generateTexBox(this._optionsSubsetDiv, "<b>Windows:</b>", this.accentColor);
-                this._generateCheckBox(this._optionsSubsetDiv, "Statistics", this._displayStatistics, function (element) { _this._displayStatistics = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Logs", this._displayLogs, function (element) { _this._displayLogs = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Meshes tree", this._displayTree, function (element) {
-                    _this._displayTree = element.checked;
-                    _this._needToRefreshMeshesTree = true;
-                });
-                this._optionsSubsetDiv.appendChild(document.createElement("br"));
-                this._generateTexBox(this._optionsSubsetDiv, "<b>General:</b>", this.accentColor);
-                this._generateCheckBox(this._optionsSubsetDiv, "Bounding boxes", this._scene.forceShowBoundingBoxes, function (element) { _this._scene.forceShowBoundingBoxes = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Clickable labels", this._labelsEnabled, function (element) {
-                    _this._labelsEnabled = element.checked;
-                    if (!_this._labelsEnabled) {
-                        _this._clearLabels();
-                    }
-                });
-                this._generateCheckBox(this._optionsSubsetDiv, "Generate user marks (F12)", BABYLON.Tools.PerformanceLogLevel === BABYLON.Tools.PerformanceUserMarkLogLevel, function (element) {
-                    if (element.checked) {
-                        BABYLON.Tools.PerformanceLogLevel = BABYLON.Tools.PerformanceUserMarkLogLevel;
-                    }
-                    else {
-                        BABYLON.Tools.PerformanceLogLevel = BABYLON.Tools.PerformanceNoneLogLevel;
-                    }
-                });
-                ;
-                this._optionsSubsetDiv.appendChild(document.createElement("br"));
-                this._generateTexBox(this._optionsSubsetDiv, "<b>Rendering mode:</b>", this.accentColor);
-                this._generateRadio(this._optionsSubsetDiv, "Solid", "renderMode", !this._scene.forceWireframe && !this._scene.forcePointsCloud, function (element) {
-                    if (element.checked) {
-                        _this._scene.forceWireframe = false;
-                        _this._scene.forcePointsCloud = false;
-                    }
-                });
-                this._generateRadio(this._optionsSubsetDiv, "Wireframe", "renderMode", this._scene.forceWireframe, function (element) {
-                    if (element.checked) {
-                        _this._scene.forceWireframe = true;
-                        _this._scene.forcePointsCloud = false;
-                    }
-                });
-                this._generateRadio(this._optionsSubsetDiv, "Point", "renderMode", this._scene.forcePointsCloud, function (element) {
-                    if (element.checked) {
-                        _this._scene.forceWireframe = false;
-                        _this._scene.forcePointsCloud = true;
-                    }
-                });
-                this._optionsSubsetDiv.appendChild(document.createElement("br"));
-                this._generateTexBox(this._optionsSubsetDiv, "<b>Texture channels:</b>", this.accentColor);
-                this._generateCheckBox(this._optionsSubsetDiv, "Diffuse", BABYLON.StandardMaterial.DiffuseTextureEnabled, function (element) { BABYLON.StandardMaterial.DiffuseTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Ambient", BABYLON.StandardMaterial.AmbientTextureEnabled, function (element) { BABYLON.StandardMaterial.AmbientTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Specular", BABYLON.StandardMaterial.SpecularTextureEnabled, function (element) { BABYLON.StandardMaterial.SpecularTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Emissive", BABYLON.StandardMaterial.EmissiveTextureEnabled, function (element) { BABYLON.StandardMaterial.EmissiveTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Bump", BABYLON.StandardMaterial.BumpTextureEnabled, function (element) { BABYLON.StandardMaterial.BumpTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Opacity", BABYLON.StandardMaterial.OpacityTextureEnabled, function (element) { BABYLON.StandardMaterial.OpacityTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Reflection", BABYLON.StandardMaterial.ReflectionTextureEnabled, function (element) { BABYLON.StandardMaterial.ReflectionTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Refraction", BABYLON.StandardMaterial.RefractionTextureEnabled, function (element) { BABYLON.StandardMaterial.RefractionTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "ColorGrading", BABYLON.StandardMaterial.ColorGradingTextureEnabled, function (element) { BABYLON.StandardMaterial.ColorGradingTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Lightmap", BABYLON.StandardMaterial.LightmapTextureEnabled, function (element) { BABYLON.StandardMaterial.LightmapTextureEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Fresnel", BABYLON.StandardMaterial.FresnelEnabled, function (element) { BABYLON.StandardMaterial.FresnelEnabled = element.checked; });
-                this._optionsSubsetDiv.appendChild(document.createElement("br"));
-                this._generateTexBox(this._optionsSubsetDiv, "<b>Options:</b>", this.accentColor);
-                this._generateCheckBox(this._optionsSubsetDiv, "Animations", this._scene.animationsEnabled, function (element) { _this._scene.animationsEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Collisions", this._scene.collisionsEnabled, function (element) { _this._scene.collisionsEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Fog", this._scene.fogEnabled, function (element) { _this._scene.fogEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Lens flares", this._scene.lensFlaresEnabled, function (element) { _this._scene.lensFlaresEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Lights", this._scene.lightsEnabled, function (element) { _this._scene.lightsEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Particles", this._scene.particlesEnabled, function (element) { _this._scene.particlesEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Post-processes", this._scene.postProcessesEnabled, function (element) { _this._scene.postProcessesEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Probes", this._scene.probesEnabled, function (element) { _this._scene.probesEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Procedural textures", this._scene.proceduralTexturesEnabled, function (element) { _this._scene.proceduralTexturesEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Render targets", this._scene.renderTargetsEnabled, function (element) { _this._scene.renderTargetsEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Shadows", this._scene.shadowsEnabled, function (element) { _this._scene.shadowsEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Skeletons", this._scene.skeletonsEnabled, function (element) { _this._scene.skeletonsEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Sprites", this._scene.spritesEnabled, function (element) { _this._scene.spritesEnabled = element.checked; });
-                this._generateCheckBox(this._optionsSubsetDiv, "Textures", this._scene.texturesEnabled, function (element) { _this._scene.texturesEnabled = element.checked; });
-                if (BABYLON.AudioEngine && BABYLON.Engine.audioEngine.canUseWebAudio) {
-                    this._optionsSubsetDiv.appendChild(document.createElement("br"));
-                    this._generateTexBox(this._optionsSubsetDiv, "<b>Audio:</b>", this.accentColor);
-                    this._generateRadio(this._optionsSubsetDiv, "Headphones", "panningModel", this._scene.headphone, function (element) {
-                        if (element.checked) {
-                            _this._scene.headphone = true;
-                        }
-                    });
-                    this._generateRadio(this._optionsSubsetDiv, "Normal Speakers", "panningModel", !this._scene.headphone, function (element) {
-                        if (element.checked) {
-                            _this._scene.headphone = false;
-                        }
-                    });
-                    this._generateCheckBox(this._optionsSubsetDiv, "Disable audio", !this._scene.audioEnabled, function (element) {
-                        _this._scene.audioEnabled = !element.checked;
-                    });
-                }
-                this._optionsSubsetDiv.appendChild(document.createElement("br"));
-                this._generateTexBox(this._optionsSubsetDiv, "<b>Viewers:</b>", this.accentColor);
-                this._generateCheckBox(this._optionsSubsetDiv, "Skeletons", false, function (element) {
-                    if (!element.checked) {
-                        _this._clearSkeletonViewers();
-                        return;
-                    }
-                    for (var index = 0; index < _this._scene.meshes.length; index++) {
-                        var mesh = _this._scene.meshes[index];
-                        if (mesh.skeleton) {
-                            var found = false;
-                            for (var sIndex = 0; sIndex < _this._skeletonViewers.length; sIndex++) {
-                                if (_this._skeletonViewers[sIndex].skeleton === mesh.skeleton) {
-                                    found = true;
-                                    break;
-                                }
-                            }
-                            if (found) {
-                                continue;
-                            }
-                            var viewer = new BABYLON.Debug.SkeletonViewer(mesh.skeleton, mesh, _this._scene);
-                            viewer.isEnabled = true;
-                            _this._skeletonViewers.push(viewer);
-                        }
-                    }
-                });
-                this._optionsSubsetDiv.appendChild(document.createElement("br"));
-                this._generateTexBox(this._optionsSubsetDiv, "<b>Tools:</b>", this.accentColor);
-                this._generateButton(this._optionsSubsetDiv, "Dump rendertargets", function (element) { _this._scene.dumpNextRenderTargets = true; });
-                this._generateButton(this._optionsSubsetDiv, "Run SceneOptimizer", function (element) { BABYLON.SceneOptimizer.OptimizeAsync(_this._scene); });
-                this._generateButton(this._optionsSubsetDiv, "Log camera object", function (element) {
-                    if (_this._camera) {
-                        console.log(_this._camera);
-                    }
-                    else {
-                        console.warn("No camera defined, or debug layer created before camera creation!");
-                    }
-                });
-                this._optionsSubsetDiv.appendChild(document.createElement("br"));
-                this._globalDiv.appendChild(this._statsDiv);
-                this._globalDiv.appendChild(this._logDiv);
-                this._globalDiv.appendChild(this._optionsDiv);
-                this._globalDiv.appendChild(this._treeDiv);
-            }
-        };
-        DebugLayer.prototype._displayStats = function () {
-            var scene = this._scene;
-            var engine = scene.getEngine();
-            var glInfo = engine.getGlInfo();
-            this._statsSubsetDiv.innerHTML = "Babylon.js v" + BABYLON.Engine.Version + " - <b>" + BABYLON.Tools.Format(engine.getFps(), 0) + " fps</b><br><br>"
-                + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
-                + "<b>Count</b><br>"
-                + "Total meshes: " + scene.meshes.length + "<br>"
-                + "Total lights: " + scene.lights.length + "<br>"
-                + "Total vertices: " + scene.getTotalVertices() + "<br>"
-                + "Total materials: " + scene.materials.length + "<br>"
-                + "Total textures: " + scene.textures.length + "<br>"
-                + "Active meshes: " + scene.getActiveMeshes().length + "<br>"
-                + "Active indices: " + scene.getActiveIndices() + "<br>"
-                + "Active bones: " + scene.getActiveBones() + "<br>"
-                + "Active particles: " + scene.getActiveParticles() + "<br>"
-                + "<b>Draw calls: " + engine.drawCalls + "</b><br><br>"
-                + "<b>Duration</b><br>"
-                + "Meshes selection:</i> " + BABYLON.Tools.Format(scene.getEvaluateActiveMeshesDuration()) + " ms<br>"
-                + "Render Targets: " + BABYLON.Tools.Format(scene.getRenderTargetsDuration()) + " ms<br>"
-                + "Particles: " + BABYLON.Tools.Format(scene.getParticlesDuration()) + " ms<br>"
-                + "Sprites: " + BABYLON.Tools.Format(scene.getSpritesDuration()) + " ms<br><br>"
-                + "Render: <b>" + BABYLON.Tools.Format(scene.getRenderDuration()) + " ms</b><br>"
-                + "Frame: " + BABYLON.Tools.Format(scene.getLastFrameDuration()) + " ms<br>"
-                + "Potential FPS: " + BABYLON.Tools.Format(1000.0 / scene.getLastFrameDuration(), 0) + "<br>"
-                + "Resolution: " + engine.getRenderWidth() + "x" + engine.getRenderHeight() + "<br><br>"
-                + "</div>"
-                + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
-                + "<b>Extensions</b><br>"
-                + "Std derivatives: " + (engine.getCaps().standardDerivatives ? "Yes" : "No") + "<br>"
-                + "Compressed textures: " + (engine.getCaps().s3tc ? "Yes" : "No") + "<br>"
-                + "Hardware instances: " + (engine.getCaps().instancedArrays ? "Yes" : "No") + "<br>"
-                + "Texture float: " + (engine.getCaps().textureFloat ? "Yes" : "No") + "<br><br>"
-                + "32bits indices: " + (engine.getCaps().uintIndices ? "Yes" : "No") + "<br>"
-                + "Fragment depth: " + (engine.getCaps().fragmentDepthSupported ? "Yes" : "No") + "<br>"
-                + "High precision shaders: " + (engine.getCaps().highPrecisionShaderSupported ? "Yes" : "No") + "<br>"
-                + "Draw buffers: " + (engine.getCaps().drawBuffersExtension ? "Yes" : "No") + "<br>"
-                + "</div><br>"
-                + "<div style='column-count: 2;-moz-column-count:2;-webkit-column-count:2'>"
-                + "<b>Caps.</b><br>"
-                + "Stencil: " + (engine.isStencilEnable ? "Enabled" : "Disabled") + "<br>"
-                + "Max textures units: " + engine.getCaps().maxTexturesImageUnits + "<br>"
-                + "Max textures size: " + engine.getCaps().maxTextureSize + "<br>"
-                + "Max anisotropy: " + engine.getCaps().maxAnisotropy + "<br>"
-                + "<b>Info</b><br>"
-                + "WebGL feature level: " + engine.webGLVersion + "<br>"
-                + glInfo.version + "<br>"
-                + "</div><br>"
-                + glInfo.renderer + "<br>";
-            if (this.customStatsFunction) {
-                this._statsSubsetDiv.innerHTML += this.customStatsFunction();
-            }
-        };
-        return DebugLayer;
-    }());
-    BABYLON.DebugLayer = DebugLayer;
-})(BABYLON || (BABYLON = {}));

+ 0 - 127
src/Debug/babylon.skeletonViewer.js

@@ -1,127 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Debug;
-    (function (Debug) {
-        /**
-        * Demo available here: http://www.babylonjs-playground.com/#1BZJVJ#8
-        */
-        var SkeletonViewer = (function () {
-            function SkeletonViewer(skeleton, mesh, scene, autoUpdateBonesMatrices, renderingGroupId) {
-                if (autoUpdateBonesMatrices === void 0) { autoUpdateBonesMatrices = true; }
-                if (renderingGroupId === void 0) { renderingGroupId = 1; }
-                this.skeleton = skeleton;
-                this.mesh = mesh;
-                this.autoUpdateBonesMatrices = autoUpdateBonesMatrices;
-                this.renderingGroupId = renderingGroupId;
-                this.color = BABYLON.Color3.White();
-                this._debugLines = [];
-                this._isEnabled = false;
-                this._scene = scene;
-                this.update();
-                this._renderFunction = this.update.bind(this);
-            }
-            Object.defineProperty(SkeletonViewer.prototype, "isEnabled", {
-                get: function () {
-                    return this._isEnabled;
-                },
-                set: function (value) {
-                    if (this._isEnabled === value) {
-                        return;
-                    }
-                    this._isEnabled = value;
-                    if (value) {
-                        this._scene.registerBeforeRender(this._renderFunction);
-                    }
-                    else {
-                        this._scene.unregisterBeforeRender(this._renderFunction);
-                    }
-                },
-                enumerable: true,
-                configurable: true
-            });
-            SkeletonViewer.prototype._getBonePosition = function (position, bone, meshMat, x, y, z) {
-                if (x === void 0) { x = 0; }
-                if (y === void 0) { y = 0; }
-                if (z === void 0) { z = 0; }
-                var tmat = BABYLON.Tmp.Matrix[0];
-                var parentBone = bone.getParent();
-                tmat.copyFrom(bone.getLocalMatrix());
-                if (x !== 0 || y !== 0 || z !== 0) {
-                    var tmat2 = BABYLON.Tmp.Matrix[1];
-                    BABYLON.Matrix.IdentityToRef(tmat2);
-                    tmat2.m[12] = x;
-                    tmat2.m[13] = y;
-                    tmat2.m[14] = z;
-                    tmat2.multiplyToRef(tmat, tmat);
-                }
-                if (parentBone) {
-                    tmat.multiplyToRef(parentBone.getAbsoluteTransform(), tmat);
-                }
-                tmat.multiplyToRef(meshMat, tmat);
-                position.x = tmat.m[12];
-                position.y = tmat.m[13];
-                position.z = tmat.m[14];
-            };
-            SkeletonViewer.prototype._getLinesForBonesWithLength = function (bones, meshMat) {
-                var len = bones.length;
-                for (var i = 0; i < len; i++) {
-                    var bone = bones[i];
-                    var points = this._debugLines[i];
-                    if (!points) {
-                        points = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
-                        this._debugLines[i] = points;
-                    }
-                    this._getBonePosition(points[0], bone, meshMat);
-                    this._getBonePosition(points[1], bone, meshMat, 0, bone.length, 0);
-                }
-            };
-            SkeletonViewer.prototype._getLinesForBonesNoLength = function (bones, meshMat) {
-                var len = bones.length;
-                var boneNum = 0;
-                for (var i = len - 1; i >= 0; i--) {
-                    var childBone = bones[i];
-                    var parentBone = childBone.getParent();
-                    if (!parentBone) {
-                        continue;
-                    }
-                    var points = this._debugLines[boneNum];
-                    if (!points) {
-                        points = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
-                        this._debugLines[boneNum] = points;
-                    }
-                    childBone.getAbsolutePositionToRef(this.mesh, points[0]);
-                    parentBone.getAbsolutePositionToRef(this.mesh, points[1]);
-                    boneNum++;
-                }
-            };
-            SkeletonViewer.prototype.update = function () {
-                if (this.autoUpdateBonesMatrices) {
-                    this.skeleton.computeAbsoluteTransforms();
-                }
-                if (this.skeleton.bones[0].length === undefined) {
-                    this._getLinesForBonesNoLength(this.skeleton.bones, this.mesh.getWorldMatrix());
-                }
-                else {
-                    this._getLinesForBonesWithLength(this.skeleton.bones, this.mesh.getWorldMatrix());
-                }
-                if (!this._debugMesh) {
-                    this._debugMesh = BABYLON.MeshBuilder.CreateLineSystem(null, { lines: this._debugLines, updatable: true }, this._scene);
-                    this._debugMesh.renderingGroupId = this.renderingGroupId;
-                }
-                else {
-                    BABYLON.MeshBuilder.CreateLineSystem(null, { lines: this._debugLines, updatable: true, instance: this._debugMesh }, this._scene);
-                }
-                this._debugMesh.color = this.color;
-            };
-            SkeletonViewer.prototype.dispose = function () {
-                if (this._debugMesh) {
-                    this.isEnabled = false;
-                    this._debugMesh.dispose();
-                    this._debugMesh = null;
-                }
-            };
-            return SkeletonViewer;
-        }());
-        Debug.SkeletonViewer = SkeletonViewer;
-    })(Debug = BABYLON.Debug || (BABYLON.Debug = {}));
-})(BABYLON || (BABYLON = {}));

+ 0 - 624
src/Layer/babylon.highlightlayer.js

@@ -1,624 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    /**
-     * Special Glow Blur post process only blurring the alpha channel
-     * It enforces keeping the most luminous color in the color channel.
-     */
-    var GlowBlurPostProcess = (function (_super) {
-        __extends(GlowBlurPostProcess, _super);
-        function GlowBlurPostProcess(name, direction, blurWidth, options, camera, samplingMode, engine, reusable) {
-            var _this = this;
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.BILINEAR_SAMPLINGMODE; }
-            _super.call(this, name, "glowBlurPostProcess", ["screenSize", "direction", "blurWidth"], null, options, camera, samplingMode, engine, reusable);
-            this.direction = direction;
-            this.blurWidth = blurWidth;
-            this.onApplyObservable.add(function (effect) {
-                effect.setFloat2("screenSize", _this.width, _this.height);
-                effect.setVector2("direction", _this.direction);
-                effect.setFloat("blurWidth", _this.blurWidth);
-            });
-        }
-        return GlowBlurPostProcess;
-    }(BABYLON.PostProcess));
-    /**
-     * The highlight layer Helps adding a glow effect around a mesh.
-     *
-     * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
-     * glowy meshes to your scene.
-     *
-     * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
-     */
-    var HighlightLayer = (function () {
-        /**
-         * Instantiates a new highlight Layer and references it to the scene..
-         * @param name The name of the layer
-         * @param scene The scene to use the layer in
-         * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
-         */
-        function HighlightLayer(name, scene, options) {
-            this._vertexBuffers = {};
-            this._mainTextureDesiredSize = { width: 0, height: 0 };
-            this._meshes = {};
-            this._maxSize = 0;
-            this._shouldRender = false;
-            this._instanceGlowingMeshStencilReference = HighlightLayer.glowingMeshStencilReference++;
-            this._excludedMeshes = {};
-            /**
-             * Specifies whether or not the inner glow is ACTIVE in the layer.
-             */
-            this.innerGlow = true;
-            /**
-             * Specifies whether or not the outer glow is ACTIVE in the layer.
-             */
-            this.outerGlow = true;
-            /**
-             * Specifies wether the highlight layer is enabled or not.
-             */
-            this.isEnabled = true;
-            /**
-             * An event triggered when the highlight layer has been disposed.
-             * @type {BABYLON.Observable}
-             */
-            this.onDisposeObservable = new BABYLON.Observable();
-            /**
-             * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
-             * @type {BABYLON.Observable}
-             */
-            this.onBeforeRenderMainTextureObservable = new BABYLON.Observable();
-            /**
-             * An event triggered when the highlight layer is being blurred.
-             * @type {BABYLON.Observable}
-             */
-            this.onBeforeBlurObservable = new BABYLON.Observable();
-            /**
-             * An event triggered when the highlight layer has been blurred.
-             * @type {BABYLON.Observable}
-             */
-            this.onAfterBlurObservable = new BABYLON.Observable();
-            /**
-             * An event triggered when the glowing blurred texture is being merged in the scene.
-             * @type {BABYLON.Observable}
-             */
-            this.onBeforeComposeObservable = new BABYLON.Observable();
-            /**
-             * An event triggered when the glowing blurred texture has been merged in the scene.
-             * @type {BABYLON.Observable}
-             */
-            this.onAfterComposeObservable = new BABYLON.Observable();
-            /**
-             * An event triggered when the highlight layer changes its size.
-             * @type {BABYLON.Observable}
-             */
-            this.onSizeChangedObservable = new BABYLON.Observable();
-            this._scene = scene;
-            var engine = scene.getEngine();
-            this._engine = engine;
-            this._maxSize = this._engine.getCaps().maxTextureSize;
-            this._scene.highlightLayers.push(this);
-            // Warn on stencil.
-            if (!this._engine.isStencilEnable) {
-                BABYLON.Tools.Warn("Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new BABYLON.Engine(canvas, antialias, { stencil: true }");
-            }
-            // Adapt options
-            this._options = options || {
-                mainTextureRatio: 0.25,
-                blurTextureSizeRatio: 0.5,
-                blurHorizontalSize: 1,
-                blurVerticalSize: 1,
-                alphaBlendingMode: BABYLON.Engine.ALPHA_COMBINE
-            };
-            this._options.mainTextureRatio = this._options.mainTextureRatio || 0.25;
-            this._options.blurTextureSizeRatio = this._options.blurTextureSizeRatio || 0.5;
-            this._options.blurHorizontalSize = this._options.blurHorizontalSize || 1;
-            this._options.blurVerticalSize = this._options.blurVerticalSize || 1;
-            this._options.alphaBlendingMode = this._options.alphaBlendingMode || BABYLON.Engine.ALPHA_COMBINE;
-            // VBO
-            var vertices = [];
-            vertices.push(1, 1);
-            vertices.push(-1, 1);
-            vertices.push(-1, -1);
-            vertices.push(1, -1);
-            var vertexBuffer = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
-            this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = vertexBuffer;
-            // Indices
-            var indices = [];
-            indices.push(0);
-            indices.push(1);
-            indices.push(2);
-            indices.push(0);
-            indices.push(2);
-            indices.push(3);
-            this._indexBuffer = engine.createIndexBuffer(indices);
-            // Effect
-            this._glowMapMergeEffect = engine.createEffect("glowMapMerge", [BABYLON.VertexBuffer.PositionKind], ["offset"], ["textureSampler"], "");
-            // Render target
-            this.setMainTextureSize();
-            // Create Textures and post processes
-            this.createTextureAndPostProcesses();
-        }
-        Object.defineProperty(HighlightLayer.prototype, "blurHorizontalSize", {
-            /**
-             * Gets the horizontal size of the blur.
-             */
-            get: function () {
-                return this._horizontalBlurPostprocess.blurWidth;
-            },
-            /**
-             * Specifies the horizontal size of the blur.
-             */
-            set: function (value) {
-                this._horizontalBlurPostprocess.blurWidth = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(HighlightLayer.prototype, "blurVerticalSize", {
-            /**
-             * Gets the vertical size of the blur.
-             */
-            get: function () {
-                return this._verticalBlurPostprocess.blurWidth;
-            },
-            /**
-             * Specifies the vertical size of the blur.
-             */
-            set: function (value) {
-                this._verticalBlurPostprocess.blurWidth = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(HighlightLayer.prototype, "camera", {
-            /**
-             * Gets the camera attached to the layer.
-             */
-            get: function () {
-                return this._options.camera;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
-         * Creates the render target textures and post processes used in the highlight layer.
-         */
-        HighlightLayer.prototype.createTextureAndPostProcesses = function () {
-            var _this = this;
-            var blurTextureWidth = this._mainTextureDesiredSize.width * this._options.blurTextureSizeRatio;
-            var blurTextureHeight = this._mainTextureDesiredSize.height * this._options.blurTextureSizeRatio;
-            blurTextureWidth = BABYLON.Tools.GetExponentOfTwo(blurTextureWidth, this._maxSize);
-            blurTextureHeight = BABYLON.Tools.GetExponentOfTwo(blurTextureHeight, this._maxSize);
-            this._mainTexture = new BABYLON.RenderTargetTexture("HighlightLayerMainRTT", {
-                width: this._mainTextureDesiredSize.width,
-                height: this._mainTextureDesiredSize.height
-            }, this._scene, false, true, BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT);
-            this._mainTexture.activeCamera = this._options.camera;
-            this._mainTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._mainTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._mainTexture.anisotropicFilteringLevel = 1;
-            this._mainTexture.updateSamplingMode(BABYLON.Texture.BILINEAR_SAMPLINGMODE);
-            this._mainTexture.renderParticles = false;
-            this._mainTexture.renderList = null;
-            this._blurTexture = new BABYLON.RenderTargetTexture("HighlightLayerBlurRTT", {
-                width: blurTextureWidth,
-                height: blurTextureHeight
-            }, this._scene, false, true, BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT);
-            this._blurTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._blurTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._blurTexture.anisotropicFilteringLevel = 16;
-            this._blurTexture.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
-            this._blurTexture.renderParticles = false;
-            this._downSamplePostprocess = new BABYLON.PassPostProcess("HighlightLayerPPP", this._options.blurTextureSizeRatio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine());
-            this._downSamplePostprocess.onApplyObservable.add(function (effect) {
-                effect.setTexture("textureSampler", _this._mainTexture);
-            });
-            this._horizontalBlurPostprocess = new GlowBlurPostProcess("HighlightLayerHBP", new BABYLON.Vector2(1.0, 0), this._options.blurHorizontalSize, 1, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine());
-            this._horizontalBlurPostprocess.onApplyObservable.add(function (effect) {
-                effect.setFloat2("screenSize", blurTextureWidth, blurTextureHeight);
-            });
-            this._verticalBlurPostprocess = new GlowBlurPostProcess("HighlightLayerVBP", new BABYLON.Vector2(0, 1.0), this._options.blurVerticalSize, 1, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine());
-            this._verticalBlurPostprocess.onApplyObservable.add(function (effect) {
-                effect.setFloat2("screenSize", blurTextureWidth, blurTextureHeight);
-            });
-            this._mainTexture.onAfterUnbindObservable.add(function () {
-                _this.onBeforeBlurObservable.notifyObservers(_this);
-                _this._scene.postProcessManager.directRender([_this._downSamplePostprocess, _this._horizontalBlurPostprocess, _this._verticalBlurPostprocess], _this._blurTexture.getInternalTexture());
-                _this.onAfterBlurObservable.notifyObservers(_this);
-            });
-            // 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;
-                }
-                // Excluded Mesh
-                if (_this._excludedMeshes[mesh.id]) {
-                    return;
-                }
-                ;
-                var hardwareInstancedRendering = (engine.getCaps().instancedArrays !== null) && (batch.visibleInstances[subMesh._id] !== null) && (batch.visibleInstances[subMesh._id] !== undefined);
-                var highlightLayerMesh = _this._meshes[mesh.id];
-                var material = subMesh.getMaterial();
-                var emissiveTexture = null;
-                if (highlightLayerMesh && highlightLayerMesh.glowEmissiveOnly && material) {
-                    emissiveTexture = material.emissiveTexture;
-                }
-                if (_this.isReady(subMesh, hardwareInstancedRendering, emissiveTexture)) {
-                    engine.enableEffect(_this._glowMapGenerationEffect);
-                    mesh._bind(subMesh, _this._glowMapGenerationEffect, BABYLON.Material.TriangleFillMode);
-                    _this._glowMapGenerationEffect.setMatrix("viewProjection", scene.getTransformMatrix());
-                    if (highlightLayerMesh) {
-                        _this._glowMapGenerationEffect.setFloat4("color", highlightLayerMesh.color.r, highlightLayerMesh.color.g, highlightLayerMesh.color.b, 1.0);
-                    }
-                    else {
-                        _this._glowMapGenerationEffect.setFloat4("color", HighlightLayer.neutralColor.r, HighlightLayer.neutralColor.g, HighlightLayer.neutralColor.b, HighlightLayer.neutralColor.a);
-                    }
-                    // Alpha test
-                    if (material && material.needAlphaTesting()) {
-                        var alphaTexture = material.getAlphaTestTexture();
-                        _this._glowMapGenerationEffect.setTexture("diffuseSampler", alphaTexture);
-                        _this._glowMapGenerationEffect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
-                    }
-                    // Glow emissive only
-                    if (emissiveTexture) {
-                        _this._glowMapGenerationEffect.setTexture("emissiveSampler", emissiveTexture);
-                        _this._glowMapGenerationEffect.setMatrix("emissiveMatrix", emissiveTexture.getTextureMatrix());
-                    }
-                    // Bones
-                    if (mesh.useBones && mesh.computeBonesUsingShaders) {
-                        _this._glowMapGenerationEffect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
-                    }
-                    // Draw
-                    mesh._processRendering(subMesh, _this._glowMapGenerationEffect, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._glowMapGenerationEffect.setMatrix("world", world); });
-                }
-                else {
-                    // Need to reset refresh rate of the shadowMap
-                    _this._mainTexture.resetRefreshCounter();
-                }
-            };
-            this._mainTexture.customRenderFunction = function (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes) {
-                _this.onBeforeRenderMainTextureObservable.notifyObservers(_this);
-                var index;
-                for (index = 0; index < opaqueSubMeshes.length; index++) {
-                    renderSubMesh(opaqueSubMeshes.data[index]);
-                }
-                for (index = 0; index < alphaTestSubMeshes.length; index++) {
-                    renderSubMesh(alphaTestSubMeshes.data[index]);
-                }
-                for (index = 0; index < transparentSubMeshes.length; index++) {
-                    renderSubMesh(transparentSubMeshes.data[index]);
-                }
-            };
-            this._mainTexture.onClearObservable.add(function (engine) {
-                engine.clear(HighlightLayer.neutralColor, true, true, true);
-            });
-        };
-        /**
-         * Checks for the readiness of the element composing the layer.
-         * @param subMesh the mesh to check for
-         * @param useInstances specify wether or not to use instances to render the mesh
-         * @param emissiveTexture the associated emissive texture used to generate the glow
-         * @return true if ready otherwise, false
-         */
-        HighlightLayer.prototype.isReady = function (subMesh, useInstances, emissiveTexture) {
-            if (!subMesh.getMaterial().isReady(subMesh.getMesh(), useInstances)) {
-                return false;
-            }
-            var defines = [];
-            var attribs = [BABYLON.VertexBuffer.PositionKind];
-            var mesh = subMesh.getMesh();
-            var material = subMesh.getMaterial();
-            var uv1 = false;
-            var uv2 = false;
-            // Alpha test
-            if (material && material.needAlphaTesting()) {
-                var alphaTexture = material.getAlphaTestTexture();
-                if (alphaTexture) {
-                    defines.push("#define ALPHATEST");
-                    if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind) &&
-                        alphaTexture.coordinatesIndex === 1) {
-                        defines.push("#define DIFFUSEUV2");
-                        uv2 = true;
-                    }
-                    else if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                        defines.push("#define DIFFUSEUV1");
-                        uv1 = true;
-                    }
-                }
-            }
-            // Emissive
-            if (emissiveTexture) {
-                defines.push("#define EMISSIVE");
-                if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind) &&
-                    emissiveTexture.coordinatesIndex === 1) {
-                    defines.push("#define EMISSIVEUV2");
-                    uv2 = true;
-                }
-                else if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                    defines.push("#define EMISSIVEUV1");
-                    uv1 = true;
-                }
-            }
-            if (uv1) {
-                attribs.push(BABYLON.VertexBuffer.UVKind);
-                defines.push("#define UV1");
-            }
-            if (uv2) {
-                attribs.push(BABYLON.VertexBuffer.UV2Kind);
-                defines.push("#define UV2");
-            }
-            // Bones
-            if (mesh.useBones && mesh.computeBonesUsingShaders) {
-                attribs.push(BABYLON.VertexBuffer.MatricesIndicesKind);
-                attribs.push(BABYLON.VertexBuffer.MatricesWeightsKind);
-                if (mesh.numBoneInfluencers > 4) {
-                    attribs.push(BABYLON.VertexBuffer.MatricesIndicesExtraKind);
-                    attribs.push(BABYLON.VertexBuffer.MatricesWeightsExtraKind);
-                }
-                defines.push("#define NUM_BONE_INFLUENCERS " + mesh.numBoneInfluencers);
-                defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
-            }
-            else {
-                defines.push("#define NUM_BONE_INFLUENCERS 0");
-            }
-            // 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._glowMapGenerationEffect = this._scene.getEngine().createEffect("glowMapGeneration", attribs, ["world", "mBones", "viewProjection", "diffuseMatrix", "color", "emissiveMatrix"], ["diffuseSampler", "emissiveSampler"], join);
-            }
-            return this._glowMapGenerationEffect.isReady();
-        };
-        /**
-         * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
-         */
-        HighlightLayer.prototype.render = function () {
-            var currentEffect = this._glowMapMergeEffect;
-            // Check
-            if (!currentEffect.isReady() || !this._blurTexture.isReady())
-                return;
-            var engine = this._scene.getEngine();
-            this.onBeforeComposeObservable.notifyObservers(this);
-            // Render
-            engine.enableEffect(currentEffect);
-            engine.setState(false);
-            // Cache
-            var previousStencilBuffer = engine.getStencilBuffer();
-            var previousStencilFunction = engine.getStencilFunction();
-            var previousStencilMask = engine.getStencilMask();
-            var previousAlphaMode = engine.getAlphaMode();
-            // Texture
-            currentEffect.setTexture("textureSampler", this._blurTexture);
-            // VBOs
-            engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);
-            // Draw order
-            engine.setAlphaMode(this._options.alphaBlendingMode);
-            engine.setStencilMask(0x00);
-            engine.setStencilBuffer(true);
-            engine.setStencilFunctionReference(this._instanceGlowingMeshStencilReference);
-            if (this.outerGlow) {
-                currentEffect.setFloat("offset", 0);
-                engine.setStencilFunction(BABYLON.Engine.NOTEQUAL);
-                engine.draw(true, 0, 6);
-            }
-            if (this.innerGlow) {
-                currentEffect.setFloat("offset", 1);
-                engine.setStencilFunction(BABYLON.Engine.EQUAL);
-                engine.draw(true, 0, 6);
-            }
-            // Restore Cache
-            engine.setStencilFunction(previousStencilFunction);
-            engine.setStencilMask(previousStencilMask);
-            engine.setAlphaMode(previousAlphaMode);
-            engine.setStencilBuffer(previousStencilBuffer);
-            this.onAfterComposeObservable.notifyObservers(this);
-            // Handle size changes.
-            var size = this._mainTexture.getSize();
-            this.setMainTextureSize();
-            if (size.width !== this._mainTextureDesiredSize.width || size.height !== this._mainTextureDesiredSize.height) {
-                // Recreate RTT and post processes on size change.
-                this.onSizeChangedObservable.notifyObservers(this);
-                this.disposeTextureAndPostProcesses();
-                this.createTextureAndPostProcesses();
-            }
-        };
-        /**
-         * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
-         * @param mesh The mesh to exclude from the highlight layer
-         */
-        HighlightLayer.prototype.addExcludedMesh = function (mesh) {
-            var meshExcluded = this._excludedMeshes[mesh.id];
-            if (!meshExcluded) {
-                this._excludedMeshes[mesh.id] = {
-                    mesh: mesh,
-                    beforeRender: mesh.onBeforeRenderObservable.add(function (mesh) {
-                        mesh.getEngine().setStencilBuffer(false);
-                    }),
-                    afterRender: mesh.onAfterRenderObservable.add(function (mesh) {
-                        mesh.getEngine().setStencilBuffer(true);
-                    }),
-                };
-            }
-        };
-        /**
-          * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
-          * @param mesh The mesh to highlight
-          */
-        HighlightLayer.prototype.removeExcludedMesh = function (mesh) {
-            var meshExcluded = this._excludedMeshes[mesh.id];
-            if (meshExcluded) {
-                mesh.onBeforeRenderObservable.remove(meshExcluded.beforeRender);
-                mesh.onAfterRenderObservable.remove(meshExcluded.afterRender);
-            }
-            this._excludedMeshes[mesh.id] = undefined;
-        };
-        /**
-         * Add a mesh in the highlight layer in order to make it glow with the chosen color.
-         * @param mesh The mesh to highlight
-         * @param color The color of the highlight
-         * @param glowEmissiveOnly Extract the glow from the emissive texture
-         */
-        HighlightLayer.prototype.addMesh = function (mesh, color, glowEmissiveOnly) {
-            var _this = this;
-            if (glowEmissiveOnly === void 0) { glowEmissiveOnly = false; }
-            var meshHighlight = this._meshes[mesh.id];
-            if (meshHighlight) {
-                meshHighlight.color = color;
-            }
-            else {
-                this._meshes[mesh.id] = {
-                    mesh: mesh,
-                    color: color,
-                    // Lambda required for capture due to Observable this context
-                    observerHighlight: mesh.onBeforeRenderObservable.add(function (mesh) {
-                        if (_this._excludedMeshes[mesh.id]) {
-                            _this.defaultStencilReference(mesh);
-                        }
-                        else {
-                            mesh.getScene().getEngine().setStencilFunctionReference(_this._instanceGlowingMeshStencilReference);
-                        }
-                    }),
-                    observerDefault: mesh.onAfterRenderObservable.add(this.defaultStencilReference),
-                    glowEmissiveOnly: glowEmissiveOnly
-                };
-            }
-            this._shouldRender = true;
-        };
-        /**
-         * Remove a mesh from the highlight layer in order to make it stop glowing.
-         * @param mesh The mesh to highlight
-         */
-        HighlightLayer.prototype.removeMesh = function (mesh) {
-            var meshHighlight = this._meshes[mesh.id];
-            if (meshHighlight) {
-                mesh.onBeforeRenderObservable.remove(meshHighlight.observerHighlight);
-                mesh.onAfterRenderObservable.remove(meshHighlight.observerDefault);
-            }
-            this._meshes[mesh.id] = undefined;
-            this._shouldRender = false;
-            for (var meshHighlightToCheck in this._meshes) {
-                if (meshHighlightToCheck) {
-                    this._shouldRender = true;
-                    break;
-                }
-            }
-        };
-        /**
-         * Returns true if the layer contains information to display, otherwise false.
-         */
-        HighlightLayer.prototype.shouldRender = function () {
-            return this.isEnabled && this._shouldRender;
-        };
-        /**
-         * Sets the main texture desired size which is the closest power of two
-         * of the engine canvas size.
-         */
-        HighlightLayer.prototype.setMainTextureSize = function () {
-            if (this._options.mainTextureFixedSize) {
-                this._mainTextureDesiredSize.width = this._options.mainTextureFixedSize;
-                this._mainTextureDesiredSize.height = this._options.mainTextureFixedSize;
-            }
-            else {
-                this._mainTextureDesiredSize.width = this._engine.getRenderingCanvas().width * this._options.mainTextureRatio;
-                this._mainTextureDesiredSize.height = this._engine.getRenderingCanvas().height * this._options.mainTextureRatio;
-                this._mainTextureDesiredSize.width = BABYLON.Tools.GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize);
-                this._mainTextureDesiredSize.height = BABYLON.Tools.GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize);
-            }
-        };
-        /**
-         * Force the stencil to the normal expected value for none glowing parts
-         */
-        HighlightLayer.prototype.defaultStencilReference = function (mesh) {
-            mesh.getScene().getEngine().setStencilFunctionReference(HighlightLayer.normalMeshStencilReference);
-        };
-        /**
-         * Dispose only the render target textures and post process.
-         */
-        HighlightLayer.prototype.disposeTextureAndPostProcesses = function () {
-            this._blurTexture.dispose();
-            this._mainTexture.dispose();
-            this._downSamplePostprocess.dispose();
-            this._horizontalBlurPostprocess.dispose();
-            this._verticalBlurPostprocess.dispose();
-        };
-        /**
-         * Dispose the highlight layer and free resources.
-         */
-        HighlightLayer.prototype.dispose = function () {
-            var vertexBuffer = this._vertexBuffers[BABYLON.VertexBuffer.PositionKind];
-            if (vertexBuffer) {
-                vertexBuffer.dispose();
-                this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = null;
-            }
-            if (this._indexBuffer) {
-                this._scene.getEngine()._releaseBuffer(this._indexBuffer);
-                this._indexBuffer = null;
-            }
-            // Clean textures and post processes
-            this.disposeTextureAndPostProcesses();
-            // Clean mesh references 
-            for (var id in this._meshes) {
-                var meshHighlight = this._meshes[id];
-                if (meshHighlight && meshHighlight.mesh) {
-                    meshHighlight.mesh.onBeforeRenderObservable.remove(meshHighlight.observerHighlight);
-                    meshHighlight.mesh.onAfterRenderObservable.remove(meshHighlight.observerDefault);
-                }
-            }
-            this._meshes = null;
-            for (var id in this._excludedMeshes) {
-                var meshHighlight = this._excludedMeshes[id];
-                if (meshHighlight) {
-                    meshHighlight.mesh.onBeforeRenderObservable.remove(meshHighlight.beforeRender);
-                    meshHighlight.mesh.onAfterRenderObservable.remove(meshHighlight.afterRender);
-                }
-            }
-            this._excludedMeshes = null;
-            // Remove from scene
-            var index = this._scene.highlightLayers.indexOf(this, 0);
-            if (index > -1) {
-                this._scene.highlightLayers.splice(index, 1);
-            }
-            // Callback
-            this.onDisposeObservable.notifyObservers(this);
-            this.onDisposeObservable.clear();
-            this.onBeforeRenderMainTextureObservable.clear();
-            this.onBeforeBlurObservable.clear();
-            this.onBeforeComposeObservable.clear();
-            this.onAfterComposeObservable.clear();
-            this.onSizeChangedObservable.clear();
-        };
-        /**
-         * The neutral color used during the preparation of the glow effect.
-         * This is black by default as the blend operation is a blend operation.
-         */
-        HighlightLayer.neutralColor = new BABYLON.Color4(0, 0, 0, 0);
-        /**
-         * Stencil value used for glowing meshes.
-         */
-        HighlightLayer.glowingMeshStencilReference = 0x02;
-        /**
-         * Stencil value used for the other meshes in the scene.
-         */
-        HighlightLayer.normalMeshStencilReference = 0x01;
-        return HighlightLayer;
-    }());
-    BABYLON.HighlightLayer = HighlightLayer;
-})(BABYLON || (BABYLON = {}));

+ 0 - 140
src/Layer/babylon.layer.js

@@ -1,140 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Layer = (function () {
-        function Layer(name, imgUrl, scene, isBackground, color) {
-            this.name = name;
-            this.scale = new BABYLON.Vector2(1, 1);
-            this.offset = new BABYLON.Vector2(0, 0);
-            this.alphaBlendingMode = BABYLON.Engine.ALPHA_COMBINE;
-            this._vertexBuffers = {};
-            // Events
-            /**
-            * An event triggered when the layer is disposed.
-            * @type {BABYLON.Observable}
-            */
-            this.onDisposeObservable = new BABYLON.Observable();
-            /**
-            * An event triggered before rendering the scene
-            * @type {BABYLON.Observable}
-            */
-            this.onBeforeRenderObservable = new BABYLON.Observable();
-            /**
-            * An event triggered after rendering the scene
-            * @type {BABYLON.Observable}
-            */
-            this.onAfterRenderObservable = new BABYLON.Observable();
-            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);
-            var engine = scene.getEngine();
-            // VBO
-            var vertices = [];
-            vertices.push(1, 1);
-            vertices.push(-1, 1);
-            vertices.push(-1, -1);
-            vertices.push(1, -1);
-            var vertexBuffer = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
-            this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = vertexBuffer;
-            // Indices
-            var indices = [];
-            indices.push(0);
-            indices.push(1);
-            indices.push(2);
-            indices.push(0);
-            indices.push(2);
-            indices.push(3);
-            this._indexBuffer = engine.createIndexBuffer(indices);
-            // Effects
-            this._effect = engine.createEffect("layer", [BABYLON.VertexBuffer.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], "");
-            this._alphaTestEffect = engine.createEffect("layer", [BABYLON.VertexBuffer.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], "#define ALPHATEST");
-        }
-        Object.defineProperty(Layer.prototype, "onDispose", {
-            set: function (callback) {
-                if (this._onDisposeObserver) {
-                    this.onDisposeObservable.remove(this._onDisposeObserver);
-                }
-                this._onDisposeObserver = this.onDisposeObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Layer.prototype, "onBeforeRender", {
-            set: function (callback) {
-                if (this._onBeforeRenderObserver) {
-                    this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);
-                }
-                this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Layer.prototype, "onAfterRender", {
-            set: function (callback) {
-                if (this._onAfterRenderObserver) {
-                    this.onAfterRenderObservable.remove(this._onAfterRenderObserver);
-                }
-                this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Layer.prototype.render = function () {
-            var currentEffect = this.alphaTest ? this._alphaTestEffect : this._effect;
-            // Check
-            if (!currentEffect.isReady() || !this.texture || !this.texture.isReady())
-                return;
-            var engine = this._scene.getEngine();
-            this.onBeforeRenderObservable.notifyObservers(this);
-            // Render
-            engine.enableEffect(currentEffect);
-            engine.setState(false);
-            // Texture
-            currentEffect.setTexture("textureSampler", this.texture);
-            currentEffect.setMatrix("textureMatrix", this.texture.getTextureMatrix());
-            // Color
-            currentEffect.setFloat4("color", this.color.r, this.color.g, this.color.b, this.color.a);
-            // Scale / offset
-            currentEffect.setVector2("offset", this.offset);
-            currentEffect.setVector2("scale", this.scale);
-            // VBOs
-            engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect);
-            // Draw order
-            if (!this.alphaTest) {
-                engine.setAlphaMode(this.alphaBlendingMode);
-                engine.draw(true, 0, 6);
-                engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
-            }
-            else {
-                engine.draw(true, 0, 6);
-            }
-            this.onAfterRenderObservable.notifyObservers(this);
-        };
-        Layer.prototype.dispose = function () {
-            var vertexBuffer = this._vertexBuffers[BABYLON.VertexBuffer.PositionKind];
-            if (vertexBuffer) {
-                vertexBuffer.dispose();
-                this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = 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
-            this.onDisposeObservable.notifyObservers(this);
-            this.onDisposeObservable.clear();
-            this.onAfterRenderObservable.clear();
-            this.onBeforeRenderObservable.clear();
-        };
-        return Layer;
-    }());
-    BABYLON.Layer = Layer;
-})(BABYLON || (BABYLON = {}));

+ 0 - 24
src/LensFlare/babylon.lensFlare.js

@@ -1,24 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var LensFlare = (function () {
-        function LensFlare(size, position, color, imgUrl, system) {
-            this.size = size;
-            this.position = position;
-            this.alphaMode = BABYLON.Engine.ALPHA_ONEONE;
-            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 = {}));

+ 0 - 235
src/LensFlare/babylon.lensFlareSystem.js

@@ -1,235 +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.viewportBorder = 0;
-            this.layerMask = 0x0FFFFFFF;
-            this._vertexBuffers = {};
-            this._isEnabled = true;
-            this._scene = scene;
-            this._emitter = emitter;
-            this.id = name;
-            scene.lensFlareSystems.push(this);
-            this.meshesSelectionPredicate = function (m) { return m.material && m.isVisible && m.isEnabled() && m.isBlocker && ((m.layerMask & scene.activeCamera.layerMask) != 0); };
-            var engine = scene.getEngine();
-            // VBO
-            var vertices = [];
-            vertices.push(1, 1);
-            vertices.push(-1, 1);
-            vertices.push(-1, -1);
-            vertices.push(1, -1);
-            this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
-            // Indices
-            var indices = [];
-            indices.push(0);
-            indices.push(1);
-            indices.push(2);
-            indices.push(0);
-            indices.push(2);
-            indices.push(3);
-            this._indexBuffer = engine.createIndexBuffer(indices);
-            // Effects
-            this._effect = engine.createEffect("lensFlare", [BABYLON.VertexBuffer.PositionKind], ["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.setEmitter = function (newEmitter) {
-            this._emitter = newEmitter;
-        };
-        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 (this.viewportBorder > 0) {
-                globalViewport.x -= this.viewportBorder;
-                globalViewport.y -= this.viewportBorder;
-                globalViewport.width += this.viewportBorder * 2;
-                globalViewport.height += this.viewportBorder * 2;
-                position.x += this.viewportBorder;
-                position.y += this.viewportBorder;
-                this._positionX += this.viewportBorder;
-                this._positionY += this.viewportBorder;
-            }
-            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 true;
-            }
-            return false;
-        };
-        LensFlareSystem.prototype._isVisible = function () {
-            if (!this._isEnabled) {
-                return false;
-            }
-            var emitterPosition = this.getEmitterPosition();
-            var direction = emitterPosition.subtract(this._scene.activeCamera.globalPosition);
-            var distance = direction.length();
-            direction.normalize();
-            var ray = new BABYLON.Ray(this._scene.activeCamera.globalPosition, 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.getRenderWidth(true), engine.getRenderHeight(true));
-            // 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;
-            away -= this.viewportBorder;
-            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;
-            }
-            if (this.viewportBorder > 0) {
-                globalViewport.x += this.viewportBorder;
-                globalViewport.y += this.viewportBorder;
-                globalViewport.width -= this.viewportBorder * 2;
-                globalViewport.height -= this.viewportBorder * 2;
-                this._positionX -= this.viewportBorder;
-                this._positionY -= this.viewportBorder;
-            }
-            // 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);
-            // VBOs
-            engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);
-            // Flares
-            for (var index = 0; index < this.lensFlares.length; index++) {
-                var flare = this.lensFlares[index];
-                engine.setAlphaMode(flare.alphaMode);
-                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, true);
-                var cx = 2 * (x / (globalViewport.width + globalViewport.x * 2)) - 1.0;
-                var cy = 1.0 - 2 * (y / (globalViewport.height + globalViewport.y * 2));
-                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 () {
-            var vertexBuffer = this._vertexBuffers[BABYLON.VertexBuffer.PositionKind];
-            if (vertexBuffer) {
-                vertexBuffer.dispose();
-                this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = 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);
-        };
-        LensFlareSystem.Parse = function (parsedLensFlareSystem, scene, rootUrl) {
-            var emitter = scene.getLastEntryByID(parsedLensFlareSystem.emitterId);
-            var name = parsedLensFlareSystem.name || "lensFlareSystem#" + parsedLensFlareSystem.emitterId;
-            var lensFlareSystem = new LensFlareSystem(name, emitter, scene);
-            lensFlareSystem.id = parsedLensFlareSystem.id || name;
-            lensFlareSystem.borderLimit = parsedLensFlareSystem.borderLimit;
-            for (var index = 0; index < parsedLensFlareSystem.flares.length; index++) {
-                var parsedFlare = parsedLensFlareSystem.flares[index];
-                var flare = new BABYLON.LensFlare(parsedFlare.size, parsedFlare.position, BABYLON.Color3.FromArray(parsedFlare.color), rootUrl + parsedFlare.textureName, lensFlareSystem);
-            }
-            return lensFlareSystem;
-        };
-        LensFlareSystem.prototype.serialize = function () {
-            var serializationObject = {};
-            serializationObject.id = this.id;
-            serializationObject.name = this.name;
-            serializationObject.emitterId = this.getEmitter().id;
-            serializationObject.borderLimit = this.borderLimit;
-            serializationObject.flares = [];
-            for (var index = 0; index < this.lensFlares.length; index++) {
-                var flare = this.lensFlares[index];
-                serializationObject.flares.push({
-                    size: flare.size,
-                    position: flare.position,
-                    color: flare.color.asArray(),
-                    textureName: BABYLON.Tools.GetFilename(flare.texture.name)
-                });
-            }
-            return serializationObject;
-        };
-        return LensFlareSystem;
-    }());
-    BABYLON.LensFlareSystem = LensFlareSystem;
-})(BABYLON || (BABYLON = {}));

+ 0 - 425
src/Lights/Shadows/babylon.shadowGenerator.js

@@ -1,425 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var ShadowGenerator = (function () {
-        function ShadowGenerator(mapSize, light) {
-            var _this = this;
-            // Members
-            this._filter = ShadowGenerator.FILTER_NONE;
-            this.blurScale = 2;
-            this._blurBoxOffset = 0;
-            this._bias = 0.00005;
-            this._lightDirection = BABYLON.Vector3.Zero();
-            this.forceBackFacesOnly = false;
-            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._currentFaceIndex = 0;
-            this._currentFaceIndexCache = 0;
-            this._useFullFloat = true;
-            this._light = light;
-            this._scene = light.getScene();
-            this._mapSize = mapSize;
-            light._shadowGenerator = this;
-            // Texture type fallback from float to int if not supported.
-            var textureType;
-            var caps = this._scene.getEngine().getCaps();
-            if (caps.textureFloat && caps.textureFloatLinearFiltering && caps.textureFloatRender) {
-                this._useFullFloat = true;
-                textureType = BABYLON.Engine.TEXTURETYPE_FLOAT;
-            }
-            else {
-                this._useFullFloat = false;
-                textureType = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-            }
-            // Render target
-            this._shadowMap = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false, true, textureType, light.needCube());
-            this._shadowMap.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._shadowMap.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._shadowMap.anisotropicFilteringLevel = 1;
-            this._shadowMap.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE);
-            this._shadowMap.renderParticles = false;
-            this._shadowMap.onBeforeRenderObservable.add(function (faceIndex) {
-                _this._currentFaceIndex = faceIndex;
-            });
-            this._shadowMap.onAfterUnbindObservable.add(function () {
-                if (!_this.useBlurVarianceShadowMap) {
-                    return;
-                }
-                if (!_this._shadowMap2) {
-                    _this._shadowMap2 = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, _this._scene, false, true, textureType);
-                    _this._shadowMap2.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-                    _this._shadowMap2.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-                    _this._shadowMap2.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
-                    _this._downSamplePostprocess = new BABYLON.PassPostProcess("downScale", 1.0 / _this.blurScale, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, _this._scene.getEngine());
-                    _this._downSamplePostprocess.onApplyObservable.add(function (effect) {
-                        effect.setTexture("textureSampler", _this._shadowMap);
-                    });
-                    _this.blurBoxOffset = 1;
-                }
-                _this._scene.postProcessManager.directRender([_this._downSamplePostprocess, _this._boxBlurPostprocess], _this._shadowMap2.getInternalTexture());
-            });
-            // 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) && (batch.visibleInstances[subMesh._id] !== undefined);
-                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());
-                    _this._effect.setVector3("lightPosition", _this.getLight().position);
-                    if (_this.getLight().needCube()) {
-                        _this._effect.setFloat2("depthValues", scene.activeCamera.minZ, scene.activeCamera.maxZ);
-                    }
-                    // Alpha test
-                    if (material && material.needAlphaTesting()) {
-                        var alphaTexture = material.getAlphaTestTexture();
-                        _this._effect.setTexture("diffuseSampler", alphaTexture);
-                        _this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
-                    }
-                    // Bones
-                    if (mesh.useBones && mesh.computeBonesUsingShaders) {
-                        _this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices(mesh));
-                    }
-                    if (_this.forceBackFacesOnly) {
-                        engine.setState(true, 0, false, true);
-                    }
-                    // Draw
-                    mesh._processRendering(subMesh, _this._effect, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { return _this._effect.setMatrix("world", world); });
-                    if (_this.forceBackFacesOnly) {
-                        engine.setState(true, 0, false, false);
-                    }
-                }
-                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]);
-                    }
-                }
-            };
-            this._shadowMap.onClearObservable.add(function (engine) {
-                if (_this.useBlurVarianceShadowMap || _this.useVarianceShadowMap) {
-                    engine.clear(new BABYLON.Color4(0, 0, 0, 0), true, true, true);
-                }
-                else {
-                    engine.clear(new BABYLON.Color4(1.0, 1.0, 1.0, 1.0), true, true, true);
-                }
-            });
-        }
-        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, "FILTER_BLURVARIANCESHADOWMAP", {
-            get: function () {
-                return ShadowGenerator._FILTER_BLURVARIANCESHADOWMAP;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ShadowGenerator.prototype, "bias", {
-            get: function () {
-                return this._bias;
-            },
-            set: function (bias) {
-                this._bias = bias;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ShadowGenerator.prototype, "blurBoxOffset", {
-            get: function () {
-                return this._blurBoxOffset;
-            },
-            set: function (value) {
-                var _this = this;
-                if (this._blurBoxOffset === value) {
-                    return;
-                }
-                this._blurBoxOffset = value;
-                if (this._boxBlurPostprocess) {
-                    this._boxBlurPostprocess.dispose();
-                }
-                this._boxBlurPostprocess = new BABYLON.PostProcess("DepthBoxBlur", "depthBoxBlur", ["screenSize", "boxOffset"], [], 1.0 / this.blurScale, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, "#define OFFSET " + value);
-                this._boxBlurPostprocess.onApplyObservable.add(function (effect) {
-                    effect.setFloat2("screenSize", _this._mapSize / _this.blurScale, _this._mapSize / _this.blurScale);
-                });
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ShadowGenerator.prototype, "filter", {
-            get: function () {
-                return this._filter;
-            },
-            set: function (value) {
-                if (this._filter === value) {
-                    return;
-                }
-                this._filter = value;
-                if (this.useVarianceShadowMap || this.useBlurVarianceShadowMap || this.usePoissonSampling) {
-                    this._shadowMap.anisotropicFilteringLevel = 16;
-                    this._shadowMap.updateSamplingMode(BABYLON.Texture.BILINEAR_SAMPLINGMODE);
-                }
-                else {
-                    this._shadowMap.anisotropicFilteringLevel = 1;
-                    this._shadowMap.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE);
-                }
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ShadowGenerator.prototype, "useVarianceShadowMap", {
-            get: function () {
-                return this.filter === ShadowGenerator.FILTER_VARIANCESHADOWMAP && this._light.supportsVSM();
-            },
-            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 ||
-                    (!this._light.supportsVSM() && (this.filter === ShadowGenerator.FILTER_VARIANCESHADOWMAP ||
-                        this.filter === ShadowGenerator.FILTER_BLURVARIANCESHADOWMAP));
-            },
-            set: function (value) {
-                this.filter = (value ? ShadowGenerator.FILTER_POISSONSAMPLING : ShadowGenerator.FILTER_NONE);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ShadowGenerator.prototype, "useBlurVarianceShadowMap", {
-            get: function () {
-                return this.filter === ShadowGenerator.FILTER_BLURVARIANCESHADOWMAP && this._light.supportsVSM();
-            },
-            set: function (value) {
-                this.filter = (value ? ShadowGenerator.FILTER_BLURVARIANCESHADOWMAP : ShadowGenerator.FILTER_NONE);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        ShadowGenerator.prototype.isReady = function (subMesh, useInstances) {
-            var defines = [];
-            if (this._useFullFloat) {
-                defines.push("#define FULLFLOAT");
-            }
-            if (this.useVarianceShadowMap || this.useBlurVarianceShadowMap) {
-                defines.push("#define VSM");
-            }
-            if (this.getLight().needCube()) {
-                defines.push("#define CUBEMAP");
-            }
-            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)) {
-                    var alphaTexture = material.getAlphaTestTexture();
-                    if (alphaTexture.coordinatesIndex === 1) {
-                        attribs.push(BABYLON.VertexBuffer.UV2Kind);
-                        defines.push("#define UV2");
-                    }
-                }
-            }
-            // Bones
-            if (mesh.useBones && mesh.computeBonesUsingShaders) {
-                attribs.push(BABYLON.VertexBuffer.MatricesIndicesKind);
-                attribs.push(BABYLON.VertexBuffer.MatricesWeightsKind);
-                if (mesh.numBoneInfluencers > 4) {
-                    attribs.push(BABYLON.VertexBuffer.MatricesIndicesExtraKind);
-                    attribs.push(BABYLON.VertexBuffer.MatricesWeightsExtraKind);
-                }
-                defines.push("#define NUM_BONE_INFLUENCERS " + mesh.numBoneInfluencers);
-                defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
-            }
-            else {
-                defines.push("#define NUM_BONE_INFLUENCERS 0");
-            }
-            // 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", "lightPosition", "depthValues"], ["diffuseSampler"], join);
-            }
-            return this._effect.isReady();
-        };
-        ShadowGenerator.prototype.getShadowMap = function () {
-            return this._shadowMap;
-        };
-        ShadowGenerator.prototype.getShadowMapForRendering = function () {
-            if (this._shadowMap2) {
-                return this._shadowMap2;
-            }
-            return this._shadowMap;
-        };
-        ShadowGenerator.prototype.getLight = function () {
-            return this._light;
-        };
-        // Methods
-        ShadowGenerator.prototype.getTransformMatrix = function () {
-            var scene = this._scene;
-            if (this._currentRenderID === scene.getRenderId() && this._currentFaceIndexCache === this._currentFaceIndex) {
-                return this._transformMatrix;
-            }
-            this._currentRenderID = scene.getRenderId();
-            this._currentFaceIndexCache = this._currentFaceIndex;
-            var lightPosition = this._light.position;
-            BABYLON.Vector3.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex), this._lightDirection);
-            if (Math.abs(BABYLON.Vector3.Dot(this._lightDirection, BABYLON.Vector3.Up())) === 1.0) {
-                this._lightDirection.z = 0.0000000000001; // Required to avoid perfectly perpendicular light
-            }
-            if (this._light.computeTransformedPosition()) {
-                lightPosition = this._light.transformedPosition;
-            }
-            if (this._light.needRefreshPerFrame() || !this._cachedPosition || !this._cachedDirection || !lightPosition.equals(this._cachedPosition) || !this._lightDirection.equals(this._cachedDirection)) {
-                this._cachedPosition = lightPosition.clone();
-                this._cachedDirection = this._lightDirection.clone();
-                BABYLON.Matrix.LookAtLHToRef(lightPosition, lightPosition.add(this._lightDirection), BABYLON.Vector3.Up(), this._viewMatrix);
-                this._light.setShadowProjectionMatrix(this._projectionMatrix, this._viewMatrix, this.getShadowMap().renderList);
-                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._packHalf = function (depth) {
-            var scale = depth * 255.0;
-            var fract = scale - Math.floor(scale);
-            return new BABYLON.Vector2(depth - fract / 255.0, fract);
-        };
-        ShadowGenerator.prototype.dispose = function () {
-            this._shadowMap.dispose();
-            if (this._shadowMap2) {
-                this._shadowMap2.dispose();
-            }
-            if (this._downSamplePostprocess) {
-                this._downSamplePostprocess.dispose();
-            }
-            if (this._boxBlurPostprocess) {
-                this._boxBlurPostprocess.dispose();
-            }
-        };
-        ShadowGenerator.prototype.serialize = function () {
-            var serializationObject = {};
-            serializationObject.lightId = this._light.id;
-            serializationObject.mapSize = this.getShadowMap().getRenderSize();
-            serializationObject.useVarianceShadowMap = this.useVarianceShadowMap;
-            serializationObject.usePoissonSampling = this.usePoissonSampling;
-            serializationObject.forceBackFacesOnly = this.forceBackFacesOnly;
-            serializationObject.renderList = [];
-            for (var meshIndex = 0; meshIndex < this.getShadowMap().renderList.length; meshIndex++) {
-                var mesh = this.getShadowMap().renderList[meshIndex];
-                serializationObject.renderList.push(mesh.id);
-            }
-            return serializationObject;
-        };
-        ShadowGenerator.Parse = function (parsedShadowGenerator, scene) {
-            //casting to point light, as light is missing the position attr and typescript complains.
-            var light = scene.getLightByID(parsedShadowGenerator.lightId);
-            var shadowGenerator = new ShadowGenerator(parsedShadowGenerator.mapSize, light);
-            for (var meshIndex = 0; meshIndex < parsedShadowGenerator.renderList.length; meshIndex++) {
-                var meshes = scene.getMeshesByID(parsedShadowGenerator.renderList[meshIndex]);
-                meshes.forEach(function (mesh) {
-                    shadowGenerator.getShadowMap().renderList.push(mesh);
-                });
-            }
-            if (parsedShadowGenerator.usePoissonSampling) {
-                shadowGenerator.usePoissonSampling = true;
-            }
-            else if (parsedShadowGenerator.useVarianceShadowMap) {
-                shadowGenerator.useVarianceShadowMap = true;
-            }
-            else if (parsedShadowGenerator.useBlurVarianceShadowMap) {
-                shadowGenerator.useBlurVarianceShadowMap = true;
-                if (parsedShadowGenerator.blurScale) {
-                    shadowGenerator.blurScale = parsedShadowGenerator.blurScale;
-                }
-                if (parsedShadowGenerator.blurBoxOffset) {
-                    shadowGenerator.blurBoxOffset = parsedShadowGenerator.blurBoxOffset;
-                }
-            }
-            if (parsedShadowGenerator.bias !== undefined) {
-                shadowGenerator.bias = parsedShadowGenerator.bias;
-            }
-            shadowGenerator.forceBackFacesOnly = parsedShadowGenerator.forceBackFacesOnly;
-            return shadowGenerator;
-        };
-        ShadowGenerator._FILTER_NONE = 0;
-        ShadowGenerator._FILTER_VARIANCESHADOWMAP = 1;
-        ShadowGenerator._FILTER_POISSONSAMPLING = 2;
-        ShadowGenerator._FILTER_BLURVARIANCESHADOWMAP = 3;
-        return ShadowGenerator;
-    }());
-    BABYLON.ShadowGenerator = ShadowGenerator;
-})(BABYLON || (BABYLON = {}));

+ 0 - 129
src/Lights/babylon.directionalLight.js

@@ -1,129 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var DirectionalLight = (function (_super) {
-        __extends(DirectionalLight, _super);
-        function DirectionalLight(name, direction, scene) {
-            _super.call(this, name, scene);
-            this.shadowOrthoScale = 0.5;
-            this.autoUpdateExtends = true;
-            // Cache
-            this._orthoLeft = Number.MAX_VALUE;
-            this._orthoRight = Number.MIN_VALUE;
-            this._orthoTop = Number.MIN_VALUE;
-            this._orthoBottom = Number.MAX_VALUE;
-            this.position = direction.scale(-1);
-            this.direction = direction;
-        }
-        DirectionalLight.prototype.getAbsolutePosition = function () {
-            return this.transformedPosition ? this.transformedPosition : this.position;
-        };
-        DirectionalLight.prototype.setDirectionToTarget = function (target) {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(this.position));
-            return this.direction;
-        };
-        DirectionalLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {
-            var activeCamera = this.getScene().activeCamera;
-            // Check extends
-            if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {
-                var tempVector3 = BABYLON.Vector3.Zero();
-                this._orthoLeft = Number.MAX_VALUE;
-                this._orthoRight = Number.MIN_VALUE;
-                this._orthoTop = Number.MIN_VALUE;
-                this._orthoBottom = Number.MAX_VALUE;
-                for (var meshIndex = 0; meshIndex < renderList.length; meshIndex++) {
-                    var mesh = renderList[meshIndex];
-                    if (!mesh) {
-                        continue;
-                    }
-                    var boundingInfo = mesh.getBoundingInfo();
-                    if (!boundingInfo) {
-                        continue;
-                    }
-                    var boundingBox = boundingInfo.boundingBox;
-                    for (var index = 0; index < boundingBox.vectorsWorld.length; index++) {
-                        BABYLON.Vector3.TransformCoordinatesToRef(boundingBox.vectorsWorld[index], viewMatrix, tempVector3);
-                        if (tempVector3.x < this._orthoLeft)
-                            this._orthoLeft = tempVector3.x;
-                        if (tempVector3.y < this._orthoBottom)
-                            this._orthoBottom = tempVector3.y;
-                        if (tempVector3.x > this._orthoRight)
-                            this._orthoRight = tempVector3.x;
-                        if (tempVector3.y > this._orthoTop)
-                            this._orthoTop = tempVector3.y;
-                    }
-                }
-            }
-            var xOffset = this._orthoRight - this._orthoLeft;
-            var yOffset = this._orthoTop - this._orthoBottom;
-            BABYLON.Matrix.OrthoOffCenterLHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale, this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale, -activeCamera.maxZ, activeCamera.maxZ, matrix);
-        };
-        DirectionalLight.prototype.supportsVSM = function () {
-            return true;
-        };
-        DirectionalLight.prototype.needRefreshPerFrame = function () {
-            return true;
-        };
-        DirectionalLight.prototype.needCube = function () {
-            return false;
-        };
-        DirectionalLight.prototype.getShadowDirection = function (faceIndex) {
-            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;
-        };
-        DirectionalLight.prototype.getTypeID = function () {
-            return 1;
-        };
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], DirectionalLight.prototype, "position", void 0);
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], DirectionalLight.prototype, "direction", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], DirectionalLight.prototype, "shadowOrthoScale", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], DirectionalLight.prototype, "autoUpdateExtends", void 0);
-        return DirectionalLight;
-    }(BABYLON.Light));
-    BABYLON.DirectionalLight = DirectionalLight;
-})(BABYLON || (BABYLON = {}));

+ 0 - 51
src/Lights/babylon.hemisphericLight.js

@@ -1,51 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var HemisphericLight = (function (_super) {
-        __extends(HemisphericLight, _super);
-        function HemisphericLight(name, direction, scene) {
-            _super.call(this, name, scene);
-            this.groundColor = new BABYLON.Color3(0.0, 0.0, 0.0);
-            this.direction = direction;
-        }
-        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;
-        };
-        HemisphericLight.prototype.getTypeID = function () {
-            return 3;
-        };
-        __decorate([
-            BABYLON.serializeAsColor3()
-        ], HemisphericLight.prototype, "groundColor", void 0);
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], HemisphericLight.prototype, "direction", void 0);
-        return HemisphericLight;
-    }(BABYLON.Light));
-    BABYLON.HemisphericLight = HemisphericLight;
-})(BABYLON || (BABYLON = {}));

+ 0 - 239
src/Lights/babylon.light.js

@@ -1,239 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-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.includeOnlyWithLayerMask = 0;
-            this.includedOnlyMeshes = new Array();
-            this.excludedMeshes = new Array();
-            this.excludeWithLayerMask = 0;
-            this.lightmapMode = 0;
-            // PBR Properties.
-            this.radius = 0.00001;
-            this._excludedMeshesIds = new Array();
-            this._includedOnlyMeshesIds = new Array();
-            scene.addLight(this);
-        }
-        Object.defineProperty(Light, "LIGHTMAP_DEFAULT", {
-            /**
-             * If every light affecting the material is in this lightmapMode,
-             * material.lightmapTexture adds or multiplies
-             * (depends on material.useLightmapAsShadowmap)
-             * after every other light calculations.
-             */
-            get: function () {
-                return Light._LIGHTMAP_DEFAULT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTMAP_SPECULAR", {
-            /**
-             * material.lightmapTexture as only diffuse lighting from this light
-             * adds pnly specular lighting from this light
-             * adds dynamic shadows
-             */
-            get: function () {
-                return Light._LIGHTMAP_SPECULAR;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTMAP_SHADOWSONLY", {
-            /**
-             * material.lightmapTexture as only lighting
-             * no light calculation from this light
-             * only adds dynamic shadows from this light
-             */
-            get: function () {
-                return Light._LIGHTMAP_SHADOWSONLY;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
-         * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
-         */
-        Light.prototype.toString = function (fullDetails) {
-            var ret = "Name: " + this.name;
-            ret += ", type: " + (["Point", "Directional", "Spot", "Hemispheric"])[this.getTypeID()];
-            if (this.animations) {
-                for (var i = 0; i < this.animations.length; i++) {
-                    ret += ", animation[0]: " + this.animations[i].toString(fullDetails);
-                }
-            }
-            if (fullDetails) {
-            }
-            return ret;
-        };
-        Light.prototype.getShadowGenerator = function () {
-            return this._shadowGenerator;
-        };
-        Light.prototype.getAbsolutePosition = function () {
-            return BABYLON.Vector3.Zero();
-        };
-        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;
-            }
-            if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {
-                return false;
-            }
-            if (this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & mesh.layerMask) {
-                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);
-                this._markSyncedWithParent();
-                return this._parentedWorldMatrix;
-            }
-            return worldMatrix;
-        };
-        Light.prototype.dispose = function () {
-            if (this._shadowGenerator) {
-                this._shadowGenerator.dispose();
-                this._shadowGenerator = null;
-            }
-            // Animations
-            this.getScene().stopAnimation(this);
-            // Remove from scene
-            this.getScene().removeLight(this);
-            _super.prototype.dispose.call(this);
-        };
-        Light.prototype.getTypeID = function () {
-            return 0;
-        };
-        Light.prototype.clone = function (name) {
-            return BABYLON.SerializationHelper.Clone(Light.GetConstructorFromName(this.getTypeID(), name, this.getScene()), this);
-        };
-        Light.prototype.serialize = function () {
-            var serializationObject = BABYLON.SerializationHelper.Serialize(this);
-            // Type
-            serializationObject.type = this.getTypeID();
-            // Parent
-            if (this.parent) {
-                serializationObject.parentId = this.parent.id;
-            }
-            // Inclusion / exclusions
-            if (this.excludedMeshes.length > 0) {
-                serializationObject.excludedMeshesIds = [];
-                this.excludedMeshes.forEach(function (mesh) {
-                    serializationObject.excludedMeshesIds.push(mesh.id);
-                });
-            }
-            if (this.includedOnlyMeshes.length > 0) {
-                serializationObject.includedOnlyMeshesIds = [];
-                this.includedOnlyMeshes.forEach(function (mesh) {
-                    serializationObject.includedOnlyMeshesIds.push(mesh.id);
-                });
-            }
-            // Animations  
-            BABYLON.Animation.AppendSerializedAnimations(this, serializationObject);
-            serializationObject.ranges = this.serializeAnimationRanges();
-            return serializationObject;
-        };
-        Light.GetConstructorFromName = function (type, name, scene) {
-            switch (type) {
-                case 0:
-                    return function () { return new BABYLON.PointLight(name, BABYLON.Vector3.Zero(), scene); };
-                case 1:
-                    return function () { return new BABYLON.DirectionalLight(name, BABYLON.Vector3.Zero(), scene); };
-                case 2:
-                    return function () { return new BABYLON.SpotLight(name, BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), 0, 0, scene); };
-                case 3:
-                    return function () { return new BABYLON.HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
-            }
-        };
-        Light.Parse = function (parsedLight, scene) {
-            var light = BABYLON.SerializationHelper.Parse(Light.GetConstructorFromName(parsedLight.type, parsedLight.name, scene), parsedLight, scene);
-            // Inclusion / exclusions
-            if (parsedLight.excludedMeshesIds) {
-                light._excludedMeshesIds = parsedLight.excludedMeshesIds;
-            }
-            if (parsedLight.includedOnlyMeshesIds) {
-                light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;
-            }
-            // Parent
-            if (parsedLight.parentId) {
-                light._waitingParentId = parsedLight.parentId;
-            }
-            // Animations
-            if (parsedLight.animations) {
-                for (var animationIndex = 0; animationIndex < parsedLight.animations.length; animationIndex++) {
-                    var parsedAnimation = parsedLight.animations[animationIndex];
-                    light.animations.push(BABYLON.Animation.Parse(parsedAnimation));
-                }
-                BABYLON.Node.ParseAnimationRanges(light, parsedLight, scene);
-            }
-            if (parsedLight.autoAnimate) {
-                scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);
-            }
-            return light;
-        };
-        //lightmapMode Consts
-        Light._LIGHTMAP_DEFAULT = 0;
-        Light._LIGHTMAP_SPECULAR = 1;
-        Light._LIGHTMAP_SHADOWSONLY = 2;
-        __decorate([
-            BABYLON.serializeAsColor3()
-        ], Light.prototype, "diffuse", void 0);
-        __decorate([
-            BABYLON.serializeAsColor3()
-        ], Light.prototype, "specular", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Light.prototype, "intensity", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Light.prototype, "range", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Light.prototype, "includeOnlyWithLayerMask", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Light.prototype, "excludeWithLayerMask", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Light.prototype, "lightmapMode", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Light.prototype, "radius", void 0);
-        return Light;
-    }(BABYLON.Node));
-    BABYLON.Light = Light;
-})(BABYLON || (BABYLON = {}));

+ 0 - 87
src/Lights/babylon.pointLight.js

@@ -1,87 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-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.getAbsolutePosition = function () {
-            return this.transformedPosition ? this.transformedPosition : this.position;
-        };
-        PointLight.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;
-        };
-        PointLight.prototype.transferToEffect = function (effect, positionUniformName) {
-            if (this.parent && this.parent.getWorldMatrix) {
-                this.computeTransformedPosition();
-                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.needCube = function () {
-            return true;
-        };
-        PointLight.prototype.supportsVSM = function () {
-            return false;
-        };
-        PointLight.prototype.needRefreshPerFrame = function () {
-            return false;
-        };
-        PointLight.prototype.getShadowDirection = function (faceIndex) {
-            switch (faceIndex) {
-                case 0:
-                    return new BABYLON.Vector3(1, 0, 0);
-                case 1:
-                    return new BABYLON.Vector3(-1, 0, 0);
-                case 2:
-                    return new BABYLON.Vector3(0, -1, 0);
-                case 3:
-                    return new BABYLON.Vector3(0, 1, 0);
-                case 4:
-                    return new BABYLON.Vector3(0, 0, 1);
-                case 5:
-                    return new BABYLON.Vector3(0, 0, -1);
-            }
-            return BABYLON.Vector3.Zero();
-        };
-        PointLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {
-            var activeCamera = this.getScene().activeCamera;
-            BABYLON.Matrix.PerspectiveFovLHToRef(Math.PI / 2, 1.0, activeCamera.minZ, activeCamera.maxZ, matrix);
-        };
-        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;
-        };
-        PointLight.prototype.getTypeID = function () {
-            return 0;
-        };
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], PointLight.prototype, "position", void 0);
-        return PointLight;
-    }(BABYLON.Light));
-    BABYLON.PointLight = PointLight;
-})(BABYLON || (BABYLON = {}));

+ 0 - 104
src/Lights/babylon.spotLight.js

@@ -1,104 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-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.getAbsolutePosition = function () {
-            return this.transformedPosition ? this.transformedPosition : this.position;
-        };
-        SpotLight.prototype.setShadowProjectionMatrix = function (matrix, viewMatrix, renderList) {
-            var activeCamera = this.getScene().activeCamera;
-            BABYLON.Matrix.PerspectiveFovLHToRef(this.angle, 1.0, activeCamera.minZ, activeCamera.maxZ, matrix);
-        };
-        SpotLight.prototype.needCube = function () {
-            return false;
-        };
-        SpotLight.prototype.supportsVSM = function () {
-            return true;
-        };
-        SpotLight.prototype.needRefreshPerFrame = function () {
-            return false;
-        };
-        SpotLight.prototype.getShadowDirection = function (faceIndex) {
-            return this.direction;
-        };
-        SpotLight.prototype.setDirectionToTarget = function (target) {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(this.position));
-            return this.direction;
-        };
-        SpotLight.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;
-        };
-        SpotLight.prototype.transferToEffect = function (effect, positionUniformName, directionUniformName) {
-            var normalizeDirection;
-            if (this.parent && this.parent.getWorldMatrix) {
-                if (!this._transformedDirection) {
-                    this._transformedDirection = BABYLON.Vector3.Zero();
-                }
-                this.computeTransformedPosition();
-                BABYLON.Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), 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;
-        };
-        SpotLight.prototype.getTypeID = function () {
-            return 2;
-        };
-        SpotLight.prototype.getRotation = function () {
-            this.direction.normalize();
-            var xaxis = BABYLON.Vector3.Cross(this.direction, BABYLON.Axis.Y);
-            var yaxis = BABYLON.Vector3.Cross(xaxis, this.direction);
-            return BABYLON.Vector3.RotationFromAxis(xaxis, yaxis, this.direction);
-        };
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], SpotLight.prototype, "position", void 0);
-        __decorate([
-            BABYLON.serializeAsVector3()
-        ], SpotLight.prototype, "direction", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], SpotLight.prototype, "angle", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], SpotLight.prototype, "exponent", void 0);
-        return SpotLight;
-    }(BABYLON.Light));
-    BABYLON.SpotLight = SpotLight;
-})(BABYLON || (BABYLON = {}));

+ 0 - 495
src/Loading/Plugins/babylon.babylonFileLoader.js

@@ -1,495 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var Internals;
-    (function (Internals) {
-        var parseMaterialById = function (id, parsedData, scene, rootUrl) {
-            for (var index = 0, cache = parsedData.materials.length; index < cache; index++) {
-                var parsedMaterial = parsedData.materials[index];
-                if (parsedMaterial.id === id) {
-                    return BABYLON.Material.Parse(parsedMaterial, scene, rootUrl);
-                }
-            }
-            return null;
-        };
-        var isDescendantOf = function (mesh, names, hierarchyIds) {
-            names = (names instanceof Array) ? names : [names];
-            for (var i in names) {
-                if (mesh.name === names[i]) {
-                    hierarchyIds.push(mesh.id);
-                    return true;
-                }
-            }
-            if (mesh.parentId && hierarchyIds.indexOf(mesh.parentId) !== -1) {
-                hierarchyIds.push(mesh.id);
-                return true;
-            }
-            return false;
-        };
-        var logOperation = function (operation, producer) {
-            return operation + " of " + (producer ? producer.file + " from " + producer.name + " version: " + producer.version + ", exporter version: " + producer.exporter_version : "unknown");
-        };
-        BABYLON.SceneLoader.RegisterPlugin({
-            extensions: ".babylon",
-            importMesh: function (meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons) {
-                // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
-                // when SceneLoader.debugLogging = true (default), or exception encountered.
-                // Everything stored in var log instead of writing separate lines to support only writing in exception,
-                // and avoid problems with multiple concurrent .babylon loads.
-                var log = "importMesh has failed JSON parse";
-                try {
-                    var parsedData = JSON.parse(data);
-                    log = "";
-                    var fullDetails = BABYLON.SceneLoader.loggingLevel === BABYLON.SceneLoader.DETAILED_LOGGING;
-                    var loadedSkeletonsIds = [];
-                    var loadedMaterialsIds = [];
-                    var hierarchyIds = [];
-                    var index;
-                    var cache;
-                    for (index = 0, cache = parsedData.meshes.length; index < cache; index++) {
-                        var parsedMesh = parsedData.meshes[index];
-                        if (!meshesNames || isDescendantOf(parsedMesh, meshesNames, hierarchyIds)) {
-                            if (meshesNames instanceof Array) {
-                                // Remove found mesh name from list.
-                                delete meshesNames[meshesNames.indexOf(parsedMesh.name)];
-                            }
-                            //Geometry?
-                            if (parsedMesh.geometryId) {
-                                //does the file contain geometries?
-                                if (parsedData.geometries) {
-                                    //find the correct geometry and add it to the scene
-                                    var found = false;
-                                    ["boxes", "spheres", "cylinders", "toruses", "grounds", "planes", "torusKnots", "vertexData"].forEach(function (geometryType) {
-                                        if (found || !parsedData.geometries[geometryType] || !(parsedData.geometries[geometryType] instanceof Array)) {
-                                            return;
-                                        }
-                                        else {
-                                            parsedData.geometries[geometryType].forEach(function (parsedGeometryData) {
-                                                if (parsedGeometryData.id === parsedMesh.geometryId) {
-                                                    switch (geometryType) {
-                                                        case "boxes":
-                                                            BABYLON.Geometry.Primitives.Box.Parse(parsedGeometryData, scene);
-                                                            break;
-                                                        case "spheres":
-                                                            BABYLON.Geometry.Primitives.Sphere.Parse(parsedGeometryData, scene);
-                                                            break;
-                                                        case "cylinders":
-                                                            BABYLON.Geometry.Primitives.Cylinder.Parse(parsedGeometryData, scene);
-                                                            break;
-                                                        case "toruses":
-                                                            BABYLON.Geometry.Primitives.Torus.Parse(parsedGeometryData, scene);
-                                                            break;
-                                                        case "grounds":
-                                                            BABYLON.Geometry.Primitives.Ground.Parse(parsedGeometryData, scene);
-                                                            break;
-                                                        case "planes":
-                                                            BABYLON.Geometry.Primitives.Plane.Parse(parsedGeometryData, scene);
-                                                            break;
-                                                        case "torusKnots":
-                                                            BABYLON.Geometry.Primitives.TorusKnot.Parse(parsedGeometryData, scene);
-                                                            break;
-                                                        case "vertexData":
-                                                            BABYLON.Geometry.Parse(parsedGeometryData, scene, rootUrl);
-                                                            break;
-                                                    }
-                                                    found = true;
-                                                }
-                                            });
-                                        }
-                                    });
-                                    if (!found) {
-                                        BABYLON.Tools.Warn("Geometry not found for mesh " + parsedMesh.id);
-                                    }
-                                }
-                            }
-                            // Material ?
-                            if (parsedMesh.materialId) {
-                                var materialFound = (loadedMaterialsIds.indexOf(parsedMesh.materialId) !== -1);
-                                if (!materialFound && parsedData.multiMaterials) {
-                                    for (var multimatIndex = 0, multimatCache = parsedData.multiMaterials.length; multimatIndex < multimatCache; multimatIndex++) {
-                                        var parsedMultiMaterial = parsedData.multiMaterials[multimatIndex];
-                                        if (parsedMultiMaterial.id === parsedMesh.materialId) {
-                                            for (var matIndex = 0, matCache = parsedMultiMaterial.materials.length; matIndex < matCache; matIndex++) {
-                                                var subMatId = parsedMultiMaterial.materials[matIndex];
-                                                loadedMaterialsIds.push(subMatId);
-                                                var mat = parseMaterialById(subMatId, parsedData, scene, rootUrl);
-                                                log += "\n\tMaterial " + mat.toString(fullDetails);
-                                            }
-                                            loadedMaterialsIds.push(parsedMultiMaterial.id);
-                                            var mmat = BABYLON.Material.ParseMultiMaterial(parsedMultiMaterial, scene);
-                                            materialFound = true;
-                                            log += "\n\tMulti-Material " + mmat.toString(fullDetails);
-                                            break;
-                                        }
-                                    }
-                                }
-                                if (!materialFound) {
-                                    loadedMaterialsIds.push(parsedMesh.materialId);
-                                    var mat = parseMaterialById(parsedMesh.materialId, parsedData, scene, rootUrl);
-                                    if (!mat) {
-                                        BABYLON.Tools.Warn("Material not found for mesh " + parsedMesh.id);
-                                    }
-                                    else {
-                                        log += "\n\tMaterial " + mat.toString(fullDetails);
-                                    }
-                                }
-                            }
-                            // Skeleton ?
-                            if (parsedMesh.skeletonId > -1 && scene.skeletons) {
-                                var skeletonAlreadyLoaded = (loadedSkeletonsIds.indexOf(parsedMesh.skeletonId) > -1);
-                                if (!skeletonAlreadyLoaded) {
-                                    for (var skeletonIndex = 0, skeletonCache = parsedData.skeletons.length; skeletonIndex < skeletonCache; skeletonIndex++) {
-                                        var parsedSkeleton = parsedData.skeletons[skeletonIndex];
-                                        if (parsedSkeleton.id === parsedMesh.skeletonId) {
-                                            var skeleton = BABYLON.Skeleton.Parse(parsedSkeleton, scene);
-                                            skeletons.push(skeleton);
-                                            loadedSkeletonsIds.push(parsedSkeleton.id);
-                                            log += "\n\tSkeleton " + skeleton.toString(fullDetails);
-                                        }
-                                    }
-                                }
-                            }
-                            var mesh = BABYLON.Mesh.Parse(parsedMesh, scene, rootUrl);
-                            meshes.push(mesh);
-                            log += "\n\tMesh " + mesh.toString(fullDetails);
-                        }
-                    }
-                    // Connecting parents
-                    var currentMesh;
-                    for (index = 0, cache = scene.meshes.length; index < cache; index++) {
-                        currentMesh = scene.meshes[index];
-                        if (currentMesh._waitingParentId) {
-                            currentMesh.parent = scene.getLastEntryByID(currentMesh._waitingParentId);
-                            currentMesh._waitingParentId = undefined;
-                        }
-                    }
-                    // freeze and compute world matrix application
-                    for (index = 0, cache = scene.meshes.length; index < cache; index++) {
-                        currentMesh = scene.meshes[index];
-                        if (currentMesh._waitingFreezeWorldMatrix) {
-                            currentMesh.freezeWorldMatrix();
-                            currentMesh._waitingFreezeWorldMatrix = undefined;
-                        }
-                        else {
-                            currentMesh.computeWorldMatrix(true);
-                        }
-                    }
-                    // Particles
-                    if (parsedData.particleSystems) {
-                        for (index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {
-                            var parsedParticleSystem = parsedData.particleSystems[index];
-                            if (hierarchyIds.indexOf(parsedParticleSystem.emitterId) !== -1) {
-                                particleSystems.push(BABYLON.ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl));
-                            }
-                        }
-                    }
-                    return true;
-                }
-                catch (err) {
-                    BABYLON.Tools.Log(logOperation("importMesh", parsedData ? parsedData.producer : "Unknown") + log);
-                    log = null;
-                    throw err;
-                }
-                finally {
-                    if (log !== null && BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.NO_LOGGING) {
-                        BABYLON.Tools.Log(logOperation("importMesh", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
-                    }
-                }
-            },
-            load: function (scene, data, rootUrl) {
-                // Entire method running in try block, so ALWAYS logs as far as it got, only actually writes details
-                // when SceneLoader.debugLogging = true (default), or exception encountered.
-                // Everything stored in var log instead of writing separate lines to support only writing in exception,
-                // and avoid problems with multiple concurrent .babylon loads.
-                var log = "importScene has failed JSON parse";
-                try {
-                    var parsedData = JSON.parse(data);
-                    log = "";
-                    var fullDetails = BABYLON.SceneLoader.loggingLevel === BABYLON.SceneLoader.DETAILED_LOGGING;
-                    // Scene
-                    scene.useDelayedTextureLoading = parsedData.useDelayedTextureLoading && !BABYLON.SceneLoader.ForceFullSceneLoadingForIncremental;
-                    scene.autoClear = parsedData.autoClear;
-                    scene.clearColor = BABYLON.Color4.FromArray(parsedData.clearColor);
-                    scene.ambientColor = BABYLON.Color3.FromArray(parsedData.ambientColor);
-                    if (parsedData.gravity) {
-                        scene.gravity = BABYLON.Vector3.FromArray(parsedData.gravity);
-                    }
-                    // Fog
-                    if (parsedData.fogMode && parsedData.fogMode !== 0) {
-                        scene.fogMode = parsedData.fogMode;
-                        scene.fogColor = BABYLON.Color3.FromArray(parsedData.fogColor);
-                        scene.fogStart = parsedData.fogStart;
-                        scene.fogEnd = parsedData.fogEnd;
-                        scene.fogDensity = parsedData.fogDensity;
-                        log += "\tFog mode for scene:  ";
-                        switch (scene.fogMode) {
-                            // getters not compiling, so using hardcoded
-                            case 1:
-                                log += "exp\n";
-                                break;
-                            case 2:
-                                log += "exp2\n";
-                                break;
-                            case 3:
-                                log += "linear\n";
-                                break;
-                        }
-                    }
-                    //Physics
-                    if (parsedData.physicsEnabled) {
-                        var physicsPlugin;
-                        if (parsedData.physicsEngine === "cannon") {
-                            physicsPlugin = new BABYLON.CannonJSPlugin();
-                        }
-                        else if (parsedData.physicsEngine === "oimo") {
-                            physicsPlugin = new BABYLON.OimoJSPlugin();
-                        }
-                        log = "\tPhysics engine " + (parsedData.physicsEngine ? parsedData.physicsEngine : "oimo") + " enabled\n";
-                        //else - default engine, which is currently oimo
-                        var physicsGravity = parsedData.physicsGravity ? BABYLON.Vector3.FromArray(parsedData.physicsGravity) : null;
-                        scene.enablePhysics(physicsGravity, physicsPlugin);
-                    }
-                    // Metadata
-                    if (parsedData.metadata !== undefined) {
-                        scene.metadata = parsedData.metadata;
-                    }
-                    //collisions, if defined. otherwise, default is true
-                    if (parsedData.collisionsEnabled != undefined) {
-                        scene.collisionsEnabled = parsedData.collisionsEnabled;
-                    }
-                    scene.workerCollisions = !!parsedData.workerCollisions;
-                    var index;
-                    var cache;
-                    // Lights
-                    for (index = 0, cache = parsedData.lights.length; index < cache; index++) {
-                        var parsedLight = parsedData.lights[index];
-                        var light = BABYLON.Light.Parse(parsedLight, scene);
-                        log += (index === 0 ? "\n\tLights:" : "");
-                        log += "\n\t\t" + light.toString(fullDetails);
-                    }
-                    // Animations
-                    if (parsedData.animations) {
-                        for (index = 0, cache = parsedData.animations.length; index < cache; index++) {
-                            var parsedAnimation = parsedData.animations[index];
-                            var animation = BABYLON.Animation.Parse(parsedAnimation);
-                            scene.animations.push(animation);
-                            log += (index === 0 ? "\n\tAnimations:" : "");
-                            log += "\n\t\t" + animation.toString(fullDetails);
-                        }
-                    }
-                    if (parsedData.autoAnimate) {
-                        scene.beginAnimation(scene, parsedData.autoAnimateFrom, parsedData.autoAnimateTo, parsedData.autoAnimateLoop, parsedData.autoAnimateSpeed || 1.0);
-                    }
-                    // Materials
-                    if (parsedData.materials) {
-                        for (index = 0, cache = parsedData.materials.length; index < cache; index++) {
-                            var parsedMaterial = parsedData.materials[index];
-                            var mat = BABYLON.Material.Parse(parsedMaterial, scene, rootUrl);
-                            log += (index === 0 ? "\n\tMaterials:" : "");
-                            log += "\n\t\t" + mat.toString(fullDetails);
-                        }
-                    }
-                    if (parsedData.multiMaterials) {
-                        for (index = 0, cache = parsedData.multiMaterials.length; index < cache; index++) {
-                            var parsedMultiMaterial = parsedData.multiMaterials[index];
-                            var mmat = BABYLON.Material.ParseMultiMaterial(parsedMultiMaterial, scene);
-                            log += (index === 0 ? "\n\tMultiMaterials:" : "");
-                            log += "\n\t\t" + mmat.toString(fullDetails);
-                        }
-                    }
-                    // Skeletons
-                    if (parsedData.skeletons) {
-                        for (index = 0, cache = parsedData.skeletons.length; index < cache; index++) {
-                            var parsedSkeleton = parsedData.skeletons[index];
-                            var skeleton = BABYLON.Skeleton.Parse(parsedSkeleton, scene);
-                            log += (index === 0 ? "\n\tSkeletons:" : "");
-                            log += "\n\t\t" + skeleton.toString(fullDetails);
-                        }
-                    }
-                    // Geometries
-                    var geometries = parsedData.geometries;
-                    if (geometries) {
-                        // Boxes
-                        var boxes = geometries.boxes;
-                        if (boxes) {
-                            for (index = 0, cache = boxes.length; index < cache; index++) {
-                                var parsedBox = boxes[index];
-                                BABYLON.Geometry.Primitives.Box.Parse(parsedBox, scene);
-                            }
-                        }
-                        // Spheres
-                        var spheres = geometries.spheres;
-                        if (spheres) {
-                            for (index = 0, cache = spheres.length; index < cache; index++) {
-                                var parsedSphere = spheres[index];
-                                BABYLON.Geometry.Primitives.Sphere.Parse(parsedSphere, scene);
-                            }
-                        }
-                        // Cylinders
-                        var cylinders = geometries.cylinders;
-                        if (cylinders) {
-                            for (index = 0, cache = cylinders.length; index < cache; index++) {
-                                var parsedCylinder = cylinders[index];
-                                BABYLON.Geometry.Primitives.Cylinder.Parse(parsedCylinder, scene);
-                            }
-                        }
-                        // Toruses
-                        var toruses = geometries.toruses;
-                        if (toruses) {
-                            for (index = 0, cache = toruses.length; index < cache; index++) {
-                                var parsedTorus = toruses[index];
-                                BABYLON.Geometry.Primitives.Torus.Parse(parsedTorus, scene);
-                            }
-                        }
-                        // Grounds
-                        var grounds = geometries.grounds;
-                        if (grounds) {
-                            for (index = 0, cache = grounds.length; index < cache; index++) {
-                                var parsedGround = grounds[index];
-                                BABYLON.Geometry.Primitives.Ground.Parse(parsedGround, scene);
-                            }
-                        }
-                        // Planes
-                        var planes = geometries.planes;
-                        if (planes) {
-                            for (index = 0, cache = planes.length; index < cache; index++) {
-                                var parsedPlane = planes[index];
-                                BABYLON.Geometry.Primitives.Plane.Parse(parsedPlane, scene);
-                            }
-                        }
-                        // TorusKnots
-                        var torusKnots = geometries.torusKnots;
-                        if (torusKnots) {
-                            for (index = 0, cache = torusKnots.length; index < cache; index++) {
-                                var parsedTorusKnot = torusKnots[index];
-                                BABYLON.Geometry.Primitives.TorusKnot.Parse(parsedTorusKnot, scene);
-                            }
-                        }
-                        // VertexData
-                        var vertexData = geometries.vertexData;
-                        if (vertexData) {
-                            for (index = 0, cache = vertexData.length; index < cache; index++) {
-                                var parsedVertexData = vertexData[index];
-                                BABYLON.Geometry.Parse(parsedVertexData, scene, rootUrl);
-                            }
-                        }
-                    }
-                    // Meshes
-                    for (index = 0, cache = parsedData.meshes.length; index < cache; index++) {
-                        var parsedMesh = parsedData.meshes[index];
-                        var mesh = BABYLON.Mesh.Parse(parsedMesh, scene, rootUrl);
-                        log += (index === 0 ? "\n\tMeshes:" : "");
-                        log += "\n\t\t" + mesh.toString(fullDetails);
-                    }
-                    // Cameras
-                    for (index = 0, cache = parsedData.cameras.length; index < cache; index++) {
-                        var parsedCamera = parsedData.cameras[index];
-                        var camera = BABYLON.Camera.Parse(parsedCamera, scene);
-                        log += (index === 0 ? "\n\tCameras:" : "");
-                        log += "\n\t\t" + camera.toString(fullDetails);
-                    }
-                    if (parsedData.activeCameraID) {
-                        scene.setActiveCameraByID(parsedData.activeCameraID);
-                    }
-                    // Browsing all the graph to connect the dots
-                    for (index = 0, cache = scene.cameras.length; index < cache; index++) {
-                        var camera = scene.cameras[index];
-                        if (camera._waitingParentId) {
-                            camera.parent = scene.getLastEntryByID(camera._waitingParentId);
-                            camera._waitingParentId = undefined;
-                        }
-                    }
-                    for (index = 0, cache = scene.lights.length; index < cache; index++) {
-                        var light = scene.lights[index];
-                        if (light._waitingParentId) {
-                            light.parent = scene.getLastEntryByID(light._waitingParentId);
-                            light._waitingParentId = undefined;
-                        }
-                    }
-                    // Sounds
-                    var loadedSounds = [];
-                    var loadedSound;
-                    if (BABYLON.AudioEngine && parsedData.sounds) {
-                        for (index = 0, cache = parsedData.sounds.length; index < cache; index++) {
-                            var parsedSound = parsedData.sounds[index];
-                            if (BABYLON.Engine.audioEngine.canUseWebAudio) {
-                                if (!parsedSound.url)
-                                    parsedSound.url = parsedSound.name;
-                                if (!loadedSounds[parsedSound.url]) {
-                                    loadedSound = BABYLON.Sound.Parse(parsedSound, scene, rootUrl);
-                                    loadedSounds[parsedSound.url] = loadedSound;
-                                }
-                                else {
-                                    BABYLON.Sound.Parse(parsedSound, scene, rootUrl, loadedSounds[parsedSound.url]);
-                                }
-                            }
-                            else {
-                                var emptySound = new BABYLON.Sound(parsedSound.name, null, scene);
-                            }
-                        }
-                    }
-                    loadedSounds = [];
-                    // Connect parents & children and parse actions
-                    for (index = 0, cache = scene.meshes.length; index < cache; index++) {
-                        var mesh = scene.meshes[index];
-                        if (mesh._waitingParentId) {
-                            mesh.parent = scene.getLastEntryByID(mesh._waitingParentId);
-                            mesh._waitingParentId = undefined;
-                        }
-                        if (mesh._waitingActions) {
-                            BABYLON.ActionManager.Parse(mesh._waitingActions, mesh, scene);
-                            mesh._waitingActions = undefined;
-                        }
-                    }
-                    // freeze world matrix application
-                    for (index = 0, cache = scene.meshes.length; index < cache; index++) {
-                        var currentMesh = scene.meshes[index];
-                        if (currentMesh._waitingFreezeWorldMatrix) {
-                            currentMesh.freezeWorldMatrix();
-                            currentMesh._waitingFreezeWorldMatrix = undefined;
-                        }
-                        else {
-                            currentMesh.computeWorldMatrix(true);
-                        }
-                    }
-                    // Particles Systems
-                    if (parsedData.particleSystems) {
-                        for (index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {
-                            var parsedParticleSystem = parsedData.particleSystems[index];
-                            BABYLON.ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);
-                        }
-                    }
-                    // Lens flares
-                    if (parsedData.lensFlareSystems) {
-                        for (index = 0, cache = parsedData.lensFlareSystems.length; index < cache; index++) {
-                            var parsedLensFlareSystem = parsedData.lensFlareSystems[index];
-                            BABYLON.LensFlareSystem.Parse(parsedLensFlareSystem, scene, rootUrl);
-                        }
-                    }
-                    // Shadows
-                    if (parsedData.shadowGenerators) {
-                        for (index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
-                            var parsedShadowGenerator = parsedData.shadowGenerators[index];
-                            BABYLON.ShadowGenerator.Parse(parsedShadowGenerator, scene);
-                        }
-                    }
-                    // Actions (scene)
-                    if (parsedData.actions) {
-                        BABYLON.ActionManager.Parse(parsedData.actions, null, scene);
-                    }
-                    // Finish
-                    return true;
-                }
-                catch (err) {
-                    BABYLON.Tools.Log(logOperation("importScene", parsedData ? parsedData.producer : "Unknown") + log);
-                    log = null;
-                    throw err;
-                }
-                finally {
-                    if (log !== null && BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.NO_LOGGING) {
-                        BABYLON.Tools.Log(logOperation("importScene", parsedData ? parsedData.producer : "Unknown") + (BABYLON.SceneLoader.loggingLevel !== BABYLON.SceneLoader.MINIMAL_LOGGING ? log : ""));
-                    }
-                }
-            }
-        });
-    })(Internals = BABYLON.Internals || (BABYLON.Internals = {}));
-})(BABYLON || (BABYLON = {}));

+ 0 - 290
src/Loading/babylon.sceneLoader.js

@@ -1,290 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var SceneLoader = (function () {
-        function SceneLoader() {
-        }
-        Object.defineProperty(SceneLoader, "NO_LOGGING", {
-            get: function () {
-                return 0;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(SceneLoader, "MINIMAL_LOGGING", {
-            get: function () {
-                return 1;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(SceneLoader, "SUMMARY_LOGGING", {
-            get: function () {
-                return 2;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(SceneLoader, "DETAILED_LOGGING", {
-            get: function () {
-                return 3;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        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
-        });
-        Object.defineProperty(SceneLoader, "loggingLevel", {
-            get: function () {
-                return SceneLoader._loggingLevel;
-            },
-            set: function (value) {
-                SceneLoader._loggingLevel = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        SceneLoader._getDefaultPlugin = function () {
-            return SceneLoader._registeredPlugins[".babylon"];
-        };
-        SceneLoader._getPluginForExtension = function (extension) {
-            var registeredPlugin = SceneLoader._registeredPlugins[extension];
-            if (registeredPlugin) {
-                return registeredPlugin;
-            }
-            return SceneLoader._getDefaultPlugin();
-        };
-        SceneLoader._getPluginForFilename = function (sceneFilename) {
-            if (sceneFilename.name) {
-                sceneFilename = sceneFilename.name;
-            }
-            var dotPosition = sceneFilename.lastIndexOf(".");
-            var queryStringPosition = sceneFilename.indexOf("?");
-            if (queryStringPosition === -1) {
-                queryStringPosition = sceneFilename.length;
-            }
-            var extension = sceneFilename.substring(dotPosition, queryStringPosition).toLowerCase();
-            return SceneLoader._getPluginForExtension(extension);
-        };
-        // use babylon file loader directly if sceneFilename is prefixed with "data:"
-        SceneLoader._getDirectLoad = function (sceneFilename) {
-            if (sceneFilename.substr && sceneFilename.substr(0, 5) === "data:") {
-                return sceneFilename.substr(5);
-            }
-            return null;
-        };
-        // Public functions
-        SceneLoader.GetPluginForExtension = function (extension) {
-            return SceneLoader._getPluginForExtension(extension).plugin;
-        };
-        SceneLoader.RegisterPlugin = function (plugin) {
-            if (typeof plugin.extensions === "string") {
-                var extension = plugin.extensions;
-                SceneLoader._registeredPlugins[extension.toLowerCase()] = {
-                    plugin: plugin,
-                    isBinary: false
-                };
-            }
-            else {
-                var extensions = plugin.extensions;
-                Object.keys(extensions).forEach(function (extension) {
-                    SceneLoader._registeredPlugins[extension.toLowerCase()] = {
-                        plugin: plugin,
-                        isBinary: extensions[extension].isBinary
-                    };
-                });
-            }
-        };
-        SceneLoader.ImportMesh = function (meshesNames, rootUrl, sceneFilename, scene, onsuccess, progressCallBack, onerror) {
-            if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
-                BABYLON.Tools.Error("Wrong sceneFilename parameter");
-                return;
-            }
-            if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
-                BABYLON.Tools.Error("Wrong sceneFilename parameter");
-                return;
-            }
-            var directLoad = SceneLoader._getDirectLoad(sceneFilename);
-            var loadingToken = {};
-            scene._addPendingData(loadingToken);
-            var manifestChecked = function (success) {
-                scene.database = database;
-                var registeredPlugin = directLoad ? SceneLoader._getDefaultPlugin() : SceneLoader._getPluginForFilename(sceneFilename);
-                var plugin = registeredPlugin.plugin;
-                var useArrayBuffer = registeredPlugin.isBinary;
-                var importMeshFromData = function (data) {
-                    var meshes = [];
-                    var particleSystems = [];
-                    var skeletons = [];
-                    try {
-                        if (plugin.importMesh) {
-                            var syncedPlugin = plugin;
-                            if (!syncedPlugin.importMesh(meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons)) {
-                                if (onerror) {
-                                    onerror(scene, 'Unable to import meshes from ' + rootUrl + sceneFilename);
-                                }
-                                scene._removePendingData(loadingToken);
-                                return;
-                            }
-                            if (onsuccess) {
-                                scene.importedMeshesFiles.push(rootUrl + sceneFilename);
-                                onsuccess(meshes, particleSystems, skeletons);
-                                scene._removePendingData(loadingToken);
-                            }
-                        }
-                        else {
-                            var asyncedPlugin = plugin;
-                            asyncedPlugin.importMeshAsync(meshesNames, scene, data, rootUrl, function (meshes, particleSystems, skeletons) {
-                                if (onsuccess) {
-                                    scene.importedMeshesFiles.push(rootUrl + sceneFilename);
-                                    onsuccess(meshes, particleSystems, skeletons);
-                                    scene._removePendingData(loadingToken);
-                                }
-                            }, function () {
-                                if (onerror) {
-                                    onerror(scene, 'Unable to import meshes from ' + rootUrl + sceneFilename);
-                                }
-                                scene._removePendingData(loadingToken);
-                            });
-                        }
-                    }
-                    catch (e) {
-                        if (onerror) {
-                            onerror(scene, 'Unable to import meshes from ' + rootUrl + sceneFilename, e);
-                        }
-                        scene._removePendingData(loadingToken);
-                    }
-                };
-                if (directLoad) {
-                    importMeshFromData(directLoad);
-                    return;
-                }
-                BABYLON.Tools.LoadFile(rootUrl + sceneFilename, function (data) {
-                    importMeshFromData(data);
-                }, progressCallBack, database, useArrayBuffer);
-            };
-            if (scene.getEngine().enableOfflineSupport && !directLoad) {
-                // 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);
-            }
-            else {
-                // If the scene is a data stream or offline support is not enabled, it's a direct load
-                manifestChecked(true);
-            }
-        };
-        /**
-        * 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) {
-            if (sceneFilename.substr && sceneFilename.substr(0, 1) === "/") {
-                BABYLON.Tools.Error("Wrong sceneFilename parameter");
-                return;
-            }
-            var directLoad = SceneLoader._getDirectLoad(sceneFilename);
-            var registeredPlugin = directLoad ? SceneLoader._getDefaultPlugin() : SceneLoader._getPluginForFilename(sceneFilename);
-            var plugin = registeredPlugin.plugin;
-            var useArrayBuffer = registeredPlugin.isBinary;
-            var database;
-            var loadingToken = {};
-            scene._addPendingData(loadingToken);
-            if (SceneLoader.ShowLoadingScreen) {
-                scene.getEngine().displayLoadingUI();
-            }
-            var loadSceneFromData = function (data) {
-                scene.database = database;
-                if (plugin.load) {
-                    var syncedPlugin = plugin;
-                    if (!syncedPlugin.load(scene, data, rootUrl)) {
-                        if (onerror) {
-                            onerror(scene);
-                        }
-                        scene._removePendingData(loadingToken);
-                        scene.getEngine().hideLoadingUI();
-                        return;
-                    }
-                    if (onsuccess) {
-                        onsuccess(scene);
-                    }
-                    scene._removePendingData(loadingToken);
-                }
-                else {
-                    var asyncedPlugin = plugin;
-                    asyncedPlugin.loadAsync(scene, data, rootUrl, function () {
-                        if (onsuccess) {
-                            onsuccess(scene);
-                        }
-                        scene._removePendingData(loadingToken);
-                    }, function () {
-                        if (onerror) {
-                            onerror(scene);
-                        }
-                        scene._removePendingData(loadingToken);
-                        scene.getEngine().hideLoadingUI();
-                    });
-                }
-                if (SceneLoader.ShowLoadingScreen) {
-                    scene.executeWhenReady(function () {
-                        scene.getEngine().hideLoadingUI();
-                    });
-                }
-            };
-            var manifestChecked = function (success) {
-                BABYLON.Tools.LoadFile(rootUrl + sceneFilename, loadSceneFromData, progressCallBack, database, useArrayBuffer);
-            };
-            if (directLoad) {
-                loadSceneFromData(directLoad);
-                return;
-            }
-            if (rootUrl.indexOf("file:") === -1) {
-                if (scene.getEngine().enableOfflineSupport) {
-                    // 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 {
-                    manifestChecked(true);
-                }
-            }
-            else {
-                BABYLON.Tools.ReadFile(sceneFilename, loadSceneFromData, progressCallBack, useArrayBuffer);
-            }
-        };
-        // Flags
-        SceneLoader._ForceFullSceneLoadingForIncremental = false;
-        SceneLoader._ShowLoadingScreen = true;
-        SceneLoader._loggingLevel = SceneLoader.NO_LOGGING;
-        // Members
-        SceneLoader._registeredPlugins = {};
-        return SceneLoader;
-    }());
-    BABYLON.SceneLoader = SceneLoader;
-    ;
-})(BABYLON || (BABYLON = {}));

+ 0 - 124
src/Materials/Textures/Procedurals/babylon.customProceduralTexture.js

@@ -1,124 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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, null, scene, fallbackTexture, generateMipMaps);
-            this._animate = true;
-            this._time = 0;
-            this._texturePath = texturePath;
-            //Try to load json
-            this.loadJson(texturePath);
-            this.refreshRate = 1;
-        }
-        CustomProceduralTexture.prototype.loadJson = function (jsonUrl) {
-            var _this = this;
-            var that = this;
-            function noConfigFile() {
-                BABYLON.Tools.Log("No config file found in " + jsonUrl + " trying to use ShadersStore or DOM element");
-                try {
-                    that.setFragment(that._texturePath);
-                }
-                catch (ex) {
-                    BABYLON.Tools.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture");
-                }
-            }
-            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 {
-                        _this._config = JSON.parse(xhr.response);
-                        _this.updateShaderUniforms();
-                        _this.updateTextures();
-                        _this.setFragment(_this._texturePath + "/custom");
-                        _this._animate = _this._config.animate;
-                        _this.refreshRate = _this._config.refreshrate;
-                    }
-                    catch (ex) {
-                        noConfigFile();
-                    }
-                }
-                else {
-                    noConfigFile();
-                }
-            }, false);
-            xhr.addEventListener("error", function () {
-                noConfigFile();
-            }, false);
-            try {
-                xhr.send();
-            }
-            catch (ex) {
-                BABYLON.Tools.Error("CustomProceduralTexture: Error on XHR send request.");
-            }
-        };
-        CustomProceduralTexture.prototype.isReady = function () {
-            if (!_super.prototype.isReady.call(this)) {
-                return false;
-            }
-            for (var name in this._textures) {
-                var texture = this._textures[name];
-                if (!texture.isReady()) {
-                    return false;
-                }
-            }
-            return true;
-        };
-        CustomProceduralTexture.prototype.render = function (useCameraPostProcess) {
-            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.sampler2Ds.length; i++) {
-                this.setTexture(this._config.sampler2Ds[i].sample2Dname, new BABYLON.Texture(this._texturePath + "/" + this._config.sampler2Ds[i].textureRelativeUrl, this.getScene()));
-            }
-        };
-        CustomProceduralTexture.prototype.updateShaderUniforms = function () {
-            if (this._config) {
-                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;
-                    }
-                }
-            }
-            this.setFloat("time", this._time);
-        };
-        Object.defineProperty(CustomProceduralTexture.prototype, "animate", {
-            get: function () {
-                return this._animate;
-            },
-            set: function (value) {
-                this._animate = value;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        return CustomProceduralTexture;
-    }(BABYLON.ProceduralTexture));
-    BABYLON.CustomProceduralTexture = CustomProceduralTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 284
src/Materials/Textures/Procedurals/babylon.proceduralTexture.js

@@ -1,284 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var ProceduralTexture = (function (_super) {
-        __extends(ProceduralTexture, _super);
-        function ProceduralTexture(name, size, fragment, scene, fallbackTexture, generateMipMaps, isCube) {
-            if (generateMipMaps === void 0) { generateMipMaps = true; }
-            if (isCube === void 0) { isCube = false; }
-            _super.call(this, null, scene, !generateMipMaps);
-            this.isCube = isCube;
-            this.isEnabled = true;
-            this._currentRefreshId = -1;
-            this._refreshRate = 1;
-            this._vertexBuffers = {};
-            this._uniforms = new Array();
-            this._samplers = new Array();
-            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._fallbackTextureUsed = false;
-            scene._proceduralTextures.push(this);
-            this.name = name;
-            this.isRenderTarget = true;
-            this._size = size;
-            this._generateMipMaps = generateMipMaps;
-            this.setFragment(fragment);
-            this._fallbackTexture = fallbackTexture;
-            var engine = scene.getEngine();
-            if (isCube) {
-                this._texture = engine.createRenderTargetCubeTexture(size, { generateMipMaps: generateMipMaps });
-                this.setFloat("face", 0);
-            }
-            else {
-                this._texture = engine.createRenderTargetTexture(size, generateMipMaps);
-            }
-            // VBO
-            var vertices = [];
-            vertices.push(1, 1);
-            vertices.push(-1, 1);
-            vertices.push(-1, -1);
-            vertices.push(1, -1);
-            this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
-            // Indices
-            var indices = [];
-            indices.push(0);
-            indices.push(1);
-            indices.push(2);
-            indices.push(0);
-            indices.push(2);
-            indices.push(3);
-            this._indexBuffer = engine.createIndexBuffer(indices);
-        }
-        ProceduralTexture.prototype.reset = function () {
-            if (this._effect === undefined) {
-                return;
-            }
-            var engine = this.getScene().getEngine();
-            engine._releaseEffect(this._effect);
-        };
-        ProceduralTexture.prototype.isReady = function () {
-            var _this = this;
-            var engine = this.getScene().getEngine();
-            var shaders;
-            if (!this._fragment) {
-                return false;
-            }
-            if (this._fallbackTextureUsed) {
-                return true;
-            }
-            if (this._fragment.fragmentElement !== undefined) {
-                shaders = { vertex: "procedural", fragmentElement: this._fragment.fragmentElement };
-            }
-            else {
-                shaders = { vertex: "procedural", fragment: this._fragment };
-            }
-            this._effect = engine.createEffect(shaders, [BABYLON.VertexBuffer.PositionKind], this._uniforms, this._samplers, "", null, null, function () {
-                _this.releaseInternalTexture();
-                if (_this._fallbackTexture) {
-                    _this._texture = _this._fallbackTexture._texture;
-                    _this._texture.references++;
-                }
-                _this._fallbackTextureUsed = true;
-            });
-            return this._effect.isReady();
-        };
-        ProceduralTexture.prototype.resetRefreshCounter = function () {
-            this._currentRefreshId = -1;
-        };
-        ProceduralTexture.prototype.setFragment = function (fragment) {
-            this._fragment = fragment;
-        };
-        Object.defineProperty(ProceduralTexture.prototype, "refreshRate", {
-            get: function () {
-                return this._refreshRate;
-            },
-            // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
-            set: function (value) {
-                this._refreshRate = value;
-                this.resetRefreshCounter();
-            },
-            enumerable: true,
-            configurable: true
-        });
-        ProceduralTexture.prototype._shouldRender = function () {
-            if (!this.isEnabled || !this.isReady() || !this._texture) {
-                return false;
-            }
-            if (this._fallbackTextureUsed) {
-                return false;
-            }
-            if (this._currentRefreshId === -1) {
-                this._currentRefreshId = 1;
-                return true;
-            }
-            if (this.refreshRate === this._currentRefreshId) {
-                this._currentRefreshId = 1;
-                return true;
-            }
-            this._currentRefreshId++;
-            return false;
-        };
-        ProceduralTexture.prototype.getRenderSize = function () {
-            return this._size;
-        };
-        ProceduralTexture.prototype.resize = function (size, generateMipMaps) {
-            if (this._fallbackTextureUsed) {
-                return;
-            }
-            this.releaseInternalTexture();
-            this._texture = this.getScene().getEngine().createRenderTargetTexture(size, generateMipMaps);
-        };
-        ProceduralTexture.prototype._checkUniform = function (uniformName) {
-            if (this._uniforms.indexOf(uniformName) === -1) {
-                this._uniforms.push(uniformName);
-            }
-        };
-        ProceduralTexture.prototype.setTexture = function (name, texture) {
-            if (this._samplers.indexOf(name) === -1) {
-                this._samplers.push(name);
-            }
-            this._textures[name] = texture;
-            return this;
-        };
-        ProceduralTexture.prototype.setFloat = function (name, value) {
-            this._checkUniform(name);
-            this._floats[name] = value;
-            return this;
-        };
-        ProceduralTexture.prototype.setFloats = function (name, value) {
-            this._checkUniform(name);
-            this._floatsArrays[name] = value;
-            return this;
-        };
-        ProceduralTexture.prototype.setColor3 = function (name, value) {
-            this._checkUniform(name);
-            this._colors3[name] = value;
-            return this;
-        };
-        ProceduralTexture.prototype.setColor4 = function (name, value) {
-            this._checkUniform(name);
-            this._colors4[name] = value;
-            return this;
-        };
-        ProceduralTexture.prototype.setVector2 = function (name, value) {
-            this._checkUniform(name);
-            this._vectors2[name] = value;
-            return this;
-        };
-        ProceduralTexture.prototype.setVector3 = function (name, value) {
-            this._checkUniform(name);
-            this._vectors3[name] = value;
-            return this;
-        };
-        ProceduralTexture.prototype.setMatrix = function (name, value) {
-            this._checkUniform(name);
-            this._matrices[name] = value;
-            return this;
-        };
-        ProceduralTexture.prototype.render = function (useCameraPostProcess) {
-            var scene = this.getScene();
-            var engine = scene.getEngine();
-            // Render
-            engine.enableEffect(this._effect);
-            engine.setState(false);
-            // 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]);
-            }
-            // Floats   
-            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]);
-            }
-            // VBOs
-            engine.bindBuffers(this._vertexBuffers, this._indexBuffer, this._effect);
-            if (this.isCube) {
-                for (var face = 0; face < 6; face++) {
-                    engine.bindFramebuffer(this._texture, face);
-                    this._effect.setFloat("face", face);
-                    // Clear
-                    engine.clear(scene.clearColor, true, true, true);
-                    // Draw order
-                    engine.draw(true, 0, 6);
-                    // Mipmaps
-                    if (face === 5) {
-                        engine.generateMipMapsForCubemap(this._texture);
-                    }
-                }
-            }
-            else {
-                engine.bindFramebuffer(this._texture);
-                // Clear
-                engine.clear(scene.clearColor, true, true, true);
-                // Draw order
-                engine.draw(true, 0, 6);
-            }
-            // Unbind
-            engine.unBindFramebuffer(this._texture, this.isCube);
-            if (this.onGenerated) {
-                this.onGenerated();
-            }
-        };
-        ProceduralTexture.prototype.clone = function () {
-            var textureSize = this.getSize();
-            var newTexture = new ProceduralTexture(this.name, textureSize.width, this._fragment, this.getScene(), this._fallbackTexture, this._generateMipMaps);
-            // Base texture
-            newTexture.hasAlpha = this.hasAlpha;
-            newTexture.level = this.level;
-            // RenderTarget Texture
-            newTexture.coordinatesMode = this.coordinatesMode;
-            return newTexture;
-        };
-        ProceduralTexture.prototype.dispose = function () {
-            var index = this.getScene()._proceduralTextures.indexOf(this);
-            if (index >= 0) {
-                this.getScene()._proceduralTextures.splice(index, 1);
-            }
-            var vertexBuffer = this._vertexBuffers[BABYLON.VertexBuffer.PositionKind];
-            if (vertexBuffer) {
-                vertexBuffer.dispose();
-                this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = null;
-            }
-            if (this._indexBuffer && this.getScene().getEngine()._releaseBuffer(this._indexBuffer)) {
-                this._indexBuffer = null;
-            }
-            _super.prototype.dispose.call(this);
-        };
-        return ProceduralTexture;
-    }(BABYLON.Texture));
-    BABYLON.ProceduralTexture = ProceduralTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 198
src/Materials/Textures/babylon.baseTexture.js

@@ -1,198 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var BaseTexture = (function () {
-        function BaseTexture(scene) {
-            this.hasAlpha = false;
-            this.getAlphaFromRGB = false;
-            this.level = 1;
-            this.coordinatesIndex = 0;
-            this.coordinatesMode = BABYLON.Texture.EXPLICIT_MODE;
-            this.wrapU = BABYLON.Texture.WRAP_ADDRESSMODE;
-            this.wrapV = BABYLON.Texture.WRAP_ADDRESSMODE;
-            this.anisotropicFilteringLevel = 4;
-            this.isCube = false;
-            this.isRenderTarget = false;
-            this.animations = new Array();
-            /**
-            * An event triggered when the texture is disposed.
-            * @type {BABYLON.Observable}
-            */
-            this.onDisposeObservable = new BABYLON.Observable();
-            this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NONE;
-            this._scene = scene;
-            this._scene.textures.push(this);
-            this._uid = null;
-        }
-        Object.defineProperty(BaseTexture.prototype, "uid", {
-            get: function () {
-                if (!this._uid) {
-                    this._uid = BABYLON.Tools.RandomId();
-                }
-                return this._uid;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        BaseTexture.prototype.toString = function () {
-            return this.name;
-        };
-        Object.defineProperty(BaseTexture.prototype, "onDispose", {
-            set: function (callback) {
-                if (this._onDisposeObserver) {
-                    this.onDisposeObservable.remove(this._onDisposeObserver);
-                }
-                this._onDisposeObserver = this.onDisposeObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        BaseTexture.prototype.getScene = function () {
-            return this._scene;
-        };
-        BaseTexture.prototype.getTextureMatrix = function () {
-            return null;
-        };
-        BaseTexture.prototype.getReflectionTextureMatrix = function () {
-            return null;
-        };
-        BaseTexture.prototype.getInternalTexture = function () {
-            return this._texture;
-        };
-        BaseTexture.prototype.isReady = function () {
-            if (this.delayLoadState === BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
-                return true;
-            }
-            if (this._texture) {
-                return this._texture.isReady;
-            }
-            return false;
-        };
-        BaseTexture.prototype.getSize = function () {
-            if (this._texture._width) {
-                return new BABYLON.Size(this._texture._width, this._texture._height);
-            }
-            if (this._texture._size) {
-                return new BABYLON.Size(this._texture._size, this._texture._size);
-            }
-            return BABYLON.Size.Zero();
-        };
-        BaseTexture.prototype.getBaseSize = function () {
-            if (!this.isReady() || !this._texture)
-                return BABYLON.Size.Zero();
-            if (this._texture._size) {
-                return new BABYLON.Size(this._texture._size, this._texture._size);
-            }
-            return new BABYLON.Size(this._texture._baseWidth, this._texture._baseHeight);
-        };
-        BaseTexture.prototype.scale = function (ratio) {
-        };
-        Object.defineProperty(BaseTexture.prototype, "canRescale", {
-            get: function () {
-                return false;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        BaseTexture.prototype._removeFromCache = function (url, noMipmap) {
-            var texturesCache = this._scene.getEngine().getLoadedTexturesCache();
-            for (var index = 0; index < texturesCache.length; index++) {
-                var texturesCacheEntry = texturesCache[index];
-                if (texturesCacheEntry.url === url && texturesCacheEntry.noMipmap === noMipmap) {
-                    texturesCache.splice(index, 1);
-                    return;
-                }
-            }
-        };
-        BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling) {
-            var texturesCache = this._scene.getEngine().getLoadedTexturesCache();
-            for (var index = 0; index < texturesCache.length; index++) {
-                var texturesCacheEntry = texturesCache[index];
-                if (texturesCacheEntry.url === url && texturesCacheEntry.noMipmap === noMipmap) {
-                    if (!sampling || sampling === texturesCacheEntry.samplingMode) {
-                        texturesCacheEntry.references++;
-                        return texturesCacheEntry;
-                    }
-                }
-            }
-            return null;
-        };
-        BaseTexture.prototype.delayLoad = function () {
-        };
-        BaseTexture.prototype.clone = function () {
-            return null;
-        };
-        BaseTexture.prototype.releaseInternalTexture = function () {
-            if (this._texture) {
-                this._scene.getEngine().releaseInternalTexture(this._texture);
-                delete this._texture;
-            }
-        };
-        BaseTexture.prototype.dispose = function () {
-            // Animations
-            this.getScene().stopAnimation(this);
-            // Remove from scene
-            var index = this._scene.textures.indexOf(this);
-            if (index >= 0) {
-                this._scene.textures.splice(index, 1);
-            }
-            if (this._texture === undefined) {
-                return;
-            }
-            // Release
-            this.releaseInternalTexture();
-            // Callback
-            this.onDisposeObservable.notifyObservers(this);
-            this.onDisposeObservable.clear();
-        };
-        BaseTexture.prototype.serialize = function () {
-            if (!this.name) {
-                return null;
-            }
-            var serializationObject = BABYLON.SerializationHelper.Serialize(this);
-            // Animations
-            BABYLON.Animation.AppendSerializedAnimations(this, serializationObject);
-            return serializationObject;
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "name", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "hasAlpha", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "getAlphaFromRGB", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "level", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "coordinatesIndex", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "coordinatesMode", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "wrapU", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "wrapV", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "anisotropicFilteringLevel", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "isCube", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], BaseTexture.prototype, "isRenderTarget", void 0);
-        return BaseTexture;
-    }());
-    BABYLON.BaseTexture = BaseTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 212
src/Materials/Textures/babylon.colorGradingTexture.js

@@ -1,212 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    /**
-     * This represents a color grading texture. This acts as a lookup table LUT, useful during post process
-     * It can help converting any input color in a desired output one. This can then be used to create effects
-     * from sepia, black and white to sixties or futuristic rendering...
-     *
-     * The only supported format is currently 3dl.
-     * More information on LUT: https://en.wikipedia.org/wiki/3D_lookup_table/
-     */
-    var ColorGradingTexture = (function (_super) {
-        __extends(ColorGradingTexture, _super);
-        /**
-         * Instantiates a ColorGradingTexture from the following parameters.
-         *
-         * @param url The location of the color gradind data (currently only supporting 3dl)
-         * @param scene The scene the texture will be used in
-         */
-        function ColorGradingTexture(url, scene) {
-            _super.call(this, scene);
-            if (!url) {
-                return;
-            }
-            this._textureMatrix = BABYLON.Matrix.Identity();
-            this.name = url;
-            this.url = url;
-            this.hasAlpha = false;
-            this.isCube = false;
-            this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this.anisotropicFilteringLevel = 1;
-            this._texture = this._getFromCache(url, true);
-            if (!this._texture) {
-                if (!scene.useDelayedTextureLoading) {
-                    this.loadTexture();
-                }
-                else {
-                    this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
-                }
-            }
-        }
-        /**
-         * Returns the texture matrix used in most of the material.
-         * This is not used in color grading but keep for troubleshooting purpose (easily swap diffuse by colorgrading to look in).
-         */
-        ColorGradingTexture.prototype.getTextureMatrix = function () {
-            return this._textureMatrix;
-        };
-        /**
-         * Occurs when the file being loaded is a .3dl LUT file.
-         */
-        ColorGradingTexture.prototype.load3dlTexture = function () {
-            var _this = this;
-            var mipLevels = 0;
-            var floatArrayView = null;
-            var texture = this.getScene().getEngine().createRawTexture(null, 1, 1, BABYLON.Engine.TEXTUREFORMAT_RGBA, false, false, BABYLON.Texture.BILINEAR_SAMPLINGMODE);
-            this._texture = texture;
-            var callback = function (text) {
-                var data;
-                var tempData;
-                var line;
-                var lines = text.split('\n');
-                var size = 0, pixelIndexW = 0, pixelIndexH = 0, pixelIndexSlice = 0;
-                var maxColor = 0;
-                for (var i = 0; i < lines.length; i++) {
-                    line = lines[i];
-                    if (!ColorGradingTexture._noneEmptyLineRegex.test(line))
-                        continue;
-                    if (line.indexOf('#') === 0)
-                        continue;
-                    var words = line.split(" ");
-                    if (size === 0) {
-                        // Number of space + one
-                        size = words.length;
-                        data = new Uint8Array(size * size * size * 4); // volume texture of side size and rgb 8
-                        tempData = new Float32Array(size * size * size * 4);
-                        continue;
-                    }
-                    if (size != 0) {
-                        var r = Math.max(parseInt(words[0]), 0);
-                        var g = Math.max(parseInt(words[1]), 0);
-                        var b = Math.max(parseInt(words[2]), 0);
-                        maxColor = Math.max(r, maxColor);
-                        maxColor = Math.max(g, maxColor);
-                        maxColor = Math.max(b, maxColor);
-                        var pixelStorageIndex = (pixelIndexW + pixelIndexSlice * size + pixelIndexH * size * size) * 4;
-                        tempData[pixelStorageIndex + 0] = r;
-                        tempData[pixelStorageIndex + 1] = g;
-                        tempData[pixelStorageIndex + 2] = b;
-                        tempData[pixelStorageIndex + 3] = 0;
-                        pixelIndexSlice++;
-                        if (pixelIndexSlice % size == 0) {
-                            pixelIndexH++;
-                            pixelIndexSlice = 0;
-                            if (pixelIndexH % size == 0) {
-                                pixelIndexW++;
-                                pixelIndexH = 0;
-                            }
-                        }
-                    }
-                }
-                for (var i = 0; i < tempData.length; i++) {
-                    var value = tempData[i];
-                    data[i] = (value / maxColor * 255);
-                }
-                _this.getScene().getEngine().updateTextureSize(texture, size * size, size);
-                _this.getScene().getEngine().updateRawTexture(texture, data, BABYLON.Engine.TEXTUREFORMAT_RGBA, false);
-            };
-            BABYLON.Tools.LoadFile(this.url, callback);
-            return this._texture;
-        };
-        /**
-         * Starts the loading process of the texture.
-         */
-        ColorGradingTexture.prototype.loadTexture = function () {
-            if (this.url && this.url.toLocaleLowerCase().indexOf(".3dl") == (this.url.length - 4)) {
-                this.load3dlTexture();
-            }
-        };
-        /**
-         * Clones the color gradind texture.
-         */
-        ColorGradingTexture.prototype.clone = function () {
-            var newTexture = new ColorGradingTexture(this.url, this.getScene());
-            // Base texture
-            newTexture.level = this.level;
-            return newTexture;
-        };
-        /**
-         * Called during delayed load for textures.
-         */
-        ColorGradingTexture.prototype.delayLoad = function () {
-            if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
-                return;
-            }
-            this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
-            this._texture = this._getFromCache(this.url, true);
-            if (!this._texture) {
-                this.loadTexture();
-            }
-        };
-        /**
-        * Binds the color grading to the shader.
-        * @param colorGrading The texture to bind
-        * @param effect The effect to bind to
-        */
-        ColorGradingTexture.Bind = function (colorGrading, effect) {
-            effect.setTexture("cameraColorGrading2DSampler", colorGrading);
-            var x = colorGrading.level; // Texture Level
-            var y = colorGrading.getSize().height; // Texture Size example with 8
-            var z = y - 1.0; // SizeMinusOne 8 - 1
-            var w = 1 / y; // Space of 1 slice 1 / 8
-            effect.setFloat4("vCameraColorGradingInfos", x, y, z, w);
-            var slicePixelSizeU = w / y; // Space of 1 pixel in U direction, e.g. 1/64
-            var slicePixelSizeV = w; // Space of 1 pixel in V direction, e.g. 1/8					    // Space of 1 pixel in V direction, e.g. 1/8
-            var x2 = z * slicePixelSizeU; // Extent of lookup range in U for a single slice so that range corresponds to (size-1) texels, for example 7/64
-            var y2 = z / y; // Extent of lookup range in V for a single slice so that range corresponds to (size-1) texels, for example 7/8
-            var z2 = 0.5 * slicePixelSizeU; // Offset of lookup range in U to align sample position with texel centre, for example 0.5/64 
-            var w2 = 0.5 * slicePixelSizeV; // Offset of lookup range in V to align sample position with texel centre, for example 0.5/8
-            effect.setFloat4("vCameraColorGradingScaleOffset", x2, y2, z2, w2);
-        };
-        /**
-         * Prepare the list of uniforms associated with the ColorGrading effects.
-         * @param uniformsList The list of uniforms used in the effect
-         * @param samplersList The list of samplers used in the effect
-         */
-        ColorGradingTexture.PrepareUniformsAndSamplers = function (uniformsList, samplersList) {
-            uniformsList.push("vCameraColorGradingInfos", "vCameraColorGradingScaleOffset");
-            samplersList.push("cameraColorGrading2DSampler");
-        };
-        /**
-         * Parses a color grading texture serialized by Babylon.
-         * @param parsedTexture The texture information being parsedTexture
-         * @param scene The scene to load the texture in
-         * @param rootUrl The root url of the data assets to load
-         * @return A color gradind texture
-         */
-        ColorGradingTexture.Parse = function (parsedTexture, scene, rootUrl) {
-            var texture = null;
-            if (parsedTexture.name && !parsedTexture.isRenderTarget) {
-                texture = new BABYLON.ColorGradingTexture(parsedTexture.name, scene);
-                texture.name = parsedTexture.name;
-                texture.level = parsedTexture.level;
-            }
-            return texture;
-        };
-        /**
-         * Serializes the LUT texture to json format.
-         */
-        ColorGradingTexture.prototype.serialize = function () {
-            if (!this.name) {
-                return null;
-            }
-            var serializationObject = {};
-            serializationObject.name = this.name;
-            serializationObject.level = this.level;
-            serializationObject.customType = "BABYLON.ColorGradingTexture";
-            return serializationObject;
-        };
-        /**
-         * Empty line regex stored for GC.
-         */
-        ColorGradingTexture._noneEmptyLineRegex = /\S+/;
-        return ColorGradingTexture;
-    }(BABYLON.BaseTexture));
-    BABYLON.ColorGradingTexture = ColorGradingTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 92
src/Materials/Textures/babylon.cubeTexture.js

@@ -1,92 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var CubeTexture = (function (_super) {
-        __extends(CubeTexture, _super);
-        function CubeTexture(rootUrl, scene, extensions, noMipmap, files, onLoad, onError) {
-            if (onLoad === void 0) { onLoad = null; }
-            if (onError === void 0) { onError = null; }
-            _super.call(this, scene);
-            this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
-            this.name = rootUrl;
-            this.url = rootUrl;
-            this._noMipmap = noMipmap;
-            this.hasAlpha = false;
-            if (!rootUrl && !files) {
-                return;
-            }
-            this._texture = this._getFromCache(rootUrl, noMipmap);
-            if (!files) {
-                if (!extensions) {
-                    extensions = ["_px.jpg", "_py.jpg", "_pz.jpg", "_nx.jpg", "_ny.jpg", "_nz.jpg"];
-                }
-                files = [];
-                for (var index = 0; index < extensions.length; index++) {
-                    files.push(rootUrl + extensions[index]);
-                }
-                this._extensions = extensions;
-            }
-            this._files = files;
-            if (!this._texture) {
-                if (!scene.useDelayedTextureLoading) {
-                    this._texture = scene.getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError);
-                }
-                else {
-                    this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
-                }
-            }
-            else if (onLoad) {
-                if (this._texture.isReady) {
-                    BABYLON.Tools.SetImmediate(function () { return onLoad(); });
-                }
-                else {
-                    this._texture.onLoadedCallbacks.push(onLoad);
-                }
-            }
-            this.isCube = true;
-            this._textureMatrix = BABYLON.Matrix.Identity();
-        }
-        CubeTexture.CreateFromImages = function (files, scene, noMipmap) {
-            return new CubeTexture("", scene, null, noMipmap, files);
-        };
-        // Methods
-        CubeTexture.prototype.delayLoad = function () {
-            if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
-                return;
-            }
-            this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
-            this._texture = this._getFromCache(this.url, this._noMipmap);
-            if (!this._texture) {
-                this._texture = this.getScene().getEngine().createCubeTexture(this.url, this.getScene(), this._files, this._noMipmap);
-            }
-        };
-        CubeTexture.prototype.getReflectionTextureMatrix = function () {
-            return this._textureMatrix;
-        };
-        CubeTexture.Parse = function (parsedTexture, scene, rootUrl) {
-            var texture = BABYLON.SerializationHelper.Parse(function () {
-                return new BABYLON.CubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.extensions);
-            }, parsedTexture, scene);
-            // Animations
-            if (parsedTexture.animations) {
-                for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {
-                    var parsedAnimation = parsedTexture.animations[animationIndex];
-                    texture.animations.push(BABYLON.Animation.Parse(parsedAnimation));
-                }
-            }
-            return texture;
-        };
-        CubeTexture.prototype.clone = function () {
-            var _this = this;
-            return BABYLON.SerializationHelper.Clone(function () {
-                return new CubeTexture(_this.url, _this.getScene(), _this._extensions, _this._noMipmap, _this._files);
-            }, this);
-        };
-        return CubeTexture;
-    }(BABYLON.BaseTexture));
-    BABYLON.CubeTexture = CubeTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 93
src/Materials/Textures/babylon.dynamicTexture.js

@@ -1,93 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var DynamicTexture = (function (_super) {
-        __extends(DynamicTexture, _super);
-        function DynamicTexture(name, options, scene, generateMipMaps, samplingMode) {
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            _super.call(this, null, scene, !generateMipMaps);
-            this.name = name;
-            this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._generateMipMaps = generateMipMaps;
-            if (options.getContext) {
-                this._canvas = options;
-                this._texture = scene.getEngine().createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);
-            }
-            else {
-                this._canvas = document.createElement("canvas");
-                if (options.width) {
-                    this._texture = scene.getEngine().createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);
-                }
-                else {
-                    this._texture = scene.getEngine().createDynamicTexture(options, options, generateMipMaps, samplingMode);
-                }
-            }
-            var textureSize = this.getSize();
-            this._canvas.width = textureSize.width;
-            this._canvas.height = textureSize.height;
-            this._context = this._canvas.getContext("2d");
-        }
-        Object.defineProperty(DynamicTexture.prototype, "canRescale", {
-            get: function () {
-                return true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        DynamicTexture.prototype.scale = function (ratio) {
-            var textureSize = this.getSize();
-            textureSize.width *= ratio;
-            textureSize.height *= ratio;
-            this._canvas.width = textureSize.width;
-            this._canvas.height = textureSize.height;
-            this.releaseInternalTexture();
-            this._texture = this.getScene().getEngine().createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this._samplingMode);
-        };
-        DynamicTexture.prototype.getContext = function () {
-            return this._context;
-        };
-        DynamicTexture.prototype.clear = function () {
-            var size = this.getSize();
-            this._context.fillRect(0, 0, size.width, size.height);
-        };
-        DynamicTexture.prototype.update = function (invertY) {
-            this.getScene().getEngine().updateDynamicTexture(this._texture, this._canvas, invertY === undefined ? true : invertY);
-        };
-        DynamicTexture.prototype.drawText = function (text, x, y, font, color, clearColor, invertY, update) {
-            if (update === void 0) { update = true; }
-            var size = this.getSize();
-            if (clearColor) {
-                this._context.fillStyle = clearColor;
-                this._context.fillRect(0, 0, size.width, size.height);
-            }
-            this._context.font = font;
-            if (x === null) {
-                var textSize = this._context.measureText(text);
-                x = (size.width - textSize.width) / 2;
-            }
-            this._context.fillStyle = color;
-            this._context.fillText(text, x, y);
-            if (update) {
-                this.update(invertY);
-            }
-        };
-        DynamicTexture.prototype.clone = function () {
-            var textureSize = this.getSize();
-            var newTexture = new DynamicTexture(this.name, textureSize, this.getScene(), this._generateMipMaps);
-            // Base texture
-            newTexture.hasAlpha = this.hasAlpha;
-            newTexture.level = this.level;
-            // Dynamic Texture
-            newTexture.wrapU = this.wrapU;
-            newTexture.wrapV = this.wrapV;
-            return newTexture;
-        };
-        return DynamicTexture;
-    }(BABYLON.Texture));
-    BABYLON.DynamicTexture = DynamicTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 482
src/Materials/Textures/babylon.fontTexture.js

@@ -1,482 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    /**
-     * This class given information about a given character.
-     */
-    var CharInfo = (function () {
-        function CharInfo() {
-        }
-        return CharInfo;
-    }());
-    BABYLON.CharInfo = CharInfo;
-    var FontTexture = (function (_super) {
-        __extends(FontTexture, _super);
-        /**
-         * Create a new instance of the FontTexture class
-         * @param name the name of the texture
-         * @param font the font to use, use the W3C CSS notation
-         * @param scene the scene that owns the texture
-         * @param maxCharCount the approximative maximum count of characters that could fit in the texture. This is an approximation because most of the fonts are proportional (each char has its own Width). The 'W' character's width is used to compute the size of the texture based on the given maxCharCount
-         * @param samplingMode the texture sampling mode
-         * @param superSample if true the FontTexture will be created with a font of a size twice bigger than the given one but all properties (lineHeight, charWidth, etc.) will be according to the original size. This is made to improve the text quality.
-         */
-        function FontTexture(name, font, scene, maxCharCount, samplingMode, superSample, signedDistanceField) {
-            if (maxCharCount === void 0) { maxCharCount = 200; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            if (superSample === void 0) { superSample = false; }
-            if (signedDistanceField === void 0) { signedDistanceField = false; }
-            _super.call(this, null, scene, true, false, samplingMode);
-            this._charInfos = {};
-            this._curCharCount = 0;
-            this._lastUpdateCharCount = -1;
-            this._usedCounter = 1;
-            this.name = name;
-            this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this._sdfScale = 8;
-            this._signedDistanceField = signedDistanceField;
-            this._superSample = false;
-            // SDF will use supersample no matter what, the resolution is otherwise too poor to produce correct result
-            if (superSample || signedDistanceField) {
-                var sfont = this.getSuperSampleFont(font);
-                if (sfont) {
-                    this._superSample = true;
-                    font = sfont;
-                }
-            }
-            // First canvas creation to determine the size of the texture to create
-            this._canvas = document.createElement("canvas");
-            this._context = this._canvas.getContext("2d");
-            this._context.font = font;
-            this._context.fillStyle = "white";
-            this._context.textBaseline = "top";
-            this._cachedFontId = null;
-            var res = this.getFontHeight(font);
-            this._lineHeightSuper = res.height + 4;
-            this._lineHeight = this._superSample ? (Math.ceil(this._lineHeightSuper / 2)) : this._lineHeightSuper;
-            this._offset = res.offset - 1;
-            this._xMargin = 1 + Math.ceil(this._lineHeightSuper / 15); // Right now this empiric formula seems to work...
-            this._yMargin = this._xMargin;
-            var maxCharWidth = this._context.measureText("W").width;
-            this._spaceWidthSuper = this._context.measureText(" ").width;
-            this._spaceWidth = this._superSample ? (this._spaceWidthSuper / 2) : this._spaceWidthSuper;
-            // This is an approximate size, but should always be able to fit at least the maxCharCount
-            var totalEstSurface = (this._lineHeightSuper + this._yMargin) * (maxCharWidth + this._xMargin) * maxCharCount;
-            var edge = Math.sqrt(totalEstSurface);
-            var textSize = Math.pow(2, Math.ceil(Math.log(edge) / Math.log(2)));
-            // Create the texture that will store the font characters
-            this._texture = scene.getEngine().createDynamicTexture(textSize, textSize, false, samplingMode);
-            var textureSize = this.getSize();
-            this.hasAlpha = this._signedDistanceField === false;
-            // Recreate a new canvas with the final size: the one matching the texture (resizing the previous one doesn't work as one would expect...)
-            this._canvas = document.createElement("canvas");
-            this._canvas.width = textureSize.width;
-            this._canvas.height = textureSize.height;
-            this._context = this._canvas.getContext("2d");
-            this._context.textBaseline = "top";
-            this._context.font = font;
-            this._context.fillStyle = "white";
-            this._context.imageSmoothingEnabled = false;
-            this._context.clearRect(0, 0, textureSize.width, textureSize.height);
-            // Create a canvas for the signed distance field mode, we only have to store one char, the purpose is to render a char scaled _sdfScale times
-            //  into this 2D context, then get the bitmap data, create the sdf char and push the result in the _context (which hold the whole Font Texture content)
-            // So you can see this context as an intermediate one, because it is.
-            if (this._signedDistanceField) {
-                var sdfC = document.createElement("canvas");
-                var s = this._sdfScale;
-                sdfC.width = maxCharWidth * s;
-                sdfC.height = this._lineHeightSuper * s;
-                var sdfCtx = sdfC.getContext("2d");
-                sdfCtx.scale(s, s);
-                sdfCtx.textBaseline = "top";
-                sdfCtx.font = font;
-                sdfCtx.fillStyle = "white";
-                sdfCtx.imageSmoothingEnabled = false;
-                this._sdfCanvas = sdfC;
-                this._sdfContext = sdfCtx;
-            }
-            this._currentFreePosition = BABYLON.Vector2.Zero();
-            // Add the basic ASCII based characters
-            for (var i = 0x20; i < 0x7F; i++) {
-                var c = String.fromCharCode(i);
-                this.getChar(c);
-            }
-            this.update();
-        }
-        Object.defineProperty(FontTexture.prototype, "isSuperSampled", {
-            get: function () {
-                return this._superSample;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(FontTexture.prototype, "isSignedDistanceField", {
-            get: function () {
-                return this._signedDistanceField;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(FontTexture.prototype, "spaceWidth", {
-            get: function () {
-                return this._spaceWidth;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(FontTexture.prototype, "lineHeight", {
-            get: function () {
-                return this._lineHeight;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        FontTexture.GetCachedFontTexture = function (scene, fontName, supersample, signedDistanceField) {
-            if (supersample === void 0) { supersample = false; }
-            if (signedDistanceField === void 0) { signedDistanceField = false; }
-            var s = scene;
-            if (!s.__fontTextureCache__) {
-                s.__fontTextureCache__ = new BABYLON.StringDictionary();
-            }
-            var dic = s.__fontTextureCache__;
-            var lfn = fontName.toLocaleLowerCase() + (supersample ? "_+SS" : "_-SS") + (signedDistanceField ? "_+SDF" : "_-SDF");
-            var ft = dic.get(lfn);
-            if (ft) {
-                ++ft._usedCounter;
-                return ft;
-            }
-            ft = new FontTexture(null, fontName, scene, supersample ? 100 : 200, BABYLON.Texture.BILINEAR_SAMPLINGMODE, supersample, signedDistanceField);
-            ft._cachedFontId = lfn;
-            dic.add(lfn, ft);
-            return ft;
-        };
-        FontTexture.ReleaseCachedFontTexture = function (scene, fontName, supersample, signedDistanceField) {
-            if (supersample === void 0) { supersample = false; }
-            if (signedDistanceField === void 0) { signedDistanceField = false; }
-            var s = scene;
-            var dic = s.__fontTextureCache__;
-            if (!dic) {
-                return;
-            }
-            var lfn = fontName.toLocaleLowerCase() + (supersample ? "_+SS" : "_-SS") + (signedDistanceField ? "_+SDF" : "_-SDF");
-            var font = dic.get(lfn);
-            if (--font._usedCounter === 0) {
-                dic.remove(lfn);
-                font.dispose();
-            }
-        };
-        /**
-         * Make sure the given char is present in the font map.
-         * @param char the character to get or add
-         * @return the CharInfo instance corresponding to the given character
-         */
-        FontTexture.prototype.getChar = function (char) {
-            if (char.length !== 1) {
-                return null;
-            }
-            var info = this._charInfos[char];
-            if (info) {
-                return info;
-            }
-            info = new CharInfo();
-            var measure = this._context.measureText(char);
-            var textureSize = this.getSize();
-            // we reached the end of the current line?
-            var width = Math.round(measure.width);
-            if (this._currentFreePosition.x + width + this._xMargin > textureSize.width) {
-                this._currentFreePosition.x = 0;
-                this._currentFreePosition.y += this._lineHeightSuper + this._yMargin;
-                // No more room?
-                if (this._currentFreePosition.y > textureSize.height) {
-                    return this.getChar("!");
-                }
-            }
-            // In sdf mode we render the character in an intermediate 2D context which scale the character this._sdfScale times (which is required to compute the sdf map accurately)
-            if (this._signedDistanceField) {
-                this._sdfContext.clearRect(0, 0, this._sdfCanvas.width, this._sdfCanvas.height);
-                this._sdfContext.fillText(char, 0, -this._offset);
-                var data = this._sdfContext.getImageData(0, 0, width * this._sdfScale, this._sdfCanvas.height);
-                var res = this._computeSDFChar(data);
-                this._context.putImageData(res, this._currentFreePosition.x, this._currentFreePosition.y);
-            }
-            else {
-                // Draw the character in the HTML canvas
-                this._context.fillText(char, this._currentFreePosition.x, this._currentFreePosition.y - this._offset);
-            }
-            // Fill the CharInfo object
-            info.topLeftUV = new BABYLON.Vector2(this._currentFreePosition.x / textureSize.width, this._currentFreePosition.y / textureSize.height);
-            info.bottomRightUV = new BABYLON.Vector2((this._currentFreePosition.x + width) / textureSize.width, info.topLeftUV.y + ((this._lineHeightSuper + 2) / textureSize.height));
-            if (this._signedDistanceField) {
-                var off = 1 / textureSize.width;
-                info.topLeftUV.addInPlace(new BABYLON.Vector2(off, off));
-                info.bottomRightUV.addInPlace(new BABYLON.Vector2(off, off));
-            }
-            info.charWidth = this._superSample ? (width / 2) : width;
-            // Add the info structure
-            this._charInfos[char] = info;
-            this._curCharCount++;
-            // Set the next position
-            this._currentFreePosition.x += width + this._xMargin;
-            return info;
-        };
-        FontTexture.prototype._computeSDFChar = function (source) {
-            var scl = this._sdfScale;
-            var sw = source.width;
-            var sh = source.height;
-            var dw = sw / scl;
-            var dh = sh / scl;
-            var roffx = 0;
-            var roffy = 0;
-            // We shouldn't look beyond half of the biggest between width and height
-            var radius = scl;
-            var br = radius - 1;
-            var lookupSrc = function (dx, dy, offX, offY, lookVis) {
-                var sx = dx * scl;
-                var sy = dy * scl;
-                // Looking out of the area? return true to make the test going on
-                if (((sx + offX) < 0) || ((sx + offX) >= sw) || ((sy + offY) < 0) || ((sy + offY) >= sh)) {
-                    return true;
-                }
-                // Get the pixel we want
-                var val = source.data[(((sy + offY) * sw) + (sx + offX)) * 4];
-                var res = (val > 0) === lookVis;
-                if (!res) {
-                    roffx = offX;
-                    roffy = offY;
-                }
-                return res;
-            };
-            var lookupArea = function (dx, dy, lookVis) {
-                // Fast rejection test, if we have the same result in N, S, W, E at a distance which is the radius-1 then it means the data will be consistent in this area. That's because we've scale the rendering of the letter "radius" times, so a letter's pixel will be at least radius wide
-                if (lookupSrc(dx, dy, 0, br, lookVis) &&
-                    lookupSrc(dx, dy, 0, -br, lookVis) &&
-                    lookupSrc(dx, dy, -br, 0, lookVis) &&
-                    lookupSrc(dx, dy, br, 0, lookVis)) {
-                    return 0;
-                }
-                for (var i = 1; i <= radius; i++) {
-                    // Quick test N, S, W, E
-                    if (!lookupSrc(dx, dy, 0, i, lookVis) || !lookupSrc(dx, dy, 0, -i, lookVis) || !lookupSrc(dx, dy, -i, 0, lookVis) || !lookupSrc(dx, dy, i, 0, lookVis)) {
-                        return i * i; // Squared Distance is simple to compute in this case
-                    }
-                    // Test the frame area (except the N, S, W, E spots) from the nearest point from the center to the further one
-                    for (var j = 1; j <= i; j++) {
-                        if (!lookupSrc(dx, dy, -j, i, lookVis) || !lookupSrc(dx, dy, j, i, lookVis) ||
-                            !lookupSrc(dx, dy, i, -j, lookVis) || !lookupSrc(dx, dy, i, j, lookVis) ||
-                            !lookupSrc(dx, dy, -j, -i, lookVis) || !lookupSrc(dx, dy, j, -i, lookVis) ||
-                            !lookupSrc(dx, dy, -i, -j, lookVis) || !lookupSrc(dx, dy, -i, j, lookVis)) {
-                            // We found the nearest texel having and opposite state, store the squared length
-                            var res_1 = (i * i) + (j * j);
-                            var count = 1;
-                            // To improve quality we will  sample the texels around this one, so it's 8 samples, we consider only the one having an opposite state, add them to the current res and will will compute the average at the end
-                            if (!lookupSrc(dx, dy, roffx - 1, roffy, lookVis)) {
-                                res_1 += (roffx - 1) * (roffx - 1) + roffy * roffy;
-                                ++count;
-                            }
-                            if (!lookupSrc(dx, dy, roffx + 1, roffy, lookVis)) {
-                                res_1 += (roffx + 1) * (roffx + 1) + roffy * roffy;
-                                ++count;
-                            }
-                            if (!lookupSrc(dx, dy, roffx, roffy - 1, lookVis)) {
-                                res_1 += roffx * roffx + (roffy - 1) * (roffy - 1);
-                                ++count;
-                            }
-                            if (!lookupSrc(dx, dy, roffx, roffy + 1, lookVis)) {
-                                res_1 += roffx * roffx + (roffy + 1) * (roffy + 1);
-                                ++count;
-                            }
-                            if (!lookupSrc(dx, dy, roffx - 1, roffy - 1, lookVis)) {
-                                res_1 += (roffx - 1) * (roffx - 1) + (roffy - 1) * (roffy - 1);
-                                ++count;
-                            }
-                            if (!lookupSrc(dx, dy, roffx + 1, roffy + 1, lookVis)) {
-                                res_1 += (roffx + 1) * (roffx + 1) + (roffy + 1) * (roffy + 1);
-                                ++count;
-                            }
-                            if (!lookupSrc(dx, dy, roffx + 1, roffy - 1, lookVis)) {
-                                res_1 += (roffx + 1) * (roffx + 1) + (roffy - 1) * (roffy - 1);
-                                ++count;
-                            }
-                            if (!lookupSrc(dx, dy, roffx - 1, roffy + 1, lookVis)) {
-                                res_1 += (roffx - 1) * (roffx - 1) + (roffy + 1) * (roffy + 1);
-                                ++count;
-                            }
-                            // Compute the average based on the accumulated distance
-                            return res_1 / count;
-                        }
-                    }
-                }
-                return 0;
-            };
-            var tmp = new Array(dw * dh);
-            for (var y = 0; y < dh; y++) {
-                for (var x = 0; x < dw; x++) {
-                    var curState = lookupSrc(x, y, 0, 0, true);
-                    var d = lookupArea(x, y, curState);
-                    if (d === 0) {
-                        d = radius * radius * 2;
-                    }
-                    tmp[(y * dw) + x] = curState ? d : -d;
-                }
-            }
-            var res = this._context.createImageData(dw, dh);
-            var size = dw * dh;
-            for (var j = 0; j < size; j++) {
-                var d = tmp[j];
-                var sign = (d < 0) ? -1 : 1;
-                d = Math.sqrt(Math.abs(d)) * sign;
-                d *= 127.5 / radius;
-                d += 127.5;
-                if (d < 0) {
-                    d = 0;
-                }
-                else if (d > 255) {
-                    d = 255;
-                }
-                d += 0.5;
-                res.data[j * 4 + 0] = d;
-                res.data[j * 4 + 1] = d;
-                res.data[j * 4 + 2] = d;
-                res.data[j * 4 + 3] = 255;
-            }
-            return res;
-        };
-        FontTexture.prototype.measureText = function (text, tabulationSize) {
-            if (tabulationSize === void 0) { tabulationSize = 4; }
-            var maxWidth = 0;
-            var curWidth = 0;
-            var lineCount = 1;
-            var charxpos = 0;
-            // Parse each char of the string
-            for (var _i = 0, text_1 = text; _i < text_1.length; _i++) {
-                var char = text_1[_i];
-                // Next line feed?
-                if (char === "\n") {
-                    maxWidth = Math.max(maxWidth, curWidth);
-                    charxpos = 0;
-                    curWidth = 0;
-                    ++lineCount;
-                    continue;
-                }
-                // Tabulation ?
-                if (char === "\t") {
-                    var nextPos = charxpos + tabulationSize;
-                    nextPos = nextPos - (nextPos % tabulationSize);
-                    curWidth += (nextPos - charxpos) * this.spaceWidth;
-                    charxpos = nextPos;
-                    continue;
-                }
-                if (char < " ") {
-                    continue;
-                }
-                curWidth += this.getChar(char).charWidth;
-                ++charxpos;
-            }
-            maxWidth = Math.max(maxWidth, curWidth);
-            return new BABYLON.Size(maxWidth, lineCount * this.lineHeight);
-        };
-        FontTexture.prototype.getSuperSampleFont = function (font) {
-            // Eternal thank to http://stackoverflow.com/a/10136041/802124
-            var regex = /^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-,\"\sa-z]+?)\s*$/;
-            var res = font.toLocaleLowerCase().match(regex);
-            if (res == null) {
-                return null;
-            }
-            var size = parseInt(res[4]);
-            res[4] = (size * 2).toString() + (res[4].match(/\D+/) || []).pop();
-            var newFont = "";
-            for (var j = 1; j < res.length; j++) {
-                if (res[j] != null) {
-                    newFont += res[j] + " ";
-                }
-            }
-            return newFont;
-        };
-        // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
-        FontTexture.prototype.getFontHeight = function (font) {
-            var fontDraw = document.createElement("canvas");
-            var ctx = fontDraw.getContext('2d');
-            ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
-            ctx.textBaseline = 'top';
-            ctx.fillStyle = 'white';
-            ctx.font = font;
-            ctx.fillText('jH|', 0, 0);
-            var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
-            var start = -1;
-            var end = -1;
-            for (var row = 0; row < fontDraw.height; row++) {
-                for (var column = 0; column < fontDraw.width; column++) {
-                    var index = (row * fontDraw.width + column) * 4;
-                    if (pixels[index] === 0) {
-                        if (column === fontDraw.width - 1 && start !== -1) {
-                            end = row;
-                            row = fontDraw.height;
-                            break;
-                        }
-                        continue;
-                    }
-                    else {
-                        if (start === -1) {
-                            start = row;
-                        }
-                        break;
-                    }
-                }
-            }
-            return { height: (end - start) + 1, offset: start - 1 };
-        };
-        Object.defineProperty(FontTexture.prototype, "canRescale", {
-            get: function () {
-                return false;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        FontTexture.prototype.getContext = function () {
-            return this._context;
-        };
-        /**
-         * Call this method when you've call getChar() at least one time, this will update the texture if needed.
-         * Don't be afraid to call it, if no new character was added, this method simply does nothing.
-         */
-        FontTexture.prototype.update = function () {
-            // Update only if there's new char added since the previous update
-            if (this._lastUpdateCharCount < this._curCharCount) {
-                this.getScene().getEngine().updateDynamicTexture(this._texture, this._canvas, false, true);
-                this._lastUpdateCharCount = this._curCharCount;
-            }
-        };
-        // cloning should be prohibited, there's no point to duplicate this texture at all
-        FontTexture.prototype.clone = function () {
-            return null;
-        };
-        /**
-         * For FontTexture retrieved using GetCachedFontTexture, use this method when you transfer this object's lifetime to another party in order to share this resource.
-         * When the other party is done with this object, decCachedFontTextureCounter must be called.
-         */
-        FontTexture.prototype.incCachedFontTextureCounter = function () {
-            ++this._usedCounter;
-        };
-        /**
-         * Use this method only in conjunction with incCachedFontTextureCounter, call it when you no longer need to use this shared resource.
-         */
-        FontTexture.prototype.decCachedFontTextureCounter = function () {
-            var s = this.getScene();
-            var dic = s.__fontTextureCache__;
-            if (!dic) {
-                return;
-            }
-            if (--this._usedCounter === 0) {
-                dic.remove(this._cachedFontId);
-                this.dispose();
-            }
-        };
-        return FontTexture;
-    }(BABYLON.Texture));
-    BABYLON.FontTexture = FontTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 448
src/Materials/Textures/babylon.hdrCubeTexture.js

@@ -1,448 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    /**
-     * This represents a texture coming from an HDR input.
-     *
-     * The only supported format is currently panorama picture stored in RGBE format.
-     * Example of such files can be found on HDRLib: http://hdrlib.com/
-     */
-    var HDRCubeTexture = (function (_super) {
-        __extends(HDRCubeTexture, _super);
-        /**
-         * Instantiates an HDRTexture from the following parameters.
-         *
-         * @param url The location of the HDR raw data (Panorama stored in RGBE format)
-         * @param scene The scene the texture will be used in
-         * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
-         * @param noMipmap Forces to not generate the mipmap if true
-         * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
-         * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
-         * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
-         */
-        function HDRCubeTexture(url, scene, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
-            if (noMipmap === void 0) { noMipmap = false; }
-            if (generateHarmonics === void 0) { generateHarmonics = true; }
-            if (useInGammaSpace === void 0) { useInGammaSpace = false; }
-            if (usePMREMGenerator === void 0) { usePMREMGenerator = false; }
-            _super.call(this, scene);
-            this._useInGammaSpace = false;
-            this._generateHarmonics = true;
-            this._isBABYLONPreprocessed = false;
-            /**
-             * The texture coordinates mode. As this texture is stored in a cube format, please modify carefully.
-             */
-            this.coordinatesMode = BABYLON.Texture.CUBIC_MODE;
-            /**
-             * The spherical polynomial data extracted from the texture.
-             */
-            this.sphericalPolynomial = null;
-            /**
-             * Specifies wether the texture has been generated through the PMREMGenerator tool.
-             * This is usefull at run time to apply the good shader.
-             */
-            this.isPMREM = false;
-            if (!url) {
-                return;
-            }
-            this.name = url;
-            this.url = url;
-            this.hasAlpha = false;
-            this.isCube = true;
-            this._textureMatrix = BABYLON.Matrix.Identity();
-            if (size) {
-                this._isBABYLONPreprocessed = false;
-                this._noMipmap = noMipmap;
-                this._size = size;
-                this._useInGammaSpace = useInGammaSpace;
-                this._usePMREMGenerator = usePMREMGenerator &&
-                    scene.getEngine().getCaps().textureLOD &&
-                    this.getScene().getEngine().getCaps().textureFloat &&
-                    !this._useInGammaSpace;
-            }
-            else {
-                this._isBABYLONPreprocessed = true;
-                this._noMipmap = false;
-                this._useInGammaSpace = false;
-                this._usePMREMGenerator = scene.getEngine().getCaps().textureLOD &&
-                    this.getScene().getEngine().getCaps().textureFloat &&
-                    !this._useInGammaSpace;
-            }
-            this.isPMREM = this._usePMREMGenerator;
-            this._texture = this._getFromCache(url, this._noMipmap);
-            if (!this._texture) {
-                if (!scene.useDelayedTextureLoading) {
-                    this.loadTexture();
-                }
-                else {
-                    this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
-                }
-            }
-        }
-        /**
-         * Occurs when the file is a preprocessed .babylon.hdr file.
-         */
-        HDRCubeTexture.prototype.loadBabylonTexture = function () {
-            var _this = this;
-            var mipLevels = 0;
-            var floatArrayView = null;
-            var mipmapGenerator = (!this._useInGammaSpace && this.getScene().getEngine().getCaps().textureFloat) ? function (data) {
-                var mips = [];
-                var startIndex = 30;
-                for (var level = 0; level < mipLevels; level++) {
-                    mips.push([]);
-                    // Fill each pixel of the mip level.
-                    var faceSize = Math.pow(_this._size >> level, 2) * 3;
-                    for (var faceIndex = 0; faceIndex < 6; faceIndex++) {
-                        var faceData = floatArrayView.subarray(startIndex, startIndex + faceSize);
-                        mips[level].push(faceData);
-                        startIndex += faceSize;
-                    }
-                }
-                return mips;
-            } : null;
-            var callback = function (buffer) {
-                // Create Native Array Views
-                var intArrayView = new Int32Array(buffer);
-                floatArrayView = new Float32Array(buffer);
-                // Fill header.
-                var version = intArrayView[0]; // Version 1. (MAy be use in case of format changes for backward compaibility)
-                _this._size = intArrayView[1]; // CubeMap max mip face size.
-                // Update Texture Information.
-                _this.getScene().getEngine().updateTextureSize(_this._texture, _this._size, _this._size);
-                // Fill polynomial information.
-                _this.sphericalPolynomial = new BABYLON.SphericalPolynomial();
-                _this.sphericalPolynomial.x.copyFromFloats(floatArrayView[2], floatArrayView[3], floatArrayView[4]);
-                _this.sphericalPolynomial.y.copyFromFloats(floatArrayView[5], floatArrayView[6], floatArrayView[7]);
-                _this.sphericalPolynomial.z.copyFromFloats(floatArrayView[8], floatArrayView[9], floatArrayView[10]);
-                _this.sphericalPolynomial.xx.copyFromFloats(floatArrayView[11], floatArrayView[12], floatArrayView[13]);
-                _this.sphericalPolynomial.yy.copyFromFloats(floatArrayView[14], floatArrayView[15], floatArrayView[16]);
-                _this.sphericalPolynomial.zz.copyFromFloats(floatArrayView[17], floatArrayView[18], floatArrayView[19]);
-                _this.sphericalPolynomial.xy.copyFromFloats(floatArrayView[20], floatArrayView[21], floatArrayView[22]);
-                _this.sphericalPolynomial.yz.copyFromFloats(floatArrayView[23], floatArrayView[24], floatArrayView[25]);
-                _this.sphericalPolynomial.zx.copyFromFloats(floatArrayView[26], floatArrayView[27], floatArrayView[28]);
-                // Fill pixel data.
-                mipLevels = intArrayView[29]; // Number of mip levels.
-                var startIndex = 30;
-                var data = [];
-                var faceSize = Math.pow(_this._size, 2) * 3;
-                for (var faceIndex = 0; faceIndex < 6; faceIndex++) {
-                    data.push(floatArrayView.subarray(startIndex, startIndex + faceSize));
-                    startIndex += faceSize;
-                }
-                var results = [];
-                var byteArray = null;
-                // Push each faces.
-                for (var k = 0; k < 6; k++) {
-                    var dataFace = null;
-                    // If special cases.
-                    if (!mipmapGenerator) {
-                        var j = ([0, 2, 4, 1, 3, 5])[k]; // Transforms +X+Y+Z... to +X-X+Y-Y... if no mipmapgenerator...
-                        dataFace = data[j];
-                        if (!_this.getScene().getEngine().getCaps().textureFloat) {
-                            // 3 channels of 1 bytes per pixel in bytes.
-                            var byteBuffer = new ArrayBuffer(faceSize);
-                            byteArray = new Uint8Array(byteBuffer);
-                        }
-                        for (var i = 0; i < _this._size * _this._size; i++) {
-                            // Put in gamma space if requested.
-                            if (_this._useInGammaSpace) {
-                                dataFace[(i * 3) + 0] = Math.pow(dataFace[(i * 3) + 0], BABYLON.ToGammaSpace);
-                                dataFace[(i * 3) + 1] = Math.pow(dataFace[(i * 3) + 1], BABYLON.ToGammaSpace);
-                                dataFace[(i * 3) + 2] = Math.pow(dataFace[(i * 3) + 2], BABYLON.ToGammaSpace);
-                            }
-                            // Convert to int texture for fallback.
-                            if (byteArray) {
-                                var r = Math.max(dataFace[(i * 3) + 0] * 255, 0);
-                                var g = Math.max(dataFace[(i * 3) + 1] * 255, 0);
-                                var b = Math.max(dataFace[(i * 3) + 2] * 255, 0);
-                                // May use luminance instead if the result is not accurate.
-                                var max = Math.max(Math.max(r, g), b);
-                                if (max > 255) {
-                                    var scale = 255 / max;
-                                    r *= scale;
-                                    g *= scale;
-                                    b *= scale;
-                                }
-                                byteArray[(i * 3) + 0] = r;
-                                byteArray[(i * 3) + 1] = g;
-                                byteArray[(i * 3) + 2] = b;
-                            }
-                        }
-                    }
-                    else {
-                        dataFace = data[k];
-                    }
-                    // Fill the array accordingly.
-                    if (byteArray) {
-                        results.push(byteArray);
-                    }
-                    else {
-                        results.push(dataFace);
-                    }
-                }
-                return results;
-            };
-            this._texture = this.getScene().getEngine().createRawCubeTexture(this.url, this.getScene(), this._size, BABYLON.Engine.TEXTUREFORMAT_RGB, this.getScene().getEngine().getCaps().textureFloat ? BABYLON.Engine.TEXTURETYPE_FLOAT : BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT, this._noMipmap, callback, mipmapGenerator);
-        };
-        /**
-         * Occurs when the file is raw .hdr file.
-         */
-        HDRCubeTexture.prototype.loadHDRTexture = function () {
-            var _this = this;
-            var callback = function (buffer) {
-                // Extract the raw linear data.
-                var data = BABYLON.Internals.HDRTools.GetCubeMapTextureData(buffer, _this._size);
-                // Generate harmonics if needed.
-                if (_this._generateHarmonics) {
-                    _this.sphericalPolynomial = BABYLON.Internals.CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(data);
-                }
-                var results = [];
-                var byteArray = null;
-                // Push each faces.
-                for (var j = 0; j < 6; j++) {
-                    // Create uintarray fallback.
-                    if (!_this.getScene().getEngine().getCaps().textureFloat) {
-                        // 3 channels of 1 bytes per pixel in bytes.
-                        var byteBuffer = new ArrayBuffer(_this._size * _this._size * 3);
-                        byteArray = new Uint8Array(byteBuffer);
-                    }
-                    var dataFace = data[HDRCubeTexture._facesMapping[j]];
-                    // If special cases.
-                    if (_this._useInGammaSpace || byteArray) {
-                        for (var i = 0; i < _this._size * _this._size; i++) {
-                            // Put in gamma space if requested.
-                            if (_this._useInGammaSpace) {
-                                dataFace[(i * 3) + 0] = Math.pow(dataFace[(i * 3) + 0], BABYLON.ToGammaSpace);
-                                dataFace[(i * 3) + 1] = Math.pow(dataFace[(i * 3) + 1], BABYLON.ToGammaSpace);
-                                dataFace[(i * 3) + 2] = Math.pow(dataFace[(i * 3) + 2], BABYLON.ToGammaSpace);
-                            }
-                            // Convert to int texture for fallback.
-                            if (byteArray) {
-                                var r = Math.max(dataFace[(i * 3) + 0] * 255, 0);
-                                var g = Math.max(dataFace[(i * 3) + 1] * 255, 0);
-                                var b = Math.max(dataFace[(i * 3) + 2] * 255, 0);
-                                // May use luminance instead if the result is not accurate.
-                                var max = Math.max(Math.max(r, g), b);
-                                if (max > 255) {
-                                    var scale = 255 / max;
-                                    r *= scale;
-                                    g *= scale;
-                                    b *= scale;
-                                }
-                                byteArray[(i * 3) + 0] = r;
-                                byteArray[(i * 3) + 1] = g;
-                                byteArray[(i * 3) + 2] = b;
-                            }
-                        }
-                    }
-                    if (byteArray) {
-                        results.push(byteArray);
-                    }
-                    else {
-                        results.push(dataFace);
-                    }
-                }
-                return results;
-            };
-            var mipmapGenerator = null;
-            if (!this._noMipmap &&
-                this._usePMREMGenerator) {
-                mipmapGenerator = function (data) {
-                    // Custom setup of the generator matching with the PBR shader values.
-                    var generator = new BABYLON.Internals.PMREMGenerator(data, _this._size, _this._size, 0, 3, _this.getScene().getEngine().getCaps().textureFloat, 2048, 0.25, false, true);
-                    return generator.filterCubeMap();
-                };
-            }
-            this._texture = this.getScene().getEngine().createRawCubeTexture(this.url, this.getScene(), this._size, BABYLON.Engine.TEXTUREFORMAT_RGB, this.getScene().getEngine().getCaps().textureFloat ? BABYLON.Engine.TEXTURETYPE_FLOAT : BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT, this._noMipmap, callback, mipmapGenerator);
-        };
-        /**
-         * Starts the loading process of the texture.
-         */
-        HDRCubeTexture.prototype.loadTexture = function () {
-            if (this._isBABYLONPreprocessed) {
-                this.loadBabylonTexture();
-            }
-            else {
-                this.loadHDRTexture();
-            }
-        };
-        HDRCubeTexture.prototype.clone = function () {
-            var size = this._isBABYLONPreprocessed ? null : this._size;
-            var newTexture = new HDRCubeTexture(this.url, this.getScene(), size, this._noMipmap, this._generateHarmonics, this._useInGammaSpace, this._usePMREMGenerator);
-            // Base texture
-            newTexture.level = this.level;
-            newTexture.wrapU = this.wrapU;
-            newTexture.wrapV = this.wrapV;
-            newTexture.coordinatesIndex = this.coordinatesIndex;
-            newTexture.coordinatesMode = this.coordinatesMode;
-            return newTexture;
-        };
-        // Methods
-        HDRCubeTexture.prototype.delayLoad = function () {
-            if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
-                return;
-            }
-            this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
-            this._texture = this._getFromCache(this.url, this._noMipmap);
-            if (!this._texture) {
-                this.loadTexture();
-            }
-        };
-        HDRCubeTexture.prototype.getReflectionTextureMatrix = function () {
-            return this._textureMatrix;
-        };
-        HDRCubeTexture.Parse = function (parsedTexture, scene, rootUrl) {
-            var texture = null;
-            if (parsedTexture.name && !parsedTexture.isRenderTarget) {
-                var size = parsedTexture.isBABYLONPreprocessed ? null : parsedTexture.size;
-                texture = new BABYLON.HDRCubeTexture(rootUrl + parsedTexture.name, scene, size, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace, parsedTexture.usePMREMGenerator);
-                texture.name = parsedTexture.name;
-                texture.hasAlpha = parsedTexture.hasAlpha;
-                texture.level = parsedTexture.level;
-                texture.coordinatesMode = parsedTexture.coordinatesMode;
-            }
-            return texture;
-        };
-        HDRCubeTexture.prototype.serialize = function () {
-            if (!this.name) {
-                return null;
-            }
-            var serializationObject = {};
-            serializationObject.name = this.name;
-            serializationObject.hasAlpha = this.hasAlpha;
-            serializationObject.isCube = true;
-            serializationObject.level = this.level;
-            serializationObject.size = this._size;
-            serializationObject.coordinatesMode = this.coordinatesMode;
-            serializationObject.useInGammaSpace = this._useInGammaSpace;
-            serializationObject.generateHarmonics = this._generateHarmonics;
-            serializationObject.usePMREMGenerator = this._usePMREMGenerator;
-            serializationObject.isBABYLONPreprocessed = this._isBABYLONPreprocessed;
-            serializationObject.customType = "BABYLON.HDRCubeTexture";
-            return serializationObject;
-        };
-        /**
-         * Saves as a file the data contained in the texture in a binary format.
-         * This can be used to prevent the long loading tie associated with creating the seamless texture as well
-         * as the spherical used in the lighting.
-         * @param url The HDR file url.
-         * @param size The size of the texture data to generate (one of the cubemap face desired width).
-         * @param onError Method called if any error happens during download.
-         * @return The packed binary data.
-         */
-        HDRCubeTexture.generateBabylonHDROnDisk = function (url, size, onError) {
-            if (onError === void 0) { onError = null; }
-            var callback = function (buffer) {
-                var data = new Blob([buffer], { type: 'application/octet-stream' });
-                // Returns a URL you can use as a href.
-                var objUrl = window.URL.createObjectURL(data);
-                // Simulates a link to it and click to dowload.
-                var a = document.createElement("a");
-                document.body.appendChild(a);
-                a.style.display = "none";
-                a.href = objUrl;
-                a.download = "envmap.babylon.hdr";
-                a.click();
-            };
-            HDRCubeTexture.generateBabylonHDR(url, size, callback, onError);
-        };
-        /**
-         * Serializes the data contained in the texture in a binary format.
-         * This can be used to prevent the long loading tie associated with creating the seamless texture as well
-         * as the spherical used in the lighting.
-         * @param url The HDR file url.
-         * @param size The size of the texture data to generate (one of the cubemap face desired width).
-         * @param onError Method called if any error happens during download.
-         * @return The packed binary data.
-         */
-        HDRCubeTexture.generateBabylonHDR = function (url, size, callback, onError) {
-            if (onError === void 0) { onError = null; }
-            // Needs the url tho create the texture.
-            if (!url) {
-                return null;
-            }
-            // Check Power of two size.
-            if (!BABYLON.Tools.IsExponentOfTwo(size)) {
-                return null;
-            }
-            var getDataCallback = function (dataBuffer) {
-                // Extract the raw linear data.
-                var cubeData = BABYLON.Internals.HDRTools.GetCubeMapTextureData(dataBuffer, size);
-                // Generate harmonics if needed.
-                var sphericalPolynomial = BABYLON.Internals.CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(cubeData);
-                // Generate seamless faces
-                var mipGeneratorArray = [];
-                // Data are known to be in +X +Y +Z -X -Y -Z
-                // mipmmapGenerator data is expected to be order in +X -X +Y -Y +Z -Z
-                mipGeneratorArray.push(cubeData.right); // +X
-                mipGeneratorArray.push(cubeData.left); // -X
-                mipGeneratorArray.push(cubeData.up); // +Y
-                mipGeneratorArray.push(cubeData.down); // -Y
-                mipGeneratorArray.push(cubeData.front); // +Z
-                mipGeneratorArray.push(cubeData.back); // -Z
-                // Custom setup of the generator matching with the PBR shader values.
-                var generator = new BABYLON.Internals.PMREMGenerator(mipGeneratorArray, size, size, 0, 3, true, 2048, 0.25, false, true);
-                var mippedData = generator.filterCubeMap();
-                // Compute required byte length.
-                var byteLength = 1 * 4; // Raw Data Version int32.
-                byteLength += 4; // CubeMap max mip face size int32.
-                byteLength += (9 * 3 * 4); // Spherical polynomial byte length 9 Vector 3 of floats.
-                // Add data size.
-                byteLength += 4; // Number of mip levels int32.
-                for (var level = 0; level < mippedData.length; level++) {
-                    var mipSize = size >> level;
-                    byteLength += (6 * mipSize * mipSize * 3 * 4); // 6 faces of size squared rgb float pixels.
-                }
-                // Prepare binary structure.
-                var buffer = new ArrayBuffer(byteLength);
-                var intArrayView = new Int32Array(buffer);
-                var floatArrayView = new Float32Array(buffer);
-                // Fill header.
-                intArrayView[0] = 1; // Version 1.
-                intArrayView[1] = size; // CubeMap max mip face size.
-                // Fill polynomial information.
-                sphericalPolynomial.x.toArray(floatArrayView, 2);
-                sphericalPolynomial.y.toArray(floatArrayView, 5);
-                sphericalPolynomial.z.toArray(floatArrayView, 8);
-                sphericalPolynomial.xx.toArray(floatArrayView, 11);
-                sphericalPolynomial.yy.toArray(floatArrayView, 14);
-                sphericalPolynomial.zz.toArray(floatArrayView, 17);
-                sphericalPolynomial.xy.toArray(floatArrayView, 20);
-                sphericalPolynomial.yz.toArray(floatArrayView, 23);
-                sphericalPolynomial.zx.toArray(floatArrayView, 26);
-                // Fill pixel data.
-                intArrayView[29] = mippedData.length; // Number of mip levels.
-                var startIndex = 30;
-                for (var level = 0; level < mippedData.length; level++) {
-                    // Fill each pixel of the mip level.
-                    var faceSize = Math.pow(size >> level, 2) * 3;
-                    for (var faceIndex = 0; faceIndex < 6; faceIndex++) {
-                        floatArrayView.set(mippedData[level][faceIndex], startIndex);
-                        startIndex += faceSize;
-                    }
-                }
-                // Callback.
-                callback(buffer);
-            };
-            // Download and process.
-            BABYLON.Tools.LoadFile(url, function (data) {
-                getDataCallback(data);
-            }, null, null, true, onError);
-        };
-        HDRCubeTexture._facesMapping = [
-            "right",
-            "up",
-            "front",
-            "left",
-            "down",
-            "back"
-        ];
-        return HDRCubeTexture;
-    }(BABYLON.BaseTexture));
-    BABYLON.HDRCubeTexture = HDRCubeTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 111
src/Materials/Textures/babylon.mapTexture.js

@@ -1,111 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var MapTexture = (function (_super) {
-        __extends(MapTexture, _super);
-        function MapTexture(name, scene, size, samplingMode, useMipMap) {
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            if (useMipMap === void 0) { useMipMap = false; }
-            _super.call(this, null, scene, !useMipMap, false, samplingMode);
-            this.name = name;
-            this._size = size;
-            this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            // Create the rectPackMap that will allocate portion of the texture
-            this._rectPackingMap = new BABYLON.RectPackingMap(new BABYLON.Size(size.width, size.height));
-            // Create the texture that will store the content
-            this._texture = scene.getEngine().createRenderTargetTexture(size, { generateMipMaps: !this.noMipmap, type: BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT });
-        }
-        /**
-         * Allocate a rectangle of a given size in the texture map
-         * @param size the size of the rectangle to allocation
-         * @return the PackedRect instance corresponding to the allocated rect or null is there was not enough space to allocate it.
-         */
-        MapTexture.prototype.allocateRect = function (size) {
-            return this._rectPackingMap.addRect(size);
-        };
-        /**
-         * Free a given rectangle from the texture map
-         * @param rectInfo the instance corresponding to the rect to free.
-         */
-        MapTexture.prototype.freeRect = function (rectInfo) {
-            if (rectInfo) {
-                rectInfo.freeContent();
-            }
-        };
-        Object.defineProperty(MapTexture.prototype, "freeSpace", {
-            /**
-             * Return the available space in the range of [O;1]. 0 being not space left at all, 1 being an empty texture map.
-             * This is the cumulated space, not the biggest available surface. Due to fragmentation you may not allocate a rect corresponding to this surface.
-             * @returns {}
-             */
-            get: function () {
-                return this._rectPackingMap.freeSpace;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
-         * Bind the texture to the rendering engine to render in the zone of a given rectangle.
-         * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
-         * Don't forget to call unbindTexture when you're done rendering
-         * @param rect the zone to render to
-         * @param clear true to clear the portion's color/depth data
-         */
-        MapTexture.prototype.bindTextureForRect = function (rect, clear) {
-            return this.bindTextureForPosSize(rect.pos, rect.contentSize, clear);
-        };
-        /**
-         * Bind the texture to the rendering engine to render in the zone of the given size at the given position.
-         * Use this method when you want to render into the texture map with a clipspace set to the location and size of the given rect.
-         * Don't forget to call unbindTexture when you're done rendering
-         * @param pos the position into the texture
-         * @param size the portion to fit the clip space to
-         * @param clear true to clear the portion's color/depth data
-         */
-        MapTexture.prototype.bindTextureForPosSize = function (pos, size, clear) {
-            var engine = this.getScene().getEngine();
-            engine.bindFramebuffer(this._texture);
-            this._replacedViewport = engine.setDirectViewport(pos.x, pos.y, size.width, size.height);
-            if (clear) {
-                // We only want to clear the part of the texture we're binding to, only the scissor can help us to achieve that
-                engine.scissorClear(pos.x, pos.y, size.width, size.height, new BABYLON.Color4(0, 0, 0, 0));
-            }
-        };
-        /**
-         * Unbind the texture map from the rendering engine.
-         * Call this method when you're done rendering. A previous call to bindTextureForRect has to be made.
-         * @param dumpForDebug if set to true the content of the texture map will be dumped to a picture file that will be sent to the internet browser.
-         */
-        MapTexture.prototype.unbindTexture = function (dumpForDebug) {
-            // Dump ?
-            if (dumpForDebug) {
-                BABYLON.Tools.DumpFramebuffer(this._size.width, this._size.height, this.getScene().getEngine());
-            }
-            var engine = this.getScene().getEngine();
-            if (this._replacedViewport) {
-                engine.setViewport(this._replacedViewport);
-                this._replacedViewport = null;
-            }
-            engine.unBindFramebuffer(this._texture);
-        };
-        Object.defineProperty(MapTexture.prototype, "canRescale", {
-            get: function () {
-                return false;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        // Note, I don't know what behavior this method should have: clone the underlying texture/rectPackingMap or just reference them?
-        // Anyway, there's not much point to use this method for this kind of texture I guess
-        MapTexture.prototype.clone = function () {
-            return null;
-        };
-        return MapTexture;
-    }(BABYLON.Texture));
-    BABYLON.MapTexture = MapTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 54
src/Materials/Textures/babylon.mirrorTexture.js

@@ -1,54 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var MirrorTexture = (function (_super) {
-        __extends(MirrorTexture, _super);
-        function MirrorTexture(name, size, scene, generateMipMaps) {
-            var _this = this;
-            _super.call(this, name, size, scene, generateMipMaps, true);
-            this.mirrorPlane = new BABYLON.Plane(0, 1, 0, 1);
-            this._transformMatrix = BABYLON.Matrix.Zero();
-            this._mirrorMatrix = BABYLON.Matrix.Zero();
-            this.onBeforeRenderObservable.add(function () {
-                BABYLON.Matrix.ReflectionToRef(_this.mirrorPlane, _this._mirrorMatrix);
-                _this._savedViewMatrix = scene.getViewMatrix();
-                _this._mirrorMatrix.multiplyToRef(_this._savedViewMatrix, _this._transformMatrix);
-                scene.setTransformMatrix(_this._transformMatrix, scene.getProjectionMatrix());
-                scene.clipPlane = _this.mirrorPlane;
-                scene.getEngine().cullBackFaces = false;
-                scene._mirroredCameraPosition = BABYLON.Vector3.TransformCoordinates(scene.activeCamera.position, _this._mirrorMatrix);
-            });
-            this.onAfterRenderObservable.add(function () {
-                scene.setTransformMatrix(_this._savedViewMatrix, scene.getProjectionMatrix());
-                scene.getEngine().cullBackFaces = true;
-                scene._mirroredCameraPosition = null;
-                delete scene.clipPlane;
-            });
-        }
-        MirrorTexture.prototype.clone = function () {
-            var textureSize = this.getSize();
-            var newTexture = new MirrorTexture(this.name, textureSize.width, this.getScene(), this._generateMipMaps);
-            // Base texture
-            newTexture.hasAlpha = this.hasAlpha;
-            newTexture.level = this.level;
-            // Mirror Texture
-            newTexture.mirrorPlane = this.mirrorPlane.clone();
-            newTexture.renderList = this.renderList.slice(0);
-            return newTexture;
-        };
-        MirrorTexture.prototype.serialize = function () {
-            if (!this.name) {
-                return null;
-            }
-            var serializationObject = _super.prototype.serialize.call(this);
-            serializationObject.mirrorPlane = this.mirrorPlane.asArray();
-            return serializationObject;
-        };
-        return MirrorTexture;
-    }(BABYLON.RenderTargetTexture));
-    BABYLON.MirrorTexture = MirrorTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 57
src/Materials/Textures/babylon.rawTexture.js

@@ -1,57 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var RawTexture = (function (_super) {
-        __extends(RawTexture, _super);
-        function RawTexture(data, width, height, format, scene, generateMipMaps, invertY, samplingMode) {
-            if (generateMipMaps === void 0) { generateMipMaps = true; }
-            if (invertY === void 0) { invertY = false; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            _super.call(this, null, scene, !generateMipMaps, invertY);
-            this.format = format;
-            this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode);
-            this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-        }
-        RawTexture.prototype.update = function (data) {
-            this.getScene().getEngine().updateRawTexture(this._texture, data, this.format, this._invertY);
-        };
-        // Statics
-        RawTexture.CreateLuminanceTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
-            if (generateMipMaps === void 0) { generateMipMaps = true; }
-            if (invertY === void 0) { invertY = false; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_LUMINANCE, scene, generateMipMaps, invertY, samplingMode);
-        };
-        RawTexture.CreateLuminanceAlphaTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
-            if (generateMipMaps === void 0) { generateMipMaps = true; }
-            if (invertY === void 0) { invertY = false; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_LUMINANCE_ALPHA, scene, generateMipMaps, invertY, samplingMode);
-        };
-        RawTexture.CreateAlphaTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
-            if (generateMipMaps === void 0) { generateMipMaps = true; }
-            if (invertY === void 0) { invertY = false; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_ALPHA, scene, generateMipMaps, invertY, samplingMode);
-        };
-        RawTexture.CreateRGBTexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
-            if (generateMipMaps === void 0) { generateMipMaps = true; }
-            if (invertY === void 0) { invertY = false; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGB, scene, generateMipMaps, invertY, samplingMode);
-        };
-        RawTexture.CreateRGBATexture = function (data, width, height, scene, generateMipMaps, invertY, samplingMode) {
-            if (generateMipMaps === void 0) { generateMipMaps = true; }
-            if (invertY === void 0) { invertY = false; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            return new RawTexture(data, width, height, BABYLON.Engine.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode);
-        };
-        return RawTexture;
-    }(BABYLON.Texture));
-    BABYLON.RawTexture = RawTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 52
src/Materials/Textures/babylon.refractionTexture.js

@@ -1,52 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    /**
-    * Creates a refraction texture used by refraction channel of the standard material.
-    * @param name the texture name
-    * @param size size of the underlying texture
-    * @param scene root scene
-    */
-    var RefractionTexture = (function (_super) {
-        __extends(RefractionTexture, _super);
-        function RefractionTexture(name, size, scene, generateMipMaps) {
-            var _this = this;
-            _super.call(this, name, size, scene, generateMipMaps, true);
-            this.refractionPlane = new BABYLON.Plane(0, 1, 0, 1);
-            this.depth = 2.0;
-            this.onBeforeRenderObservable.add(function () {
-                scene.clipPlane = _this.refractionPlane;
-            });
-            this.onAfterRenderObservable.add(function () {
-                delete scene.clipPlane;
-            });
-        }
-        RefractionTexture.prototype.clone = function () {
-            var textureSize = this.getSize();
-            var newTexture = new RefractionTexture(this.name, textureSize.width, this.getScene(), this._generateMipMaps);
-            // Base texture
-            newTexture.hasAlpha = this.hasAlpha;
-            newTexture.level = this.level;
-            // Refraction Texture
-            newTexture.refractionPlane = this.refractionPlane.clone();
-            newTexture.renderList = this.renderList.slice(0);
-            newTexture.depth = this.depth;
-            return newTexture;
-        };
-        RefractionTexture.prototype.serialize = function () {
-            if (!this.name) {
-                return null;
-            }
-            var serializationObject = _super.prototype.serialize.call(this);
-            serializationObject.mirrorPlane = this.refractionPlane.asArray();
-            serializationObject.depth = this.depth;
-            return serializationObject;
-        };
-        return RefractionTexture;
-    }(BABYLON.RenderTargetTexture));
-    BABYLON.RefractionTexture = RefractionTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 372
src/Materials/Textures/babylon.renderTargetTexture.js

@@ -1,372 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var RenderTargetTexture = (function (_super) {
-        __extends(RenderTargetTexture, _super);
-        function RenderTargetTexture(name, size, scene, generateMipMaps, doNotChangeAspectRatio, type, isCube, samplingMode, generateDepthBuffer, generateStencilBuffer) {
-            if (doNotChangeAspectRatio === void 0) { doNotChangeAspectRatio = true; }
-            if (type === void 0) { type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
-            if (isCube === void 0) { isCube = false; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            if (generateDepthBuffer === void 0) { generateDepthBuffer = true; }
-            if (generateStencilBuffer === void 0) { generateStencilBuffer = false; }
-            _super.call(this, null, scene, !generateMipMaps);
-            this.isCube = isCube;
-            /**
-            * Use this list to define the list of mesh you want to render.
-            */
-            this.renderList = new Array();
-            this.renderParticles = true;
-            this.renderSprites = false;
-            this.coordinatesMode = BABYLON.Texture.PROJECTION_MODE;
-            // Events
-            /**
-            * An event triggered when the texture is unbind.
-            * @type {BABYLON.Observable}
-            */
-            this.onAfterUnbindObservable = new BABYLON.Observable();
-            /**
-            * An event triggered before rendering the texture
-            * @type {BABYLON.Observable}
-            */
-            this.onBeforeRenderObservable = new BABYLON.Observable();
-            /**
-            * An event triggered after rendering the texture
-            * @type {BABYLON.Observable}
-            */
-            this.onAfterRenderObservable = new BABYLON.Observable();
-            /**
-            * An event triggered after the texture clear
-            * @type {BABYLON.Observable}
-            */
-            this.onClearObservable = new BABYLON.Observable();
-            this._currentRefreshId = -1;
-            this._refreshRate = 1;
-            this.name = name;
-            this.isRenderTarget = true;
-            this._size = size;
-            this._generateMipMaps = generateMipMaps;
-            this._doNotChangeAspectRatio = doNotChangeAspectRatio;
-            if (samplingMode === BABYLON.Texture.NEAREST_SAMPLINGMODE) {
-                this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-                this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-            }
-            if (isCube) {
-                this._texture = scene.getEngine().createRenderTargetCubeTexture(size, {
-                    generateMipMaps: generateMipMaps,
-                    samplingMode: samplingMode,
-                    generateDepthBuffer: generateDepthBuffer,
-                    generateStencilBuffer: generateStencilBuffer
-                });
-                this.coordinatesMode = BABYLON.Texture.INVCUBIC_MODE;
-                this._textureMatrix = BABYLON.Matrix.Identity();
-            }
-            else {
-                this._texture = scene.getEngine().createRenderTargetTexture(size, {
-                    generateMipMaps: generateMipMaps,
-                    type: type,
-                    samplingMode: samplingMode,
-                    generateDepthBuffer: generateDepthBuffer,
-                    generateStencilBuffer: generateStencilBuffer
-                });
-            }
-            // Rendering groups
-            this._renderingManager = new BABYLON.RenderingManager(scene);
-        }
-        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDER_ONCE", {
-            get: function () {
-                return RenderTargetTexture._REFRESHRATE_RENDER_ONCE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDER_ONEVERYFRAME", {
-            get: function () {
-                return RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDER_ONEVERYTWOFRAMES", {
-            get: function () {
-                return RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYTWOFRAMES;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(RenderTargetTexture.prototype, "onAfterUnbind", {
-            set: function (callback) {
-                if (this._onAfterUnbindObserver) {
-                    this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);
-                }
-                this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(RenderTargetTexture.prototype, "onBeforeRender", {
-            set: function (callback) {
-                if (this._onBeforeRenderObserver) {
-                    this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);
-                }
-                this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(RenderTargetTexture.prototype, "onAfterRender", {
-            set: function (callback) {
-                if (this._onAfterRenderObserver) {
-                    this.onAfterRenderObservable.remove(this._onAfterRenderObserver);
-                }
-                this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(RenderTargetTexture.prototype, "onClear", {
-            set: function (callback) {
-                if (this._onClearObserver) {
-                    this.onClearObservable.remove(this._onClearObserver);
-                }
-                this._onClearObserver = this.onClearObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        RenderTargetTexture.prototype.resetRefreshCounter = function () {
-            this._currentRefreshId = -1;
-        };
-        Object.defineProperty(RenderTargetTexture.prototype, "refreshRate", {
-            get: function () {
-                return this._refreshRate;
-            },
-            // Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...
-            set: function (value) {
-                this._refreshRate = value;
-                this.resetRefreshCounter();
-            },
-            enumerable: true,
-            configurable: true
-        });
-        RenderTargetTexture.prototype._shouldRender = function () {
-            if (this._currentRefreshId === -1) {
-                this._currentRefreshId = 1;
-                return true;
-            }
-            if (this.refreshRate === this._currentRefreshId) {
-                this._currentRefreshId = 1;
-                return true;
-            }
-            this._currentRefreshId++;
-            return false;
-        };
-        RenderTargetTexture.prototype.isReady = function () {
-            if (!this.getScene().renderTargetsEnabled) {
-                return false;
-            }
-            return _super.prototype.isReady.call(this);
-        };
-        RenderTargetTexture.prototype.getRenderSize = function () {
-            return this._size;
-        };
-        Object.defineProperty(RenderTargetTexture.prototype, "canRescale", {
-            get: function () {
-                return true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        RenderTargetTexture.prototype.scale = function (ratio) {
-            var newSize = this._size * ratio;
-            this.resize(newSize, this._generateMipMaps);
-        };
-        RenderTargetTexture.prototype.getReflectionTextureMatrix = function () {
-            if (this.isCube) {
-                return this._textureMatrix;
-            }
-            return _super.prototype.getReflectionTextureMatrix.call(this);
-        };
-        RenderTargetTexture.prototype.resize = function (size, generateMipMaps) {
-            this.releaseInternalTexture();
-            if (this.isCube) {
-                this._texture = this.getScene().getEngine().createRenderTargetCubeTexture(size);
-            }
-            else {
-                this._texture = this.getScene().getEngine().createRenderTargetTexture(size, generateMipMaps);
-            }
-        };
-        RenderTargetTexture.prototype.render = function (useCameraPostProcess, dumpForDebug) {
-            var scene = this.getScene();
-            if (this.useCameraPostProcesses !== undefined) {
-                useCameraPostProcess = this.useCameraPostProcesses;
-            }
-            if (this.activeCamera && this.activeCamera !== scene.activeCamera) {
-                scene.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true));
-            }
-            if (this._waitingRenderList) {
-                this.renderList = [];
-                for (var index = 0; index < this._waitingRenderList.length; index++) {
-                    var id = this._waitingRenderList[index];
-                    this.renderList.push(scene.getMeshByID(id));
-                }
-                delete this._waitingRenderList;
-            }
-            // Is predicate defined?
-            if (this.renderListPredicate) {
-                this.renderList.splice(0); // Clear previous renderList
-                var sceneMeshes = this.getScene().meshes;
-                for (var index = 0; index < sceneMeshes.length; index++) {
-                    var mesh = sceneMeshes[index];
-                    if (this.renderListPredicate(mesh)) {
-                        this.renderList.push(mesh);
-                    }
-                }
-            }
-            if (this.renderList && this.renderList.length === 0) {
-                return;
-            }
-            // Prepare renderingManager
-            this._renderingManager.reset();
-            var currentRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;
-            var currentRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;
-            var sceneRenderId = scene.getRenderId();
-            for (var meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {
-                var mesh = currentRenderList[meshIndex];
-                if (mesh) {
-                    if (!mesh.isReady()) {
-                        // Reset _currentRefreshId
-                        this.resetRefreshCounter();
-                        continue;
-                    }
-                    mesh._preActivateForIntermediateRendering(sceneRenderId);
-                    if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && ((mesh.layerMask & scene.activeCamera.layerMask) !== 0)) {
-                        mesh._activate(sceneRenderId);
-                        for (var subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {
-                            var subMesh = mesh.subMeshes[subIndex];
-                            scene._activeIndices.addCount(subMesh.indexCount, false);
-                            this._renderingManager.dispatch(subMesh);
-                        }
-                    }
-                }
-            }
-            if (this.isCube) {
-                for (var face = 0; face < 6; face++) {
-                    this.renderToTarget(face, currentRenderList, currentRenderListLength, useCameraPostProcess, dumpForDebug);
-                    scene.incrementRenderId();
-                    scene.resetCachedMaterial();
-                }
-            }
-            else {
-                this.renderToTarget(0, currentRenderList, currentRenderListLength, useCameraPostProcess, dumpForDebug);
-            }
-            this.onAfterUnbindObservable.notifyObservers(this);
-            if (this.activeCamera && this.activeCamera !== scene.activeCamera) {
-                scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));
-            }
-            scene.resetCachedMaterial();
-        };
-        RenderTargetTexture.prototype.renderToTarget = function (faceIndex, currentRenderList, currentRenderListLength, useCameraPostProcess, dumpForDebug) {
-            var scene = this.getScene();
-            var engine = scene.getEngine();
-            // Bind
-            if (!useCameraPostProcess || !scene.postProcessManager._prepareFrame(this._texture)) {
-                if (this.isCube) {
-                    engine.bindFramebuffer(this._texture, faceIndex);
-                }
-                else {
-                    engine.bindFramebuffer(this._texture);
-                }
-            }
-            this.onBeforeRenderObservable.notifyObservers(faceIndex);
-            // Clear
-            if (this.onClearObservable.hasObservers()) {
-                this.onClearObservable.notifyObservers(engine);
-            }
-            else {
-                engine.clear(scene.clearColor, true, true, true);
-            }
-            if (!this._doNotChangeAspectRatio) {
-                scene.updateTransformMatrix(true);
-            }
-            // Render
-            this._renderingManager.render(this.customRenderFunction, currentRenderList, this.renderParticles, this.renderSprites);
-            if (useCameraPostProcess) {
-                scene.postProcessManager._finalizeFrame(false, this._texture, faceIndex);
-            }
-            if (!this._doNotChangeAspectRatio) {
-                scene.updateTransformMatrix(true);
-            }
-            this.onAfterRenderObservable.notifyObservers(faceIndex);
-            // Dump ?
-            if (dumpForDebug) {
-                BABYLON.Tools.DumpFramebuffer(this._size, this._size, engine);
-            }
-            // Unbind
-            if (!this.isCube || faceIndex === 5) {
-                if (this.isCube) {
-                    if (faceIndex === 5) {
-                        engine.generateMipMapsForCubemap(this._texture);
-                    }
-                }
-                engine.unBindFramebuffer(this._texture, this.isCube);
-            }
-        };
-        /**
-         * Overrides the default sort function applied in the renderging group to prepare the meshes.
-         * This allowed control for front to back rendering or reversly depending of the special needs.
-         *
-         * @param renderingGroupId The rendering group id corresponding to its index
-         * @param opaqueSortCompareFn The opaque queue comparison function use to sort.
-         * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.
-         * @param transparentSortCompareFn The transparent queue comparison function use to sort.
-         */
-        RenderTargetTexture.prototype.setRenderingOrder = function (renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn) {
-            if (opaqueSortCompareFn === void 0) { opaqueSortCompareFn = null; }
-            if (alphaTestSortCompareFn === void 0) { alphaTestSortCompareFn = null; }
-            if (transparentSortCompareFn === void 0) { transparentSortCompareFn = null; }
-            this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);
-        };
-        /**
-         * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.
-         *
-         * @param renderingGroupId The rendering group id corresponding to its index
-         * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.
-         */
-        RenderTargetTexture.prototype.setRenderingAutoClearDepthStencil = function (renderingGroupId, autoClearDepthStencil) {
-            this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);
-        };
-        RenderTargetTexture.prototype.clone = function () {
-            var textureSize = this.getSize();
-            var newTexture = new RenderTargetTexture(this.name, textureSize.width, this.getScene(), this._generateMipMaps);
-            // Base texture
-            newTexture.hasAlpha = this.hasAlpha;
-            newTexture.level = this.level;
-            // RenderTarget Texture
-            newTexture.coordinatesMode = this.coordinatesMode;
-            newTexture.renderList = this.renderList.slice(0);
-            return newTexture;
-        };
-        RenderTargetTexture.prototype.serialize = function () {
-            if (!this.name) {
-                return null;
-            }
-            var serializationObject = _super.prototype.serialize.call(this);
-            serializationObject.renderTargetSize = this.getRenderSize();
-            serializationObject.renderList = [];
-            for (var index = 0; index < this.renderList.length; index++) {
-                serializationObject.renderList.push(this.renderList[index].id);
-            }
-            return serializationObject;
-        };
-        RenderTargetTexture._REFRESHRATE_RENDER_ONCE = 0;
-        RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME = 1;
-        RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;
-        return RenderTargetTexture;
-    }(BABYLON.Texture));
-    BABYLON.RenderTargetTexture = RenderTargetTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 321
src/Materials/Textures/babylon.texture.js

@@ -1,321 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var Texture = (function (_super) {
-        __extends(Texture, _super);
-        function Texture(urlOrList, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer) {
-            var _this = this;
-            if (noMipmap === void 0) { noMipmap = false; }
-            if (invertY === void 0) { invertY = true; }
-            if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
-            if (onLoad === void 0) { onLoad = null; }
-            if (onError === void 0) { onError = null; }
-            if (buffer === void 0) { buffer = null; }
-            if (deleteBuffer === void 0) { deleteBuffer = false; }
-            _super.call(this, scene);
-            this.uOffset = 0;
-            this.vOffset = 0;
-            this.uScale = 1.0;
-            this.vScale = 1.0;
-            this.uAng = 0;
-            this.vAng = 0;
-            this.wAng = 0;
-            var url = ((urlOrList instanceof Array) ? urlOrList[0] : urlOrList);
-            this.name = url;
-            this.url = url;
-            this._delayReloadData = urlOrList;
-            this._noMipmap = noMipmap;
-            this._invertY = invertY;
-            this._samplingMode = samplingMode;
-            this._buffer = buffer;
-            this._deleteBuffer = deleteBuffer;
-            if (!url) {
-                return;
-            }
-            this._texture = this._getFromCache(url, noMipmap, samplingMode);
-            var load = function () {
-                if (_this._onLoadObservarble && _this._onLoadObservarble.hasObservers()) {
-                    _this.onLoadObservable.notifyObservers(true);
-                }
-                if (onLoad) {
-                    onLoad();
-                }
-            };
-            if (!this._texture) {
-                if (!scene.useDelayedTextureLoading) {
-                    this._texture = scene.getEngine().createTexture(urlOrList, noMipmap, invertY, scene, this._samplingMode, load, onError, this._buffer);
-                    if (deleteBuffer) {
-                        delete this._buffer;
-                    }
-                }
-                else {
-                    this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
-                    this._delayedOnLoad = load;
-                    this._delayedOnError = onError;
-                }
-            }
-            else {
-                if (this._texture.isReady) {
-                    BABYLON.Tools.SetImmediate(function () { return load(); });
-                }
-                else {
-                    this._texture.onLoadedCallbacks.push(load);
-                }
-            }
-        }
-        Object.defineProperty(Texture.prototype, "noMipmap", {
-            get: function () {
-                return this._noMipmap;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Texture.prototype.delayLoad = function () {
-            if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
-                return;
-            }
-            this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
-            this._texture = this._getFromCache(this.url, this._noMipmap, this._samplingMode);
-            if (!this._texture) {
-                this._texture = this.getScene().getEngine().createTexture(this._delayReloadData, this._noMipmap, this._invertY, this.getScene(), this._samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer);
-                if (this._deleteBuffer) {
-                    delete this._buffer;
-                }
-            }
-        };
-        Texture.prototype.updateSamplingMode = function (samplingMode) {
-            if (!this._texture) {
-                return;
-            }
-            this._samplingMode = samplingMode;
-            this.getScene().getEngine().updateTextureSamplingMode(samplingMode, this._texture);
-        };
-        Texture.prototype._prepareRowForTextureGeneration = function (x, y, z, t) {
-            x *= this.uScale;
-            y *= this.vScale;
-            x -= 0.5 * this.uScale;
-            y -= 0.5 * this.vScale;
-            z -= 0.5;
-            BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix, t);
-            t.x += 0.5 * this.uScale + this.uOffset;
-            t.y += 0.5 * this.vScale + this.vOffset;
-            t.z += 0.5;
-        };
-        Texture.prototype.getTextureMatrix = function () {
-            if (this.uOffset === this._cachedUOffset &&
-                this.vOffset === this._cachedVOffset &&
-                this.uScale === this._cachedUScale &&
-                this.vScale === this._cachedVScale &&
-                this.uAng === this._cachedUAng &&
-                this.vAng === this._cachedVAng &&
-                this.wAng === this._cachedWAng) {
-                return this._cachedTextureMatrix;
-            }
-            this._cachedUOffset = this.uOffset;
-            this._cachedVOffset = this.vOffset;
-            this._cachedUScale = this.uScale;
-            this._cachedVScale = this.vScale;
-            this._cachedUAng = this.uAng;
-            this._cachedVAng = this.vAng;
-            this._cachedWAng = this.wAng;
-            if (!this._cachedTextureMatrix) {
-                this._cachedTextureMatrix = BABYLON.Matrix.Zero();
-                this._rowGenerationMatrix = new BABYLON.Matrix();
-                this._t0 = BABYLON.Vector3.Zero();
-                this._t1 = BABYLON.Vector3.Zero();
-                this._t2 = BABYLON.Vector3.Zero();
-            }
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix);
-            this._prepareRowForTextureGeneration(0, 0, 0, this._t0);
-            this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1);
-            this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2);
-            this._t1.subtractInPlace(this._t0);
-            this._t2.subtractInPlace(this._t0);
-            BABYLON.Matrix.IdentityToRef(this._cachedTextureMatrix);
-            this._cachedTextureMatrix.m[0] = this._t1.x;
-            this._cachedTextureMatrix.m[1] = this._t1.y;
-            this._cachedTextureMatrix.m[2] = this._t1.z;
-            this._cachedTextureMatrix.m[4] = this._t2.x;
-            this._cachedTextureMatrix.m[5] = this._t2.y;
-            this._cachedTextureMatrix.m[6] = this._t2.z;
-            this._cachedTextureMatrix.m[8] = this._t0.x;
-            this._cachedTextureMatrix.m[9] = this._t0.y;
-            this._cachedTextureMatrix.m[10] = this._t0.z;
-            return this._cachedTextureMatrix;
-        };
-        Texture.prototype.getReflectionTextureMatrix = function () {
-            if (this.uOffset === this._cachedUOffset &&
-                this.vOffset === this._cachedVOffset &&
-                this.uScale === this._cachedUScale &&
-                this.vScale === this._cachedVScale &&
-                this.coordinatesMode === this._cachedCoordinatesMode) {
-                return this._cachedTextureMatrix;
-            }
-            if (!this._cachedTextureMatrix) {
-                this._cachedTextureMatrix = BABYLON.Matrix.Zero();
-                this._projectionModeMatrix = BABYLON.Matrix.Zero();
-            }
-            this._cachedCoordinatesMode = this.coordinatesMode;
-            switch (this.coordinatesMode) {
-                case Texture.PLANAR_MODE:
-                    BABYLON.Matrix.IdentityToRef(this._cachedTextureMatrix);
-                    this._cachedTextureMatrix[0] = this.uScale;
-                    this._cachedTextureMatrix[5] = this.vScale;
-                    this._cachedTextureMatrix[12] = this.uOffset;
-                    this._cachedTextureMatrix[13] = this.vOffset;
-                    break;
-                case Texture.PROJECTION_MODE:
-                    BABYLON.Matrix.IdentityToRef(this._projectionModeMatrix);
-                    this._projectionModeMatrix.m[0] = 0.5;
-                    this._projectionModeMatrix.m[5] = -0.5;
-                    this._projectionModeMatrix.m[10] = 0.0;
-                    this._projectionModeMatrix.m[12] = 0.5;
-                    this._projectionModeMatrix.m[13] = 0.5;
-                    this._projectionModeMatrix.m[14] = 1.0;
-                    this._projectionModeMatrix.m[15] = 1.0;
-                    this.getScene().getProjectionMatrix().multiplyToRef(this._projectionModeMatrix, this._cachedTextureMatrix);
-                    break;
-                default:
-                    BABYLON.Matrix.IdentityToRef(this._cachedTextureMatrix);
-                    break;
-            }
-            return this._cachedTextureMatrix;
-        };
-        Texture.prototype.clone = function () {
-            var _this = this;
-            return BABYLON.SerializationHelper.Clone(function () {
-                return new Texture(_this._texture.url, _this.getScene(), _this._noMipmap, _this._invertY, _this._samplingMode);
-            }, this);
-        };
-        Object.defineProperty(Texture.prototype, "onLoadObservable", {
-            get: function () {
-                if (!this._onLoadObservarble) {
-                    this._onLoadObservarble = new BABYLON.Observable();
-                }
-                return this._onLoadObservarble;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        // Statics
-        Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError) {
-            if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
-            if (onLoad === void 0) { onLoad = null; }
-            if (onError === void 0) { onError = null; }
-            return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data);
-        };
-        Texture.Parse = function (parsedTexture, scene, rootUrl) {
-            if (parsedTexture.customType) {
-                var customTexture = BABYLON.Tools.Instantiate(parsedTexture.customType);
-                return customTexture.Parse(parsedTexture, scene, rootUrl);
-            }
-            if (parsedTexture.isCube) {
-                return BABYLON.CubeTexture.Parse(parsedTexture, scene, rootUrl);
-            }
-            if (!parsedTexture.name && !parsedTexture.isRenderTarget) {
-                return null;
-            }
-            var texture = BABYLON.SerializationHelper.Parse(function () {
-                if (parsedTexture.mirrorPlane) {
-                    var mirrorTexture = new BABYLON.MirrorTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene);
-                    mirrorTexture._waitingRenderList = parsedTexture.renderList;
-                    mirrorTexture.mirrorPlane = BABYLON.Plane.FromArray(parsedTexture.mirrorPlane);
-                    return mirrorTexture;
-                }
-                else if (parsedTexture.isRenderTarget) {
-                    var renderTargetTexture = new BABYLON.RenderTargetTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene);
-                    renderTargetTexture._waitingRenderList = parsedTexture.renderList;
-                    return renderTargetTexture;
-                }
-                else {
-                    var texture;
-                    if (parsedTexture.base64String) {
-                        texture = Texture.CreateFromBase64String(parsedTexture.base64String, parsedTexture.name, scene);
-                    }
-                    else if (parsedTexture.name instanceof Array) {
-                        for (var i = 0, len = parsedTexture.name.length; i < len; i++) {
-                            parsedTexture.name[i] = rootUrl + parsedTexture.name[i];
-                        }
-                        texture = new Texture(parsedTexture.name, scene);
-                    }
-                    else {
-                        texture = new Texture(rootUrl + parsedTexture.name, scene);
-                    }
-                    return texture;
-                }
-            }, parsedTexture, scene);
-            // Animations
-            if (parsedTexture.animations) {
-                for (var animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {
-                    var parsedAnimation = parsedTexture.animations[animationIndex];
-                    texture.animations.push(BABYLON.Animation.Parse(parsedAnimation));
-                }
-            }
-            return texture;
-        };
-        Texture.LoadFromDataString = function (name, buffer, scene, deleteBuffer, noMipmap, invertY, samplingMode, onLoad, onError) {
-            if (deleteBuffer === void 0) { deleteBuffer = false; }
-            if (noMipmap === void 0) { noMipmap = false; }
-            if (invertY === void 0) { invertY = true; }
-            if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
-            if (onLoad === void 0) { onLoad = null; }
-            if (onError === void 0) { onError = null; }
-            if (name.substr(0, 5) !== "data:") {
-                name = "data:" + name;
-            }
-            return new Texture(name, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer);
-        };
-        // Constants
-        Texture.NEAREST_SAMPLINGMODE = 1;
-        Texture.BILINEAR_SAMPLINGMODE = 2;
-        Texture.TRILINEAR_SAMPLINGMODE = 3;
-        Texture.EXPLICIT_MODE = 0;
-        Texture.SPHERICAL_MODE = 1;
-        Texture.PLANAR_MODE = 2;
-        Texture.CUBIC_MODE = 3;
-        Texture.PROJECTION_MODE = 4;
-        Texture.SKYBOX_MODE = 5;
-        Texture.INVCUBIC_MODE = 6;
-        Texture.EQUIRECTANGULAR_MODE = 7;
-        Texture.FIXED_EQUIRECTANGULAR_MODE = 8;
-        Texture.CLAMP_ADDRESSMODE = 0;
-        Texture.WRAP_ADDRESSMODE = 1;
-        Texture.MIRROR_ADDRESSMODE = 2;
-        __decorate([
-            BABYLON.serialize()
-        ], Texture.prototype, "url", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Texture.prototype, "uOffset", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Texture.prototype, "vOffset", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Texture.prototype, "uScale", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Texture.prototype, "vScale", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Texture.prototype, "uAng", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Texture.prototype, "vAng", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Texture.prototype, "wAng", void 0);
-        return Texture;
-    }(BABYLON.BaseTexture));
-    BABYLON.Texture = Texture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 83
src/Materials/Textures/babylon.videoTexture.js

@@ -1,83 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var BABYLON;
-(function (BABYLON) {
-    var VideoTexture = (function (_super) {
-        __extends(VideoTexture, _super);
-        /**
-         * Creates a video texture.
-         * Sample : https://doc.babylonjs.com/tutorials/01._Advanced_Texturing
-         * @param {Array} urlsOrVideo can be used to provide an array of urls or an already setup HTML video element.
-         * @param {BABYLON.Scene} scene is obviously the current scene.
-         * @param {boolean} generateMipMaps can be used to turn on mipmaps (Can be expensive for videoTextures because they are often updated).
-         * @param {boolean} invertY is false by default but can be used to invert video on Y axis
-         * @param {number} samplingMode controls the sampling method and is set to TRILINEAR_SAMPLINGMODE by default
-         */
-        function VideoTexture(name, urlsOrVideo, scene, generateMipMaps, invertY, samplingMode) {
-            var _this = this;
-            if (generateMipMaps === void 0) { generateMipMaps = false; }
-            if (invertY === void 0) { invertY = false; }
-            if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
-            _super.call(this, null, scene, !generateMipMaps, invertY);
-            this._autoLaunch = true;
-            var urls;
-            this.name = name;
-            if (urlsOrVideo instanceof HTMLVideoElement) {
-                this.video = urlsOrVideo;
-            }
-            else {
-                urls = urlsOrVideo;
-                this.video = document.createElement("video");
-                this.video.autoplay = false;
-                this.video.loop = true;
-            }
-            this._generateMipMaps = generateMipMaps;
-            this._samplingMode = samplingMode;
-            if (BABYLON.Tools.IsExponentOfTwo(this.video.videoWidth) && BABYLON.Tools.IsExponentOfTwo(this.video.videoHeight)) {
-                this.wrapU = BABYLON.Texture.WRAP_ADDRESSMODE;
-                this.wrapV = BABYLON.Texture.WRAP_ADDRESSMODE;
-            }
-            else {
-                this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-                this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-                this._generateMipMaps = false;
-            }
-            if (urls) {
-                this.video.addEventListener("canplaythrough", function () {
-                    _this._createTexture();
-                });
-                urls.forEach(function (url) {
-                    var source = document.createElement("source");
-                    source.src = url;
-                    _this.video.appendChild(source);
-                });
-            }
-            else {
-                this._createTexture();
-            }
-            this._lastUpdate = BABYLON.Tools.Now;
-        }
-        VideoTexture.prototype._createTexture = function () {
-            this._texture = this.getScene().getEngine().createDynamicTexture(this.video.videoWidth, this.video.videoHeight, this._generateMipMaps, this._samplingMode);
-            this._texture.isReady = true;
-        };
-        VideoTexture.prototype.update = function () {
-            if (this._autoLaunch) {
-                this._autoLaunch = false;
-                this.video.play();
-            }
-            var now = BABYLON.Tools.Now;
-            if (now - this._lastUpdate < 15 || this.video.readyState !== this.video.HAVE_ENOUGH_DATA) {
-                return false;
-            }
-            this._lastUpdate = now;
-            this.getScene().getEngine().updateVideoTexture(this._texture, this.video, this._invertY);
-            return true;
-        };
-        return VideoTexture;
-    }(BABYLON.Texture));
-    BABYLON.VideoTexture = VideoTexture;
-})(BABYLON || (BABYLON = {}));

+ 0 - 545
src/Materials/babylon.colorCurves.js

@@ -1,545 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    /**
-     * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
-     * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
-     * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
-     * corresponding to low luminance, medium luminance, and high luminance areas respectively.
-     */
-    var ColorCurves = (function () {
-        function ColorCurves() {
-            this._dirty = true;
-            this._tempColor = new BABYLON.Color4(0, 0, 0, 0);
-            this._globalCurve = new BABYLON.Color4(0, 0, 0, 0);
-            this._highlightsCurve = new BABYLON.Color4(0, 0, 0, 0);
-            this._midtonesCurve = new BABYLON.Color4(0, 0, 0, 0);
-            this._shadowsCurve = new BABYLON.Color4(0, 0, 0, 0);
-            this._positiveCurve = new BABYLON.Color4(0, 0, 0, 0);
-            this._negativeCurve = new BABYLON.Color4(0, 0, 0, 0);
-            this._globalHue = 30;
-            this._globalDensity = 0;
-            this._globalSaturation = 0;
-            this._globalExposure = 0;
-            this._highlightsHue = 30;
-            this._highlightsDensity = 0;
-            this._highlightsSaturation = 0;
-            this._highlightsExposure = 0;
-            this._midtonesHue = 30;
-            this._midtonesDensity = 0;
-            this._midtonesSaturation = 0;
-            this._midtonesExposure = 0;
-            this._shadowsHue = 30;
-            this._shadowsDensity = 0;
-            this._shadowsSaturation = 0;
-            this._shadowsExposure = 0;
-        }
-        Object.defineProperty(ColorCurves.prototype, "GlobalHue", {
-            /**
-             * Gets the global Hue value.
-             * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
-             */
-            get: function () {
-                return this._globalHue;
-            },
-            /**
-             * Sets the global Hue value.
-             * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
-             */
-            set: function (value) {
-                this._globalHue = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "GlobalDensity", {
-            /**
-             * Gets the global Density value.
-             * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
-             * Values less than zero provide a filter of opposite hue.
-             */
-            get: function () {
-                return this._globalDensity;
-            },
-            /**
-             * Sets the global Density value.
-             * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
-             * Values less than zero provide a filter of opposite hue.
-             */
-            set: function (value) {
-                this._globalDensity = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "GlobalSaturation", {
-            /**
-             * Gets the global Saturation value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
-             */
-            get: function () {
-                return this._globalSaturation;
-            },
-            /**
-             * Sets the global Saturation value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
-             */
-            set: function (value) {
-                this._globalSaturation = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "HighlightsHue", {
-            /**
-             * Gets the highlights Hue value.
-             * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
-             */
-            get: function () {
-                return this._highlightsHue;
-            },
-            /**
-             * Sets the highlights Hue value.
-             * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
-             */
-            set: function (value) {
-                this._highlightsHue = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "HighlightsDensity", {
-            /**
-             * Gets the highlights Density value.
-             * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
-             * Values less than zero provide a filter of opposite hue.
-             */
-            get: function () {
-                return this._highlightsDensity;
-            },
-            /**
-             * Sets the highlights Density value.
-             * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
-             * Values less than zero provide a filter of opposite hue.
-             */
-            set: function (value) {
-                this._highlightsDensity = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "HighlightsSaturation", {
-            /**
-             * Gets the highlights Saturation value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
-             */
-            get: function () {
-                return this._highlightsSaturation;
-            },
-            /**
-             * Sets the highlights Saturation value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
-             */
-            set: function (value) {
-                this._highlightsSaturation = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "HighlightsExposure", {
-            /**
-             * Gets the highlights Exposure value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
-             */
-            get: function () {
-                return this._highlightsExposure;
-            },
-            /**
-             * Sets the highlights Exposure value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
-             */
-            set: function (value) {
-                this._highlightsExposure = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "MidtonesHue", {
-            /**
-             * Gets the midtones Hue value.
-             * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
-             */
-            get: function () {
-                return this._midtonesHue;
-            },
-            /**
-             * Sets the midtones Hue value.
-             * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
-             */
-            set: function (value) {
-                this._midtonesHue = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "MidtonesDensity", {
-            /**
-             * Gets the midtones Density value.
-             * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
-             * Values less than zero provide a filter of opposite hue.
-             */
-            get: function () {
-                return this._midtonesDensity;
-            },
-            /**
-             * Sets the midtones Density value.
-             * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
-             * Values less than zero provide a filter of opposite hue.
-             */
-            set: function (value) {
-                this._midtonesDensity = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "MidtonesSaturation", {
-            /**
-             * Gets the midtones Saturation value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
-             */
-            get: function () {
-                return this._midtonesSaturation;
-            },
-            /**
-             * Sets the midtones Saturation value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
-             */
-            set: function (value) {
-                this._midtonesSaturation = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "MidtonesExposure", {
-            /**
-             * Gets the midtones Exposure value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
-             */
-            get: function () {
-                return this._midtonesExposure;
-            },
-            /**
-             * Sets the midtones Exposure value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
-             */
-            set: function (value) {
-                this._midtonesExposure = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "ShadowsHue", {
-            /**
-             * Gets the shadows Hue value.
-             * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
-             */
-            get: function () {
-                return this._shadowsHue;
-            },
-            /**
-             * Sets the shadows Hue value.
-             * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
-             */
-            set: function (value) {
-                this._shadowsHue = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "ShadowsDensity", {
-            /**
-             * Gets the shadows Density value.
-             * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
-             * Values less than zero provide a filter of opposite hue.
-             */
-            get: function () {
-                return this._shadowsDensity;
-            },
-            /**
-             * Sets the shadows Density value.
-             * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.
-             * Values less than zero provide a filter of opposite hue.
-             */
-            set: function (value) {
-                this._shadowsDensity = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "ShadowsSaturation", {
-            /**
-             * Gets the shadows Saturation value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
-             */
-            get: function () {
-                return this._shadowsSaturation;
-            },
-            /**
-             * Sets the shadows Saturation value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.
-             */
-            set: function (value) {
-                this._shadowsSaturation = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(ColorCurves.prototype, "ShadowsExposure", {
-            /**
-             * Gets the shadows Exposure value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
-             */
-            get: function () {
-                return this._shadowsExposure;
-            },
-            /**
-             * Sets the shadows Exposure value.
-             * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
-             */
-            set: function (value) {
-                this._shadowsExposure = value;
-                this._dirty = true;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        /**
-         * Binds the color curves to the shader.
-         * @param colorCurves The color curve to bind
-         * @param effect The effect to bind to
-         */
-        ColorCurves.Bind = function (colorCurves, effect) {
-            if (colorCurves._dirty) {
-                colorCurves._dirty = false;
-                // Fill in global info.
-                colorCurves.getColorGradingDataToRef(colorCurves._globalHue, colorCurves._globalDensity, colorCurves._globalSaturation, colorCurves._globalExposure, colorCurves._globalCurve);
-                // Compute highlights info.
-                colorCurves.getColorGradingDataToRef(colorCurves._highlightsHue, colorCurves._highlightsDensity, colorCurves._highlightsSaturation, colorCurves._highlightsExposure, colorCurves._tempColor);
-                colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._highlightsCurve);
-                // Compute midtones info.
-                colorCurves.getColorGradingDataToRef(colorCurves._midtonesHue, colorCurves._midtonesDensity, colorCurves._midtonesSaturation, colorCurves._midtonesExposure, colorCurves._tempColor);
-                colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._midtonesCurve);
-                // Compute shadows info.
-                colorCurves.getColorGradingDataToRef(colorCurves._shadowsHue, colorCurves._shadowsDensity, colorCurves._shadowsSaturation, colorCurves._shadowsExposure, colorCurves._tempColor);
-                colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._shadowsCurve);
-                // Compute deltas (neutral is midtones).
-                colorCurves._highlightsCurve.subtractToRef(colorCurves._midtonesCurve, colorCurves._positiveCurve);
-                colorCurves._midtonesCurve.subtractToRef(colorCurves._shadowsCurve, colorCurves._negativeCurve);
-            }
-            effect.setFloat4("vCameraColorCurvePositive", colorCurves._positiveCurve.r, colorCurves._positiveCurve.g, colorCurves._positiveCurve.b, colorCurves._positiveCurve.a);
-            effect.setFloat4("vCameraColorCurveNeutral", colorCurves._midtonesCurve.r, colorCurves._midtonesCurve.g, colorCurves._midtonesCurve.b, colorCurves._midtonesCurve.a);
-            effect.setFloat4("vCameraColorCurveNegative", colorCurves._negativeCurve.r, colorCurves._negativeCurve.g, colorCurves._negativeCurve.b, colorCurves._negativeCurve.a);
-        };
-        /**
-         * Prepare the list of uniforms associated with the ColorCurves effects.
-         * @param uniformsList The list of uniforms used in the effect
-         */
-        ColorCurves.PrepareUniforms = function (uniformsList) {
-            uniformsList.push("vCameraColorCurveNeutral", "vCameraColorCurvePositive", "vCameraColorCurveNegative");
-        };
-        /**
-         * Returns color grading data based on a hue, density, saturation and exposure value.
-         * @param filterHue The hue of the color filter.
-         * @param filterDensity The density of the color filter.
-         * @param saturation The saturation.
-         * @param exposure The exposure.
-         * @param result The result data container.
-         */
-        ColorCurves.prototype.getColorGradingDataToRef = function (hue, density, saturation, exposure, result) {
-            if (hue == null) {
-                return;
-            }
-            hue = ColorCurves.clamp(hue, 0, 360);
-            density = ColorCurves.clamp(density, -100, 100);
-            saturation = ColorCurves.clamp(saturation, -100, 100);
-            exposure = ColorCurves.clamp(exposure, -100, 100);
-            // Remap the slider/config filter density with non-linear mapping and also scale by half
-            // so that the maximum filter density is only 50% control. This provides fine control 
-            // for small values and reasonable range.
-            density = ColorCurves.applyColorGradingSliderNonlinear(density);
-            density *= 0.5;
-            exposure = ColorCurves.applyColorGradingSliderNonlinear(exposure);
-            if (density < 0) {
-                density *= -1;
-                hue = (hue + 180) % 360;
-            }
-            ColorCurves.fromHSBToRef(hue, density, 50 + 0.25 * exposure, result);
-            result.scaleToRef(2, result);
-            result.a = 1 + 0.01 * saturation;
-        };
-        /**
-         * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
-         * @param value The input slider value in range [-100,100].
-         * @returns Adjusted value.
-         */
-        ColorCurves.applyColorGradingSliderNonlinear = function (value) {
-            value /= 100;
-            var x = Math.abs(value);
-            x = Math.pow(x, 2);
-            if (value < 0) {
-                x *= -1;
-            }
-            x *= 100;
-            return x;
-        };
-        /**
-         * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
-         * @param hue The hue (H) input.
-         * @param saturation The saturation (S) input.
-         * @param brightness The brightness (B) input.
-         * @result An RGBA color represented as Vector4.
-         */
-        ColorCurves.fromHSBToRef = function (hue, saturation, brightness, result) {
-            var h = ColorCurves.clamp(hue, 0, 360);
-            var s = ColorCurves.clamp(saturation / 100, 0, 1);
-            var v = ColorCurves.clamp(brightness / 100, 0, 1);
-            if (s === 0) {
-                result.r = v;
-                result.g = v;
-                result.b = v;
-            }
-            else {
-                // sector 0 to 5
-                h /= 60;
-                var i = Math.floor(h);
-                // fractional part of h
-                var f = h - i;
-                var p = v * (1 - s);
-                var q = v * (1 - s * f);
-                var t = v * (1 - s * (1 - f));
-                switch (i) {
-                    case 0:
-                        result.r = v;
-                        result.g = t;
-                        result.b = p;
-                        break;
-                    case 1:
-                        result.r = q;
-                        result.g = v;
-                        result.b = p;
-                        break;
-                    case 2:
-                        result.r = p;
-                        result.g = v;
-                        result.b = t;
-                        break;
-                    case 3:
-                        result.r = p;
-                        result.g = q;
-                        result.b = v;
-                        break;
-                    case 4:
-                        result.r = t;
-                        result.g = p;
-                        result.b = v;
-                        break;
-                    default:
-                        result.r = v;
-                        result.g = p;
-                        result.b = q;
-                        break;
-                }
-            }
-            result.a = 1;
-        };
-        /**
-         * Returns a value clamped between min and max
-         * @param value The value to clamp
-         * @param min The minimum of value
-         * @param max The maximum of value
-         * @returns The clamped value.
-         */
-        ColorCurves.clamp = function (value, min, max) {
-            return Math.min(Math.max(value, min), max);
-        };
-        /**
-         * Clones the current color curve instance.
-         * @return The cloned curves
-         */
-        ColorCurves.prototype.clone = function () {
-            return BABYLON.SerializationHelper.Clone(function () { return new ColorCurves(); }, this);
-        };
-        /**
-         * Serializes the current color curve instance to a json representation.
-         * @return a JSON representation
-         */
-        ColorCurves.prototype.serialize = function () {
-            return BABYLON.SerializationHelper.Serialize(this);
-        };
-        /**
-         * Parses the color curve from a json representation.
-         * @param source the JSON source to parse
-         * @return The parsed curves
-         */
-        ColorCurves.Parse = function (source) {
-            return BABYLON.SerializationHelper.Parse(function () { return new ColorCurves(); }, source, null, null);
-        };
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_globalHue", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_globalDensity", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_globalSaturation", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_globalExposure", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_highlightsHue", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_highlightsDensity", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_highlightsSaturation", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_highlightsExposure", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_midtonesHue", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_midtonesDensity", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_midtonesSaturation", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], ColorCurves.prototype, "_midtonesExposure", void 0);
-        return ColorCurves;
-    }());
-    BABYLON.ColorCurves = ColorCurves;
-})(BABYLON || (BABYLON = {}));

+ 0 - 580
src/Materials/babylon.effect.js

@@ -1,580 +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);
-        };
-        EffectFallbacks.prototype.addCPUSkinningFallback = function (rank, mesh) {
-            this._meshRank = rank;
-            this._mesh = mesh;
-            if (rank > this._maxRank) {
-                this._maxRank = rank;
-            }
-        };
-        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], "");
-            }
-            if (this._mesh && this._currentRank === this._meshRank) {
-                this._mesh.computeBonesUsingShaders = false;
-                currentDefines = currentDefines.replace("#define NUM_BONE_INFLUENCERS " + this._mesh.numBoneInfluencers, "#define NUM_BONE_INFLUENCERS 0");
-                BABYLON.Tools.Log("Falling back to CPU skinning for " + this._mesh.name);
-            }
-            this._currentRank++;
-            return currentDefines;
-        };
-        return EffectFallbacks;
-    }());
-    BABYLON.EffectFallbacks = EffectFallbacks;
-    var Effect = (function () {
-        function Effect(baseName, attributesNames, uniformsNames, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {
-            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;
-            this._indexParameters = indexParameters;
-            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._processIncludes(vertexCode, function (vertexCodeWithIncludes) {
-                    _this._loadFragmentShader(fragmentSource, function (fragmentCode) {
-                        _this._processIncludes(fragmentCode, function (fragmentCodeWithIncludes) {
-                            _this._prepareEffect(vertexCodeWithIncludes, fragmentCodeWithIncludes, 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;
-        };
-        Effect.prototype.getVertexShaderSource = function () {
-            return this._engine.getVertexShaderSource(this._program);
-        };
-        Effect.prototype.getFragmentShaderSource = function () {
-            return this._engine.getFragmentShaderSource(this._program);
-        };
-        // Methods
-        Effect.prototype._loadVertexShader = function (vertex, callback) {
-            // DOM element ?
-            if (vertex instanceof HTMLElement) {
-                var vertexCode = BABYLON.Tools.GetDOMTextContent(vertex);
-                callback(vertexCode);
-                return;
-            }
-            // Base64 encoded ?
-            if (vertex.substr(0, 7) === "base64:") {
-                var vertexBinary = window.atob(vertex.substr(7));
-                callback(vertexBinary);
-                return;
-            }
-            // Is in local store ?
-            if (Effect.ShadersStore[vertex + "VertexShader"]) {
-                callback(Effect.ShadersStore[vertex + "VertexShader"]);
-                return;
-            }
-            var vertexShaderUrl;
-            if (vertex[0] === "." || vertex[0] === "/" || vertex.indexOf("http") > -1) {
-                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;
-            }
-            // Base64 encoded ?
-            if (fragment.substr(0, 7) === "base64:") {
-                var fragmentBinary = window.atob(fragment.substr(7));
-                callback(fragmentBinary);
-                return;
-            }
-            // Is in local store ?
-            if (Effect.ShadersStore[fragment + "PixelShader"]) {
-                callback(Effect.ShadersStore[fragment + "PixelShader"]);
-                return;
-            }
-            if (Effect.ShadersStore[fragment + "FragmentShader"]) {
-                callback(Effect.ShadersStore[fragment + "FragmentShader"]);
-                return;
-            }
-            var fragmentShaderUrl;
-            if (fragment[0] === "." || fragment[0] === "/" || fragment.indexOf("http") > -1) {
-                fragmentShaderUrl = fragment;
-            }
-            else {
-                fragmentShaderUrl = BABYLON.Engine.ShadersRepository + fragment;
-            }
-            // Fragment shader
-            BABYLON.Tools.LoadFile(fragmentShaderUrl + ".fragment.fx", callback);
-        };
-        Effect.prototype._dumpShadersName = function () {
-            if (this.name.vertexElement) {
-                BABYLON.Tools.Error("Vertex shader:" + this.name.vertexElement);
-                BABYLON.Tools.Error("Fragment shader:" + this.name.fragmentElement);
-            }
-            else if (this.name.vertex) {
-                BABYLON.Tools.Error("Vertex shader:" + this.name.vertex);
-                BABYLON.Tools.Error("Fragment shader:" + this.name.fragment);
-            }
-            else {
-                BABYLON.Tools.Error("Vertex shader:" + this.name);
-                BABYLON.Tools.Error("Fragment shader:" + this.name);
-            }
-        };
-        Effect.prototype._processIncludes = function (sourceCode, callback) {
-            var _this = this;
-            var regex = /#include<(.+)>(\((.*)\))*(\[(.*)\])*/g;
-            var match = regex.exec(sourceCode);
-            var returnValue = new String(sourceCode);
-            while (match != null) {
-                var includeFile = match[1];
-                if (Effect.IncludesShadersStore[includeFile]) {
-                    // Substitution
-                    var includeContent = Effect.IncludesShadersStore[includeFile];
-                    if (match[2]) {
-                        var splits = match[3].split(",");
-                        for (var index = 0; index < splits.length; index += 2) {
-                            var source = new RegExp(splits[index], "g");
-                            var dest = splits[index + 1];
-                            includeContent = includeContent.replace(source, dest);
-                        }
-                    }
-                    if (match[4]) {
-                        var indexString = match[5];
-                        if (indexString.indexOf("..") !== -1) {
-                            var indexSplits = indexString.split("..");
-                            var minIndex = parseInt(indexSplits[0]);
-                            var maxIndex = parseInt(indexSplits[1]);
-                            var sourceIncludeContent = includeContent.slice(0);
-                            includeContent = "";
-                            if (isNaN(maxIndex)) {
-                                maxIndex = this._indexParameters[indexSplits[1]];
-                            }
-                            for (var i = minIndex; i <= maxIndex; i++) {
-                                includeContent += sourceIncludeContent.replace(/\{X\}/g, i) + "\n";
-                            }
-                        }
-                        else {
-                            includeContent = includeContent.replace(/\{X\}/g, indexString);
-                        }
-                    }
-                    // Replace
-                    returnValue = returnValue.replace(match[0], includeContent);
-                }
-                else {
-                    var includeShaderUrl = BABYLON.Engine.ShadersRepository + "ShadersInclude/" + includeFile + ".fx";
-                    BABYLON.Tools.LoadFile(includeShaderUrl, function (fileContent) {
-                        Effect.IncludesShadersStore[includeFile] = fileContent;
-                        _this._processIncludes(returnValue, callback);
-                    });
-                    return;
-                }
-                match = regex.exec(sourceCode);
-            }
-            callback(returnValue);
-        };
-        Effect.prototype._processPrecision = function (source) {
-            if (source.indexOf("precision highp float") === -1) {
-                if (!this._engine.getCaps().highPrecisionShaderSupported) {
-                    source = "precision mediump float;\n" + source;
-                }
-                else {
-                    source = "precision highp float;\n" + source;
-                }
-            }
-            else {
-                if (!this._engine.getCaps().highPrecisionShaderSupported) {
-                    source = source.replace("precision highp float", "precision mediump float");
-                }
-            }
-            return source;
-        };
-        Effect.prototype._prepareEffect = function (vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks) {
-            try {
-                var engine = this._engine;
-                // Precision
-                vertexSourceCode = this._processPrecision(vertexSourceCode);
-                fragmentSourceCode = this._processPrecision(fragmentSourceCode);
-                this._program = engine.createShaderProgram(vertexSourceCode, fragmentSourceCode, defines);
-                this._uniforms = engine.getUniforms(this._program, this._uniformsNames);
-                this._attributes = engine.getAttributes(this._program, attributesNames);
-                var index;
-                for (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._compilationError = "";
-                this._isReady = true;
-                if (this.onCompiled) {
-                    this.onCompiled(this);
-                }
-            }
-            catch (e) {
-                this._compilationError = e.message;
-                // Let's go through fallbacks then
-                BABYLON.Tools.Error("Unable to compile effect: ");
-                BABYLON.Tools.Error("Defines: " + defines);
-                BABYLON.Tools.Error("Error: " + this._compilationError);
-                this._dumpShadersName();
-                if (fallbacks && fallbacks.isMoreFallbacks) {
-                    BABYLON.Tools.Error("Trying next fallback.");
-                    defines = fallbacks.reduce(defines);
-                    this._prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks);
-                }
-                else {
-                    if (this.onError) {
-                        this.onError(this, this._compilationError);
-                    }
-                }
-            }
-        };
-        Object.defineProperty(Effect.prototype, "isSupported", {
-            get: function () {
-                return this._compilationError === "";
-            },
-            enumerable: true,
-            configurable: true
-        });
-        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), this.getUniform(channel), texture);
-        };
-        Effect.prototype.setTextureArray = function (channel, textures) {
-            if (this._samplers.indexOf(channel + "Ex") === -1) {
-                var initialPos = this._samplers.indexOf(channel);
-                for (var index = 1; index < textures.length; index++) {
-                    this._samplers.splice(initialPos + index, 0, channel + "Ex");
-                }
-            }
-            this._engine.setTextureArray(this._samplers.indexOf(channel), this.getUniform(channel), textures);
-        };
-        Effect.prototype.setTextureFromPostProcess = function (channel, postProcess) {
-            this._engine.setTextureFromPostProcess(this._samplers.indexOf(channel), postProcess);
-        };
-        Effect.prototype._cacheMatrix = function (uniformName, matrix) {
-            var changed = false;
-            var cache = this._valueCache[uniformName];
-            if (!cache || !(cache instanceof BABYLON.Matrix)) {
-                changed = true;
-                cache = new BABYLON.Matrix();
-            }
-            var tm = cache.m;
-            var om = matrix.m;
-            for (var index = 0; index < 16; index++) {
-                if (tm[index] !== om[index]) {
-                    tm[index] = om[index];
-                    changed = true;
-                }
-            }
-            this._valueCache[uniformName] = cache;
-            return changed;
-        };
-        Effect.prototype._cacheFloat2 = function (uniformName, x, y) {
-            var cache = this._valueCache[uniformName];
-            if (!cache) {
-                cache = [x, y];
-                this._valueCache[uniformName] = cache;
-                return true;
-            }
-            var changed = false;
-            if (cache[0] !== x) {
-                cache[0] = x;
-                changed = true;
-            }
-            if (cache[1] !== y) {
-                cache[1] = y;
-                changed = true;
-            }
-            return changed;
-        };
-        Effect.prototype._cacheFloat3 = function (uniformName, x, y, z) {
-            var cache = this._valueCache[uniformName];
-            if (!cache) {
-                cache = [x, y, z];
-                this._valueCache[uniformName] = cache;
-                return true;
-            }
-            var changed = false;
-            if (cache[0] !== x) {
-                cache[0] = x;
-                changed = true;
-            }
-            if (cache[1] !== y) {
-                cache[1] = y;
-                changed = true;
-            }
-            if (cache[2] !== z) {
-                cache[2] = z;
-                changed = true;
-            }
-            return changed;
-        };
-        Effect.prototype._cacheFloat4 = function (uniformName, x, y, z, w) {
-            var cache = this._valueCache[uniformName];
-            if (!cache) {
-                cache = [x, y, z, w];
-                this._valueCache[uniformName] = cache;
-                return true;
-            }
-            var changed = false;
-            if (cache[0] !== x) {
-                cache[0] = x;
-                changed = true;
-            }
-            if (cache[1] !== y) {
-                cache[1] = y;
-                changed = true;
-            }
-            if (cache[2] !== z) {
-                cache[2] = z;
-                changed = true;
-            }
-            if (cache[3] !== w) {
-                cache[3] = w;
-                changed = true;
-            }
-            return changed;
-        };
-        Effect.prototype.setIntArray = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setIntArray(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setIntArray2 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setIntArray2(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setIntArray3 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setIntArray3(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setIntArray4 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setIntArray4(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setFloatArray = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setFloatArray(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setFloatArray2 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setFloatArray2(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setFloatArray3 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setFloatArray3(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setFloatArray4 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setFloatArray4(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setArray = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setArray(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setArray2 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setArray2(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setArray3 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setArray3(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setArray4 = function (uniformName, array) {
-            this._valueCache[uniformName] = null;
-            this._engine.setArray4(this.getUniform(uniformName), array);
-            return this;
-        };
-        Effect.prototype.setMatrices = function (uniformName, matrices) {
-            this._valueCache[uniformName] = null;
-            this._engine.setMatrices(this.getUniform(uniformName), matrices);
-            return this;
-        };
-        Effect.prototype.setMatrix = function (uniformName, matrix) {
-            if (this._cacheMatrix(uniformName, matrix)) {
-                this._engine.setMatrix(this.getUniform(uniformName), matrix);
-            }
-            return this;
-        };
-        Effect.prototype.setMatrix3x3 = function (uniformName, matrix) {
-            this._valueCache[uniformName] = null;
-            this._engine.setMatrix3x3(this.getUniform(uniformName), matrix);
-            return this;
-        };
-        Effect.prototype.setMatrix2x2 = function (uniformName, matrix) {
-            this._valueCache[uniformName] = null;
-            this._engine.setMatrix2x2(this.getUniform(uniformName), matrix);
-            return this;
-        };
-        Effect.prototype.setFloat = function (uniformName, value) {
-            var cache = this._valueCache[uniformName];
-            if (cache !== undefined && cache === value)
-                return this;
-            this._valueCache[uniformName] = value;
-            this._engine.setFloat(this.getUniform(uniformName), value);
-            return this;
-        };
-        Effect.prototype.setBool = function (uniformName, bool) {
-            var cache = this._valueCache[uniformName];
-            if (cache !== undefined && cache === 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._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._cacheFloat2(uniformName, x, y)) {
-                this._engine.setFloat2(this.getUniform(uniformName), x, y);
-            }
-            return this;
-        };
-        Effect.prototype.setVector3 = function (uniformName, vector3) {
-            if (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._cacheFloat3(uniformName, x, y, z)) {
-                this._engine.setFloat3(this.getUniform(uniformName), x, y, z);
-            }
-            return this;
-        };
-        Effect.prototype.setVector4 = function (uniformName, vector4) {
-            if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {
-                this._engine.setFloat4(this.getUniform(uniformName), vector4.x, vector4.y, vector4.z, vector4.w);
-            }
-            return this;
-        };
-        Effect.prototype.setFloat4 = function (uniformName, x, y, z, w) {
-            if (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._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._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {
-                this._engine.setColor4(this.getUniform(uniformName), color3, alpha);
-            }
-            return this;
-        };
-        // Statics
-        Effect.ShadersStore = {};
-        Effect.IncludesShadersStore = {};
-        return Effect;
-    }());
-    BABYLON.Effect = Effect;
-})(BABYLON || (BABYLON = {}));

+ 0 - 37
src/Materials/babylon.fresnelParameters.js

@@ -1,37 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var FresnelParameters = (function () {
-        function FresnelParameters() {
-            this.isEnabled = true;
-            this.leftColor = BABYLON.Color3.White();
-            this.rightColor = BABYLON.Color3.Black();
-            this.bias = 0;
-            this.power = 1;
-        }
-        FresnelParameters.prototype.clone = function () {
-            var newFresnelParameters = new FresnelParameters();
-            BABYLON.Tools.DeepCopy(this, newFresnelParameters);
-            return newFresnelParameters;
-        };
-        FresnelParameters.prototype.serialize = function () {
-            var serializationObject = {};
-            serializationObject.isEnabled = this.isEnabled;
-            serializationObject.leftColor = this.leftColor;
-            serializationObject.rightColor = this.rightColor;
-            serializationObject.bias = this.bias;
-            serializationObject.power = this.power;
-            return serializationObject;
-        };
-        FresnelParameters.Parse = function (parsedFresnelParameters) {
-            var fresnelParameters = new FresnelParameters();
-            fresnelParameters.isEnabled = parsedFresnelParameters.isEnabled;
-            fresnelParameters.leftColor = BABYLON.Color3.FromArray(parsedFresnelParameters.leftColor);
-            fresnelParameters.rightColor = BABYLON.Color3.FromArray(parsedFresnelParameters.rightColor);
-            fresnelParameters.bias = parsedFresnelParameters.bias;
-            fresnelParameters.power = parsedFresnelParameters.power || 1.0;
-            return fresnelParameters;
-        };
-        return FresnelParameters;
-    }());
-    BABYLON.FresnelParameters = FresnelParameters;
-})(BABYLON || (BABYLON = {}));

+ 0 - 379
src/Materials/babylon.material.js

@@ -1,379 +0,0 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var MaterialDefines = (function () {
-        function MaterialDefines() {
-        }
-        MaterialDefines.prototype.rebuild = function () {
-            if (this._keys) {
-                delete this._keys;
-            }
-            this._keys = Object.keys(this);
-        };
-        MaterialDefines.prototype.isEqual = function (other) {
-            if (this._keys.length !== other._keys.length) {
-                return false;
-            }
-            for (var index = 0; index < this._keys.length; index++) {
-                var prop = this._keys[index];
-                if (this[prop] !== other[prop]) {
-                    return false;
-                }
-            }
-            return true;
-        };
-        MaterialDefines.prototype.cloneTo = function (other) {
-            if (this._keys.length !== other._keys.length) {
-                other._keys = this._keys.slice(0);
-            }
-            for (var index = 0; index < this._keys.length; index++) {
-                var prop = this._keys[index];
-                other[prop] = this[prop];
-            }
-        };
-        MaterialDefines.prototype.reset = function () {
-            for (var index = 0; index < this._keys.length; index++) {
-                var prop = this._keys[index];
-                if (typeof (this[prop]) === "number") {
-                    this[prop] = 0;
-                }
-                else {
-                    this[prop] = false;
-                }
-            }
-        };
-        MaterialDefines.prototype.toString = function () {
-            var result = "";
-            for (var index = 0; index < this._keys.length; index++) {
-                var prop = this._keys[index];
-                if (typeof (this[prop]) === "number") {
-                    result += "#define " + prop + " " + this[prop] + "\n";
-                }
-                else if (this[prop]) {
-                    result += "#define " + prop + "\n";
-                }
-            }
-            return result;
-        };
-        return MaterialDefines;
-    }());
-    BABYLON.MaterialDefines = MaterialDefines;
-    var Material = (function () {
-        function Material(name, scene, doNotAdd) {
-            this.name = name;
-            this.checkReadyOnEveryCall = false;
-            this.checkReadyOnlyOnce = false;
-            this.state = "";
-            this.alpha = 1.0;
-            this.backFaceCulling = true;
-            /**
-            * An event triggered when the material is disposed.
-            * @type {BABYLON.Observable}
-            */
-            this.onDisposeObservable = new BABYLON.Observable();
-            /**
-            * An event triggered when the material is bound.
-            * @type {BABYLON.Observable}
-            */
-            this.onBindObservable = new BABYLON.Observable();
-            /**
-            * An event triggered when the material is unbound.
-            * @type {BABYLON.Observable}
-            */
-            this.onUnBindObservable = new BABYLON.Observable();
-            this.alphaMode = BABYLON.Engine.ALPHA_COMBINE;
-            this.disableDepthWrite = false;
-            this.fogEnabled = true;
-            this.pointSize = 1.0;
-            this.zOffset = 0;
-            this._wasPreviouslyReady = false;
-            this._fillMode = Material.TriangleFillMode;
-            this.id = name;
-            this._scene = scene;
-            if (scene.useRightHandedSystem) {
-                this.sideOrientation = Material.ClockWiseSideOrientation;
-            }
-            else {
-                this.sideOrientation = Material.CounterClockWiseSideOrientation;
-            }
-            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, "ClockWiseSideOrientation", {
-            get: function () {
-                return Material._ClockWiseSideOrientation;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Material, "CounterClockWiseSideOrientation", {
-            get: function () {
-                return Material._CounterClockWiseSideOrientation;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Material.prototype, "onDispose", {
-            set: function (callback) {
-                if (this._onDisposeObserver) {
-                    this.onDisposeObservable.remove(this._onDisposeObserver);
-                }
-                this._onDisposeObserver = this.onDisposeObservable.add(callback);
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Material.prototype, "onBind", {
-            set: function (callback) {
-                if (this._onBindObserver) {
-                    this.onBindObservable.remove(this._onBindObserver);
-                }
-                this._onBindObserver = this.onBindObservable.add(callback);
-            },
-            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
-        });
-        /**
-         * @param {boolean} fullDetails - support for multiple levels of logging within scene loading
-         * subclasses should override adding information pertainent to themselves
-         */
-        Material.prototype.toString = function (fullDetails) {
-            var ret = "Name: " + this.name;
-            if (fullDetails) {
-            }
-            return ret;
-        };
-        Object.defineProperty(Material.prototype, "isFrozen", {
-            get: function () {
-                return this.checkReadyOnlyOnce;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Material.prototype.freeze = function () {
-            this.checkReadyOnlyOnce = true;
-        };
-        Material.prototype.unfreeze = function () {
-            this.checkReadyOnlyOnce = false;
-        };
-        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.markDirty = function () {
-            this._wasPreviouslyReady = false;
-        };
-        Material.prototype._preBind = function () {
-            var engine = this._scene.getEngine();
-            var reverse = this.sideOrientation === Material.ClockWiseSideOrientation;
-            engine.enableEffect(this._effect);
-            engine.setState(this.backFaceCulling, this.zOffset, false, reverse);
-        };
-        Material.prototype.bind = function (world, mesh) {
-            this._scene._cachedMaterial = this;
-            this.onBindObservable.notifyObservers(mesh);
-            if (this.disableDepthWrite) {
-                var engine = this._scene.getEngine();
-                this._cachedDepthWriteState = engine.getDepthWrite();
-                engine.setDepthWrite(false);
-            }
-        };
-        Material.prototype.bindOnlyWorldMatrix = function (world) {
-        };
-        Material.prototype.unbind = function () {
-            this.onUnBindObservable.notifyObservers(this);
-            if (this.disableDepthWrite) {
-                var engine = this._scene.getEngine();
-                engine.setDepthWrite(this._cachedDepthWriteState);
-            }
-        };
-        Material.prototype.clone = function (name) {
-            return null;
-        };
-        Material.prototype.getBindedMeshes = function () {
-            var result = new Array();
-            for (var index = 0; index < this._scene.meshes.length; index++) {
-                var mesh = this._scene.meshes[index];
-                if (mesh.material === this) {
-                    result.push(mesh);
-                }
-            }
-            return result;
-        };
-        Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
-            // Animations
-            this.getScene().stopAnimation(this);
-            // Remove from scene
-            var index = this._scene.materials.indexOf(this);
-            if (index >= 0) {
-                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;
-            }
-            // Remove from meshes
-            for (index = 0; index < this._scene.meshes.length; index++) {
-                var mesh = this._scene.meshes[index];
-                if (mesh.material === this) {
-                    mesh.material = null;
-                }
-            }
-            // Callback
-            this.onDisposeObservable.notifyObservers(this);
-            this.onDisposeObservable.clear();
-            this.onBindObservable.clear();
-            this.onUnBindObservable.clear();
-        };
-        Material.prototype.serialize = function () {
-            return BABYLON.SerializationHelper.Serialize(this);
-        };
-        Material.ParseMultiMaterial = function (parsedMultiMaterial, scene) {
-            var multiMaterial = new BABYLON.MultiMaterial(parsedMultiMaterial.name, scene);
-            multiMaterial.id = parsedMultiMaterial.id;
-            BABYLON.Tags.AddTagsTo(multiMaterial, parsedMultiMaterial.tags);
-            for (var matIndex = 0; matIndex < parsedMultiMaterial.materials.length; matIndex++) {
-                var subMatId = parsedMultiMaterial.materials[matIndex];
-                if (subMatId) {
-                    multiMaterial.subMaterials.push(scene.getMaterialByID(subMatId));
-                }
-                else {
-                    multiMaterial.subMaterials.push(null);
-                }
-            }
-            return multiMaterial;
-        };
-        Material.Parse = function (parsedMaterial, scene, rootUrl) {
-            if (!parsedMaterial.customType) {
-                return BABYLON.StandardMaterial.Parse(parsedMaterial, scene, rootUrl);
-            }
-            var materialType = BABYLON.Tools.Instantiate(parsedMaterial.customType);
-            return materialType.Parse(parsedMaterial, scene, rootUrl);
-            ;
-        };
-        Material._TriangleFillMode = 0;
-        Material._WireFrameFillMode = 1;
-        Material._PointFillMode = 2;
-        Material._ClockWiseSideOrientation = 0;
-        Material._CounterClockWiseSideOrientation = 1;
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "id", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "checkReadyOnEveryCall", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "checkReadyOnlyOnce", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "state", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "alpha", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "backFaceCulling", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "sideOrientation", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "alphaMode", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "disableDepthWrite", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "fogEnabled", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "pointSize", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "zOffset", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "wireframe", null);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "pointsCloud", null);
-        __decorate([
-            BABYLON.serialize()
-        ], Material.prototype, "fillMode", null);
-        return Material;
-    }());
-    BABYLON.Material = Material;
-})(BABYLON || (BABYLON = {}));

+ 0 - 267
src/Materials/babylon.materialHelper.js

@@ -1,267 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var MaterialHelper = (function () {
-        function MaterialHelper() {
-        }
-        MaterialHelper.PrepareDefinesForLights = function (scene, mesh, defines, maxSimultaneousLights) {
-            if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }
-            var lightIndex = 0;
-            var needNormals = false;
-            var needRebuild = false;
-            var needShadows = false;
-            var lightmapMode = false;
-            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;
-                }
-                needNormals = true;
-                if (defines["LIGHT" + lightIndex] === undefined) {
-                    needRebuild = true;
-                }
-                defines["LIGHT" + lightIndex] = true;
-                var type;
-                if (light instanceof BABYLON.SpotLight) {
-                    type = "SPOTLIGHT" + lightIndex;
-                }
-                else if (light instanceof BABYLON.HemisphericLight) {
-                    type = "HEMILIGHT" + lightIndex;
-                }
-                else if (light instanceof BABYLON.PointLight) {
-                    type = "POINTLIGHT" + lightIndex;
-                }
-                else {
-                    type = "DIRLIGHT" + lightIndex;
-                }
-                if (defines[type] === undefined) {
-                    needRebuild = true;
-                }
-                defines[type] = true;
-                // Specular
-                if (!light.specular.equalsFloats(0, 0, 0) && defines["SPECULARTERM"] !== undefined) {
-                    defines["SPECULARTERM"] = true;
-                }
-                // Shadows
-                if (scene.shadowsEnabled) {
-                    var shadowGenerator = light.getShadowGenerator();
-                    if (mesh && mesh.receiveShadows && shadowGenerator) {
-                        if (defines["SHADOW" + lightIndex] === undefined) {
-                            needRebuild = true;
-                        }
-                        defines["SHADOW" + lightIndex] = true;
-                        defines["SHADOWS"] = true;
-                        if (shadowGenerator.useVarianceShadowMap || shadowGenerator.useBlurVarianceShadowMap) {
-                            if (defines["SHADOWVSM" + lightIndex] === undefined) {
-                                needRebuild = true;
-                            }
-                            defines["SHADOWVSM" + lightIndex] = true;
-                        }
-                        if (shadowGenerator.usePoissonSampling) {
-                            if (defines["SHADOWPCF" + lightIndex] === undefined) {
-                                needRebuild = true;
-                            }
-                            defines["SHADOWPCF" + lightIndex] = true;
-                        }
-                        needShadows = true;
-                    }
-                }
-                if (light.lightmapMode != BABYLON.Light.LIGHTMAP_DEFAULT) {
-                    lightmapMode = true;
-                    if (defines["LIGHTMAPEXCLUDED" + lightIndex] === undefined) {
-                        needRebuild = true;
-                    }
-                    if (defines["LIGHTMAPNOSPECULAR" + lightIndex] === undefined) {
-                        needRebuild = true;
-                    }
-                    defines["LIGHTMAPEXCLUDED" + lightIndex] = true;
-                    if (light.lightmapMode == BABYLON.Light.LIGHTMAP_SHADOWSONLY) {
-                        defines["LIGHTMAPNOSPECULAR" + lightIndex] = true;
-                    }
-                }
-                lightIndex++;
-                if (lightIndex === maxSimultaneousLights)
-                    break;
-            }
-            var caps = scene.getEngine().getCaps();
-            if (needShadows && caps.textureFloat && caps.textureFloatLinearFiltering && caps.textureFloatRender) {
-                if (defines["SHADOWFULLFLOAT"] === undefined) {
-                    needRebuild = true;
-                }
-                defines["SHADOWFULLFLOAT"] = true;
-            }
-            if (defines["LIGHTMAPEXCLUDED"] === undefined) {
-                needRebuild = true;
-            }
-            if (lightmapMode) {
-                defines["LIGHTMAPEXCLUDED"] = true;
-            }
-            if (needRebuild) {
-                defines.rebuild();
-            }
-            return needNormals;
-        };
-        MaterialHelper.PrepareUniformsAndSamplersList = function (uniformsList, samplersList, defines, maxSimultaneousLights) {
-            if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }
-            for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {
-                if (!defines["LIGHT" + lightIndex]) {
-                    break;
-                }
-                uniformsList.push("vLightData" + lightIndex, "vLightDiffuse" + lightIndex, "vLightSpecular" + lightIndex, "vLightDirection" + lightIndex, "vLightGround" + lightIndex, "lightMatrix" + lightIndex, "shadowsInfo" + lightIndex);
-                samplersList.push("shadowSampler" + lightIndex);
-            }
-        };
-        MaterialHelper.HandleFallbacksForShadows = function (defines, fallbacks, maxSimultaneousLights) {
-            if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }
-            for (var lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {
-                if (!defines["LIGHT" + lightIndex]) {
-                    break;
-                }
-                if (lightIndex > 0) {
-                    fallbacks.addFallback(lightIndex, "LIGHT" + lightIndex);
-                }
-                if (defines["SHADOW" + lightIndex]) {
-                    fallbacks.addFallback(0, "SHADOW" + lightIndex);
-                }
-                if (defines["SHADOWPCF" + lightIndex]) {
-                    fallbacks.addFallback(0, "SHADOWPCF" + lightIndex);
-                }
-                if (defines["SHADOWVSM" + lightIndex]) {
-                    fallbacks.addFallback(0, "SHADOWVSM" + lightIndex);
-                }
-            }
-        };
-        MaterialHelper.PrepareAttributesForBones = function (attribs, mesh, defines, fallbacks) {
-            if (defines["NUM_BONE_INFLUENCERS"] > 0) {
-                fallbacks.addCPUSkinningFallback(0, mesh);
-                attribs.push(BABYLON.VertexBuffer.MatricesIndicesKind);
-                attribs.push(BABYLON.VertexBuffer.MatricesWeightsKind);
-                if (defines["NUM_BONE_INFLUENCERS"] > 4) {
-                    attribs.push(BABYLON.VertexBuffer.MatricesIndicesExtraKind);
-                    attribs.push(BABYLON.VertexBuffer.MatricesWeightsExtraKind);
-                }
-            }
-        };
-        MaterialHelper.PrepareAttributesForInstances = function (attribs, defines) {
-            if (defines["INSTANCES"]) {
-                attribs.push("world0");
-                attribs.push("world1");
-                attribs.push("world2");
-                attribs.push("world3");
-            }
-        };
-        // Bindings
-        MaterialHelper.BindLightShadow = function (light, scene, mesh, lightIndex, effect, depthValuesAlreadySet) {
-            var shadowGenerator = light.getShadowGenerator();
-            if (mesh.receiveShadows && shadowGenerator) {
-                if (!light.needCube()) {
-                    effect.setMatrix("lightMatrix" + lightIndex, shadowGenerator.getTransformMatrix());
-                }
-                else {
-                    if (!depthValuesAlreadySet) {
-                        depthValuesAlreadySet = true;
-                        effect.setFloat2("depthValues", scene.activeCamera.minZ, scene.activeCamera.maxZ);
-                    }
-                }
-                effect.setTexture("shadowSampler" + lightIndex, shadowGenerator.getShadowMapForRendering());
-                effect.setFloat3("shadowsInfo" + lightIndex, shadowGenerator.getDarkness(), shadowGenerator.blurScale / shadowGenerator.getShadowMap().getSize().width, shadowGenerator.bias);
-            }
-            return depthValuesAlreadySet;
-        };
-        MaterialHelper.BindLightProperties = function (light, effect, lightIndex) {
-            if (light instanceof BABYLON.PointLight) {
-                // Point Light
-                light.transferToEffect(effect, "vLightData" + lightIndex);
-            }
-            else if (light instanceof BABYLON.DirectionalLight) {
-                // Directional Light
-                light.transferToEffect(effect, "vLightData" + lightIndex);
-            }
-            else if (light instanceof BABYLON.SpotLight) {
-                // Spot Light
-                light.transferToEffect(effect, "vLightData" + lightIndex, "vLightDirection" + lightIndex);
-            }
-            else if (light instanceof BABYLON.HemisphericLight) {
-                // Hemispheric Light
-                light.transferToEffect(effect, "vLightData" + lightIndex, "vLightGround" + lightIndex);
-            }
-        };
-        MaterialHelper.BindLights = function (scene, mesh, effect, defines, maxSimultaneousLights) {
-            if (maxSimultaneousLights === void 0) { maxSimultaneousLights = 4; }
-            var lightIndex = 0;
-            var depthValuesAlreadySet = false;
-            for (var index = 0; index < scene.lights.length; index++) {
-                var light = scene.lights[index];
-                if (!light.isEnabled()) {
-                    continue;
-                }
-                if (!light.canAffectMesh(mesh)) {
-                    continue;
-                }
-                MaterialHelper.BindLightProperties(light, effect, lightIndex);
-                light.diffuse.scaleToRef(light.intensity, BABYLON.Tmp.Color3[0]);
-                effect.setColor4("vLightDiffuse" + lightIndex, BABYLON.Tmp.Color3[0], light.range);
-                if (defines["SPECULARTERM"]) {
-                    light.specular.scaleToRef(light.intensity, BABYLON.Tmp.Color3[1]);
-                    effect.setColor3("vLightSpecular" + lightIndex, BABYLON.Tmp.Color3[1]);
-                }
-                // Shadows
-                if (scene.shadowsEnabled) {
-                    depthValuesAlreadySet = this.BindLightShadow(light, scene, mesh, lightIndex, effect, depthValuesAlreadySet);
-                }
-                lightIndex++;
-                if (lightIndex === maxSimultaneousLights)
-                    break;
-            }
-        };
-        MaterialHelper.BindFogParameters = function (scene, mesh, effect) {
-            if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
-                effect.setFloat4("vFogInfos", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);
-                effect.setColor3("vFogColor", scene.fogColor);
-            }
-        };
-        MaterialHelper.BindBonesParameters = function (mesh, effect) {
-            if (mesh && mesh.useBones && mesh.computeBonesUsingShaders) {
-                var matrices = mesh.skeleton.getTransformMatrices(mesh);
-                if (matrices) {
-                    effect.setMatrices("mBones", matrices);
-                }
-            }
-        };
-        MaterialHelper.BindLogDepth = function (defines, effect, scene) {
-            if (defines["LOGARITHMICDEPTH"]) {
-                effect.setFloat("logarithmicDepthConstant", 2.0 / (Math.log(scene.activeCamera.maxZ + 1.0) / Math.LN2));
-            }
-        };
-        MaterialHelper.BindClipPlane = function (effect, scene) {
-            if (scene.clipPlane) {
-                var clipPlane = scene.clipPlane;
-                effect.setFloat4("vClipPlane", clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
-            }
-        };
-        return MaterialHelper;
-    }());
-    BABYLON.MaterialHelper = MaterialHelper;
-})(BABYLON || (BABYLON = {}));

+ 0 - 68
src/Materials/babylon.multiMaterial.js

@@ -1,68 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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;
-        };
-        MultiMaterial.prototype.clone = function (name, cloneChildren) {
-            var newMultiMaterial = new MultiMaterial(name, this.getScene());
-            for (var index = 0; index < this.subMaterials.length; index++) {
-                var subMaterial = null;
-                if (cloneChildren) {
-                    subMaterial = this.subMaterials[index].clone(name + "-" + this.subMaterials[index].name);
-                }
-                else {
-                    subMaterial = this.subMaterials[index];
-                }
-                newMultiMaterial.subMaterials.push(subMaterial);
-            }
-            return newMultiMaterial;
-        };
-        MultiMaterial.prototype.serialize = function () {
-            var serializationObject = {};
-            serializationObject.name = this.name;
-            serializationObject.id = this.id;
-            serializationObject.tags = BABYLON.Tags.GetTags(this);
-            serializationObject.materials = [];
-            for (var matIndex = 0; matIndex < this.subMaterials.length; matIndex++) {
-                var subMat = this.subMaterials[matIndex];
-                if (subMat) {
-                    serializationObject.materials.push(subMat.id);
-                }
-                else {
-                    serializationObject.materials.push(null);
-                }
-            }
-            return serializationObject;
-        };
-        return MultiMaterial;
-    }(BABYLON.Material));
-    BABYLON.MultiMaterial = MultiMaterial;
-})(BABYLON || (BABYLON = {}));

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 1268
src/Materials/babylon.pbrMaterial.js


+ 0 - 402
src/Materials/babylon.shaderMaterial.js

@@ -1,402 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.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 = {};
-            this._textureArrays = {};
-            this._floats = {};
-            this._floatsArrays = {};
-            this._colors3 = {};
-            this._colors4 = {};
-            this._vectors2 = {};
-            this._vectors3 = {};
-            this._vectors4 = {};
-            this._matrices = {};
-            this._matrices3x3 = {};
-            this._matrices2x2 = {};
-            this._vectors3Arrays = {};
-            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 || [];
-            options.defines = options.defines || [];
-            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.setTextureArray = function (name, textures) {
-            if (this._options.samplers.indexOf(name) === -1) {
-                this._options.samplers.push(name);
-            }
-            this._checkUniform(name);
-            this._textureArrays[name] = textures;
-            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.setVector4 = function (name, value) {
-            this._checkUniform(name);
-            this._vectors4[name] = value;
-            return this;
-        };
-        ShaderMaterial.prototype.setMatrix = function (name, value) {
-            this._checkUniform(name);
-            this._matrices[name] = value;
-            return this;
-        };
-        ShaderMaterial.prototype.setMatrix3x3 = function (name, value) {
-            this._checkUniform(name);
-            this._matrices3x3[name] = value;
-            return this;
-        };
-        ShaderMaterial.prototype.setMatrix2x2 = function (name, value) {
-            this._checkUniform(name);
-            this._matrices2x2[name] = value;
-            return this;
-        };
-        ShaderMaterial.prototype.setArray3 = function (name, value) {
-            this._checkUniform(name);
-            this._vectors3Arrays[name] = value;
-            return this;
-        };
-        ShaderMaterial.prototype.isReady = function (mesh, useInstances) {
-            var scene = this.getScene();
-            var engine = scene.getEngine();
-            if (!this.checkReadyOnEveryCall) {
-                if (this._renderId === scene.getRenderId()) {
-                    return true;
-                }
-            }
-            // Instances
-            var defines = [];
-            var fallbacks = new BABYLON.EffectFallbacks();
-            if (useInstances) {
-                defines.push("#define INSTANCES");
-            }
-            for (var index = 0; index < this._options.defines.length; index++) {
-                defines.push(this._options.defines[index]);
-            }
-            // Bones
-            if (mesh && mesh.useBones && mesh.computeBonesUsingShaders) {
-                defines.push("#define NUM_BONE_INFLUENCERS " + mesh.numBoneInfluencers);
-                defines.push("#define BonesPerMesh " + (mesh.skeleton.bones.length + 1));
-                fallbacks.addCPUSkinningFallback(0, mesh);
-            }
-            // Alpha test
-            if (engine.getAlphaTesting()) {
-                defines.push("#define ALPHATEST");
-            }
-            var previousEffect = this._effect;
-            var join = defines.join("\n");
-            this._effect = engine.createEffect(this._shaderPath, this._options.attributes, this._options.uniforms, this._options.samplers, join, fallbacks, this.onCompiled, this.onError);
-            if (!this._effect.isReady()) {
-                return false;
-            }
-            if (previousEffect !== this._effect) {
-                scene.resetCachedMaterial();
-            }
-            this._renderId = scene.getRenderId();
-            return true;
-        };
-        ShaderMaterial.prototype.bindOnlyWorldMatrix = function (world) {
-            var scene = this.getScene();
-            if (this._options.uniforms.indexOf("world") !== -1) {
-                this._effect.setMatrix("world", world);
-            }
-            if (this._options.uniforms.indexOf("worldView") !== -1) {
-                world.multiplyToRef(scene.getViewMatrix(), this._cachedWorldViewMatrix);
-                this._effect.setMatrix("worldView", this._cachedWorldViewMatrix);
-            }
-            if (this._options.uniforms.indexOf("worldViewProjection") !== -1) {
-                this._effect.setMatrix("worldViewProjection", world.multiply(scene.getTransformMatrix()));
-            }
-        };
-        ShaderMaterial.prototype.bind = function (world, mesh) {
-            // Std values
-            this.bindOnlyWorldMatrix(world);
-            if (this.getScene().getCachedMaterial() !== this) {
-                if (this._options.uniforms.indexOf("view") !== -1) {
-                    this._effect.setMatrix("view", this.getScene().getViewMatrix());
-                }
-                if (this._options.uniforms.indexOf("projection") !== -1) {
-                    this._effect.setMatrix("projection", this.getScene().getProjectionMatrix());
-                }
-                if (this._options.uniforms.indexOf("viewProjection") !== -1) {
-                    this._effect.setMatrix("viewProjection", this.getScene().getTransformMatrix());
-                }
-                // Bones
-                BABYLON.MaterialHelper.BindBonesParameters(mesh, this._effect);
-                var name;
-                // Texture
-                for (name in this._textures) {
-                    this._effect.setTexture(name, this._textures[name]);
-                }
-                // Texture arrays
-                for (name in this._textureArrays) {
-                    this._effect.setTextureArray(name, this._textureArrays[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]);
-                }
-                // Vector4        
-                for (name in this._vectors4) {
-                    this._effect.setVector4(name, this._vectors4[name]);
-                }
-                // Matrix      
-                for (name in this._matrices) {
-                    this._effect.setMatrix(name, this._matrices[name]);
-                }
-                // Matrix 3x3
-                for (name in this._matrices3x3) {
-                    this._effect.setMatrix3x3(name, this._matrices3x3[name]);
-                }
-                // Matrix 2x2
-                for (name in this._matrices2x2) {
-                    this._effect.setMatrix2x2(name, this._matrices2x2[name]);
-                }
-                // Vector3Array   
-                for (name in this._vectors3Arrays) {
-                    this._effect.setArray3(name, this._vectors3Arrays[name]);
-                }
-            }
-            _super.prototype.bind.call(this, world, mesh);
-        };
-        ShaderMaterial.prototype.clone = function (name) {
-            var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
-            return newShaderMaterial;
-        };
-        ShaderMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
-            if (forceDisposeTextures) {
-                var name;
-                for (name in this._textures) {
-                    this._textures[name].dispose();
-                }
-                for (name in this._textureArrays) {
-                    var array = this._textureArrays[name];
-                    for (var index = 0; index < array.length; index++) {
-                        array[index].dispose();
-                    }
-                }
-            }
-            this._textures = {};
-            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
-        };
-        ShaderMaterial.prototype.serialize = function () {
-            var serializationObject = BABYLON.SerializationHelper.Serialize(this);
-            serializationObject.customType = "BABYLON.ShaderMaterial";
-            serializationObject.options = this._options;
-            serializationObject.shaderPath = this._shaderPath;
-            var name;
-            // Texture
-            serializationObject.textures = {};
-            for (name in this._textures) {
-                serializationObject.textures[name] = this._textures[name].serialize();
-            }
-            // Texture arrays
-            serializationObject.textureArrays = {};
-            for (name in this._textureArrays) {
-                serializationObject.textureArrays[name] = [];
-                var array = this._textureArrays[name];
-                for (var index = 0; index < array.length; index++) {
-                    serializationObject.textureArrays[name].push(array[index].serialize());
-                }
-            }
-            // Float    
-            serializationObject.floats = {};
-            for (name in this._floats) {
-                serializationObject.floats[name] = this._floats[name];
-            }
-            // Float s   
-            serializationObject.floatArrays = {};
-            for (name in this._floatsArrays) {
-                serializationObject.floatArrays[name] = this._floatsArrays[name];
-            }
-            // Color3    
-            serializationObject.colors3 = {};
-            for (name in this._colors3) {
-                serializationObject.colors3[name] = this._colors3[name].asArray();
-            }
-            // Color4  
-            serializationObject.colors4 = {};
-            for (name in this._colors4) {
-                serializationObject.colors4[name] = this._colors4[name].asArray();
-            }
-            // Vector2  
-            serializationObject.vectors2 = {};
-            for (name in this._vectors2) {
-                serializationObject.vectors2[name] = this._vectors2[name].asArray();
-            }
-            // Vector3        
-            serializationObject.vectors3 = {};
-            for (name in this._vectors3) {
-                serializationObject.vectors3[name] = this._vectors3[name].asArray();
-            }
-            // Vector4        
-            serializationObject.vectors4 = {};
-            for (name in this._vectors4) {
-                serializationObject.vectors4[name] = this._vectors4[name].asArray();
-            }
-            // Matrix      
-            serializationObject.matrices = {};
-            for (name in this._matrices) {
-                serializationObject.matrices[name] = this._matrices[name].asArray();
-            }
-            // Matrix 3x3
-            serializationObject.matrices3x3 = {};
-            for (name in this._matrices3x3) {
-                serializationObject.matrices3x3[name] = this._matrices3x3[name];
-            }
-            // Matrix 2x2
-            serializationObject.matrices2x2 = {};
-            for (name in this._matrices2x2) {
-                serializationObject.matrices2x2[name] = this._matrices2x2[name];
-            }
-            // Vector3Array
-            serializationObject.vectors3Arrays = {};
-            for (name in this._vectors3Arrays) {
-                serializationObject.vectors3Arrays[name] = this._vectors3Arrays[name];
-            }
-            return serializationObject;
-        };
-        ShaderMaterial.Parse = function (source, scene, rootUrl) {
-            var material = BABYLON.SerializationHelper.Parse(function () { return new ShaderMaterial(source.name, scene, source.shaderPath, source.options); }, source, scene, rootUrl);
-            var name;
-            // Texture
-            for (name in source.textures) {
-                material.setTexture(name, BABYLON.Texture.Parse(source.textures[name], scene, rootUrl));
-            }
-            // Texture arrays
-            for (name in source.textureArrays) {
-                var array = source.textureArrays[name];
-                var textureArray = new Array();
-                for (var index = 0; index < array.length; index++) {
-                    textureArray.push(BABYLON.Texture.Parse(array[index], scene, rootUrl));
-                }
-                material.setTextureArray(name, textureArray);
-            }
-            // Float    
-            for (name in source.floats) {
-                material.setFloat(name, source.floats[name]);
-            }
-            // Float s   
-            for (name in source.floatsArrays) {
-                material.setFloats(name, source.floatsArrays[name]);
-            }
-            // Color3        
-            for (name in source.colors3) {
-                material.setColor3(name, BABYLON.Color3.FromArray(source.colors3[name]));
-            }
-            // Color4      
-            for (name in source.colors4) {
-                material.setColor4(name, BABYLON.Color4.FromArray(source.colors4[name]));
-            }
-            // Vector2        
-            for (name in source.vectors2) {
-                material.setVector2(name, BABYLON.Vector2.FromArray(source.vectors2[name]));
-            }
-            // Vector3        
-            for (name in source.vectors3) {
-                material.setVector3(name, BABYLON.Vector3.FromArray(source.vectors3[name]));
-            }
-            // Vector4        
-            for (name in source.vectors4) {
-                material.setVector4(name, BABYLON.Vector4.FromArray(source.vectors4[name]));
-            }
-            // Matrix      
-            for (name in source.matrices) {
-                material.setMatrix(name, BABYLON.Matrix.FromArray(source.matrices[name]));
-            }
-            // Matrix 3x3
-            for (name in source.matrices3x3) {
-                material.setMatrix3x3(name, source.matrices3x3[name]);
-            }
-            // Matrix 2x2
-            for (name in source.matrices2x2) {
-                material.setMatrix2x2(name, source.matrices2x2[name]);
-            }
-            // Vector3Array
-            for (name in source.vectors3Arrays) {
-                material.setArray3(name, source.vectors3Arrays[name]);
-            }
-            return material;
-        };
-        return ShaderMaterial;
-    }(BABYLON.Material));
-    BABYLON.ShaderMaterial = ShaderMaterial;
-})(BABYLON || (BABYLON = {}));

+ 0 - 897
src/Materials/babylon.standardMaterial.js

@@ -1,897 +0,0 @@
-var __extends = (this && this.__extends) || function (d, b) {
-    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
-    function __() { this.constructor = d; }
-    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
-};
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var BABYLON;
-(function (BABYLON) {
-    var StandardMaterialDefines = (function (_super) {
-        __extends(StandardMaterialDefines, _super);
-        function StandardMaterialDefines() {
-            _super.call(this);
-            this.DIFFUSE = false;
-            this.AMBIENT = false;
-            this.OPACITY = false;
-            this.OPACITYRGB = false;
-            this.REFLECTION = false;
-            this.EMISSIVE = false;
-            this.SPECULAR = false;
-            this.BUMP = false;
-            this.PARALLAX = false;
-            this.PARALLAXOCCLUSION = false;
-            this.SPECULAROVERALPHA = false;
-            this.CLIPPLANE = false;
-            this.ALPHATEST = false;
-            this.ALPHAFROMDIFFUSE = false;
-            this.POINTSIZE = false;
-            this.FOG = false;
-            this.SPECULARTERM = false;
-            this.DIFFUSEFRESNEL = false;
-            this.OPACITYFRESNEL = false;
-            this.REFLECTIONFRESNEL = false;
-            this.REFRACTIONFRESNEL = false;
-            this.EMISSIVEFRESNEL = false;
-            this.FRESNEL = false;
-            this.NORMAL = false;
-            this.UV1 = false;
-            this.UV2 = false;
-            this.VERTEXCOLOR = false;
-            this.VERTEXALPHA = false;
-            this.NUM_BONE_INFLUENCERS = 0;
-            this.BonesPerMesh = 0;
-            this.INSTANCES = false;
-            this.GLOSSINESS = false;
-            this.ROUGHNESS = false;
-            this.EMISSIVEASILLUMINATION = false;
-            this.LINKEMISSIVEWITHDIFFUSE = false;
-            this.REFLECTIONFRESNELFROMSPECULAR = false;
-            this.LIGHTMAP = false;
-            this.USELIGHTMAPASSHADOWMAP = false;
-            this.REFLECTIONMAP_3D = false;
-            this.REFLECTIONMAP_SPHERICAL = false;
-            this.REFLECTIONMAP_PLANAR = false;
-            this.REFLECTIONMAP_CUBIC = false;
-            this.REFLECTIONMAP_PROJECTION = false;
-            this.REFLECTIONMAP_SKYBOX = false;
-            this.REFLECTIONMAP_EXPLICIT = false;
-            this.REFLECTIONMAP_EQUIRECTANGULAR = false;
-            this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
-            this.INVERTCUBICMAP = false;
-            this.LOGARITHMICDEPTH = false;
-            this.REFRACTION = false;
-            this.REFRACTIONMAP_3D = false;
-            this.REFLECTIONOVERALPHA = false;
-            this.INVERTNORMALMAPX = false;
-            this.INVERTNORMALMAPY = false;
-            this.SHADOWFULLFLOAT = false;
-            this.CAMERACOLORGRADING = false;
-            this.CAMERACOLORCURVES = false;
-            this.rebuild();
-        }
-        return StandardMaterialDefines;
-    }(BABYLON.MaterialDefines));
-    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.emissiveColor = new BABYLON.Color3(0, 0, 0);
-            this.specularPower = 64;
-            this.useAlphaFromDiffuseTexture = false;
-            this.useEmissiveAsIllumination = false;
-            this.linkEmissiveWithDiffuse = false;
-            this.useReflectionFresnelFromSpecular = false;
-            this.useSpecularOverAlpha = false;
-            this.useReflectionOverAlpha = false;
-            this.disableLighting = false;
-            this.useParallax = false;
-            this.useParallaxOcclusion = false;
-            this.parallaxScaleBias = 0.05;
-            this.roughness = 0;
-            this.indexOfRefraction = 0.98;
-            this.invertRefractionY = true;
-            this.useLightmapAsShadowmap = false;
-            this.useGlossinessFromSpecularMapAlpha = false;
-            this.maxSimultaneousLights = 4;
-            /**
-             * If sets to true, x component of normal map value will invert (x = 1.0 - x).
-             */
-            this.invertNormalMapX = false;
-            /**
-             * If sets to true, y component of normal map value will invert (y = 1.0 - y).
-             */
-            this.invertNormalMapY = false;
-            /**
-             * Color Grading 2D Lookup Texture.
-             * This allows special effects like sepia, black and white to sixties rendering style.
-             */
-            this.cameraColorGradingTexture = null;
-            /**
-             * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
-             * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
-             * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
-             * corresponding to low luminance, medium luminance, and high luminance areas respectively.
-             */
-            this.cameraColorCurves = null;
-            this._renderTargets = new BABYLON.SmartArray(16);
-            this._worldViewProjectionMatrix = BABYLON.Matrix.Zero();
-            this._globalAmbientColor = new BABYLON.Color3(0, 0, 0);
-            this._defines = new StandardMaterialDefines();
-            this._cachedDefines = new StandardMaterialDefines();
-            this._cachedDefines.BonesPerMesh = -1;
-            this.getRenderTargetTextures = function () {
-                _this._renderTargets.reset();
-                if (_this.reflectionTexture && _this.reflectionTexture.isRenderTarget) {
-                    _this._renderTargets.push(_this.reflectionTexture);
-                }
-                if (_this.refractionTexture && _this.refractionTexture.isRenderTarget) {
-                    _this._renderTargets.push(_this.refractionTexture);
-                }
-                return _this._renderTargets;
-            };
-        }
-        Object.defineProperty(StandardMaterial.prototype, "useLogarithmicDepth", {
-            get: function () {
-                return this._useLogarithmicDepth;
-            },
-            set: function (value) {
-                this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        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;
-        };
-        StandardMaterial.prototype._shouldUseAlphaFromDiffuseTexture = function () {
-            return this.diffuseTexture != null && this.diffuseTexture.hasAlpha && this.useAlphaFromDiffuseTexture;
-        };
-        StandardMaterial.prototype.getAlphaTestTexture = function () {
-            return this.diffuseTexture;
-        };
-        // Methods   
-        StandardMaterial.prototype._checkCache = function (scene, mesh, useInstances) {
-            if (!mesh) {
-                return true;
-            }
-            if (this._defines.INSTANCES !== useInstances) {
-                return false;
-            }
-            if (mesh._materialDefines && mesh._materialDefines.isEqual(this._defines)) {
-                return true;
-            }
-            return false;
-        };
-        StandardMaterial.prototype.isReady = function (mesh, useInstances) {
-            if (this.isFrozen) {
-                if (this._wasPreviouslyReady) {
-                    return true;
-                }
-            }
-            var scene = this.getScene();
-            var engine = scene.getEngine();
-            var needUVs = false;
-            var needNormals = false;
-            this._defines.reset();
-            // Lights
-            if (scene.lightsEnabled && !this.disableLighting) {
-                needNormals = BABYLON.MaterialHelper.PrepareDefinesForLights(scene, mesh, this._defines, this.maxSimultaneousLights);
-            }
-            if (!this.checkReadyOnEveryCall) {
-                if (this._renderId === scene.getRenderId()) {
-                    if (this._checkCache(scene, mesh, useInstances)) {
-                        return true;
-                    }
-                }
-            }
-            // Textures
-            if (scene.texturesEnabled) {
-                if (this.diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {
-                    if (!this.diffuseTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needUVs = true;
-                        this._defines.DIFFUSE = true;
-                    }
-                }
-                if (this.ambientTexture && StandardMaterial.AmbientTextureEnabled) {
-                    if (!this.ambientTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needUVs = true;
-                        this._defines.AMBIENT = true;
-                    }
-                }
-                if (this.opacityTexture && StandardMaterial.OpacityTextureEnabled) {
-                    if (!this.opacityTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needUVs = true;
-                        this._defines.OPACITY = true;
-                        if (this.opacityTexture.getAlphaFromRGB) {
-                            this._defines.OPACITYRGB = true;
-                        }
-                    }
-                }
-                if (this.reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {
-                    if (!this.reflectionTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needNormals = true;
-                        this._defines.REFLECTION = true;
-                        if (this.roughness > 0) {
-                            this._defines.ROUGHNESS = true;
-                        }
-                        if (this.useReflectionOverAlpha) {
-                            this._defines.REFLECTIONOVERALPHA = true;
-                        }
-                        if (this.reflectionTexture.coordinatesMode === BABYLON.Texture.INVCUBIC_MODE) {
-                            this._defines.INVERTCUBICMAP = true;
-                        }
-                        this._defines.REFLECTIONMAP_3D = this.reflectionTexture.isCube;
-                        switch (this.reflectionTexture.coordinatesMode) {
-                            case BABYLON.Texture.CUBIC_MODE:
-                            case BABYLON.Texture.INVCUBIC_MODE:
-                                this._defines.REFLECTIONMAP_CUBIC = true;
-                                break;
-                            case BABYLON.Texture.EXPLICIT_MODE:
-                                this._defines.REFLECTIONMAP_EXPLICIT = true;
-                                break;
-                            case BABYLON.Texture.PLANAR_MODE:
-                                this._defines.REFLECTIONMAP_PLANAR = true;
-                                break;
-                            case BABYLON.Texture.PROJECTION_MODE:
-                                this._defines.REFLECTIONMAP_PROJECTION = true;
-                                break;
-                            case BABYLON.Texture.SKYBOX_MODE:
-                                this._defines.REFLECTIONMAP_SKYBOX = true;
-                                break;
-                            case BABYLON.Texture.SPHERICAL_MODE:
-                                this._defines.REFLECTIONMAP_SPHERICAL = true;
-                                break;
-                            case BABYLON.Texture.EQUIRECTANGULAR_MODE:
-                                this._defines.REFLECTIONMAP_EQUIRECTANGULAR = true;
-                                break;
-                            case BABYLON.Texture.FIXED_EQUIRECTANGULAR_MODE:
-                                this._defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;
-                                break;
-                        }
-                    }
-                }
-                if (this.emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {
-                    if (!this.emissiveTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needUVs = true;
-                        this._defines.EMISSIVE = true;
-                    }
-                }
-                if (this.lightmapTexture && StandardMaterial.LightmapTextureEnabled) {
-                    if (!this.lightmapTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needUVs = true;
-                        this._defines.LIGHTMAP = true;
-                        this._defines.USELIGHTMAPASSHADOWMAP = this.useLightmapAsShadowmap;
-                    }
-                }
-                if (this.specularTexture && StandardMaterial.SpecularTextureEnabled) {
-                    if (!this.specularTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needUVs = true;
-                        this._defines.SPECULAR = true;
-                        this._defines.GLOSSINESS = this.useGlossinessFromSpecularMapAlpha;
-                    }
-                }
-                if (scene.getEngine().getCaps().standardDerivatives && this.bumpTexture && StandardMaterial.BumpTextureEnabled) {
-                    if (!this.bumpTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needUVs = true;
-                        this._defines.BUMP = true;
-                        if (this.useParallax) {
-                            this._defines.PARALLAX = true;
-                            if (this.useParallaxOcclusion) {
-                                this._defines.PARALLAXOCCLUSION = true;
-                            }
-                        }
-                        if (this.invertNormalMapX) {
-                            this._defines.INVERTNORMALMAPX = true;
-                        }
-                        if (this.invertNormalMapY) {
-                            this._defines.INVERTNORMALMAPY = true;
-                        }
-                    }
-                }
-                if (this.refractionTexture && StandardMaterial.RefractionTextureEnabled) {
-                    if (!this.refractionTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        needUVs = true;
-                        this._defines.REFRACTION = true;
-                        this._defines.REFRACTIONMAP_3D = this.refractionTexture.isCube;
-                    }
-                }
-                if (this.cameraColorGradingTexture && StandardMaterial.ColorGradingTextureEnabled) {
-                    if (!this.cameraColorGradingTexture.isReady()) {
-                        return false;
-                    }
-                    else {
-                        this._defines.CAMERACOLORGRADING = true;
-                    }
-                }
-            }
-            // Effect
-            if (scene.clipPlane) {
-                this._defines.CLIPPLANE = true;
-            }
-            if (engine.getAlphaTesting()) {
-                this._defines.ALPHATEST = true;
-            }
-            if (this._shouldUseAlphaFromDiffuseTexture()) {
-                this._defines.ALPHAFROMDIFFUSE = true;
-            }
-            if (this.useEmissiveAsIllumination) {
-                this._defines.EMISSIVEASILLUMINATION = true;
-            }
-            if (this.linkEmissiveWithDiffuse) {
-                this._defines.LINKEMISSIVEWITHDIFFUSE = true;
-            }
-            if (this.useLogarithmicDepth) {
-                this._defines.LOGARITHMICDEPTH = true;
-            }
-            if (this.cameraColorCurves) {
-                this._defines.CAMERACOLORCURVES = true;
-            }
-            // Point size
-            if (this.pointsCloud || scene.forcePointsCloud) {
-                this._defines.POINTSIZE = true;
-            }
-            // Fog
-            if (scene.fogEnabled && mesh && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
-                this._defines.FOG = true;
-            }
-            if (StandardMaterial.FresnelEnabled) {
-                // Fresnel
-                if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled ||
-                    this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled ||
-                    this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled ||
-                    this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled ||
-                    this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
-                    if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {
-                        this._defines.DIFFUSEFRESNEL = true;
-                    }
-                    if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {
-                        this._defines.OPACITYFRESNEL = true;
-                    }
-                    if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {
-                        this._defines.REFLECTIONFRESNEL = true;
-                        if (this.useReflectionFresnelFromSpecular) {
-                            this._defines.REFLECTIONFRESNELFROMSPECULAR = true;
-                        }
-                    }
-                    if (this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled) {
-                        this._defines.REFRACTIONFRESNEL = true;
-                    }
-                    if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {
-                        this._defines.EMISSIVEFRESNEL = true;
-                    }
-                    needNormals = true;
-                    this._defines.FRESNEL = true;
-                }
-            }
-            if (this._defines.SPECULARTERM && this.useSpecularOverAlpha) {
-                this._defines.SPECULAROVERALPHA = true;
-            }
-            // Attribs
-            if (mesh) {
-                if (needNormals && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
-                    this._defines.NORMAL = true;
-                }
-                if (needUVs) {
-                    if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                        this._defines.UV1 = true;
-                    }
-                    if (mesh.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind)) {
-                        this._defines.UV2 = true;
-                    }
-                }
-                if (mesh.useVertexColors && mesh.isVerticesDataPresent(BABYLON.VertexBuffer.ColorKind)) {
-                    this._defines.VERTEXCOLOR = true;
-                    if (mesh.hasVertexAlpha) {
-                        this._defines.VERTEXALPHA = true;
-                    }
-                }
-                if (mesh.useBones && mesh.computeBonesUsingShaders) {
-                    this._defines.NUM_BONE_INFLUENCERS = mesh.numBoneInfluencers;
-                    this._defines.BonesPerMesh = (mesh.skeleton.bones.length + 1);
-                }
-                // Instances
-                if (useInstances) {
-                    this._defines.INSTANCES = true;
-                }
-            }
-            // Get correct effect      
-            if (!this._defines.isEqual(this._cachedDefines)) {
-                this._defines.cloneTo(this._cachedDefines);
-                scene.resetCachedMaterial();
-                // Fallbacks
-                var fallbacks = new BABYLON.EffectFallbacks();
-                if (this._defines.REFLECTION) {
-                    fallbacks.addFallback(0, "REFLECTION");
-                }
-                if (this._defines.SPECULAR) {
-                    fallbacks.addFallback(0, "SPECULAR");
-                }
-                if (this._defines.BUMP) {
-                    fallbacks.addFallback(0, "BUMP");
-                }
-                if (this._defines.PARALLAX) {
-                    fallbacks.addFallback(1, "PARALLAX");
-                }
-                if (this._defines.PARALLAXOCCLUSION) {
-                    fallbacks.addFallback(0, "PARALLAXOCCLUSION");
-                }
-                if (this._defines.SPECULAROVERALPHA) {
-                    fallbacks.addFallback(0, "SPECULAROVERALPHA");
-                }
-                if (this._defines.FOG) {
-                    fallbacks.addFallback(1, "FOG");
-                }
-                if (this._defines.POINTSIZE) {
-                    fallbacks.addFallback(0, "POINTSIZE");
-                }
-                if (this._defines.LOGARITHMICDEPTH) {
-                    fallbacks.addFallback(0, "LOGARITHMICDEPTH");
-                }
-                BABYLON.MaterialHelper.HandleFallbacksForShadows(this._defines, fallbacks, this.maxSimultaneousLights);
-                if (this._defines.SPECULARTERM) {
-                    fallbacks.addFallback(0, "SPECULARTERM");
-                }
-                if (this._defines.DIFFUSEFRESNEL) {
-                    fallbacks.addFallback(1, "DIFFUSEFRESNEL");
-                }
-                if (this._defines.OPACITYFRESNEL) {
-                    fallbacks.addFallback(2, "OPACITYFRESNEL");
-                }
-                if (this._defines.REFLECTIONFRESNEL) {
-                    fallbacks.addFallback(3, "REFLECTIONFRESNEL");
-                }
-                if (this._defines.EMISSIVEFRESNEL) {
-                    fallbacks.addFallback(4, "EMISSIVEFRESNEL");
-                }
-                if (this._defines.FRESNEL) {
-                    fallbacks.addFallback(4, "FRESNEL");
-                }
-                //Attributes
-                var attribs = [BABYLON.VertexBuffer.PositionKind];
-                if (this._defines.NORMAL) {
-                    attribs.push(BABYLON.VertexBuffer.NormalKind);
-                }
-                if (this._defines.UV1) {
-                    attribs.push(BABYLON.VertexBuffer.UVKind);
-                }
-                if (this._defines.UV2) {
-                    attribs.push(BABYLON.VertexBuffer.UV2Kind);
-                }
-                if (this._defines.VERTEXCOLOR) {
-                    attribs.push(BABYLON.VertexBuffer.ColorKind);
-                }
-                BABYLON.MaterialHelper.PrepareAttributesForBones(attribs, mesh, this._defines, fallbacks);
-                BABYLON.MaterialHelper.PrepareAttributesForInstances(attribs, this._defines);
-                var shaderName = "default";
-                var join = this._defines.toString();
-                var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vAmbientColor", "vDiffuseColor", "vSpecularColor", "vEmissiveColor",
-                    "vFogInfos", "vFogColor", "pointSize",
-                    "vDiffuseInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", "vEmissiveInfos", "vSpecularInfos", "vBumpInfos", "vLightmapInfos", "vRefractionInfos",
-                    "mBones",
-                    "vClipPlane", "diffuseMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", "emissiveMatrix", "specularMatrix", "bumpMatrix", "lightmapMatrix", "refractionMatrix",
-                    "depthValues",
-                    "diffuseLeftColor", "diffuseRightColor", "opacityParts", "reflectionLeftColor", "reflectionRightColor", "emissiveLeftColor", "emissiveRightColor", "refractionLeftColor", "refractionRightColor",
-                    "logarithmicDepthConstant"
-                ];
-                var samplers = ["diffuseSampler", "ambientSampler", "opacitySampler", "reflectionCubeSampler", "reflection2DSampler", "emissiveSampler", "specularSampler", "bumpSampler", "lightmapSampler", "refractionCubeSampler", "refraction2DSampler"];
-                if (this._defines.CAMERACOLORCURVES) {
-                    BABYLON.ColorCurves.PrepareUniforms(uniforms);
-                }
-                if (this._defines.CAMERACOLORGRADING) {
-                    BABYLON.ColorGradingTexture.PrepareUniformsAndSamplers(uniforms, samplers);
-                }
-                BABYLON.MaterialHelper.PrepareUniformsAndSamplersList(uniforms, samplers, this._defines, this.maxSimultaneousLights);
-                this._effect = scene.getEngine().createEffect(shaderName, attribs, uniforms, samplers, join, fallbacks, this.onCompiled, this.onError, { maxSimultaneousLights: this.maxSimultaneousLights - 1 });
-            }
-            if (!this._effect.isReady()) {
-                return false;
-            }
-            this._renderId = scene.getRenderId();
-            this._wasPreviouslyReady = true;
-            if (mesh) {
-                if (!mesh._materialDefines) {
-                    mesh._materialDefines = new StandardMaterialDefines();
-                }
-                this._defines.cloneTo(mesh._materialDefines);
-            }
-            return true;
-        };
-        StandardMaterial.prototype.unbind = function () {
-            if (this.reflectionTexture && this.reflectionTexture.isRenderTarget) {
-                this._effect.setTexture("reflection2DSampler", null);
-            }
-            if (this.refractionTexture && this.refractionTexture.isRenderTarget) {
-                this._effect.setTexture("refraction2DSampler", null);
-            }
-            _super.prototype.unbind.call(this);
-        };
-        StandardMaterial.prototype.bindOnlyWorldMatrix = function (world) {
-            this._effect.setMatrix("world", world);
-        };
-        StandardMaterial.prototype.bind = function (world, mesh) {
-            var scene = this.getScene();
-            // Matrices        
-            this.bindOnlyWorldMatrix(world);
-            // Bones
-            BABYLON.MaterialHelper.BindBonesParameters(mesh, this._effect);
-            if (scene.getCachedMaterial() !== this) {
-                this._effect.setMatrix("viewProjection", scene.getTransformMatrix());
-                if (StandardMaterial.FresnelEnabled) {
-                    // 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.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled) {
-                        this._effect.setColor4("refractionLeftColor", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power);
-                        this._effect.setColor4("refractionRightColor", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.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 (scene.texturesEnabled) {
-                    if (this.diffuseTexture && 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 && 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 && 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 && 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.setFloat2("vReflectionInfos", this.reflectionTexture.level, this.roughness);
-                    }
-                    if (this.emissiveTexture && 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.lightmapTexture && StandardMaterial.LightmapTextureEnabled) {
-                        this._effect.setTexture("lightmapSampler", this.lightmapTexture);
-                        this._effect.setFloat2("vLightmapInfos", this.lightmapTexture.coordinatesIndex, this.lightmapTexture.level);
-                        this._effect.setMatrix("lightmapMatrix", this.lightmapTexture.getTextureMatrix());
-                    }
-                    if (this.specularTexture && 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 && StandardMaterial.BumpTextureEnabled) {
-                        this._effect.setTexture("bumpSampler", this.bumpTexture);
-                        this._effect.setFloat3("vBumpInfos", this.bumpTexture.coordinatesIndex, 1.0 / this.bumpTexture.level, this.parallaxScaleBias);
-                        this._effect.setMatrix("bumpMatrix", this.bumpTexture.getTextureMatrix());
-                    }
-                    if (this.refractionTexture && StandardMaterial.RefractionTextureEnabled) {
-                        var depth = 1.0;
-                        if (this.refractionTexture.isCube) {
-                            this._effect.setTexture("refractionCubeSampler", this.refractionTexture);
-                        }
-                        else {
-                            this._effect.setTexture("refraction2DSampler", this.refractionTexture);
-                            this._effect.setMatrix("refractionMatrix", this.refractionTexture.getReflectionTextureMatrix());
-                            if (this.refractionTexture.depth) {
-                                depth = this.refractionTexture.depth;
-                            }
-                        }
-                        this._effect.setFloat4("vRefractionInfos", this.refractionTexture.level, this.indexOfRefraction, depth, this.invertRefractionY ? -1 : 1);
-                    }
-                    if (this.cameraColorGradingTexture && StandardMaterial.ColorGradingTextureEnabled) {
-                        BABYLON.ColorGradingTexture.Bind(this.cameraColorGradingTexture, this._effect);
-                    }
-                }
-                // Clip plane
-                BABYLON.MaterialHelper.BindClipPlane(this._effect, scene);
-                // Point size
-                if (this.pointsCloud) {
-                    this._effect.setFloat("pointSize", this.pointSize);
-                }
-                // Colors
-                scene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);
-                this._effect.setVector3("vEyePosition", scene._mirroredCameraPosition ? scene._mirroredCameraPosition : scene.activeCamera.position);
-                this._effect.setColor3("vAmbientColor", this._globalAmbientColor);
-                if (this._defines.SPECULARTERM) {
-                    this._effect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
-                }
-                this._effect.setColor3("vEmissiveColor", this.emissiveColor);
-            }
-            if (scene.getCachedMaterial() !== this || !this.isFrozen) {
-                // Diffuse
-                this._effect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
-                // Lights
-                if (scene.lightsEnabled && !this.disableLighting) {
-                    BABYLON.MaterialHelper.BindLights(scene, mesh, this._effect, this._defines, this.maxSimultaneousLights);
-                }
-                // View
-                if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== BABYLON.Scene.FOGMODE_NONE || this.reflectionTexture || this.refractionTexture) {
-                    this._effect.setMatrix("view", scene.getViewMatrix());
-                }
-                // Fog
-                BABYLON.MaterialHelper.BindFogParameters(scene, mesh, this._effect);
-                // Log. depth
-                BABYLON.MaterialHelper.BindLogDepth(this._defines, this._effect, scene);
-                // Color Curves
-                if (this.cameraColorCurves) {
-                    BABYLON.ColorCurves.Bind(this.cameraColorCurves, this._effect);
-                }
-            }
-            _super.prototype.bind.call(this, world, mesh);
-        };
-        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);
-            }
-            if (this.lightmapTexture && this.lightmapTexture.animations && this.lightmapTexture.animations.length > 0) {
-                results.push(this.lightmapTexture);
-            }
-            if (this.refractionTexture && this.refractionTexture.animations && this.refractionTexture.animations.length > 0) {
-                results.push(this.refractionTexture);
-            }
-            if (this.cameraColorGradingTexture && this.cameraColorGradingTexture.animations && this.cameraColorGradingTexture.animations.length > 0) {
-                results.push(this.cameraColorGradingTexture);
-            }
-            return results;
-        };
-        StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
-            if (forceDisposeTextures) {
-                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();
-                }
-                if (this.lightmapTexture) {
-                    this.lightmapTexture.dispose();
-                }
-                if (this.refractionTexture) {
-                    this.refractionTexture.dispose();
-                }
-                if (this.cameraColorGradingTexture) {
-                    this.cameraColorGradingTexture.dispose();
-                }
-            }
-            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
-        };
-        StandardMaterial.prototype.clone = function (name) {
-            var _this = this;
-            return BABYLON.SerializationHelper.Clone(function () { return new StandardMaterial(name, _this.getScene()); }, this);
-        };
-        StandardMaterial.prototype.serialize = function () {
-            return BABYLON.SerializationHelper.Serialize(this);
-        };
-        // Statics
-        StandardMaterial.Parse = function (source, scene, rootUrl) {
-            return BABYLON.SerializationHelper.Parse(function () { return new StandardMaterial(source.name, scene); }, source, scene, rootUrl);
-        };
-        // Flags used to enable or disable a type of texture for all Standard Materials
-        StandardMaterial.DiffuseTextureEnabled = true;
-        StandardMaterial.AmbientTextureEnabled = true;
-        StandardMaterial.OpacityTextureEnabled = true;
-        StandardMaterial.ReflectionTextureEnabled = true;
-        StandardMaterial.EmissiveTextureEnabled = true;
-        StandardMaterial.SpecularTextureEnabled = true;
-        StandardMaterial.BumpTextureEnabled = true;
-        StandardMaterial.FresnelEnabled = true;
-        StandardMaterial.LightmapTextureEnabled = true;
-        StandardMaterial.RefractionTextureEnabled = true;
-        StandardMaterial.ColorGradingTextureEnabled = true;
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "diffuseTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "ambientTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "opacityTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "reflectionTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "emissiveTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "specularTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "bumpTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "lightmapTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "refractionTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsColor3("ambient")
-        ], StandardMaterial.prototype, "ambientColor", void 0);
-        __decorate([
-            BABYLON.serializeAsColor3("diffuse")
-        ], StandardMaterial.prototype, "diffuseColor", void 0);
-        __decorate([
-            BABYLON.serializeAsColor3("specular")
-        ], StandardMaterial.prototype, "specularColor", void 0);
-        __decorate([
-            BABYLON.serializeAsColor3("emissive")
-        ], StandardMaterial.prototype, "emissiveColor", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "specularPower", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useAlphaFromDiffuseTexture", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useEmissiveAsIllumination", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "linkEmissiveWithDiffuse", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useReflectionFresnelFromSpecular", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useSpecularOverAlpha", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useReflectionOverAlpha", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "disableLighting", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useParallax", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useParallaxOcclusion", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "parallaxScaleBias", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "roughness", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "indexOfRefraction", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "invertRefractionY", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useLightmapAsShadowmap", void 0);
-        __decorate([
-            BABYLON.serializeAsFresnelParameters()
-        ], StandardMaterial.prototype, "diffuseFresnelParameters", void 0);
-        __decorate([
-            BABYLON.serializeAsFresnelParameters()
-        ], StandardMaterial.prototype, "opacityFresnelParameters", void 0);
-        __decorate([
-            BABYLON.serializeAsFresnelParameters()
-        ], StandardMaterial.prototype, "reflectionFresnelParameters", void 0);
-        __decorate([
-            BABYLON.serializeAsFresnelParameters()
-        ], StandardMaterial.prototype, "refractionFresnelParameters", void 0);
-        __decorate([
-            BABYLON.serializeAsFresnelParameters()
-        ], StandardMaterial.prototype, "emissiveFresnelParameters", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useGlossinessFromSpecularMapAlpha", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "maxSimultaneousLights", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "invertNormalMapX", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "invertNormalMapY", void 0);
-        __decorate([
-            BABYLON.serializeAsTexture()
-        ], StandardMaterial.prototype, "cameraColorGradingTexture", void 0);
-        __decorate([
-            BABYLON.serializeAsColorCurves()
-        ], StandardMaterial.prototype, "cameraColorCurves", void 0);
-        __decorate([
-            BABYLON.serialize()
-        ], StandardMaterial.prototype, "useLogarithmicDepth", null);
-        return StandardMaterial;
-    }(BABYLON.Material));
-    BABYLON.StandardMaterial = StandardMaterial;
-})(BABYLON || (BABYLON = {}));

+ 0 - 240
src/Math/babylon.math.SIMD.js

@@ -1,240 +0,0 @@
-var BABYLON;
-(function (BABYLON) {
-    var SIMDVector3 = (function () {
-        function SIMDVector3() {
-        }
-        SIMDVector3.TransformCoordinatesToRefSIMD = function (vector, transformation, result) {
-            SIMDVector3.TransformCoordinatesFromFloatsToRefSIMD(vector.x, vector.y, vector.z, transformation, result);
-        };
-        SIMDVector3.TransformCoordinatesFromFloatsToRefSIMD = function (x, y, z, transformation, result) {
-            var m = transformation.m;
-            var m0 = SIMD.Float32x4.load(m, 0);
-            var m1 = SIMD.Float32x4.load(m, 4);
-            var m2 = SIMD.Float32x4.load(m, 8);
-            var m3 = SIMD.Float32x4.load(m, 12);
-            var r = SIMD.Float32x4.add(SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.splat(x), m0), SIMD.Float32x4.mul(SIMD.Float32x4.splat(y), m1)), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.splat(z), m2), m3));
-            r = SIMD.Float32x4.div(r, SIMD.Float32x4.swizzle(r, 3, 3, 3, 3));
-            result.x = SIMD.Float32x4.extractLane(r, 0);
-            result.y = SIMD.Float32x4.extractLane(r, 1);
-            result.z = SIMD.Float32x4.extractLane(r, 2);
-        };
-        return SIMDVector3;
-    }());
-    var SIMDMatrix = (function () {
-        function SIMDMatrix() {
-        }
-        SIMDMatrix.prototype.multiplyToArraySIMD = function (other, result, offset) {
-            var tm = this.m;
-            var om = other.m;
-            var m0 = SIMD.Float32x4.load(om, 0);
-            var m1 = SIMD.Float32x4.load(om, 4);
-            var m2 = SIMD.Float32x4.load(om, 8);
-            var m3 = SIMD.Float32x4.load(om, 12);
-            for (var i = 0; i < 16; i += 4) {
-                SIMD.Float32x4.store(result, i + offset, SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.splat(tm[i]), m0), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.splat(tm[i + 1]), m1), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.splat(tm[i + 2]), m2), SIMD.Float32x4.mul(SIMD.Float32x4.splat(tm[i + 3]), m3)))));
-            }
-            return this;
-        };
-        SIMDMatrix.prototype.invertToRefSIMD = function (other) {
-            var src = this.m;
-            var dest = other.m;
-            // Load the 4 rows
-            var src0 = SIMD.Float32x4.load(src, 0);
-            var src1 = SIMD.Float32x4.load(src, 4);
-            var src2 = SIMD.Float32x4.load(src, 8);
-            var src3 = SIMD.Float32x4.load(src, 12);
-            // Transpose the source matrix.  Sort of.  Not a true transpose operation
-            var tmp1 = SIMD.Float32x4.shuffle(src0, src1, 0, 1, 4, 5);
-            var row1 = SIMD.Float32x4.shuffle(src2, src3, 0, 1, 4, 5);
-            var row0 = SIMD.Float32x4.shuffle(tmp1, row1, 0, 2, 4, 6);
-            row1 = SIMD.Float32x4.shuffle(row1, tmp1, 1, 3, 5, 7);
-            tmp1 = SIMD.Float32x4.shuffle(src0, src1, 2, 3, 6, 7);
-            var row3 = SIMD.Float32x4.shuffle(src2, src3, 2, 3, 6, 7);
-            var row2 = SIMD.Float32x4.shuffle(tmp1, row3, 0, 2, 4, 6);
-            row3 = SIMD.Float32x4.shuffle(row3, tmp1, 1, 3, 5, 7);
-            // This is a true transposition, but it will lead to an incorrect result
-            //tmp1 = shuffle(src0, src1, 0, 1, 4, 5);
-            //tmp2 = shuffle(src2, src3, 0, 1, 4, 5);
-            //row0  = shuffle(tmp1, tmp2, 0, 2, 4, 6);
-            //row1  = shuffle(tmp1, tmp2, 1, 3, 5, 7);
-            //tmp1 = shuffle(src0, src1, 2, 3, 6, 7);
-            //tmp2 = shuffle(src2, src3, 2, 3, 6, 7);
-            //row2  = shuffle(tmp1, tmp2, 0, 2, 4, 6);
-            //row3  = shuffle(tmp1, tmp2, 1, 3, 5, 7);
-            // ----
-            tmp1 = SIMD.Float32x4.mul(row2, row3);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 1, 0, 3, 2); // 0xB1 = 10110001
-            var minor0 = SIMD.Float32x4.mul(row1, tmp1);
-            var minor1 = SIMD.Float32x4.mul(row0, tmp1);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 2, 3, 0, 1); // 0x4E = 01001110
-            minor0 = SIMD.Float32x4.sub(SIMD.Float32x4.mul(row1, tmp1), minor0);
-            minor1 = SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0, tmp1), minor1);
-            minor1 = SIMD.Float32x4.swizzle(minor1, 2, 3, 0, 1); // 0x4E = 01001110
-            // ----
-            tmp1 = SIMD.Float32x4.mul(row1, row2);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 1, 0, 3, 2); // 0xB1 = 10110001
-            minor0 = SIMD.Float32x4.add(SIMD.Float32x4.mul(row3, tmp1), minor0);
-            var minor3 = SIMD.Float32x4.mul(row0, tmp1);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 2, 3, 0, 1); // 0x4E = 01001110
-            minor0 = SIMD.Float32x4.sub(minor0, SIMD.Float32x4.mul(row3, tmp1));
-            minor3 = SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0, tmp1), minor3);
-            minor3 = SIMD.Float32x4.swizzle(minor3, 2, 3, 0, 1); // 0x4E = 01001110
-            // ----
-            tmp1 = SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(row1, 2, 3, 0, 1), row3); // 0x4E = 01001110
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 1, 0, 3, 2); // 0xB1 = 10110001
-            row2 = SIMD.Float32x4.swizzle(row2, 2, 3, 0, 1); // 0x4E = 01001110
-            minor0 = SIMD.Float32x4.add(SIMD.Float32x4.mul(row2, tmp1), minor0);
-            var minor2 = SIMD.Float32x4.mul(row0, tmp1);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 2, 3, 0, 1); // 0x4E = 01001110
-            minor0 = SIMD.Float32x4.sub(minor0, SIMD.Float32x4.mul(row2, tmp1));
-            minor2 = SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0, tmp1), minor2);
-            minor2 = SIMD.Float32x4.swizzle(minor2, 2, 3, 0, 1); // 0x4E = 01001110
-            // ----
-            tmp1 = SIMD.Float32x4.mul(row0, row1);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 1, 0, 3, 2); // 0xB1 = 10110001
-            minor2 = SIMD.Float32x4.add(SIMD.Float32x4.mul(row3, tmp1), minor2);
-            minor3 = SIMD.Float32x4.sub(SIMD.Float32x4.mul(row2, tmp1), minor3);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 2, 3, 0, 1); // 0x4E = 01001110
-            minor2 = SIMD.Float32x4.sub(SIMD.Float32x4.mul(row3, tmp1), minor2);
-            minor3 = SIMD.Float32x4.sub(minor3, SIMD.Float32x4.mul(row2, tmp1));
-            // ----
-            tmp1 = SIMD.Float32x4.mul(row0, row3);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 1, 0, 3, 2); // 0xB1 = 10110001
-            minor1 = SIMD.Float32x4.sub(minor1, SIMD.Float32x4.mul(row2, tmp1));
-            minor2 = SIMD.Float32x4.add(SIMD.Float32x4.mul(row1, tmp1), minor2);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 2, 3, 0, 1); // 0x4E = 01001110
-            minor1 = SIMD.Float32x4.add(SIMD.Float32x4.mul(row2, tmp1), minor1);
-            minor2 = SIMD.Float32x4.sub(minor2, SIMD.Float32x4.mul(row1, tmp1));
-            // ----
-            tmp1 = SIMD.Float32x4.mul(row0, row2);
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 1, 0, 3, 2); // 0xB1 = 10110001
-            minor1 = SIMD.Float32x4.add(SIMD.Float32x4.mul(row3, tmp1), minor1);
-            minor3 = SIMD.Float32x4.sub(minor3, SIMD.Float32x4.mul(row1, tmp1));
-            tmp1 = SIMD.Float32x4.swizzle(tmp1, 2, 3, 0, 1); // 0x4E = 01001110
-            minor1 = SIMD.Float32x4.sub(minor1, SIMD.Float32x4.mul(row3, tmp1));
-            minor3 = SIMD.Float32x4.add(SIMD.Float32x4.mul(row1, tmp1), minor3);
-            // Compute determinant
-            var det = SIMD.Float32x4.mul(row0, minor0);
-            det = SIMD.Float32x4.add(SIMD.Float32x4.swizzle(det, 2, 3, 0, 1), det); // 0x4E = 01001110
-            det = SIMD.Float32x4.add(SIMD.Float32x4.swizzle(det, 1, 0, 3, 2), det); // 0xB1 = 10110001
-            tmp1 = SIMD.Float32x4.reciprocalApproximation(det);
-            det = SIMD.Float32x4.sub(SIMD.Float32x4.add(tmp1, tmp1), SIMD.Float32x4.mul(det, SIMD.Float32x4.mul(tmp1, tmp1)));
-            det = SIMD.Float32x4.swizzle(det, 0, 0, 0, 0);
-            // These shuffles aren't necessary if the faulty transposition is done
-            // up at the top of this function.
-            //minor0 =SIMD.Float32x4.swizzle(minor0, 2, 1, 0, 3);
-            //minor1 =SIMD.Float32x4.swizzle(minor1, 2, 1, 0, 3);
-            //minor2 =SIMD.Float32x4.swizzle(minor2, 2, 1, 0, 3);
-            //minor3 =SIMD.Float32x4.swizzle(minor3, 2, 1, 0, 3);
-            // Compute final values by multiplying with 1/det
-            SIMD.Float32x4.store(dest, 0, SIMD.Float32x4.mul(det, minor0));
-            SIMD.Float32x4.store(dest, 4, SIMD.Float32x4.mul(det, minor1));
-            SIMD.Float32x4.store(dest, 8, minor2 = SIMD.Float32x4.mul(det, minor2));
-            SIMD.Float32x4.store(dest, 12, SIMD.Float32x4.mul(det, minor3));
-            return this;
-        };
-        SIMDMatrix.LookAtLHToRefSIMD = function (eyeRef, targetRef, upRef, result) {
-            var out = result.m;
-            var center = SIMD.Float32x4(targetRef.x, targetRef.y, targetRef.z, 0.0);
-            var eye = SIMD.Float32x4(eyeRef.x, eyeRef.y, eyeRef.z, 0.0);
-            var up = SIMD.Float32x4(upRef.x, upRef.y, upRef.z, 0.0);
-            // cc.kmVec3Subtract(f, pCenter, pEye);
-            var f = SIMD.Float32x4.sub(center, eye);
-            // cc.kmVec3Normalize(f, f);    
-            var tmp = SIMD.Float32x4.mul(f, f);
-            tmp = SIMD.Float32x4.add(tmp, SIMD.Float32x4.add(SIMD.Float32x4.swizzle(tmp, 1, 2, 0, 3), SIMD.Float32x4.swizzle(tmp, 2, 0, 1, 3)));
-            f = SIMD.Float32x4.mul(f, SIMD.Float32x4.reciprocalSqrtApproximation(tmp));
-            // cc.kmVec3Assign(up, pUp);
-            // cc.kmVec3Normalize(up, up);
-            tmp = SIMD.Float32x4.mul(up, up);
-            tmp = SIMD.Float32x4.add(tmp, SIMD.Float32x4.add(SIMD.Float32x4.swizzle(tmp, 1, 2, 0, 3), SIMD.Float32x4.swizzle(tmp, 2, 0, 1, 3)));
-            up = SIMD.Float32x4.mul(up, SIMD.Float32x4.reciprocalSqrtApproximation(tmp));
-            // cc.kmVec3Cross(s, f, up);
-            var s = SIMD.Float32x4.sub(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(f, 1, 2, 0, 3), SIMD.Float32x4.swizzle(up, 2, 0, 1, 3)), SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(f, 2, 0, 1, 3), SIMD.Float32x4.swizzle(up, 1, 2, 0, 3)));
-            // cc.kmVec3Normalize(s, s);
-            tmp = SIMD.Float32x4.mul(s, s);
-            tmp = SIMD.Float32x4.add(tmp, SIMD.Float32x4.add(SIMD.Float32x4.swizzle(tmp, 1, 2, 0, 3), SIMD.Float32x4.swizzle(tmp, 2, 0, 1, 3)));
-            s = SIMD.Float32x4.mul(s, SIMD.Float32x4.reciprocalSqrtApproximation(tmp));
-            // cc.kmVec3Cross(u, s, f);
-            var u = SIMD.Float32x4.sub(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s, 1, 2, 0, 3), SIMD.Float32x4.swizzle(f, 2, 0, 1, 3)), SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s, 2, 0, 1, 3), SIMD.Float32x4.swizzle(f, 1, 2, 0, 3)));
-            // cc.kmVec3Normalize(s, s);
-            tmp = SIMD.Float32x4.mul(s, s);
-            tmp = SIMD.Float32x4.add(tmp, SIMD.Float32x4.add(SIMD.Float32x4.swizzle(tmp, 1, 2, 0, 3), SIMD.Float32x4.swizzle(tmp, 2, 0, 1, 3)));
-            s = SIMD.Float32x4.mul(s, SIMD.Float32x4.reciprocalSqrtApproximation(tmp));
-            var zero = SIMD.Float32x4.splat(0.0);
-            s = SIMD.Float32x4.neg(s);
-            var tmp01 = SIMD.Float32x4.shuffle(s, u, 0, 1, 4, 5);
-            var tmp23 = SIMD.Float32x4.shuffle(f, zero, 0, 1, 4, 5);
-            var a0 = SIMD.Float32x4.shuffle(tmp01, tmp23, 0, 2, 4, 6);
-            var a1 = SIMD.Float32x4.shuffle(tmp01, tmp23, 1, 3, 5, 7);
-            var a2 = SIMD.Float32x4.shuffle(SIMD.Float32x4.shuffle(s, u, 2, 3, 6, 7), SIMD.Float32x4.shuffle(f, zero, 2, 3, 6, 7), 0, 2, 4, 6);
-            var a3 = SIMD.Float32x4(0.0, 0.0, 0.0, 1.0);
-            var b = SIMD.Float32x4(1.0, 0.0, 0.0, 0.0);
-            SIMD.Float32x4.store(out, 0, SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 0, 0, 0, 0), a0), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 1, 1, 1, 1), a1), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 2, 2, 2, 2), a2), SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 3, 3, 3, 3), a3)))));
-            b = SIMD.Float32x4(0.0, 1.0, 0.0, 0.0);
-            SIMD.Float32x4.store(out, 4, SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 0, 0, 0, 0), a0), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 1, 1, 1, 1), a1), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 2, 2, 2, 2), a2), SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 3, 3, 3, 3), a3)))));
-            b = SIMD.Float32x4(0.0, 0.0, 1.0, 0.0);
-            SIMD.Float32x4.store(out, 8, SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 0, 0, 0, 0), a0), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 1, 1, 1, 1), a1), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 2, 2, 2, 2), a2), SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 3, 3, 3, 3), a3)))));
-            b = SIMD.Float32x4.replaceLane(SIMD.Float32x4.neg(eye), 3, 1.0);
-            SIMD.Float32x4.store(out, 12, SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 0, 0, 0, 0), a0), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 1, 1, 1, 1), a1), SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 2, 2, 2, 2), a2), SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b, 3, 3, 3, 3), a3)))));
-        };
-        return SIMDMatrix;
-    }());
-    var previousMultiplyToArray = BABYLON.Matrix.prototype.multiplyToArray;
-    var previousInvertToRef = BABYLON.Matrix.prototype.invertToRef;
-    var previousLookAtLHToRef = BABYLON.Matrix.LookAtLHToRef;
-    var previousTransformCoordinatesToRef = BABYLON.Vector3.TransformCoordinatesToRef;
-    var previousTransformCoordinatesFromFloatsToRef = BABYLON.Vector3.TransformCoordinatesFromFloatsToRef;
-    var SIMDHelper = (function () {
-        function SIMDHelper() {
-        }
-        Object.defineProperty(SIMDHelper, "IsEnabled", {
-            get: function () {
-                return SIMDHelper._isEnabled;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        SIMDHelper.DisableSIMD = function () {
-            // Replace functions
-            BABYLON.Matrix.prototype.multiplyToArray = previousMultiplyToArray;
-            BABYLON.Matrix.prototype.invertToRef = previousInvertToRef;
-            BABYLON.Matrix.LookAtLHToRef = previousLookAtLHToRef;
-            BABYLON.Vector3.TransformCoordinatesToRef = previousTransformCoordinatesToRef;
-            BABYLON.Vector3.TransformCoordinatesFromFloatsToRef = previousTransformCoordinatesFromFloatsToRef;
-            SIMDHelper._isEnabled = false;
-        };
-        SIMDHelper.EnableSIMD = function () {
-            if (self.SIMD === undefined) {
-                return;
-            }
-            // check if polyfills needed
-            if (!self.Math.fround) {
-                self.Math.fround = (function (array) { return function (x) {
-                    return array[0] = x, array[0];
-                }; })(new Float32Array(1));
-            }
-            if (!self.Math.imul) {
-                self.Math.imul = function (a, b) {
-                    var ah = (a >>> 16) & 0xffff;
-                    var al = a & 0xffff;
-                    var bh = (b >>> 16) & 0xffff;
-                    var bl = b & 0xffff;
-                    // the shift by 0 fixes the sign on the high part
-                    // the final |0 converts the unsigned value into a signed value
-                    return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
-                };
-            }
-            // Replace functions
-            BABYLON.Matrix.prototype.multiplyToArray = SIMDMatrix.prototype.multiplyToArraySIMD;
-            BABYLON.Matrix.prototype.invertToRef = SIMDMatrix.prototype.invertToRefSIMD;
-            BABYLON.Matrix.LookAtLHToRef = SIMDMatrix.LookAtLHToRefSIMD;
-            BABYLON.Vector3.TransformCoordinatesToRef = SIMDVector3.TransformCoordinatesToRefSIMD;
-            BABYLON.Vector3.TransformCoordinatesFromFloatsToRef = SIMDVector3.TransformCoordinatesFromFloatsToRefSIMD;
-            SIMDHelper._isEnabled = true;
-        };
-        SIMDHelper._isEnabled = false;
-        return SIMDHelper;
-    }());
-    BABYLON.SIMDHelper = SIMDHelper;
-})(BABYLON || (BABYLON = {}));

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 3283
src/Math/babylon.math.js


+ 0 - 0
src/Mesh/babylon.abstractMesh.js


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.