David Catuhe 9 vuotta sitten
vanhempi
commit
d5819832b0

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 6
dist/preview release/babylon.core.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 4316 - 4315
dist/preview release/babylon.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 14 - 14
dist/preview release/babylon.js


+ 21 - 13
dist/preview release/babylon.max.js

@@ -22627,7 +22627,8 @@ var BABYLON;
             }
             }
             return result;
             return result;
         };
         };
-        Material.prototype.dispose = function (forceDisposeEffect, keepTextures) {
+        Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            if (forceDisposeTextures === void 0) { forceDisposeTextures = true; }
             // Animations
             // Animations
             this.getScene().stopAnimation(this);
             this.getScene().stopAnimation(this);
             // Remove from scene
             // Remove from scene
@@ -23423,8 +23424,9 @@ var BABYLON;
             }
             }
             return results;
             return results;
         };
         };
-        StandardMaterial.prototype.dispose = function (forceDisposeEffect, keepTextures) {
-            if (!keepTextures) {
+        StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            if (forceDisposeTextures === void 0) { forceDisposeTextures = true; }
+            if (forceDisposeTextures) {
                 if (this.diffuseTexture) {
                 if (this.diffuseTexture) {
                     this.diffuseTexture.dispose();
                     this.diffuseTexture.dispose();
                 }
                 }
@@ -23453,7 +23455,7 @@ var BABYLON;
                     this.refractionTexture.dispose();
                     this.refractionTexture.dispose();
                 }
                 }
             }
             }
-            _super.prototype.dispose.call(this, forceDisposeEffect);
+            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
         };
         };
         StandardMaterial.prototype.clone = function (name) {
         StandardMaterial.prototype.clone = function (name) {
             var _this = this;
             var _this = this;
@@ -27535,7 +27537,7 @@ var BABYLON;
                 _this._physicsEngine.removeJoint(_this, j.otherImpostor, j.joint);
                 _this._physicsEngine.removeJoint(_this, j.otherImpostor, j.joint);
             });
             });
             //dispose the physics body
             //dispose the physics body
-            this.physicsBody = null;
+            this._physicsEngine.removeImpostor(this);
             if (this.parent) {
             if (this.parent) {
                 this.parent.forceUpdate();
                 this.parent.forceUpdate();
             }
             }
@@ -32472,6 +32474,10 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        LinesMesh.prototype.createInstance = function (name) {
+            BABYLON.Tools.Log("LinesMeshes do not support createInstance.");
+            return null;
+        };
         LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {
         LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {
             var engine = this.getScene().getEngine();
             var engine = this.getScene().getEngine();
             var indexToBind = this._geometry.getIndexBuffer();
             var indexToBind = this._geometry.getIndexBuffer();
@@ -34563,14 +34569,15 @@ var BABYLON;
             var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
             var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
             return newShaderMaterial;
             return newShaderMaterial;
         };
         };
-        ShaderMaterial.prototype.dispose = function (forceDisposeEffect, keepTextures) {
-            if (!keepTextures) {
+        ShaderMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            if (forceDisposeTextures === void 0) { forceDisposeTextures = true; }
+            if (forceDisposeTextures) {
                 for (var name in this._textures) {
                 for (var name in this._textures) {
                     this._textures[name].dispose();
                     this._textures[name].dispose();
                 }
                 }
             }
             }
             this._textures = {};
             this._textures = {};
-            _super.prototype.dispose.call(this, forceDisposeEffect, keepTextures);
+            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
         };
         };
         ShaderMaterial.prototype.serialize = function () {
         ShaderMaterial.prototype.serialize = function () {
             var serializationObject = BABYLON.SerializationHelper.Serialize(this);
             var serializationObject = BABYLON.SerializationHelper.Serialize(this);
@@ -35069,7 +35076,7 @@ var BABYLON;
             }
             }
         };
         };
         CannonJSPlugin.prototype.removeJoint = function (impostorJoint) {
         CannonJSPlugin.prototype.removeJoint = function (impostorJoint) {
-            this.world.remove(impostorJoint.joint);
+            this.world.removeConstraint(impostorJoint.joint.physicsJoint);
         };
         };
         CannonJSPlugin.prototype._addMaterial = function (name, friction, restitution) {
         CannonJSPlugin.prototype._addMaterial = function (name, friction, restitution) {
             var index;
             var index;
@@ -35080,7 +35087,7 @@ var BABYLON;
                     return mat;
                     return mat;
                 }
                 }
             }
             }
