瀏覽代碼

Fixing occulus distorsion bug

David Catuhe 10 年之前
父節點
當前提交
ebf4506c24

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

@@ -78,6 +78,11 @@ var BABYLON;
                 var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
                 var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
                 running = running || isRunning;
                 running = running || isRunning;
             }
             }
+            if (!running) {
+                // Remove from active animatables
+                index = this._scene._activeAnimatables.indexOf(this);
+                this._scene._activeAnimatables.splice(index, 1);
+            }
             if (!running && this.onAnimationEnd) {
             if (!running && this.onAnimationEnd) {
                 this.onAnimationEnd();
                 this.onAnimationEnd();
             }
             }

+ 5 - 4
Babylon/Animations/babylon.animatable.ts

@@ -23,8 +23,8 @@
                 var animation = animations[index];
                 var animation = animations[index];
 
 
                 animation._target = target;
                 animation._target = target;
-                this._animations.push(animation);    
-            }            
+                this._animations.push(animation);
+            }
         }
         }
 
 
         public getAnimationByTargetProperty(property: string) {
         public getAnimationByTargetProperty(property: string) {
@@ -86,9 +86,10 @@
                 var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
                 var isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this.speedRatio);
                 running = running || isRunning;
                 running = running || isRunning;
             }
             }
+
             if (!running) {
             if (!running) {
                 // Remove from active animatables
                 // Remove from active animatables
-                var index = this._scene._activeAnimatables.indexOf(this);
+                index = this._scene._activeAnimatables.indexOf(this);
                 this._scene._activeAnimatables.splice(index, 1);
                 this._scene._activeAnimatables.splice(index, 1);
             }
             }
 
 
@@ -99,4 +100,4 @@
             return running;
             return running;
         }
         }
     }
     }
-} 
+} 

+ 9 - 4
Babylon/Audio/babylon.sound.js

@@ -96,6 +96,9 @@ var BABYLON;
                     BABYLON.Tools.Error("Web Audio is not supported by your browser.");
                     BABYLON.Tools.Error("Web Audio is not supported by your browser.");
                     BABYLON.Engine.audioEngine.WarnedWebAudioUnsupported = true;
                     BABYLON.Engine.audioEngine.WarnedWebAudioUnsupported = true;
                 }
                 }
+                if (this._readyToPlayCallback) {
+                    this._readyToPlayCallback();
+                }
             }
             }
         }
         }
         Sound.prototype.dispose = function () {
         Sound.prototype.dispose = function () {
@@ -228,7 +231,7 @@ var BABYLON;
         };
         };
         Sound.prototype.setPosition = function (newPosition) {
         Sound.prototype.setPosition = function (newPosition) {
             this._position = newPosition;
             this._position = newPosition;
-            if (this.isPlaying && this.spatialSound) {
+            if (this.spatialSound) {
                 this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
                 this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
             }
             }
         };
         };
