예제 #1
0
        public override void SetBlendMode(BlendMode blendMode)
        {
            if (currentBlendMode == blendMode)
            {
                return;
            }
            currentBlendMode = blendMode;
            switch (blendMode)
            {
            case BlendMode.Opaque:
                GLCore.Disable(EnableCap.Blend);
                break;

            case BlendMode.Normal:
                GLCore.Enable(EnableCap.Blend);
                GLCore.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
                GLCore.BlendEquation(BlendEquationMode.FuncAdd);
                break;

            case BlendMode.AlphaTest:
                GLCore.Disable(EnableCap.Blend);
                GLCore.Enable(EnableCap.AlphaTest);
                break;

            case BlendMode.Additive:
                GLCore.Enable(EnableCap.Blend);
                GLCore.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One);
                GLCore.BlendEquation(BlendEquationMode.FuncAdd);
                break;

            case BlendMode.Subtractive:
                GLCore.Enable(EnableCap.Blend);
                GLCore.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One);
                GLCore.BlendEquation(BlendEquationMode.FuncReverseSubtract);
                break;

            case BlendMode.LightEffect:
                GLCore.Enable(EnableCap.Blend);
                GLCore.BlendFunc(BlendingFactorSrc.DstColor, BlendingFactorDest.One);
                GLCore.BlendEquation(BlendEquationMode.FuncAdd);
                break;
            }
        }