Explorar o código

only update defines if they change, dont check left cam using string, remove redundant if

Trevor Baron %!s(int64=6) %!d(string=hai) anos
pai
achega
f99ca2c061

+ 4 - 1
src/Materials/Background/backgroundMaterial.ts

@@ -678,8 +678,11 @@ export class BackgroundMaterial extends PushMaterial {
 
         // Multiview
         if (scene.activeCamera) {
+            var previousMultiview = defines.MULTIVIEW;
             defines.MULTIVIEW = (scene.activeCamera.outputRenderTarget !== null && scene.activeCamera.outputRenderTarget.getViewCount() > 1);
-            defines.markAsUnprocessed();
+            if (defines.MULTIVIEW != previousMultiview) {
+                defines.markAsUnprocessed();
+            }
         }
 
         // Textures

+ 4 - 1
src/Materials/PBR/pbrBaseMaterial.ts

@@ -1243,8 +1243,11 @@ export abstract class PBRBaseMaterial extends PushMaterial {
 
         // Multiview
         if (scene.activeCamera) {
+            var previousMultiview = defines.MULTIVIEW;
             defines.MULTIVIEW = (scene.activeCamera.outputRenderTarget !== null && scene.activeCamera.outputRenderTarget.getViewCount() > 1);
-            defines.markAsUnprocessed();
+            if (defines.MULTIVIEW != previousMultiview) {
+                defines.markAsUnprocessed();
+            }
         }
 
         // Textures

+ 1 - 1
src/PostProcesses/vrDistortionCorrectionPostProcess.ts

@@ -71,7 +71,7 @@ export class VRMultiviewToSingleview extends PostProcess {
         this.onSizeChangedObservable.add(() => {
         });
         this.onApplyObservable.add((effect: Effect) => {
-            if (camera._scene.activeCamera && camera._scene.activeCamera.name == "_L") {
+            if (camera._scene.activeCamera && camera._scene.activeCamera.isLeftCamera) {
                 effect.setInt("imageIndex", 0);
             }else {
                 effect.setInt("imageIndex", 1);

+ 0 - 2
src/scene.ts

@@ -4129,8 +4129,6 @@ export class Scene extends AbstractScene implements IAnimatable {
                 engine.setViewport(this._activeCamera.viewport);
                 if (this.postProcessManager) {
                     this.postProcessManager._prepareFrame();
-                }
-                if (this.postProcessManager) {
                     this.postProcessManager._finalizeFrame(this._activeCamera.isIntermediate);
                 }
             }