-            var currentMat = new CANNON.Material("mat");
+            var currentMat = new CANNON.Material(name);
             currentMat.friction = friction;
             currentMat.friction = friction;
             currentMat.restitution = restitution;
             currentMat.restitution = restitution;
             this._physicsMaterials.push(currentMat);
             this._physicsMaterials.push(currentMat);
@@ -45671,8 +45678,9 @@ var BABYLON;
             }
             }
             return results;
             return results;
         };
         };
-        PBRMaterial.prototype.dispose = function (forceDisposeEffect, keepTextures) {
-            if (!keepTextures) {
+        PBRMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            if (forceDisposeTextures === void 0) { forceDisposeTextures = true; }
+            if (forceDisposeTextures) {
                 if (this.albedoTexture) {
                 if (this.albedoTexture) {
                     this.albedoTexture.dispose();
                     this.albedoTexture.dispose();
                 }
                 }
@@ -45701,7 +45709,7 @@ var BABYLON;
                     this.refractionTexture.dispose();
                     this.refractionTexture.dispose();
                 }
                 }
             }
             }
-            _super.prototype.dispose.call(this, forceDisposeEffect, keepTextures);
+            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
         };
         };
         PBRMaterial.prototype.clone = function (name) {
         PBRMaterial.prototype.clone = function (name) {
             var _this = this;
             var _this = this;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 14 - 14
dist/preview release/babylon.noworker.js


+ 2 - 1
src/Materials/babylon.material.js

@@ -221,7 +221,8 @@ var BABYLON;
             }
             }
             return result;
             return result;
         };
         };
-        Material.prototype.dispose = function (forceDisposeEffect, keepTextures) {
+        Material.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            if (forceDisposeTextures === void 0) { forceDisposeTextures = true; }
             // Animations
             // Animations
             this.getScene().stopAnimation(this);
             this.getScene().stopAnimation(this);
             // Remove from scene
             // Remove from scene

+ 1 - 1
src/Materials/babylon.material.ts

@@ -269,7 +269,7 @@
             return result;
             return result;
         }
         }
 
 
-        public dispose(forceDisposeEffect?: boolean, keepTextures?: boolean): void {
+        public dispose(forceDisposeEffect?: boolean, forceDisposeTextures: boolean = true): void {
             // Animations
             // Animations
             this.getScene().stopAnimation(this);
             this.getScene().stopAnimation(this);
 
 

+ 4 - 3
src/Materials/babylon.pbrMaterial.js

@@ -1004,8 +1004,9 @@ var BABYLON;
             }
             }
             return results;
             return results;
         };
         };
-        PBRMaterial.prototype.dispose = function (forceDisposeEffect, keepTextures) {
-            if (!keepTextures) {
+        PBRMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            if (forceDisposeTextures === void 0) { forceDisposeTextures = true; }
+            if (forceDisposeTextures) {
                 if (this.albedoTexture) {
                 if (this.albedoTexture) {
                     this.albedoTexture.dispose();
                     this.albedoTexture.dispose();
                 }
                 }
@@ -1034,7 +1035,7 @@ var BABYLON;
                     this.refractionTexture.dispose();
                     this.refractionTexture.dispose();
                 }
                 }
             }
             }
-            _super.prototype.dispose.call(this, forceDisposeEffect, keepTextures);
+            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
         };
         };
         PBRMaterial.prototype.clone = function (name) {
         PBRMaterial.prototype.clone = function (name) {
             var _this = this;
             var _this = this;

+ 3 - 3
src/Materials/babylon.pbrMaterial.ts

@@ -1322,8 +1322,8 @@
             return results;
             return results;
         }
         }
 
 
-        public dispose(forceDisposeEffect?: boolean, keepTextures?: boolean): void {
-            if (!keepTextures) {
+        public dispose(forceDisposeEffect?: boolean, forceDisposeTextures: boolean = true): void {
+            if (forceDisposeTextures) {
                 if (this.albedoTexture) {
                 if (this.albedoTexture) {
                     this.albedoTexture.dispose();
                     this.albedoTexture.dispose();
                 }
                 }
@@ -1361,7 +1361,7 @@
                 }
                 }
             }
             }
 
 
