Explorar el Código

Merge pull request #6363 from TrevorDev/rttMultipleScenes

do not skip updating rtt view ubo if multiple scenes are active
David Catuhe hace 6 años
padre
commit
5c1e8f8135
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      src/Materials/Textures/renderTargetTexture.ts

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

@@ -721,7 +721,8 @@ export class RenderTargetTexture extends Texture {
         this.onAfterUnbindObservable.notifyObservers(this);
 
         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));
             }
             engine.setViewport(scene.activeCamera.viewport);
@@ -1017,4 +1018,4 @@ export class RenderTargetTexture extends Texture {
 
 Texture._CreateRenderTargetTexture = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean) => {
     return new RenderTargetTexture(name, renderTargetSize, scene, generateMipMaps);
-};
+};