浏览代码

do not skip updating rtt view ubo if multiple scenes are active

Trevor Baron 6 年之前
父节点
当前提交
1d74ceb5a0
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/Materials/Textures/renderTargetTexture.ts

+ 6 - 2
src/Materials/Textures/renderTargetTexture.ts

@@ -584,7 +584,10 @@ export class RenderTargetTexture extends Texture {
      */
      */
     public render(useCameraPostProcess: boolean = false, dumpForDebug: boolean = false): void {
     public render(useCameraPostProcess: boolean = false, dumpForDebug: boolean = false): void {
         var scene = this.getScene();
         var scene = this.getScene();
-
+        if(this.name == "outputTextureX"){
+            debugger;
+        }
+        
         if (!scene) {
         if (!scene) {
             return;
             return;
         }
         }
@@ -721,7 +724,8 @@ export class RenderTargetTexture extends Texture {
         this.onAfterUnbindObservable.notifyObservers(this);
         this.onAfterUnbindObservable.notifyObservers(this);
 
 
         if (scene.activeCamera) {
         if (scene.activeCamera) {
-            if (this.activeCamera && this.activeCamera !== scene.activeCamera) {
+            // Do not avoid setting uniforms when multiple scenes are active as another camera may have overwrite these
+            if (scene.getEngine().scenes.length > 1 || (this.activeCamera && this.activeCamera !== scene.activeCamera)) {
                 scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));
                 scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));
             }
             }
             engine.setViewport(scene.activeCamera.viewport);
             engine.setViewport(scene.activeCamera.viewport);