-            super.dispose(forceDisposeEffect, keepTextures);
+            super.dispose(forceDisposeEffect, forceDisposeTextures);
         }
         }
 
 
         public clone(name: string): PBRMaterial {
         public clone(name: string): PBRMaterial {

+ 4 - 3
src/Materials/babylon.shaderMaterial.js

@@ -219,14 +219,15 @@ var BABYLON;
             var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
             var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
             return newShaderMaterial;
             return newShaderMaterial;
         };
         };
-        ShaderMaterial.prototype.dispose = function (forceDisposeEffect, keepTextures) {
-            if (!keepTextures) {
+        ShaderMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            if (forceDisposeTextures === void 0) { forceDisposeTextures = true; }
+            if (forceDisposeTextures) {
                 for (var name in this._textures) {
                 for (var name in this._textures) {
                     this._textures[name].dispose();
                     this._textures[name].dispose();
                 }
                 }
             }
             }
             this._textures = {};
             this._textures = {};
-            _super.prototype.dispose.call(this, forceDisposeEffect, keepTextures);
+            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
         };
         };
         ShaderMaterial.prototype.serialize = function () {
         ShaderMaterial.prototype.serialize = function () {
             var serializationObject = BABYLON.SerializationHelper.Serialize(this);
             var serializationObject = BABYLON.SerializationHelper.Serialize(this);

+ 3 - 3
src/Materials/babylon.shaderMaterial.ts

@@ -283,9 +283,9 @@
             return newShaderMaterial;
             return newShaderMaterial;
         }
         }
 
 
-        public dispose(forceDisposeEffect?: boolean, keepTextures?: boolean): void {
+        public dispose(forceDisposeEffect?: boolean, forceDisposeTextures: boolean = true): void {
 
 
-            if (!keepTextures) {
+            if (forceDisposeTextures) {
                 for (var name in this._textures) {
                 for (var name in this._textures) {
                     this._textures[name].dispose();
                     this._textures[name].dispose();
                 }
                 }
@@ -293,7 +293,7 @@
 
 
             this._textures = {};
             this._textures = {};
 
 
-            super.dispose(forceDisposeEffect, keepTextures);
+            super.dispose(forceDisposeEffect, forceDisposeTextures);
         }
         }
 
 
         public serialize(): any {
         public serialize(): any {

+ 4 - 3
src/Materials/babylon.standardMaterial.js

@@ -693,8 +693,9 @@ var BABYLON;
             }
             }
             return results;
             return results;
         };
         };
-        StandardMaterial.prototype.dispose = function (forceDisposeEffect, keepTextures) {
-            if (!keepTextures) {
+        StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
+            if (forceDisposeTextures === void 0) { forceDisposeTextures = true; }
+            if (forceDisposeTextures) {
                 if (this.diffuseTexture) {
                 if (this.diffuseTexture) {
                     this.diffuseTexture.dispose();
                     this.diffuseTexture.dispose();
                 }
                 }
@@ -723,7 +724,7 @@ var BABYLON;
                     this.refractionTexture.dispose();
                     this.refractionTexture.dispose();
                 }
                 }
             }
             }
-            _super.prototype.dispose.call(this, forceDisposeEffect);
+            _super.prototype.dispose.call(this, forceDisposeEffect, forceDisposeTextures);
         };
         };
         StandardMaterial.prototype.clone = function (name) {
         StandardMaterial.prototype.clone = function (name) {
             var _this = this;
             var _this = this;

+ 3 - 3
src/Materials/babylon.standardMaterial.ts

@@ -898,8 +898,8 @@
             return results;
             return results;
         }
         }
 
 
-        public dispose(forceDisposeEffect?: boolean, keepTextures?: boolean): void {
-            if (!keepTextures) {
+        public dispose(forceDisposeEffect?: boolean, forceDisposeTextures: boolean = true): void {
+            if (forceDisposeTextures) {
                 if (this.diffuseTexture) {
                 if (this.diffuseTexture) {
                     this.diffuseTexture.dispose();
                     this.diffuseTexture.dispose();
                 }
                 }
@@ -937,7 +937,7 @@
                 }
                 }
             }
             }
 
 
