浏览代码

Merge pull request #1619 from haxiomic/PorterDuffOver

Add Engine.ALPHA_PREMULTIPLIED blend mode (Porter-Duff Over)
David Catuhe 8 年之前
父节点
当前提交
f64e8b2035
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      src/babylon.engine.ts

+ 9 - 0
src/babylon.engine.ts

@@ -214,6 +214,7 @@
         private static _ALPHA_MULTIPLY = 4;
         private static _ALPHA_MAXIMIZED = 5;
         private static _ALPHA_ONEONE = 6;
+        private static _ALPHA_PREMULTIPLIED = 7;
 
         private static _DELAYLOADSTATE_NONE = 0;
         private static _DELAYLOADSTATE_LOADED = 1;
@@ -337,6 +338,10 @@
             return Engine._ALPHA_MAXIMIZED;
         }
 
+        public static get ALPHA_PREMULTIPLIED(): number {
+            return Engine._ALPHA_PREMULTIPLIED;
+        }
+
         public static get DELAYLOADSTATE_NONE(): number {
             return Engine._DELAYLOADSTATE_NONE;
         }
@@ -1859,6 +1864,10 @@
                 case Engine.ALPHA_DISABLE:
                     this._alphaState.alphaBlend = false;
                     break;
+                case Engine.ALPHA_PREMULTIPLIED:
+                    this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
+                    this._alphaState.alphaBlend = true;
+                    break;
                 case Engine.ALPHA_COMBINE:
                     this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
                     this._alphaState.alphaBlend = true;