Browse Source

Moving previous releases
Fixing cannon.js bug

David Catuhe 10 years ago
parent
commit
d435568c17

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

@@ -35,6 +35,10 @@
             return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
             return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
         };
         };
 
 
+        Animation.prototype.vector2InterpolateFunction = function (startValue, endValue, gradient) {
+            return BABYLON.Vector2.Lerp(startValue, endValue, gradient);
+        };
+
         Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {
         Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {
             return BABYLON.Color3.Lerp(startValue, endValue, gradient);
             return BABYLON.Color3.Lerp(startValue, endValue, gradient);
         };
         };
@@ -100,6 +104,15 @@
                                     return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                                     return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                             }
                             }
 
 
+                        case Animation.ANIMATIONTYPE_VECTOR2:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    return this.vector2InterpolateFunction(startValue, endValue, gradient);
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return this.vector2InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
+                            }
+
                         case Animation.ANIMATIONTYPE_COLOR3:
                         case Animation.ANIMATIONTYPE_COLOR3:
                             switch (loopMode) {
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -179,6 +192,9 @@
                             case Animation.ANIMATIONTYPE_VECTOR3:
                             case Animation.ANIMATIONTYPE_VECTOR3:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
 
 
+                            case Animation.ANIMATIONTYPE_VECTOR2:
+                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
+
                             case Animation.ANIMATIONTYPE_COLOR3:
                             case Animation.ANIMATIONTYPE_COLOR3:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                             default:
                             default:
@@ -207,6 +223,10 @@
                         offsetValue = BABYLON.Vector3.Zero();
                         offsetValue = BABYLON.Vector3.Zero();
                         break;
                         break;
 
 
+                    case Animation.ANIMATIONTYPE_VECTOR2:
+                        offsetValue = BABYLON.Vector2.Zero();
+                        break;
+
                     case Animation.ANIMATIONTYPE_COLOR3:
                     case Animation.ANIMATIONTYPE_COLOR3:
                         offsetValue = BABYLON.Color3.Black();
                         offsetValue = BABYLON.Color3.Black();
                 }
                 }
@@ -257,6 +277,14 @@
             configurable: true
             configurable: true
         });
         });
 
 