-            super.dispose(forceDisposeEffect);
+            super.dispose(forceDisposeEffect, forceDisposeTextures);
         }
         }
 
 
         public clone(name: string): StandardMaterial {
         public clone(name: string): StandardMaterial {

+ 4 - 0
src/Mesh/babylon.linesMesh.js

@@ -67,6 +67,10 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        LinesMesh.prototype.createInstance = function (name) {
+            BABYLON.Tools.Log("LinesMeshes do not support createInstance.");
+            return null;
+        };
         LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {
         LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {
             var engine = this.getScene().getEngine();
             var engine = this.getScene().getEngine();
             var indexToBind = this._geometry.getIndexBuffer();
             var indexToBind = this._geometry.getIndexBuffer();

+ 5 - 0
src/Mesh/babylon.linesMesh.ts

@@ -56,6 +56,11 @@
             return false;
             return false;
         }
         }
 
 
+        public createInstance(name: string): InstancedMesh {
+            Tools.Log("LinesMeshes do not support createInstance.");
+            return null;
+        }
+
         public _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void {
         public _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void {
             var engine = this.getScene().getEngine();
             var engine = this.getScene().getEngine();
 
 

+ 2 - 2
src/Physics/Plugins/babylon.cannonJSPlugin.js

@@ -195,7 +195,7 @@ var BABYLON;
             }
             }
         };
         };
         CannonJSPlugin.prototype.removeJoint = function (impostorJoint) {
         CannonJSPlugin.prototype.removeJoint = function (impostorJoint) {
-            this.world.remove(impostorJoint.joint);
+            this.world.removeConstraint(impostorJoint.joint.physicsJoint);
         };
         };
         CannonJSPlugin.prototype._addMaterial = function (name, friction, restitution) {
         CannonJSPlugin.prototype._addMaterial = function (name, friction, restitution) {
             var index;
             var index;
@@ -206,7 +206,7 @@ var BABYLON;
                     return mat;
                     return mat;
                 }
                 }
             }
             }
-            var currentMat = new CANNON.Material("mat");
+            var currentMat = new CANNON.Material(name);
             currentMat.friction = friction;
             currentMat.friction = friction;
             currentMat.restitution = restitution;
             currentMat.restitution = restitution;
             this._physicsMaterials.push(currentMat);
             this._physicsMaterials.push(currentMat);

+ 2 - 3
src/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -92,7 +92,7 @@
                 //try to keep the body moving in the right direction by taking old properties.
                 //try to keep the body moving in the right direction by taking old properties.
                 //Should be tested!
                 //Should be tested!
                 if (oldBody) {
                 if (oldBody) {
-                    ['force', 'torque', 'velocity', 'angularVelocity'].forEach(function(param) {
+                    ['force', 'torque', 'velocity', 'angularVelocity'].forEach(function (param) {
                         impostor.physicsBody[param].copy(oldBody[param]);
                         impostor.physicsBody[param].copy(oldBody[param]);
                     });
                     });
                 }
                 }
@@ -199,7 +199,7 @@
             if (impostorJoint.joint.type !== PhysicsJoint.SpringJoint) {
             if (impostorJoint.joint.type !== PhysicsJoint.SpringJoint) {
                 this.world.addConstraint(constraint);
                 this.world.addConstraint(constraint);
             } else {
             } else {
-                impostorJoint.mainImpostor.registerAfterPhysicsStep(function() {
+                impostorJoint.mainImpostor.registerAfterPhysicsStep(function () {
                     constraint.applyForce();
                     constraint.applyForce();
                 });
                 });
             }
             }
@@ -496,4 +496,3 @@
         }
         }
     }
     }
 }
 }
-

+ 1 - 1
src/Physics/babylon.physicsImpostor.js

@@ -326,7 +326,7 @@ var BABYLON;
                 _this._physicsEngine.removeJoint(_this, j.otherImpostor, j.joint);
                 _this._physicsEngine.removeJoint(_this, j.otherImpostor, j.joint);
             });
             });
             //dispose the physics body
             //dispose the physics body
-            this.physicsBody = null;
+            this._physicsEngine.removeImpostor(this);
             if (this.parent) {
             if (this.parent) {
                 this.parent.forceUpdate();
                 this.parent.forceUpdate();
             }
             }

+ 1 - 1
src/Physics/babylon.physicsImpostor.ts

@@ -395,7 +395,7 @@ module BABYLON {
                 this._physicsEngine.removeJoint(this, j.otherImpostor, j.joint);
                 this._physicsEngine.removeJoint(this, j.otherImpostor, j.joint);
             })
             })
             //dispose the physics body
             //dispose the physics body
-            this._physicsEngine.removeImpostor(this);
+            this._physicsEngine.removeImpostor(this); 
             if (this.parent) {
             if (this.parent) {
                 this.parent.forceUpdate();
                 this.parent.forceUpdate();
             } else {
             } else {