浏览代码

Fixing worldMatrix cache issue

Deltakosh 11 年之前
父节点
当前提交
92581c3991
共有 4 个文件被更改,包括 4 次插入5 次删除
  1. 1 1
      Babylon/Cameras/babylon.camera.js
  2. 1 2
      Babylon/Mesh/babylon.mesh.js
  3. 1 1
      Babylon/Shaders/default.fragment.fx
  4. 1 1
      Babylon/babylon.node.js

+ 1 - 1
Babylon/Cameras/babylon.camera.js

@@ -294,10 +294,10 @@ var BABYLON = BABYLON || {};
     
     BABYLON.Camera.prototype._computeViewMatrix = function (force) {
         if (!force && this._isSynchronizedViewMatrix()) {
-            this._currentRenderId = this._scene.getRenderId();
             return this._computedViewMatrix;
         }
 
+        this._currentRenderId = this._scene.getRenderId();
         this._computedViewMatrix = this._getViewMatrix();
         return this._computedViewMatrix;
     };

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

@@ -324,8 +324,7 @@ var BABYLON = BABYLON || {};
     };
 
     BABYLON.Mesh.prototype.computeWorldMatrix = function (force) {
-        if (!force && (this._currentRenderId == this._scene.getRenderId() || this.isSynchronized(true))) {
-            this._currentRenderId = this._scene.getRenderId();
+        if (!force && this.isSynchronized(true)) {
             return this._worldMatrix;
         }
 

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

@@ -336,7 +336,7 @@ lightingInfo computeLighting(vec3 viewDirectionW, vec3 vNormal, vec4 lightData,
 	// Specular
 	vec3 angleW = normalize(viewDirectionW + lightVectorW);
 	float specComp = max(0., dot(vNormal, angleW));
-	specComp = pow(specComp, vSpecularColor.a);
+	specComp = pow(specComp, max(1., vSpecularColor.a));
 
 	result.diffuse = ndl * diffuseColor;
 	result.specular = specComp * specularColor;

+ 1 - 1
Babylon/babylon.node.js

@@ -52,7 +52,7 @@ var BABYLON = BABYLON || {};
     };
 
     BABYLON.Node.prototype.isSynchronizedWithParent = function() {
-        return this.parent ? !this.parent._currentRenderId === this._currentRenderId : true;
+        return this.parent ? this.parent._currentRenderId === this._currentRenderId : true;
     };
 
     BABYLON.Node.prototype.isSynchronized = function (updateCache) {