Selaa lähdekoodia

only bind if subcamera has an outputRenderTarget

Trevor Baron 6 vuotta sitten
vanhempi
commit
8682c07927
1 muutettua tiedostoa jossa 9 lisäystä ja 3 poistoa
  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();
+            }
 
         }