소스 검색

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;
+                }
             }
         }