Browse Source

validating recent PRs

David Catuhe 10 years ago
parent
commit
afaedc4c23

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

@@ -10,7 +10,7 @@ var BABYLON;
             this.bones = [];
             this._scene = scene;
             scene.skeletons.push(this);
-            this.prepare():
+            this.prepare();
             //make sure it will recalculate the matrix next time prepare is called.
             this._isDirty = true;
         }
@@ -71,4 +71,4 @@ var BABYLON;
     })();
     BABYLON.Skeleton = Skeleton;
 })(BABYLON || (BABYLON = {}));
-//# sourceMappingURL=babylon.skeleton.js.map
+//# sourceMappingURL=babylon.skeleton.js.map

+ 3 - 3
Babylon/Bones/babylon.skeleton.ts

@@ -14,10 +14,10 @@
             this._scene = scene;
 
             scene.skeletons.push(this);
-            
+
             this.prepare();
             //make sure it will recalculate the matrix next time prepare is called.
-            this._isDirty = true; 
+            this._isDirty = true;
         }
 
         // Members
@@ -90,4 +90,4 @@
             return result;
         }
     }
-}
+}

+ 0 - 13
Babylon/Materials/Textures/Procedurals/babylon.standardProceduralTexture.js

@@ -50,7 +50,6 @@ var BABYLON;
             _super.call(this, name, size, "fire", scene, fallbackTexture, generateMipMaps);
             this._time = 0.0;
             this._speed = new BABYLON.Vector2(0.5, 0.3);
-            this._shift = 1.6;
             this._autoGenerateTime = true;
             this._alphaThreshold = 0.5;
             this._fireColors = FireProceduralTexture.RedFireColors;
@@ -60,7 +59,6 @@ var BABYLON;
         FireProceduralTexture.prototype.updateShaderUniforms = function () {
             this.setFloat("time", this._time);
             this.setVector2("speed", this._speed);
-            this.setFloat("shift", this._shift);
             this.setColor3("c1", this._fireColors[0]);
             this.setColor3("c2", this._fireColors[1]);
             this.setColor3("c3", this._fireColors[2]);
@@ -165,17 +163,6 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
-        Object.defineProperty(FireProceduralTexture.prototype, "shift", {
-            get: function () {
-                return this._shift;
-            },
-            set: function (value) {
-                this._shift = value;
-                this.updateShaderUniforms();
-            },
-            enumerable: true,
-            configurable: true
-        });
         Object.defineProperty(FireProceduralTexture.prototype, "alphaThreshold", {
             get: function () {
                 return this._alphaThreshold;

+ 0 - 11
Babylon/Materials/Textures/Procedurals/babylon.standardProceduralTexture.ts

@@ -36,7 +36,6 @@
     export class FireProceduralTexture extends ProceduralTexture {
         private _time: number = 0.0;
         private _speed = new Vector2(0.5, 0.3);
-        private _shift: number = 1.6;
         private _autoGenerateTime: boolean = true;
         private _fireColors: Color3[];
         private _alphaThreshold: number = 0.5;
@@ -51,7 +50,6 @@
         public updateShaderUniforms() {
             this.setFloat("time", this._time);
             this.setVector2("speed", this._speed);
-            this.setFloat("shift", this._shift);
             this.setColor3("c1", this._fireColors[0]);
             this.setColor3("c2", this._fireColors[1]);
             this.setColor3("c3", this._fireColors[2]);
@@ -140,15 +138,6 @@
             this.updateShaderUniforms();
         }
 
-        public get shift(): number {
-            return this._shift;
-        }
-
-        public set shift(value: number) {
-            this._shift = value;
-            this.updateShaderUniforms();
-        }
-
         public get alphaThreshold(): number {
             return this._alphaThreshold;
         }

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

@@ -97,7 +97,7 @@ var BABYLON;
         Material.prototype.bind = function (world, mesh) {
             this._scene._cachedMaterial = this;
             if (this.onBind) {
-                this.onBind(this);
+                this.onBind(this, mesh);
             }
         };
         Material.prototype.bindOnlyWorldMatrix = function (world) {

+ 2 - 2
Babylon/Materials/babylon.material.ts

@@ -41,7 +41,7 @@
             return this._fillMode === Material.WireFrameFillMode;
         }
 
-        public set wireframe(value:boolean) {
+        public set wireframe(value: boolean) {
             this._fillMode = (value ? Material.WireFrameFillMode : Material.TriangleFillMode);
         }
 
@@ -136,4 +136,4 @@
             }
         }
     }
-} 
+} 

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

@@ -173,7 +173,7 @@ var BABYLON;
                     this._effect.setMatrix(name, this._matrices[name]);
                 }
             }