@@ -297,9 +300,11 @@ var BABYLON;
             }
             }
         };
         };
         Sound.prototype._onended = function () {
         Sound.prototype._onended = function () {
-            this.isPlaying = false;
-            if (this.onended) {
-                this.onended();
+            if (!this.loop) {
+                this.isPlaying = false;
+                if (this.onended) {
+                    this.onended();
+                }
             }
             }
         };
         };
         /**
         /**

+ 10 - 5
Babylon/Audio/babylon.sound.ts

@@ -89,7 +89,7 @@
                 if (urlOrArrayBuffer) {
                 if (urlOrArrayBuffer) {
                     // If it's an URL
                     // If it's an URL
                     if (typeof (urlOrArrayBuffer) === "string") {
                     if (typeof (urlOrArrayBuffer) === "string") {
-                        Tools.LoadFile(urlOrArrayBuffer,(data) => { this._soundLoaded(data); }, null, null, true);
+                        Tools.LoadFile(urlOrArrayBuffer, (data) => { this._soundLoaded(data); }, null, null, true);
                     }
                     }
                     else {
                     else {
                         if (urlOrArrayBuffer instanceof ArrayBuffer) {
                         if (urlOrArrayBuffer instanceof ArrayBuffer) {
@@ -108,6 +108,9 @@
                     BABYLON.Tools.Error("Web Audio is not supported by your browser.");
                     BABYLON.Tools.Error("Web Audio is not supported by your browser.");
                     Engine.audioEngine.WarnedWebAudioUnsupported = true;
                     Engine.audioEngine.WarnedWebAudioUnsupported = true;
                 }
                 }
+                if (this._readyToPlayCallback) {
+                    this._readyToPlayCallback();
+                }
             }
             }
         }
         }
 
 
@@ -248,7 +251,7 @@
         public setPosition(newPosition: Vector3) {
         public setPosition(newPosition: Vector3) {
             this._position = newPosition;
             this._position = newPosition;
 
 
-            if (this.isPlaying && this.spatialSound) {
+            if (this.spatialSound) {
                 this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
                 this._soundPanner.setPosition(this._position.x, this._position.y, this._position.z);
             }
             }
         }
         }
@@ -321,9 +324,11 @@
         }
         }
 
 
         private _onended() {
         private _onended() {
-            this.isPlaying = false;
-            if (this.onended) {
-                this.onended();
+            if (!this.loop) {
+                this.isPlaying = false;
+                if (this.onended) {
+                    this.onended();
+                }
             }
             }
         }
         }
 
 

+ 3 - 3
Babylon/Lights/Shadows/babylon.shadowGenerator.js

@@ -22,6 +22,7 @@ var BABYLON;
             this._shadowMap = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false);
             this._shadowMap = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false);
             this._shadowMap.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
             this._shadowMap.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
             this._shadowMap.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
             this._shadowMap.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
+            this._shadowMap.anisotropicFilteringLevel = 1;
             this._shadowMap.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE);
             this._shadowMap.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE);
             this._shadowMap.renderParticles = false;
             this._shadowMap.renderParticles = false;
             this._shadowMap.onAfterUnbind = function () {
             this._shadowMap.onAfterUnbind = function () {
@@ -32,9 +33,8 @@ var BABYLON;
                     _this._shadowMap2 = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, _this._scene, false);
                     _this._shadowMap2 = new BABYLON.RenderTargetTexture(light.name + "_shadowMap", mapSize, _this._scene, false);
                     _this._shadowMap2.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
                     _this._shadowMap2.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
-                    _this._shadowMap2.anisotropicFilteringLevel = 16;
                     _this._shadowMap2.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
                     _this._shadowMap2.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
-                    _this._downSamplePostprocess = new BABYLON.PassPostProcess("downScale", 1.0 / _this.blurScale, null, BABYLON.Texture.NEAREST_SAMPLINGMODE, _this._scene.getEngine());
+                    _this._downSamplePostprocess = new BABYLON.PassPostProcess("downScale", 1.0 / _this.blurScale, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, _this._scene.getEngine());
                     _this._downSamplePostprocess.onApply = function (effect) {
                     _this._downSamplePostprocess.onApply = function (effect) {
                         effect.setTexture("textureSampler", _this._shadowMap);
                         effect.setTexture("textureSampler", _this._shadowMap);
                     };
                     };
@@ -172,7 +172,7 @@ var BABYLON;
                 this._filter = value;
                 this._filter = value;
                 if (this.useVarianceShadowMap || this.useBlurVarianceShadowMap) {
                 if (this.useVarianceShadowMap || this.useBlurVarianceShadowMap) {
                     this._shadowMap.anisotropicFilteringLevel = 16;
                     this._shadowMap.anisotropicFilteringLevel = 16;
-                    this._shadowMap.updateSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE);
+                    this._shadowMap.updateSamplingMode(BABYLON.Texture.BILINEAR_SAMPLINGMODE);
                 }
                 }
                 else {
                 else {
                     this._shadowMap.anisotropicFilteringLevel = 1;
                     this._shadowMap.anisotropicFilteringLevel = 1;

+ 3 - 3
Babylon/Lights/Shadows/babylon.shadowGenerator.ts

@@ -69,7 +69,7 @@
 
 
             if (this.useVarianceShadowMap || this.useBlurVarianceShadowMap) {
             if (this.useVarianceShadowMap || this.useBlurVarianceShadowMap) {
                 this._shadowMap.anisotropicFilteringLevel = 16;
                 this._shadowMap.anisotropicFilteringLevel = 16;
-                this._shadowMap.updateSamplingMode(Texture.TRILINEAR_SAMPLINGMODE);
+                this._shadowMap.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);
             } else {
             } else {
                 this._shadowMap.anisotropicFilteringLevel = 1;
                 this._shadowMap.anisotropicFilteringLevel = 1;
                 this._shadowMap.updateSamplingMode(Texture.NEAREST_SAMPLINGMODE);
                 this._shadowMap.updateSamplingMode(Texture.NEAREST_SAMPLINGMODE);
@@ -132,6 +132,7 @@
             this._shadowMap = new RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false);
             this._shadowMap = new RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false);
             this._shadowMap.wrapU = Texture.CLAMP_ADDRESSMODE;
             this._shadowMap.wrapU = Texture.CLAMP_ADDRESSMODE;
             this._shadowMap.wrapV = Texture.CLAMP_ADDRESSMODE;
             this._shadowMap.wrapV = Texture.CLAMP_ADDRESSMODE;
+            this._shadowMap.anisotropicFilteringLevel = 1;
             this._shadowMap.updateSamplingMode(Texture.NEAREST_SAMPLINGMODE);
             this._shadowMap.updateSamplingMode(Texture.NEAREST_SAMPLINGMODE);
             this._shadowMap.renderParticles = false;
             this._shadowMap.renderParticles = false;
 
 
@@ -144,10 +145,9 @@
                     this._shadowMap2 = new RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false);
                     this._shadowMap2 = new RenderTargetTexture(light.name + "_shadowMap", mapSize, this._scene, false);
                     this._shadowMap2.wrapU = Texture.CLAMP_ADDRESSMODE;
                     this._shadowMap2.wrapU = Texture.CLAMP_ADDRESSMODE;
                     this._shadowMap2.wrapV = Texture.CLAMP_ADDRESSMODE;
                     this._shadowMap2.wrapV = Texture.CLAMP_ADDRESSMODE;
-                    this._shadowMap2.anisotropicFilteringLevel = 16;
                     this._shadowMap2.updateSamplingMode(Texture.TRILINEAR_SAMPLINGMODE);
                     this._shadowMap2.updateSamplingMode(Texture.TRILINEAR_SAMPLINGMODE);
 
 
-                    this._downSamplePostprocess = new PassPostProcess("downScale", 1.0 / this.blurScale, null, Texture.NEAREST_SAMPLINGMODE, this._scene.getEngine());
+                    this._downSamplePostprocess = new PassPostProcess("downScale", 1.0 / this.blurScale, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine());
                     this._downSamplePostprocess.onApply = effect => {
                     this._downSamplePostprocess.onApply = effect => {
                         effect.setTexture("textureSampler", this._shadowMap);
                         effect.setTexture("textureSampler", this._shadowMap);
                     };
                     };

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

@@ -26,6 +26,9 @@ var BABYLON;
         SceneLoader._getPluginForFilename = function (sceneFilename) {
         SceneLoader._getPluginForFilename = function (sceneFilename) {
             var dotPosition = sceneFilename.lastIndexOf(".");
             var dotPosition = sceneFilename.lastIndexOf(".");
             var queryStringPosition = sceneFilename.indexOf("?");
             var queryStringPosition = sceneFilename.indexOf("?");
+            if (queryStringPosition === -1) {
+                queryStringPosition = sceneFilename.length;
+            }
             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];

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

@@ -33,6 +33,11 @@
             var dotPosition = sceneFilename.lastIndexOf(".");
             var dotPosition = sceneFilename.lastIndexOf(".");
 
 
             var queryStringPosition = sceneFilename.indexOf("?");
             var queryStringPosition = sceneFilename.indexOf("?");
+
+            if (queryStringPosition === -1) {
+                queryStringPosition = sceneFilename.length;
+            }
+
             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++) {

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

@@ -61,13 +61,11 @@ var BABYLON;
         StandardMaterial.prototype.isReady = function (mesh, useInstances) {
         StandardMaterial.prototype.isReady = function (mesh, useInstances) {
             if (this.checkReadyOnlyOnce) {
             if (this.checkReadyOnlyOnce) {
                 if (this._wasPreviouslyReady) {
                 if (this._wasPreviouslyReady) {
-                    return true;
                 }
                 }
             }
             }
             var scene = this.getScene();
             var scene = this.getScene();
             if (!this.checkReadyOnEveryCall) {
             if (!this.checkReadyOnEveryCall) {
                 if (this._renderId === scene.getRenderId()) {
                 if (this._renderId === scene.getRenderId()) {
-                    return true;
                 }
                 }
             }
             }
             var engine = scene.getEngine();
             var engine = scene.getEngine();

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

@@ -74,7 +74,7 @@
         public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean {
         public isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean {
             if (this.checkReadyOnlyOnce) {
             if (this.checkReadyOnlyOnce) {
                 if (this._wasPreviouslyReady) {
                 if (this._wasPreviouslyReady) {
-                    return true;
+                 //   return true;
                 }
                 }
             }
             }
 
 
@@ -82,7 +82,7 @@
 
 
             if (!this.checkReadyOnEveryCall) {
             if (!this.checkReadyOnEveryCall) {
                 if (this._renderId === scene.getRenderId()) {
                 if (this._renderId === scene.getRenderId()) {
-                    return true;
+                  //  return true;
                 }
                 }
             }
             }
 
 

+ 3 - 3
Babylon/Math/babylon.math.js

@@ -631,14 +631,14 @@ var BABYLON;
             result.z = rz / rw;
             result.z = rz / rw;
         };
         };
         Vector3.TransformCoordinatesToRefSIMD = function (vector, transformation, result) {
         Vector3.TransformCoordinatesToRefSIMD = function (vector, transformation, result) {
-            var v = SIMD.float32x4(vector.x, vector.y, vector.z, 0);
+            var v = SIMD.float32x4.loadXYZ(vector._data, 0);
             var m0 = SIMD.float32x4.load(transformation.m, 0);
             var m0 = SIMD.float32x4.load(transformation.m, 0);
             var m1 = SIMD.float32x4.load(transformation.m, 4);
             var m1 = SIMD.float32x4.load(transformation.m, 4);
             var m2 = SIMD.float32x4.load(transformation.m, 8);
             var m2 = SIMD.float32x4.load(transformation.m, 8);
             var m3 = SIMD.float32x4.load(transformation.m, 12);
             var m3 = SIMD.float32x4.load(transformation.m, 12);
             var r = SIMD.float32x4.add(SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 0, 0, 0, 0), m0), SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 1, 1, 1, 1), m1)), SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 2, 2, 2, 2), m2), m3));
             var r = SIMD.float32x4.add(SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 0, 0, 0, 0), m0), SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 1, 1, 1, 1), m1)), SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 2, 2, 2, 2), m2), m3));
             r = SIMD.float32x4.div(r, SIMD.float32x4.swizzle(r, 3, 3, 3, 3));
             r = SIMD.float32x4.div(r, SIMD.float32x4.swizzle(r, 3, 3, 3, 3));
-            SIMD.float32x4.storeXYZ(result, 0, r);
+            SIMD.float32x4.storeXYZ(result._data, 0, r);
         };
         };
         Vector3.TransformCoordinatesFromFloatsToRefSIMD = function (x, y, z, transformation, result) {
         Vector3.TransformCoordinatesFromFloatsToRefSIMD = function (x, y, z, transformation, result) {
             var v0 = SIMD.float32x4.splat(x);
             var v0 = SIMD.float32x4.splat(x);
@@ -650,7 +650,7 @@ var BABYLON;
             var m3 = SIMD.float32x4.load(transformation.m, 12);
             var m3 = SIMD.float32x4.load(transformation.m, 12);
             var r = SIMD.float32x4.add(SIMD.float32x4.add(SIMD.float32x4.mul(v0, m0), SIMD.float32x4.mul(v1, m1)), SIMD.float32x4.add(SIMD.float32x4.mul(v2, m2), m3));
             var r = SIMD.float32x4.add(SIMD.float32x4.add(SIMD.float32x4.mul(v0, m0), SIMD.float32x4.mul(v1, m1)), SIMD.float32x4.add(SIMD.float32x4.mul(v2, m2), m3));
             r = SIMD.float32x4.div(r, SIMD.float32x4.swizzle(r, 3, 3, 3, 3));
             r = SIMD.float32x4.div(r, SIMD.float32x4.swizzle(r, 3, 3, 3, 3));
-            SIMD.float32x4.storeXYZ(result, 0, r);
+            SIMD.float32x4.storeXYZ(result._data, 0, r);
         };
         };
         Vector3.TransformNormal = function (vector, transformation) {
         Vector3.TransformNormal = function (vector, transformation) {
             var result = Vector3.Zero();
             var result = Vector3.Zero();

+ 3 - 3
Babylon/Math/babylon.math.ts

@@ -781,14 +781,14 @@
         }
         }
 
 
         public static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void {
         public static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void {
-            var v = SIMD.float32x4(vector.x, vector.y, vector.z, 0);
+            var v = SIMD.float32x4.loadXYZ((<any>vector)._data, 0);
             var m0 = SIMD.float32x4.load(transformation.m, 0);
             var m0 = SIMD.float32x4.load(transformation.m, 0);
             var m1 = SIMD.float32x4.load(transformation.m, 4);
             var m1 = SIMD.float32x4.load(transformation.m, 4);
             var m2 = SIMD.float32x4.load(transformation.m, 8);
             var m2 = SIMD.float32x4.load(transformation.m, 8);
             var m3 = SIMD.float32x4.load(transformation.m, 12);
             var m3 = SIMD.float32x4.load(transformation.m, 12);
             var r = SIMD.float32x4.add(SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 0, 0, 0, 0), m0), SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 1, 1, 1, 1), m1)), SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 2, 2, 2, 2), m2), m3));
             var r = SIMD.float32x4.add(SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 0, 0, 0, 0), m0), SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 1, 1, 1, 1), m1)), SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(v, 2, 2, 2, 2), m2), m3));
             r = SIMD.float32x4.div(r, SIMD.float32x4.swizzle(r, 3, 3, 3, 3));
             r = SIMD.float32x4.div(r, SIMD.float32x4.swizzle(r, 3, 3, 3, 3));
-            SIMD.float32x4.storeXYZ(result, 0, r);
+            SIMD.float32x4.storeXYZ((<any>result)._data, 0, r);
         }
         }
 
 
         public static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void {
         public static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void {
@@ -801,7 +801,7 @@
             var m3 = SIMD.float32x4.load(transformation.m, 12);
             var m3 = SIMD.float32x4.load(transformation.m, 12);
             var r = SIMD.float32x4.add(SIMD.float32x4.add(SIMD.float32x4.mul(v0, m0), SIMD.float32x4.mul(v1, m1)), SIMD.float32x4.add(SIMD.float32x4.mul(v2, m2), m3));
             var r = SIMD.float32x4.add(SIMD.float32x4.add(SIMD.float32x4.mul(v0, m0), SIMD.float32x4.mul(v1, m1)), SIMD.float32x4.add(SIMD.float32x4.mul(v2, m2), m3));
             r = SIMD.float32x4.div(r, SIMD.float32x4.swizzle(r, 3, 3, 3, 3));
             r = SIMD.float32x4.div(r, SIMD.float32x4.swizzle(r, 3, 3, 3, 3));
-            SIMD.float32x4.storeXYZ(result, 0, r);
+            SIMD.float32x4.storeXYZ((<any>result)._data, 0, r);
         }
         }
 
 
         public static TransformNormal(vector: Vector3, transformation: Matrix): Vector3 {
         public static TransformNormal(vector: Vector3, transformation: Matrix): Vector3 {

+ 5 - 0
Babylon/Mesh/babylon.geometry.js

@@ -11,6 +11,7 @@ var BABYLON;
             this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NONE;
             this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NONE;
             this._totalVertices = 0;
             this._totalVertices = 0;
             this._indices = [];
             this._indices = [];
+            this._isDisposed = false;
             this.id = id;
             this.id = id;
             this._engine = scene.getEngine();
             this._engine = scene.getEngine();
             this._meshes = [];
             this._meshes = [];
@@ -271,6 +272,9 @@ var BABYLON;
             }, function () {
             }, function () {
             }, scene.database);
             }, scene.database);
         };
         };
+        Geometry.prototype.isDisposed = function () {
+            return this._isDisposed;
+        };
         Geometry.prototype.dispose = function () {
         Geometry.prototype.dispose = function () {
             var meshes = this._meshes;
             var meshes = this._meshes;
             var numOfMeshes = meshes.length;
             var numOfMeshes = meshes.length;
@@ -299,6 +303,7 @@ var BABYLON;
             if (index > -1) {
             if (index > -1) {
                 geometries.splice(index, 1);
                 geometries.splice(index, 1);
             }
             }
+            this._isDisposed = true;
         };
         };
         Geometry.prototype.copy = function (id) {
         Geometry.prototype.copy = function (id) {
             var vertexData = new BABYLON.VertexData();
             var vertexData = new BABYLON.VertexData();

+ 1 - 2
Babylon/Mesh/babylon.geometry.ts

@@ -348,7 +348,7 @@
                 if (onLoaded) {
                 if (onLoaded) {
                     onLoaded();
                     onLoaded();
                 }
                 }
-            }, () => { }, scene.database);
+            },() => { }, scene.database);
         }
         }
 
 
         public isDisposed(): boolean {
         public isDisposed(): boolean {
@@ -743,4 +743,3 @@
         }
         }
     }
     }
 } 
 } 
-

+ 1 - 2
Babylon/PostProcess/babylon.oculusDistortionCorrectionPostProcess.ts

@@ -24,8 +24,7 @@
             this._postProcessScaleFactor = cameraSettings.PostProcessScaleFactor;
             this._postProcessScaleFactor = cameraSettings.PostProcessScaleFactor;
             this._lensCenterOffset = cameraSettings.LensCenterOffset;
             this._lensCenterOffset = cameraSettings.LensCenterOffset;
 
 
-
-           this.onSizeChanged = () => {
+            this.onSizeChanged = () => {
                 this.aspectRatio = this.width * .5 / this.height;
                 this.aspectRatio = this.width * .5 / this.height;
                 this._scaleIn = new BABYLON.Vector2(2, 2 / this.aspectRatio);
                 this._scaleIn = new BABYLON.Vector2(2, 2 / this.aspectRatio);
                 this._scaleFactor = new BABYLON.Vector2(.5 * (1 / this._postProcessScaleFactor), .5 * (1 / this._postProcessScaleFactor) * this.aspectRatio);
                 this._scaleFactor = new BABYLON.Vector2(.5 * (1 / this._postProcessScaleFactor), .5 * (1 / this._postProcessScaleFactor) * this.aspectRatio);

+ 6 - 1
Babylon/PostProcess/babylon.postProcess.js

@@ -58,7 +58,12 @@ var BABYLON;
                 this.onActivate(camera);
                 this.onActivate(camera);
             }
             }
             // Clear
             // Clear
-            this._engine.clear(scene.clearColor, scene.autoClear || scene.forceWireframe, true);
+            if (this.clearColor) {
+                this._engine.clear(this.clearColor, true, true);
+            }
+            else {
+                this._engine.clear(scene.clearColor, scene.autoClear || scene.forceWireframe, true);
+            }
             if (this._reusable) {
             if (this._reusable) {
                 this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;
                 this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;
             }
             }

+ 6 - 2
Babylon/PostProcess/babylon.postProcess.ts

@@ -7,6 +7,7 @@
         public width = -1;
         public width = -1;
         public height = -1;
         public height = -1;
         public renderTargetSamplingMode: number;
         public renderTargetSamplingMode: number;
+        public clearColor: Color4;
 
 
         private _camera: Camera;
         private _camera: Camera;
         private _scene: Scene;
         private _scene: Scene;
@@ -74,7 +75,6 @@
                 if (this.onSizeChanged) {
                 if (this.onSizeChanged) {
                     this.onSizeChanged();
                     this.onSizeChanged();
                 }
                 }
-
             }
             }
 
 
             this._engine.bindFramebuffer(this._textures.data[this._currentRenderTextureInd]);
             this._engine.bindFramebuffer(this._textures.data[this._currentRenderTextureInd]);
@@ -84,7 +84,11 @@
             }
             }
 
 
             // Clear
             // Clear
-            this._engine.clear(scene.clearColor, scene.autoClear || scene.forceWireframe, true);
+            if (this.clearColor) {
+                this._engine.clear(this.clearColor, true, true);
+            } else {
+                this._engine.clear(scene.clearColor, scene.autoClear || scene.forceWireframe, true);
+            }
 
 
             if (this._reusable) {
             if (this._reusable) {
                 this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;
                 this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;

+ 0 - 1
Babylon/PostProcess/babylon.postProcessManager.ts

@@ -85,7 +85,6 @@
             if (postProcessesTakenIndices.length === 0 || !this._scene.postProcessesEnabled) {
             if (postProcessesTakenIndices.length === 0 || !this._scene.postProcessesEnabled) {
                 return;
                 return;
             }
             }
-
             var engine = this._scene.getEngine();
             var engine = this._scene.getEngine();
 
 
             for (var index = 0; index < postProcessesTakenIndices.length; index++) {
             for (var index = 0; index < postProcessesTakenIndices.length; index++) {

+ 1 - 1
Babylon/Shaders/default.fragment.fx

@@ -283,7 +283,7 @@ float computeShadowWithVSM(vec4 vPositionFromLight, sampler2D shadowSampler, flo
 	depth = 0.5 * depth + vec3(0.5);
 	depth = 0.5 * depth + vec3(0.5);
 	vec2 uv = depth.xy;
 	vec2 uv = depth.xy;
 
 
-	if (uv.x < 0. || uv.x > 1.0 || uv.y < 0. || uv.y > 1.0 || depth.z > 1.0)
+	if (uv.x < 0. || uv.x > 1.0 || uv.y < 0. || uv.y > 1.0 || depth.z >= 1.0)
 	{
 	{
 		return 1.0;
 		return 1.0;
 	}
 	}

+ 1 - 4
Babylon/babylon.scene.js

@@ -508,10 +508,7 @@ var BABYLON;
             var now = BABYLON.Tools.Now;
             var now = BABYLON.Tools.Now;
             var delay = now - this._animationStartDate;
             var delay = now - this._animationStartDate;
             for (var index = 0; index < this._activeAnimatables.length; index++) {
             for (var index = 0; index < this._activeAnimatables.length; index++) {
-                if (!this._activeAnimatables[index]._animate(delay)) {
-                    this._activeAnimatables.splice(index, 1);
-                    index--;
-                }
+                this._activeAnimatables[index]._animate(delay);
             }
             }
         };
         };
         // Matrix
         // Matrix

+ 1 - 1
Babylon/babylon.scene.ts

@@ -2091,4 +2091,4 @@
             return this._getByTags(this.materials, tagsQuery, forEach).concat(this._getByTags(this.multiMaterials, tagsQuery, forEach));
             return this._getByTags(this.materials, tagsQuery, forEach).concat(this._getByTags(this.multiMaterials, tagsQuery, forEach));
         }
         }
     }
     }
-} 
+} 

文件差異過大導致無法顯示
+ 36 - 18
babylon.2.1-alpha.debug.js


文件差異過大導致無法顯示
+ 15 - 15
babylon.2.1-alpha.js