Browse Source

Merge pull request #1593 from sebavan/Development

Try fix
David Catuhe 8 years ago
parent
commit
1e549d9dbe

+ 14 - 16
src/Materials/Textures/babylon.renderTargetTexture.ts

@@ -241,6 +241,20 @@
                 return;
             }
 
+            // Set custom projection.
+            // Needs to be before binding to prevent changing the aspect ratio.
+            if (this.activeCamera) {
+                engine.setViewport(this.activeCamera.viewport);
+
+                if (this.activeCamera !== scene.activeCamera)
+                {
+                    scene.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true));
+                }
+            }
+            else {
+                engine.setViewport(scene.activeCamera.viewport);
+            }
+
             // Prepare renderingManager
             this._renderingManager.reset();
 
@@ -304,22 +318,6 @@
                 }
             }
 
-            // Set states for projection (this does not change accross faces)
-            if (!this.isCube || faceIndex === 0) {            
-                if (this.activeCamera && this.activeCamera !== scene.activeCamera) {
-                    scene.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(true));
-                } else {
-                    scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));               
-                }
-
-                if (this.activeCamera) {
-                    engine.setViewport(this.activeCamera.viewport);
-                }
-                else {
-                    engine.setViewport(scene.activeCamera.viewport);
-                }
-            }
-
             this.onBeforeRenderObservable.notifyObservers(faceIndex);
 
             // Clear

+ 1 - 2
src/Materials/babylon.pbrMaterial.ts

@@ -1329,8 +1329,7 @@
                 this._overloadedIntensity.w = this.overloadedEmissiveIntensity;
                 this._effect.setVector4("vOverloadedIntensity", this._overloadedIntensity);
 
-                this.convertColorToLinearSpaceToRef(this.overloadedAmbient, this._tempColor);
-                this._effect.setColor3("vOverloadedAmbient", this._tempColor);
+                this._effect.setColor3("vOverloadedAmbient", this.overloadedAmbient);
                 this.convertColorToLinearSpaceToRef(this.overloadedAlbedo, this._tempColor);
                 this._effect.setColor3("vOverloadedAlbedo", this._tempColor);
                 this.convertColorToLinearSpaceToRef(this.overloadedReflectivity, this._tempColor);