浏览代码

Merge pull request #5037 from sebavan/master

Allow disabling unpack cache in case of shared context
sebavan 7 年之前
父节点
当前提交
13d76701b4
共有 1 个文件被更改,包括 13 次插入2 次删除
  1. 13 2
      src/Engine/babylon.engine.ts

+ 13 - 2
src/Engine/babylon.engine.ts

@@ -4412,11 +4412,22 @@
         }
 
         private _unpackFlipYCached: Nullable<boolean> = null;
+
+        /**
+         * In case you are sharing the context with other applications, it might 
+         * be interested to not cache the unpack flip y state to ensure a consistent 
+         * value would be set.
+         */
+        public enableUnpackFlipYCached = true;
+
         /** @hidden */
-        public _unpackFlipY(value: boolean) {
+        public _unpackFlipY(value: boolean): void {
             if (this._unpackFlipYCached !== value) {
-                this._unpackFlipYCached = value;
                 this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);
+
+                if (this.enableUnpackFlipYCached) {
+                    this._unpackFlipYCached = value;
+                }
             }
         }