+        Object.defineProperty(Animation, "ANIMATIONTYPE_VECTOR2", {
+            get: function () {
+                return Animation._ANIMATIONTYPE_VECTOR2;
+            },
+            enumerable: true,
+            configurable: true
+        });
+
         Object.defineProperty(Animation, "ANIMATIONTYPE_QUATERNION", {
         Object.defineProperty(Animation, "ANIMATIONTYPE_QUATERNION", {
             get: function () {
             get: function () {
                 return Animation._ANIMATIONTYPE_QUATERNION;
                 return Animation._ANIMATIONTYPE_QUATERNION;
@@ -309,6 +337,7 @@
         Animation._ANIMATIONTYPE_QUATERNION = 2;
         Animation._ANIMATIONTYPE_QUATERNION = 2;
         Animation._ANIMATIONTYPE_MATRIX = 3;
         Animation._ANIMATIONTYPE_MATRIX = 3;
         Animation._ANIMATIONTYPE_COLOR3 = 4;
         Animation._ANIMATIONTYPE_COLOR3 = 4;
+        Animation._ANIMATIONTYPE_VECTOR2 = 5;
         Animation._ANIMATIONLOOPMODE_RELATIVE = 0;
         Animation._ANIMATIONLOOPMODE_RELATIVE = 0;
         Animation._ANIMATIONLOOPMODE_CYCLE = 1;
         Animation._ANIMATIONLOOPMODE_CYCLE = 1;
         Animation._ANIMATIONLOOPMODE_CONSTANT = 2;
         Animation._ANIMATIONLOOPMODE_CONSTANT = 2;

+ 9 - 9
Babylon/Animations/babylon.animation.ts

@@ -35,8 +35,8 @@
         public vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3 {
         public vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3 {
             return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
             return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
         }
         }
-		
-		 public vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2 {
+
+        public vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2 {
             return BABYLON.Vector2.Lerp(startValue, endValue, gradient);
             return BABYLON.Vector2.Lerp(startValue, endValue, gradient);
         }
         }
 
 
@@ -58,7 +58,7 @@
             this._highLimitsCache = {};
             this._highLimitsCache = {};
         }
         }
 
 
-        private _interpolate(currentFrame: number, repeatCount: number, loopMode: number, offsetValue? , highLimitValue?) {
+        private _interpolate(currentFrame: number, repeatCount: number, loopMode: number, offsetValue?, highLimitValue?) {
             if (loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && repeatCount > 0) {
             if (loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && repeatCount > 0) {
                 return highLimitValue.clone ? highLimitValue.clone() : highLimitValue;
                 return highLimitValue.clone ? highLimitValue.clone() : highLimitValue;
             }
             }
@@ -105,7 +105,7 @@
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                                     return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                             }
                             }
-						// Vector2
+                        // Vector2
                         case Animation.ANIMATIONTYPE_VECTOR2:
                         case Animation.ANIMATIONTYPE_VECTOR2:
                             switch (loopMode) {
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -193,7 +193,7 @@
                             // Vector3
                             // Vector3
                             case Animation.ANIMATIONTYPE_VECTOR3:
                             case Animation.ANIMATIONTYPE_VECTOR3:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
-							// Vector2
+                            // Vector2
                             case Animation.ANIMATIONTYPE_VECTOR2:
                             case Animation.ANIMATIONTYPE_VECTOR2:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                             // Color3
                             // Color3
@@ -225,7 +225,7 @@
                     case Animation.ANIMATIONTYPE_VECTOR3:
                     case Animation.ANIMATIONTYPE_VECTOR3:
                         offsetValue = Vector3.Zero();
                         offsetValue = Vector3.Zero();
                         break;
                         break;
-					// Vector2
+                    // Vector2
                     case Animation.ANIMATIONTYPE_VECTOR2:
                     case Animation.ANIMATIONTYPE_VECTOR2:
                         offsetValue = Vector2.Zero();
                         offsetValue = Vector2.Zero();
                         break;
                         break;
@@ -270,7 +270,7 @@
         private static _ANIMATIONTYPE_QUATERNION = 2;
         private static _ANIMATIONTYPE_QUATERNION = 2;
         private static _ANIMATIONTYPE_MATRIX = 3;
         private static _ANIMATIONTYPE_MATRIX = 3;
         private static _ANIMATIONTYPE_COLOR3 = 4;
         private static _ANIMATIONTYPE_COLOR3 = 4;
-		private static _ANIMATIONTYPE_VECTOR2 = 5;
+        private static _ANIMATIONTYPE_VECTOR2 = 5;
         private static _ANIMATIONLOOPMODE_RELATIVE = 0;
         private static _ANIMATIONLOOPMODE_RELATIVE = 0;
         private static _ANIMATIONLOOPMODE_CYCLE = 1;
         private static _ANIMATIONLOOPMODE_CYCLE = 1;
         private static _ANIMATIONLOOPMODE_CONSTANT = 2;
         private static _ANIMATIONLOOPMODE_CONSTANT = 2;
@@ -283,10 +283,10 @@
             return Animation._ANIMATIONTYPE_VECTOR3;
             return Animation._ANIMATIONTYPE_VECTOR3;
         }
         }
 
 
-		public static get ANIMATIONTYPE_VECTOR2(): number {
+        public static get ANIMATIONTYPE_VECTOR2(): number {
             return Animation._ANIMATIONTYPE_VECTOR2;
             return Animation._ANIMATIONTYPE_VECTOR2;
         }
         }
-		
+
         public static get ANIMATIONTYPE_QUATERNION(): number {
         public static get ANIMATIONTYPE_QUATERNION(): number {
             return Animation._ANIMATIONTYPE_QUATERNION;
             return Animation._ANIMATIONTYPE_QUATERNION;
         }
         }

+ 7 - 1
Babylon/Cameras/babylon.arcRotateCamera.js

@@ -32,6 +32,7 @@ var BABYLON;
             this.keysLeft = [37];
             this.keysLeft = [37];
             this.keysRight = [39];
             this.keysRight = [39];
             this.zoomOnFactor = 1;
             this.zoomOnFactor = 1;
+            this.targetScreenOffset = BABYLON.Vector2.Zero();
             this._keys = [];
             this._keys = [];
             this._viewMatrix = new BABYLON.Matrix();
             this._viewMatrix = new BABYLON.Matrix();
             this.checkCollisions = false;
             this.checkCollisions = false;
@@ -58,6 +59,7 @@ var BABYLON;
             this._cache.alpha = undefined;
             this._cache.alpha = undefined;
             this._cache.beta = undefined;
             this._cache.beta = undefined;
             this._cache.radius = undefined;
             this._cache.radius = undefined;
+            this._cache.targetScreenOffset = undefined;
         };
         };
 
 
         ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {
         ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {
@@ -69,6 +71,7 @@ var BABYLON;
             this._cache.alpha = this.alpha;
             this._cache.alpha = this.alpha;
             this._cache.beta = this.beta;
             this._cache.beta = this.beta;
             this._cache.radius = this.radius;
             this._cache.radius = this.radius;
+            this._cache.targetScreenOffset = this.targetScreenOffset.clone();
         };
         };
 
 
         // Synchronized
         // Synchronized
@@ -76,7 +79,7 @@ var BABYLON;
             if (!_super.prototype._isSynchronizedViewMatrix.call(this))
             if (!_super.prototype._isSynchronizedViewMatrix.call(this))
                 return false;
                 return false;
 
 
-            return this._cache.target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius;
+            return this._cache.target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius && this._cache.targetScreenOffset.equals(this.targetScreenOffset);
         };
         };
 
 
         // Methods
         // Methods
