Browse Source

only bind if subcamera has an outputRenderTarget

Trevor Baron 6 năm trước cách đây
mục cha
commit
8682c07927
1 tập tin đã thay đổi với 9 bổ sung3 xóa
  1. 9 3
      src/scene.ts

+ 9 - 3
src/scene.ts

@@ -3523,9 +3523,15 @@ export class Scene extends AbstractScene implements IAnimatable {
 
             this._intermediateRendering = false;
 
-            // Bind the frame (this is needed to be done in case a subcamera has an outputRenderTarget)
-            // TODO this undoes the change that addresses this https://github.com/BabylonJS/Babylon.js/issues/6124
-            this._bindFrameBuffer();
+            // Need to bind if sub-camera has an outputRenderTarget eg. for webXR
+            if(this.activeCamera && this.activeCamera.outputRenderTarget){
+                needRebind = true;
+            }
+
+            // Restore framebuffer after rendering to targets
+            if (needRebind) {
+                this._bindFrameBuffer();
+            }
 
         }