浏览代码

Merge pull request #6734 from sebavan/master

Fix side by side videoDome
David Catuhe 6 年之前
父节点
当前提交
7ad040d05d
共有 2 个文件被更改,包括 25 次插入2 次删除
  1. 4 2
      src/Helpers/videoDome.ts
  2. 21 0
      src/Materials/Background/backgroundMaterial.ts

+ 4 - 2
src/Helpers/videoDome.ts

@@ -227,14 +227,16 @@ export class VideoDome extends TransformNode {
         switch (value) {
             case VideoDome.MODE_SIDEBYSIDE:
                 // in half-dome mode the uScale should be double of 360 videos
-                this._videoTexture.uScale = this._halfDome ? 1 : 0.5;
+                // Use 0.99999 to boost perf by not switching program
+                this._videoTexture.uScale = this._halfDome ? 0.99999 : 0.5;
                 this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add((camera) => {
                     this._videoTexture.uOffset = camera.isRightCamera ? 0.5 : 0.0;
                 });
                 break;
             case VideoDome.MODE_TOPBOTTOM:
                 // in half-dome mode the vScale should be double of 360 videos
-                this._videoTexture.vScale = this._halfDome ? 1 : 0.5;
+                // Use 0.99999 to boost perf by not switching program
+                this._videoTexture.vScale = this._halfDome ? 0.99999 : 0.5;
                 this._onBeforeCameraRenderObserver = this._scene.onBeforeCameraRenderObservable.add((camera) => {
                     this._videoTexture.vOffset = camera.isRightCamera ? 0.5 : 0.0;
                 });

+ 21 - 0
src/Materials/Background/backgroundMaterial.ts

@@ -1144,6 +1144,27 @@ export class BackgroundMaterial extends PushMaterial {
     }
 
     /**
+     * Checks to see if a texture is used in the material.
+     * @param texture - Base texture to use.
+     * @returns - Boolean specifying if a texture is used in the material.
+     */
+    public hasTexture(texture: BaseTexture): boolean {
+        if (super.hasTexture(texture)) {
+            return true;
+        }
+
+        if (this._reflectionTexture === texture) {
+            return true;
+        }
+
+        if (this._diffuseTexture === texture) {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
      * Dispose the material.
      * @param forceDisposeEffect Force disposal of the associated effect.
      * @param forceDisposeTextures Force disposal of the associated textures.