@@ -493,6 +496,9 @@ var BABYLON;
             this._previousRadius = this.radius;
             this._previousRadius = this.radius;
             this._previousPosition.copyFrom(this.position);
             this._previousPosition.copyFrom(this.position);
 
 
+            this._viewMatrix.m[12] += this.targetScreenOffset.x;
+            this._viewMatrix.m[13] += this.targetScreenOffset.y;
+
             return this._viewMatrix;
             return this._viewMatrix;
         };
         };
 
 

+ 2 - 1
Babylon/Loading/babylon.sceneLoader.js

@@ -29,8 +29,9 @@
 
 
         SceneLoader._getPluginForFilename = function (sceneFilename) {
         SceneLoader._getPluginForFilename = function (sceneFilename) {
             var dotPosition = sceneFilename.lastIndexOf(".");
             var dotPosition = sceneFilename.lastIndexOf(".");
+
             var queryStringPosition = sceneFilename.indexOf("?");
             var queryStringPosition = sceneFilename.indexOf("?");
-            var extension = sceneFilename.substring(dotPosition,queryStringPosition).toLowerCase();
+            var extension = sceneFilename.substring(dotPosition, queryStringPosition).toLowerCase();
 
 
             for (var index = 0; index < this._registeredPlugins.length; index++) {
             for (var index = 0; index < this._registeredPlugins.length; index++) {
                 var plugin = this._registeredPlugins[index];
                 var plugin = this._registeredPlugins[index];

+ 2 - 1
Babylon/Loading/babylon.sceneLoader.ts

@@ -31,8 +31,9 @@
 
 
         private static _getPluginForFilename(sceneFilename): ISceneLoaderPlugin {
         private static _getPluginForFilename(sceneFilename): ISceneLoaderPlugin {
             var dotPosition = sceneFilename.lastIndexOf(".");
             var dotPosition = sceneFilename.lastIndexOf(".");
+
             var queryStringPosition = sceneFilename.indexOf("?");
             var queryStringPosition = sceneFilename.indexOf("?");
-            var extension = sceneFilename.substring(dotPosition,queryStringPosition).toLowerCase();
+            var extension = sceneFilename.substring(dotPosition, queryStringPosition).toLowerCase();
 
 
             for (var index = 0; index < this._registeredPlugins.length; index++) {
             for (var index = 0; index < this._registeredPlugins.length; index++) {
                 var plugin = this._registeredPlugins[index];
                 var plugin = this._registeredPlugins[index];

+ 226 - 0
Babylon/Materials/textures/babylon.proceduralTexture.js

@@ -0,0 +1,226 @@
+var __extends = this.__extends || function (d, b) {
+    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+    function __() { this.constructor = d; }
+    __.prototype = b.prototype;
+    d.prototype = new __();
+};
+var BABYLON;
+(function (BABYLON) {
+    var ProceduralTexture = (function (_super) {
+        __extends(ProceduralTexture, _super);
+        function ProceduralTexture(name, size, fragment, scene, generateMipMaps) {
+            _super.call(this, null, scene, !generateMipMaps);
+            this._currentRefreshId = -1;
+            this._refreshRate = 1;
+            this._vertexDeclaration = [2];
+            this._vertexStrideSize = 2 * 4;
+            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();
+
+            scene._proceduralTextures.push(this);
+
+            this.name = name;
+            this.isRenderTarget = true;
+            this._size = size;
+            this._generateMipMaps = generateMipMaps;
+
+            this._fragment = fragment;
+
+            this._texture = scene.getEngine().createRenderTargetTexture(size, generateMipMaps);
+
+            // VBO
+            var vertices = [];
+            vertices.push(1, 1);
+            vertices.push(-1, 1);
+            vertices.push(-1, -1);
+            vertices.push(1, -1);
+
+            this._vertexBuffer = scene.getEngine().createVertexBuffer(vertices);
+
+            // Indices
+            var indices = [];
+            indices.push(0);
+            indices.push(1);
+            indices.push(2);
+
+            indices.push(0);
+            indices.push(2);
+            indices.push(3);
+
+            this._indexBuffer = scene.getEngine().createIndexBuffer(indices);
+        }
+        ProceduralTexture.prototype.isReady = function () {
+            var engine = this.getScene().getEngine();
+
+            this._effect = engine.createEffect({ vertex: "procedural", fragment: this._fragment }, ["position"], this._uniforms, this._samplers, "");
+
+            return this._effect.isReady();
+        };
+
+        ProceduralTexture.prototype.resetRefreshCounter = function () {
+            this._currentRefreshId = -1;
+        };
+
+        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._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) {
+            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) {
+            if (!this.isReady() || !this._texture)
+                return;
+
+            var scene = this.getScene();
+            var engine = scene.getEngine();
+
+            engine.bindFramebuffer(this._texture);
+
+            // Clear
+            engine.clear(scene.clearColor, true, true);
+
+            // Render
+            engine.enableEffect(this._effect);
+            engine.setState(false);
+
+            // VBOs
+            engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
+
+            // Draw order
+            engine.draw(true, 0, 6);
+
+            // Unbind
+            engine.unBindFramebuffer(this._texture);
+        };
+
+        ProceduralTexture.prototype.clone = function () {
+            var textureSize = this.getSize();
+            var newTexture = new BABYLON.ProceduralTexture(this.name, textureSize.width, this._fragment, this.getScene(), 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);
+            }
+            _super.prototype.dispose.call(this);
+        };
+        return ProceduralTexture;
+    })(BABYLON.Texture);
+    BABYLON.ProceduralTexture = ProceduralTexture;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.proceduralTexture.js.map

+ 1 - 1
Babylon/Physics/Plugins/babylon.cannonJSPlugin.js

@@ -8,7 +8,7 @@
                 for (var index = 0; index < this._registeredMeshes.length; index++) {
                 for (var index = 0; index < this._registeredMeshes.length; index++) {
                     var registeredMesh = this._registeredMeshes[index];
                     var registeredMesh = this._registeredMeshes[index];
                     if (registeredMesh.mesh === mesh || registeredMesh.mesh === mesh.parent) {
                     if (registeredMesh.mesh === mesh || registeredMesh.mesh === mesh.parent) {
-                        var body = registeredMesh.body.body;
+                        var body = registeredMesh.body;
 
 
                         var center = mesh.getBoundingInfo().boundingBox.center;
                         var center = mesh.getBoundingInfo().boundingBox.center;
                         body.position.set(center.x, center.z, center.y);
                         body.position.set(center.x, center.z, center.y);

+ 1 - 1
Babylon/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -279,7 +279,7 @@
             for (var index = 0; index < this._registeredMeshes.length; index++) {
             for (var index = 0; index < this._registeredMeshes.length; index++) {
                 var registeredMesh = this._registeredMeshes[index];
                 var registeredMesh = this._registeredMeshes[index];
                 if (registeredMesh.mesh === mesh || registeredMesh.mesh === mesh.parent) {
                 if (registeredMesh.mesh === mesh || registeredMesh.mesh === mesh.parent) {
-                    var body = registeredMesh.body.body;
+                    var body = registeredMesh.body;
 
 
                     var center = mesh.getBoundingInfo().boundingBox.center;
                     var center = mesh.getBoundingInfo().boundingBox.center;
                     body.position.set(center.x, center.z, center.y);
                     body.position.set(center.x, center.z, center.y);

babylon.1.11.js → Previous releases/babylon.1.11.js


babylon.1.12.js → Previous releases/babylon.1.12.js


babylon.1.13.js → Previous releases/babylon.1.13.js


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

@@ -67,6 +67,7 @@
   <script src="Babylon/Materials/textures/babylon.dynamicTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.dynamicTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.mirrorTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.mirrorTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.renderTargetTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.renderTargetTexture.js"></script>
+  <script src="Babylon/Materials/textures/procedurals/babylon.proceduralTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.cubeTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.cubeTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.texture.js"></script>
   <script src="Babylon/Materials/textures/babylon.texture.js"></script>
   <script src="Babylon/Materials/textures/babylon.baseTexture.js"></script>
   <script src="Babylon/Materials/textures/babylon.baseTexture.js"></script>

+ 1 - 0
Tools/Gulp/gulpfile.js

@@ -86,6 +86,7 @@ gulp.task('scripts', ['shaders'] ,function() {
       '../../Babylon/Materials/textures/babylon.texture.js',
       '../../Babylon/Materials/textures/babylon.texture.js',
       '../../Babylon/Materials/textures/babylon.cubeTexture.js',
       '../../Babylon/Materials/textures/babylon.cubeTexture.js',
       '../../Babylon/Materials/textures/babylon.renderTargetTexture.js',
       '../../Babylon/Materials/textures/babylon.renderTargetTexture.js',
+      '../../Babylon/Materials/textures/procedurals/babylon.proceduralTexture.js',
       '../../Babylon/Materials/textures/babylon.mirrorTexture.js',
       '../../Babylon/Materials/textures/babylon.mirrorTexture.js',
       '../../Babylon/Materials/textures/babylon.dynamicTexture.js',
       '../../Babylon/Materials/textures/babylon.dynamicTexture.js',
       '../../Babylon/Materials/textures/babylon.videoTexture.js',
       '../../Babylon/Materials/textures/babylon.videoTexture.js',

+ 40 - 3
babylon.2.0-alpha.debug.js

@@ -7147,6 +7147,7 @@ var BABYLON;
             this.keysLeft = [37];
             this.keysLeft = [37];
             this.keysRight = [39];
             this.keysRight = [39];
             this.zoomOnFactor = 1;
             this.zoomOnFactor = 1;
+            this.targetScreenOffset = BABYLON.Vector2.Zero();
             this._keys = [];
             this._keys = [];
             this._viewMatrix = new BABYLON.Matrix();
             this._viewMatrix = new BABYLON.Matrix();
             this.checkCollisions = false;
             this.checkCollisions = false;
@@ -7173,6 +7174,7 @@ var BABYLON;
             this._cache.alpha = undefined;
             this._cache.alpha = undefined;
             this._cache.beta = undefined;
             this._cache.beta = undefined;
             this._cache.radius = undefined;
             this._cache.radius = undefined;
+            this._cache.targetScreenOffset = undefined;
         };
         };
 
 
         ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {
         ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {
@@ -7184,6 +7186,7 @@ var BABYLON;
             this._cache.alpha = this.alpha;
             this._cache.alpha = this.alpha;
             this._cache.beta = this.beta;
             this._cache.beta = this.beta;
             this._cache.radius = this.radius;
             this._cache.radius = this.radius;
+            this._cache.targetScreenOffset = this.targetScreenOffset.clone();
         };
         };
 
 
        
        
@@ -7191,7 +7194,7 @@ var BABYLON;
             if (!_super.prototype._isSynchronizedViewMatrix.call(this))
             if (!_super.prototype._isSynchronizedViewMatrix.call(this))
                 return false;
                 return false;
 
 
-            return this._cache.target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius;
+            return this._cache.target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius && this._cache.targetScreenOffset.equals(this.targetScreenOffset);
         };
         };
 
 
        
        
@@ -7608,6 +7611,9 @@ var BABYLON;
             this._previousRadius = this.radius;
             this._previousRadius = this.radius;
             this._previousPosition.copyFrom(this.position);
             this._previousPosition.copyFrom(this.position);
 
 
+            this._viewMatrix.m[12] += this.targetScreenOffset.x;
+            this._viewMatrix.m[13] += this.targetScreenOffset.y;
+
             return this._viewMatrix;
             return this._viewMatrix;
         };
         };
 
 
@@ -15533,6 +15539,10 @@ var BABYLON;
             return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
             return BABYLON.Vector3.Lerp(startValue, endValue, gradient);
         };
         };
 
 
+        Animation.prototype.vector2InterpolateFunction = function (startValue, endValue, gradient) {
+            return BABYLON.Vector2.Lerp(startValue, endValue, gradient);
+        };
+
         Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {
         Animation.prototype.color3InterpolateFunction = function (startValue, endValue, gradient) {
             return BABYLON.Color3.Lerp(startValue, endValue, gradient);
             return BABYLON.Color3.Lerp(startValue, endValue, gradient);
         };
         };
@@ -15598,6 +15608,15 @@ var BABYLON;
                                     return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                                     return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                             }
                             }
 
 
+                        case Animation.ANIMATIONTYPE_VECTOR2:
+                            switch (loopMode) {
+                                case Animation.ANIMATIONLOOPMODE_CYCLE:
+                                case Animation.ANIMATIONLOOPMODE_CONSTANT:
+                                    return this.vector2InterpolateFunction(startValue, endValue, gradient);
+                                case Animation.ANIMATIONLOOPMODE_RELATIVE:
+                                    return this.vector2InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
+                            }
+
                         case Animation.ANIMATIONTYPE_COLOR3:
                         case Animation.ANIMATIONTYPE_COLOR3:
                             switch (loopMode) {
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -15677,6 +15696,9 @@ var BABYLON;
                             case Animation.ANIMATIONTYPE_VECTOR3:
                             case Animation.ANIMATIONTYPE_VECTOR3:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
 
 
+                            case Animation.ANIMATIONTYPE_VECTOR2:
+                                this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
+
                             case Animation.ANIMATIONTYPE_COLOR3:
                             case Animation.ANIMATIONTYPE_COLOR3:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                             default:
                             default:
@@ -15705,6 +15727,10 @@ var BABYLON;
                         offsetValue = BABYLON.Vector3.Zero();
                         offsetValue = BABYLON.Vector3.Zero();
                         break;
                         break;
 
 
+                    case Animation.ANIMATIONTYPE_VECTOR2:
+                        offsetValue = BABYLON.Vector2.Zero();
+                        break;
+
                     case Animation.ANIMATIONTYPE_COLOR3:
                     case Animation.ANIMATIONTYPE_COLOR3:
                         offsetValue = BABYLON.Color3.Black();
                         offsetValue = BABYLON.Color3.Black();
                 }
                 }
@@ -15755,6 +15781,14 @@ var BABYLON;
             configurable: true
             configurable: true
         });
         });
 
 
+        Object.defineProperty(Animation, "ANIMATIONTYPE_VECTOR2", {
+            get: function () {
+                return Animation._ANIMATIONTYPE_VECTOR2;
+            },
+            enumerable: true,
+            configurable: true
+        });
+
         Object.defineProperty(Animation, "ANIMATIONTYPE_QUATERNION", {
         Object.defineProperty(Animation, "ANIMATIONTYPE_QUATERNION", {
             get: function () {
             get: function () {
                 return Animation._ANIMATIONTYPE_QUATERNION;
                 return Animation._ANIMATIONTYPE_QUATERNION;
@@ -15807,6 +15841,7 @@ var BABYLON;
         Animation._ANIMATIONTYPE_QUATERNION = 2;
         Animation._ANIMATIONTYPE_QUATERNION = 2;
         Animation._ANIMATIONTYPE_MATRIX = 3;
         Animation._ANIMATIONTYPE_MATRIX = 3;
         Animation._ANIMATIONTYPE_COLOR3 = 4;
         Animation._ANIMATIONTYPE_COLOR3 = 4;
+        Animation._ANIMATIONTYPE_VECTOR2 = 5;
         Animation._ANIMATIONLOOPMODE_RELATIVE = 0;
         Animation._ANIMATIONLOOPMODE_RELATIVE = 0;
         Animation._ANIMATIONLOOPMODE_CYCLE = 1;
         Animation._ANIMATIONLOOPMODE_CYCLE = 1;
         Animation._ANIMATIONLOOPMODE_CONSTANT = 2;
         Animation._ANIMATIONLOOPMODE_CONSTANT = 2;
@@ -18401,7 +18436,9 @@ var BABYLON;
 
 
         SceneLoader._getPluginForFilename = function (sceneFilename) {
         SceneLoader._getPluginForFilename = function (sceneFilename) {
             var dotPosition = sceneFilename.lastIndexOf(".");
             var dotPosition = sceneFilename.lastIndexOf(".");
-            var extension = sceneFilename.substring(dotPosition).toLowerCase();
+
+            var queryStringPosition = sceneFilename.indexOf("?");
+            var extension = sceneFilename.substring(dotPosition, queryStringPosition).toLowerCase();
 
 
             for (var index = 0; index < this._registeredPlugins.length; index++) {
             for (var index = 0; index < this._registeredPlugins.length; index++) {
                 var plugin = this._registeredPlugins[index];
                 var plugin = this._registeredPlugins[index];
@@ -23731,7 +23768,7 @@ var BABYLON;
                 for (var index = 0; index < this._registeredMeshes.length; index++) {
                 for (var index = 0; index < this._registeredMeshes.length; index++) {
                     var registeredMesh = this._registeredMeshes[index];
                     var registeredMesh = this._registeredMeshes[index];
                     if (registeredMesh.mesh === mesh || registeredMesh.mesh === mesh.parent) {
                     if (registeredMesh.mesh === mesh || registeredMesh.mesh === mesh.parent) {
-                        var body = registeredMesh.body.body;
+                        var body = registeredMesh.body;
 
 
                         var center = mesh.getBoundingInfo().boundingBox.center;
                         var center = mesh.getBoundingInfo().boundingBox.center;
                         body.position.set(center.x, center.z, center.y);
                         body.position.set(center.x, center.z, center.y);

File diff suppressed because it is too large
+ 13 - 13
babylon.2.0-alpha.js


+ 48 - 0
babylon.2.0.d.ts

@@ -739,6 +739,7 @@ declare module BABYLON {
         public floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
         public floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number;
         public quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
         public quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion;
         public vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
         public vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3;
+        public vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2;
         public color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
         public color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3;
         public clone(): Animation;
         public clone(): Animation;
         public setKeys(values: any[]): void;
         public setKeys(values: any[]): void;
@@ -749,11 +750,13 @@ declare module BABYLON {
         private static _ANIMATIONTYPE_QUATERNION;
         private static _ANIMATIONTYPE_QUATERNION;
         private static _ANIMATIONTYPE_MATRIX;
         private static _ANIMATIONTYPE_MATRIX;
         private static _ANIMATIONTYPE_COLOR3;
         private static _ANIMATIONTYPE_COLOR3;
+        private static _ANIMATIONTYPE_VECTOR2;
         private static _ANIMATIONLOOPMODE_RELATIVE;
         private static _ANIMATIONLOOPMODE_RELATIVE;
         private static _ANIMATIONLOOPMODE_CYCLE;
         private static _ANIMATIONLOOPMODE_CYCLE;
         private static _ANIMATIONLOOPMODE_CONSTANT;
         private static _ANIMATIONLOOPMODE_CONSTANT;
         static ANIMATIONTYPE_FLOAT : number;
         static ANIMATIONTYPE_FLOAT : number;
         static ANIMATIONTYPE_VECTOR3 : number;
         static ANIMATIONTYPE_VECTOR3 : number;
+        static ANIMATIONTYPE_VECTOR2 : number;
         static ANIMATIONTYPE_QUATERNION : number;
         static ANIMATIONTYPE_QUATERNION : number;
         static ANIMATIONTYPE_MATRIX : number;
         static ANIMATIONTYPE_MATRIX : number;
         static ANIMATIONTYPE_COLOR3 : number;
         static ANIMATIONTYPE_COLOR3 : number;
@@ -846,6 +849,7 @@ declare module BABYLON {
         public keysLeft: number[];
         public keysLeft: number[];
         public keysRight: number[];
         public keysRight: number[];
         public zoomOnFactor: number;
         public zoomOnFactor: number;
+        public targetScreenOffset: Vector2;
         private _keys;
         private _keys;
         private _viewMatrix;
         private _viewMatrix;
         private _attachedElement;
         private _attachedElement;
@@ -1746,6 +1750,50 @@ declare module BABYLON {
     }
     }
 }
 }
 declare module BABYLON {
 declare module BABYLON {
+    class ProceduralTexture extends Texture {
+        private _size;
+        public _generateMipMaps: boolean;
+        private _doNotChangeAspectRatio;
+        private _currentRefreshId;
+        private _refreshRate;
+        private _vertexBuffer;
+        private _indexBuffer;
+        private _effect;
+        private _vertexDeclaration;
+        private _vertexStrideSize;
+        private _uniforms;
+        private _samplers;
+        private _fragment;
+        private _textures;
+        private _floats;
+        private _floatsArrays;
+        private _colors3;
+        private _colors4;
+        private _vectors2;
+        private _vectors3;
+        private _matrices;
+        constructor(name: string, size: any, fragment: any, scene: Scene, generateMipMaps?: boolean);
+        public isReady(): boolean;
+        public resetRefreshCounter(): void;
+        public refreshRate : number;
+        public _shouldRender(): boolean;
+        public getRenderSize(): number;
+        public resize(size: any, generateMipMaps: any): void;
+        private _checkUniform(uniformName);
+        public setTexture(name: string, texture: Texture): ProceduralTexture;
+        public setFloat(name: string, value: number): ProceduralTexture;
+        public setFloats(name: string, value: number[]): ProceduralTexture;
+        public setColor3(name: string, value: Color3): ProceduralTexture;
+        public setColor4(name: string, value: Color4): ProceduralTexture;
+        public setVector2(name: string, value: Vector2): ProceduralTexture;
+        public setVector3(name: string, value: Vector3): ProceduralTexture;
+        public setMatrix(name: string, value: Matrix): ProceduralTexture;
+        public render(useCameraPostProcess?: boolean): void;
+        public clone(): ProceduralTexture;
+        public dispose(): void;
+    }
+}
+declare module BABYLON {
     class RenderTargetTexture extends Texture {
     class RenderTargetTexture extends Texture {
         public renderList: AbstractMesh[];
         public renderList: AbstractMesh[];
         public renderParticles: boolean;
         public renderParticles: boolean;