-            _super.prototype.bind.call(this, world, null);
+            _super.prototype.bind.call(this, world, mesh);
         };
         ShaderMaterial.prototype.dispose = function (forceDisposeEffect) {
             for (var name in this._textures) {

+ 2 - 2
Babylon/Materials/babylon.shaderMaterial.ts

@@ -33,7 +33,7 @@
         public needAlphaTesting(): boolean {
             return this._options.needAlphaTesting;
         }
-   
+
         private _checkUniform(uniformName): void {
             if (this._options.uniforms.indexOf(uniformName) === -1) {
                 this._options.uniforms.push(uniformName);
@@ -244,4 +244,4 @@
             super.dispose(forceDisposeEffect);
         }
     }
-} 
+} 

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

@@ -973,5 +973,4 @@ var BABYLON;
     })();
     BABYLON.VertexData = VertexData;
 })(BABYLON || (BABYLON = {}));
-
-//# sourceMappingURL=../Mesh/babylon.mesh.vertexData.js.map
+//# sourceMappingURL=babylon.mesh.vertexData.js.map

+ 50 - 20
babylon.2.1-alpha.debug.js

@@ -8274,6 +8274,7 @@ var BABYLON;
             this._transformMatrix = BABYLON.Matrix.Zero();
             this._scaledPosition = BABYLON.Vector3.Zero();
             this._scaledVelocity = BABYLON.Vector3.Zero();
+            this._uniqueIdCounter = 0;
             this._engine = engine;
             engine.scenes.push(this);
             this._renderingManager = new BABYLON.RenderingManager(this);
@@ -8672,6 +8673,7 @@ var BABYLON;
         };
         // Methods
         Scene.prototype.addMesh = function (newMesh) {
+            newMesh.uniqueId = this._uniqueIdCounter++;
             var position = this.meshes.push(newMesh);
             if (this.onNewMeshAdded) {
                 this.onNewMeshAdded(newMesh, position, this);
@@ -8711,12 +8713,14 @@ var BABYLON;
             return index;
         };
         Scene.prototype.addLight = function (newLight) {
+            newLight.uniqueId = this._uniqueIdCounter++;
             var position = this.lights.push(newLight);
             if (this.onNewLightAdded) {
                 this.onNewLightAdded(newLight, position, this);
             }
         };
         Scene.prototype.addCamera = function (newCamera) {
+            newCamera.uniqueId = this._uniqueIdCounter++;
             var position = this.cameras.push(newCamera);
             if (this.onNewCameraAdded) {
                 this.onNewCameraAdded(newCamera, position, this);
@@ -8784,6 +8788,14 @@ var BABYLON;
             }
             return null;
         };
+        Scene.prototype.getCameraByUniqueID = function (uniqueId) {
+            for (var index = 0; index < this.cameras.length; index++) {
+                if (this.cameras[index].uniqueId === uniqueId) {
+                    return this.cameras[index];
+                }
+            }
+            return null;
+        };
         /**
          * get a camera using its name
          * @param {string} the camera's name
@@ -8824,6 +8836,19 @@ var BABYLON;
             return null;
         };
         /**
+         * get a light node using its scene-generated unique ID
+         * @param {number} the light's unique id
+         * @return {BABYLON.Light|null} the light or null if none found.
+         */
+        Scene.prototype.getLightByUniqueID = function (uniqueId) {
+            for (var index = 0; index < this.lights.length; index++) {
+                if (this.lights[index].uniqueId === uniqueId) {
+                    return this.lights[index];
+                }
+            }
+            return null;
+        };
+        /**
          * get a geometry using its ID
          * @param {string} the geometry's id
          * @return {BABYLON.Geometry|null} the geometry or null if none found.
@@ -8853,7 +8878,7 @@ var BABYLON;
             return this._geometries;
         };
         /**
-         * Get a the first added mesh found of a given ID
+         * Get the first added mesh found of a given ID
          * @param {string} id - the id to search for
          * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
          */
@@ -8866,6 +8891,19 @@ var BABYLON;
             return null;
         };
         /**
+         * Get a mesh with its auto-generated unique id
+         * @param {number} uniqueId - the unique id to search for
+         * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
+         */
+        Scene.prototype.getMeshByUniqueID = function (uniqueId) {
+            for (var index = 0; index < this.meshes.length; index++) {
+                if (this.meshes[index].uniqueId === uniqueId) {
+                    return this.meshes[index];
+                }
+            }
+            return null;
+        };
+        /**
          * Get a the last added mesh found of a given ID
          * @param {string} id - the id to search for
          * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
@@ -13424,7 +13462,6 @@ var BABYLON;
             _super.call(this, name, size, "fire", scene, fallbackTexture, generateMipMaps);
             this._time = 0.0;
             this._speed = new BABYLON.Vector2(0.5, 0.3);
-            this._shift = 1.6;
             this._autoGenerateTime = true;
             this._alphaThreshold = 0.5;
             this._fireColors = FireProceduralTexture.RedFireColors;
@@ -13434,7 +13471,6 @@ var BABYLON;
         FireProceduralTexture.prototype.updateShaderUniforms = function () {
             this.setFloat("time", this._time);
             this.setVector2("speed", this._speed);
-            this.setFloat("shift", this._shift);
             this.setColor3("c1", this._fireColors[0]);
             this.setColor3("c2", this._fireColors[1]);
             this.setColor3("c3", this._fireColors[2]);
@@ -13539,17 +13575,6 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
-        Object.defineProperty(FireProceduralTexture.prototype, "shift", {
-            get: function () {
-                return this._shift;
-            },
-            set: function (value) {
-                this._shift = value;
-                this.updateShaderUniforms();
-            },
-            enumerable: true,
-            configurable: true
-        });
         Object.defineProperty(FireProceduralTexture.prototype, "alphaThreshold", {
             get: function () {
                 return this._alphaThreshold;
@@ -14595,7 +14620,7 @@ woodPixelShader:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nvarying vec2 vP
         Material.prototype.bind = function (world, mesh) {
             this._scene._cachedMaterial = this;
             if (this.onBind) {
-                this.onBind(this);
+                this.onBind(this, mesh);
             }
         };
         Material.prototype.bindOnlyWorldMatrix = function (world) {
@@ -17399,6 +17424,9 @@ var BABYLON;
             this.bones = [];
             this._scene = scene;
             scene.skeletons.push(this);
+            this.prepare();
+            //make sure it will recalculate the matrix next time prepare is called.
+            this._isDirty = true;
         }
         // Members
         Skeleton.prototype.getTransformMatrices = function () {
@@ -21943,10 +21971,7 @@ var BABYLON;
                 defines.push("#define BONES4");
                 fallbacks.addFallback(0, "BONES4");
             }
-            // Clip plane and alpha test
-            if (scene.clipPlane) {
-                defines.push("#define CLIPPLANE");
-            }
+            // Alpha test
             if (engine.getAlphaTesting()) {
                 defines.push("#define ALPHATEST");
             }
@@ -22018,7 +22043,7 @@ var BABYLON;
                     this._effect.setMatrix(name, this._matrices[name]);
                 }
             }
-            _super.prototype.bind.call(this, world, null);
+            _super.prototype.bind.call(this, world, mesh);
         };
         ShaderMaterial.prototype.dispose = function (forceDisposeEffect) {
             for (var name in this._textures) {
@@ -22917,6 +22942,11 @@ var BABYLON;
             return vertexData;
         };
         // Tools
+        /**
+         * @param {any} - positions (number[] or Float32Array)
+         * @param {any} - indices   (number[] or Uint16Array)
+         * @param {any} - normals   (number[] or Float32Array)
+         */
         VertexData.ComputeNormals = function (positions, indices, normals) {
             var positionVectors = [];
             var facesOfVertices = [];

File diff suppressed because it is too large
+ 25 - 22
babylon.2.1-alpha.js