Ejemplo n.º 1
0
        public BlendStateDesc(BlendStateTypes type)
        {
            try
            {
                bool enable = false;
                REIGN_D3D11_BLEND_OP operation = REIGN_D3D11_BLEND_OP.ADD;
                REIGN_D3D11_BLEND srcBlend = REIGN_D3D11_BLEND.ONE, dstBlend = REIGN_D3D11_BLEND.ONE;
                switch (type)
                {
                    case BlendStateTypes.None:
                        enable = false;
                        operation = REIGN_D3D11_BLEND_OP.ADD;
                        srcBlend = REIGN_D3D11_BLEND.ONE;
                        dstBlend = REIGN_D3D11_BLEND.ONE;
                        break;

                    case BlendStateTypes.Add:
                        enable = true;
                        operation = REIGN_D3D11_BLEND_OP.ADD;
                        srcBlend = REIGN_D3D11_BLEND.ONE;
                        dstBlend = REIGN_D3D11_BLEND.ONE;
                        break;

                    case BlendStateTypes.Subtract:
                        enable = true;
                        operation = REIGN_D3D11_BLEND_OP.SUBTRACT;
                        srcBlend = REIGN_D3D11_BLEND.ONE;
                        dstBlend = REIGN_D3D11_BLEND.ONE;
                        break;

                    case BlendStateTypes.RevSubtract:
                        enable = true;
                        operation = REIGN_D3D11_BLEND_OP.REV_SUBTRACT;
                        srcBlend = REIGN_D3D11_BLEND.ONE;
                        dstBlend = REIGN_D3D11_BLEND.ONE;
                        break;

                    case BlendStateTypes.Alpha:
                        enable = true;
                        operation = REIGN_D3D11_BLEND_OP.ADD;
                        srcBlend = REIGN_D3D11_BLEND.SRC_ALPHA;
                        dstBlend = REIGN_D3D11_BLEND.INV_SRC_ALPHA;
                        break;

                    default:
                        Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                        break;
                }

                com = new BlendStateDescCom(enable, operation, srcBlend, dstBlend);
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
Ejemplo n.º 2
0
        public BlendStateDesc(BlendStateTypes type)
        {
            try
            {
                bool enable = false;
                REIGN_D3D11_BLEND_OP operation = REIGN_D3D11_BLEND_OP.ADD;
                REIGN_D3D11_BLEND    srcBlend = REIGN_D3D11_BLEND.ONE, dstBlend = REIGN_D3D11_BLEND.ONE;
                switch (type)
                {
                case BlendStateTypes.None:
                    enable    = false;
                    operation = REIGN_D3D11_BLEND_OP.ADD;
                    srcBlend  = REIGN_D3D11_BLEND.ONE;
                    dstBlend  = REIGN_D3D11_BLEND.ONE;
                    break;

                case BlendStateTypes.Add:
                    enable    = true;
                    operation = REIGN_D3D11_BLEND_OP.ADD;
                    srcBlend  = REIGN_D3D11_BLEND.ONE;
                    dstBlend  = REIGN_D3D11_BLEND.ONE;
                    break;

                case BlendStateTypes.Subtract:
                    enable    = true;
                    operation = REIGN_D3D11_BLEND_OP.SUBTRACT;
                    srcBlend  = REIGN_D3D11_BLEND.ONE;
                    dstBlend  = REIGN_D3D11_BLEND.ONE;
                    break;

                case BlendStateTypes.RevSubtract:
                    enable    = true;
                    operation = REIGN_D3D11_BLEND_OP.REV_SUBTRACT;
                    srcBlend  = REIGN_D3D11_BLEND.ONE;
                    dstBlend  = REIGN_D3D11_BLEND.ONE;
                    break;

                case BlendStateTypes.Alpha:
                    enable    = true;
                    operation = REIGN_D3D11_BLEND_OP.ADD;
                    srcBlend  = REIGN_D3D11_BLEND.SRC_ALPHA;
                    dstBlend  = REIGN_D3D11_BLEND.INV_SRC_ALPHA;
                    break;

                default:
                    Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                    break;
                }

                com = new BlendStateDescCom(enable, operation, srcBlend, dstBlend);
            }
            catch (Exception e)
            {
                Dispose();
                throw e;
            }
        }
Ejemplo n.º 3
0
        public static IBlendStateDesc New(VideoTypes videoType, BlendStateTypes type)
        {
            IBlendStateDesc api = null;

                        #if WIN32
            if (videoType == VideoTypes.D3D9)
            {
                api = new D3D9.BlendStateDesc(type);
            }
                        #endif

                        #if WIN32 || WINRT || WP8
            if (videoType == VideoTypes.D3D11)
            {
                api = new D3D11.BlendStateDesc(type);
            }
                        #endif

                        #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl
            if (videoType == VideoTypes.OpenGL)
            {
                api = new OpenGL.BlendStateDesc(type);
            }
                        #endif

                        #if XNA
            if (videoType == VideoTypes.XNA)
            {
                api = new XNA.BlendStateDesc(type);
            }
                        #endif

                        #if VITA
            if (videoType == VideoTypes.Vita)
            {
                api = new Vita.BlendStateDesc(type);
            }
                        #endif

            if (api == null)
            {
                Debug.ThrowError("BlendStateDescAPI", "Unsuported InputType: " + videoType);
            }
            return(api);
        }
Ejemplo n.º 4
0
        public BlendStateDesc(BlendStateTypes type)
        {
            renderTargetWriteMask = X.ColorWriteChannels.All;

            switch (type)
            {
            case BlendStateTypes.None:
                blendEnable = false;
                blendOp     = X.BlendFunction.Add;
                srcBlend    = X.Blend.One;
                dstBlend    = X.Blend.One;

                blendOpAlpha  = X.BlendFunction.Add;
                srcBlendAlpha = X.Blend.One;
                dstBlendAlpha = X.Blend.One;
                break;

            case BlendStateTypes.Add:
                blendEnable = true;
                blendOp     = X.BlendFunction.Add;
                srcBlend    = X.Blend.One;
                dstBlend    = X.Blend.One;

                blendOpAlpha  = X.BlendFunction.Add;
                srcBlendAlpha = X.Blend.One;
                dstBlendAlpha = X.Blend.One;
                break;

            case BlendStateTypes.Subtract:
                blendEnable = true;
                blendOp     = X.BlendFunction.Subtract;
                srcBlend    = X.Blend.One;
                dstBlend    = X.Blend.One;

                blendOpAlpha  = X.BlendFunction.Subtract;
                srcBlendAlpha = X.Blend.One;
                dstBlendAlpha = X.Blend.One;
                break;

            case BlendStateTypes.RevSubtract:
                blendEnable = true;
                blendOp     = X.BlendFunction.ReverseSubtract;
                srcBlend    = X.Blend.One;
                dstBlend    = X.Blend.One;

                blendOpAlpha  = X.BlendFunction.ReverseSubtract;
                srcBlendAlpha = X.Blend.One;
                dstBlendAlpha = X.Blend.One;
                break;

            case BlendStateTypes.Alpha:
                blendEnable = true;
                blendOp     = X.BlendFunction.Add;
                srcBlend    = X.Blend.SourceAlpha;
                dstBlend    = X.Blend.InverseSourceAlpha;

                blendOpAlpha  = X.BlendFunction.Add;
                srcBlendAlpha = X.Blend.SourceAlpha;
                dstBlendAlpha = X.Blend.InverseSourceAlpha;
                break;

            default:
                Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                break;
            }
        }
Ejemplo n.º 5
0
 public static BlendStateDesc New(BlendStateTypes type)
 {
     return(new BlendStateDesc(type));
 }
Ejemplo n.º 6
0
        public BlendStateDesc(BlendStateTypes type)
        {
            renderTargetWriteMaskR = true;
            renderTargetWriteMaskG = true;
            renderTargetWriteMaskB = true;
            renderTargetWriteMaskA = true;

            switch (type)
            {
            case BlendStateTypes.None:
                blendEnable = false;
                blendOp     = GL.FUNC_ADD;
                srcBlend    = GL.ONE;
                dstBlend    = GL.ONE;

                blendEnableAlpha = false;
                blendOpAlpha     = GL.FUNC_ADD;
                srcBlendAlpha    = GL.ONE;
                dstBlendAlpha    = GL.ONE;
                break;

            case BlendStateTypes.Add:
                blendEnable = true;
                blendOp     = GL.FUNC_ADD;
                srcBlend    = GL.ONE;
                dstBlend    = GL.ONE;

                blendEnableAlpha = false;
                blendOpAlpha     = GL.FUNC_ADD;
                srcBlendAlpha    = GL.ONE;
                dstBlendAlpha    = GL.ONE;
                break;

            case BlendStateTypes.Subtract:
                blendEnable = true;
                blendOp     = GL.FUNC_SUBTRACT;
                srcBlend    = GL.ONE;
                dstBlend    = GL.ONE;

                blendEnableAlpha = false;
                blendOpAlpha     = GL.FUNC_SUBTRACT;
                srcBlendAlpha    = GL.ONE;
                dstBlendAlpha    = GL.ONE;
                break;

            case BlendStateTypes.RevSubtract:
                blendEnable = true;
                blendOp     = GL.FUNC_REVERSE_SUBTRACT;
                srcBlend    = GL.ONE;
                dstBlend    = GL.ONE;

                blendEnableAlpha = false;
                blendOpAlpha     = GL.FUNC_REVERSE_SUBTRACT;
                srcBlendAlpha    = GL.ONE;
                dstBlendAlpha    = GL.ONE;
                break;

            case BlendStateTypes.Alpha:
                blendEnable = true;
                blendOp     = GL.FUNC_ADD;
                srcBlend    = GL.SRC_ALPHA;
                dstBlend    = GL.ONE_MINUS_SRC_ALPHA;

                blendEnableAlpha = false;
                blendOpAlpha     = GL.FUNC_ADD;
                srcBlendAlpha    = GL.SRC_ALPHA;
                dstBlendAlpha    = GL.ONE_MINUS_SRC_ALPHA;
                break;

            default:
                Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                break;
            }
        }
Ejemplo n.º 7
0
        public BlendStateDesc(BlendStateTypes type)
        {
            renderTargetWriteMaskR = true;
            renderTargetWriteMaskG = true;
            renderTargetWriteMaskB = true;
            renderTargetWriteMaskA = true;

            switch (type)
            {
                case BlendStateTypes.None:
                    blendEnable = false;
                    blendOp = GL.FUNC_ADD;
                    srcBlend = GL.ONE;
                    dstBlend = GL.ONE;

                    blendEnableAlpha = false;
                    blendOpAlpha = GL.FUNC_ADD;
                    srcBlendAlpha = GL.ONE;
                    dstBlendAlpha = GL.ONE;
                    break;

                case BlendStateTypes.Add:
                    blendEnable = true;
                    blendOp = GL.FUNC_ADD;
                    srcBlend = GL.ONE;
                    dstBlend = GL.ONE;

                    blendEnableAlpha = false;
                    blendOpAlpha = GL.FUNC_ADD;
                    srcBlendAlpha = GL.ONE;
                    dstBlendAlpha = GL.ONE;
                    break;

                case BlendStateTypes.Subtract:
                    blendEnable = true;
                    blendOp = GL.FUNC_SUBTRACT;
                    srcBlend = GL.ONE;
                    dstBlend = GL.ONE;

                    blendEnableAlpha = false;
                    blendOpAlpha = GL.FUNC_SUBTRACT;
                    srcBlendAlpha = GL.ONE;
                    dstBlendAlpha = GL.ONE;
                    break;

                case BlendStateTypes.RevSubtract:
                    blendEnable = true;
                    blendOp = GL.FUNC_REVERSE_SUBTRACT;
                    srcBlend = GL.ONE;
                    dstBlend = GL.ONE;

                    blendEnableAlpha = false;
                    blendOpAlpha = GL.FUNC_REVERSE_SUBTRACT;
                    srcBlendAlpha = GL.ONE;
                    dstBlendAlpha = GL.ONE;
                    break;

                case BlendStateTypes.Alpha:
                    blendEnable = true;
                    blendOp = GL.FUNC_ADD;
                    srcBlend = GL.SRC_ALPHA;
                    dstBlend = GL.ONE_MINUS_SRC_ALPHA;

                    blendEnableAlpha = false;
                    blendOpAlpha = GL.FUNC_ADD;
                    srcBlendAlpha = GL.SRC_ALPHA;
                    dstBlendAlpha = GL.ONE_MINUS_SRC_ALPHA;
                    break;

                default:
                    Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                    break;
            }
        }
Ejemplo n.º 8
0
        public BlendStateDesc(BlendStateTypes type)
        {
            uint             renderTargetWriteMask = 0xFFFFFFFF;
            bool             blendEnable = false, blendEnableAlpha = false;
            REIGN_D3DBLENDOP blendOp = REIGN_D3DBLENDOP.ADD, blendOpAlpha = REIGN_D3DBLENDOP.ADD;
            REIGN_D3DBLEND   srcBlend = REIGN_D3DBLEND.ONE, dstBlend = REIGN_D3DBLEND.ONE, srcBlendAlpha = REIGN_D3DBLEND.ONE, dstBlendAlpha = REIGN_D3DBLEND.ONE;

            switch (type)
            {
            case BlendStateTypes.None:
                blendEnable = false;
                blendOp     = REIGN_D3DBLENDOP.ADD;
                srcBlend    = REIGN_D3DBLEND.ONE;
                dstBlend    = REIGN_D3DBLEND.ZERO;

                blendEnableAlpha = false;
                blendOpAlpha     = REIGN_D3DBLENDOP.ADD;
                srcBlendAlpha    = REIGN_D3DBLEND.ONE;
                dstBlendAlpha    = REIGN_D3DBLEND.ZERO;
                break;

            case BlendStateTypes.Add:
                blendEnable = true;
                blendOp     = REIGN_D3DBLENDOP.ADD;
                srcBlend    = REIGN_D3DBLEND.ONE;
                dstBlend    = REIGN_D3DBLEND.ONE;

                blendEnableAlpha = false;
                blendOpAlpha     = REIGN_D3DBLENDOP.ADD;
                srcBlendAlpha    = REIGN_D3DBLEND.ONE;
                dstBlendAlpha    = REIGN_D3DBLEND.ONE;
                break;

            case BlendStateTypes.Subtract:
                blendEnable = true;
                blendOp     = REIGN_D3DBLENDOP.SUBTRACT;
                srcBlend    = REIGN_D3DBLEND.ONE;
                dstBlend    = REIGN_D3DBLEND.ONE;

                blendEnableAlpha = false;
                blendOpAlpha     = REIGN_D3DBLENDOP.SUBTRACT;
                srcBlendAlpha    = REIGN_D3DBLEND.ONE;
                dstBlendAlpha    = REIGN_D3DBLEND.ONE;
                break;

            case BlendStateTypes.RevSubtract:
                blendEnable = true;
                blendOp     = REIGN_D3DBLENDOP.REVSUBTRACT;
                srcBlend    = REIGN_D3DBLEND.ONE;
                dstBlend    = REIGN_D3DBLEND.ONE;

                blendEnableAlpha = false;
                blendOpAlpha     = REIGN_D3DBLENDOP.REVSUBTRACT;
                srcBlendAlpha    = REIGN_D3DBLEND.ONE;
                dstBlendAlpha    = REIGN_D3DBLEND.ONE;
                break;

            case BlendStateTypes.Alpha:
                blendEnable = true;
                blendOp     = REIGN_D3DBLENDOP.ADD;
                srcBlend    = REIGN_D3DBLEND.SRCALPHA;
                dstBlend    = REIGN_D3DBLEND.INVSRCALPHA;

                blendEnableAlpha = false;
                blendOpAlpha     = REIGN_D3DBLENDOP.ADD;
                srcBlendAlpha    = REIGN_D3DBLEND.SRCALPHA;
                dstBlendAlpha    = REIGN_D3DBLEND.INVSRCALPHA;
                break;

            default:
                Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                break;
            }

            com = new BlendStateDescCom(renderTargetWriteMask, blendEnable, blendOp, srcBlend, dstBlend, blendEnableAlpha, blendOpAlpha, srcBlendAlpha, dstBlendAlpha);
        }
Ejemplo n.º 9
0
        public BlendStateDesc(BlendStateTypes type)
        {
            colorMask = ColorMask.Rgba;

            switch (type)
            {
            case BlendStateTypes.None:
                blendEnable = false;
                blendOp     = BlendFuncMode.Add;
                srcBlend    = BlendFuncFactor.One;
                dstBlend    = BlendFuncFactor.One;

                blendEnableAlpha = false;
                blendOpAlpha     = BlendFuncMode.Add;
                srcBlendAlpha    = BlendFuncFactor.One;
                dstBlendAlpha    = BlendFuncFactor.One;
                break;

            case BlendStateTypes.Add:
                blendEnable = true;
                blendOp     = BlendFuncMode.Add;
                srcBlend    = BlendFuncFactor.One;
                dstBlend    = BlendFuncFactor.One;

                blendEnableAlpha = false;
                blendOpAlpha     = BlendFuncMode.Add;
                srcBlendAlpha    = BlendFuncFactor.One;
                dstBlendAlpha    = BlendFuncFactor.One;
                break;

            case BlendStateTypes.Subtract:
                blendEnable = true;
                blendOp     = BlendFuncMode.Subtract;
                srcBlend    = BlendFuncFactor.One;
                dstBlend    = BlendFuncFactor.One;

                blendEnableAlpha = false;
                blendOpAlpha     = BlendFuncMode.Subtract;
                srcBlendAlpha    = BlendFuncFactor.One;
                dstBlendAlpha    = BlendFuncFactor.One;
                break;

            case BlendStateTypes.RevSubtract:
                blendEnable = true;
                blendOp     = BlendFuncMode.Subtract;
                srcBlend    = BlendFuncFactor.One;
                dstBlend    = BlendFuncFactor.One;

                blendEnableAlpha = false;
                blendOpAlpha     = BlendFuncMode.Subtract;
                srcBlendAlpha    = BlendFuncFactor.One;
                dstBlendAlpha    = BlendFuncFactor.One;
                break;

            case BlendStateTypes.Alpha:
                blendEnable = true;
                blendOp     = BlendFuncMode.Add;
                srcBlend    = BlendFuncFactor.SrcAlpha;
                dstBlend    = BlendFuncFactor.OneMinusSrcAlpha;

                blendEnableAlpha = false;
                blendOpAlpha     = BlendFuncMode.Add;
                srcBlendAlpha    = BlendFuncFactor.SrcAlpha;
                dstBlendAlpha    = BlendFuncFactor.OneMinusSrcAlpha;
                break;

            default:
                Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                break;
            }
        }
Ejemplo n.º 10
0
        public BlendStateDesc(BlendStateTypes type)
        {
            uint renderTargetWriteMask = 0xFFFFFFFF;
            bool blendEnable = false, blendEnableAlpha = false;
            REIGN_D3DBLENDOP blendOp = REIGN_D3DBLENDOP.ADD, blendOpAlpha = REIGN_D3DBLENDOP.ADD;
            REIGN_D3DBLEND srcBlend = REIGN_D3DBLEND.ONE, dstBlend = REIGN_D3DBLEND.ONE, srcBlendAlpha = REIGN_D3DBLEND.ONE, dstBlendAlpha = REIGN_D3DBLEND.ONE;

            switch (type)
            {
                case BlendStateTypes.None:
                    blendEnable = false;
                    blendOp = REIGN_D3DBLENDOP.ADD;
                    srcBlend = REIGN_D3DBLEND.ONE;
                    dstBlend = REIGN_D3DBLEND.ZERO;

                    blendEnableAlpha = false;
                    blendOpAlpha = REIGN_D3DBLENDOP.ADD;
                    srcBlendAlpha = REIGN_D3DBLEND.ONE;
                    dstBlendAlpha = REIGN_D3DBLEND.ZERO;
                    break;

                case BlendStateTypes.Add:
                    blendEnable = true;
                    blendOp = REIGN_D3DBLENDOP.ADD;
                    srcBlend = REIGN_D3DBLEND.ONE;
                    dstBlend = REIGN_D3DBLEND.ONE;

                    blendEnableAlpha = false;
                    blendOpAlpha = REIGN_D3DBLENDOP.ADD;
                    srcBlendAlpha = REIGN_D3DBLEND.ONE;
                    dstBlendAlpha = REIGN_D3DBLEND.ONE;
                    break;

                case BlendStateTypes.Subtract:
                    blendEnable = true;
                    blendOp = REIGN_D3DBLENDOP.SUBTRACT;
                    srcBlend = REIGN_D3DBLEND.ONE;
                    dstBlend = REIGN_D3DBLEND.ONE;

                    blendEnableAlpha = false;
                    blendOpAlpha = REIGN_D3DBLENDOP.SUBTRACT;
                    srcBlendAlpha = REIGN_D3DBLEND.ONE;
                    dstBlendAlpha = REIGN_D3DBLEND.ONE;
                    break;

                case BlendStateTypes.RevSubtract:
                    blendEnable = true;
                    blendOp = REIGN_D3DBLENDOP.REVSUBTRACT;
                    srcBlend = REIGN_D3DBLEND.ONE;
                    dstBlend = REIGN_D3DBLEND.ONE;

                    blendEnableAlpha = false;
                    blendOpAlpha = REIGN_D3DBLENDOP.REVSUBTRACT;
                    srcBlendAlpha = REIGN_D3DBLEND.ONE;
                    dstBlendAlpha = REIGN_D3DBLEND.ONE;
                    break;

                case BlendStateTypes.Alpha:
                    blendEnable = true;
                    blendOp = REIGN_D3DBLENDOP.ADD;
                    srcBlend = REIGN_D3DBLEND.SRCALPHA;
                    dstBlend = REIGN_D3DBLEND.INVSRCALPHA;

                    blendEnableAlpha = false;
                    blendOpAlpha = REIGN_D3DBLENDOP.ADD;
                    srcBlendAlpha = REIGN_D3DBLEND.SRCALPHA;
                    dstBlendAlpha = REIGN_D3DBLEND.INVSRCALPHA;
                    break;

                default:
                    Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                    break;
            }

            com = new BlendStateDescCom(renderTargetWriteMask, blendEnable, blendOp, srcBlend, dstBlend, blendEnableAlpha, blendOpAlpha, srcBlendAlpha, dstBlendAlpha);
        }
Ejemplo n.º 11
0
 public static BlendStateDesc New(BlendStateTypes type)
 {
     return new BlendStateDesc(type);
 }
Ejemplo n.º 12
0
        public BlendStateDesc(BlendStateTypes type)
        {
            renderTargetWriteMask = X.ColorWriteChannels.All;

            switch (type)
            {
                case BlendStateTypes.None:
                    blendEnable = false;
                    blendOp = X.BlendFunction.Add;
                    srcBlend = X.Blend.One;
                    dstBlend = X.Blend.One;

                    blendOpAlpha = X.BlendFunction.Add;
                    srcBlendAlpha = X.Blend.One;
                    dstBlendAlpha = X.Blend.One;
                    break;

                case BlendStateTypes.Add:
                    blendEnable = true;
                    blendOp = X.BlendFunction.Add;
                    srcBlend = X.Blend.One;
                    dstBlend = X.Blend.One;

                    blendOpAlpha = X.BlendFunction.Add;
                    srcBlendAlpha = X.Blend.One;
                    dstBlendAlpha = X.Blend.One;
                    break;

                case BlendStateTypes.Subtract:
                    blendEnable = true;
                    blendOp = X.BlendFunction.Subtract;
                    srcBlend = X.Blend.One;
                    dstBlend = X.Blend.One;

                    blendOpAlpha = X.BlendFunction.Subtract;
                    srcBlendAlpha = X.Blend.One;
                    dstBlendAlpha = X.Blend.One;
                    break;

                case BlendStateTypes.RevSubtract:
                    blendEnable = true;
                    blendOp = X.BlendFunction.ReverseSubtract;
                    srcBlend = X.Blend.One;
                    dstBlend = X.Blend.One;

                    blendOpAlpha = X.BlendFunction.ReverseSubtract;
                    srcBlendAlpha = X.Blend.One;
                    dstBlendAlpha = X.Blend.One;
                    break;

                case BlendStateTypes.Alpha:
                    blendEnable = true;
                    blendOp = X.BlendFunction.Add;
                    srcBlend = X.Blend.SourceAlpha;
                    dstBlend = X.Blend.InverseSourceAlpha;

                    blendOpAlpha = X.BlendFunction.Add;
                    srcBlendAlpha = X.Blend.SourceAlpha;
                    dstBlendAlpha = X.Blend.InverseSourceAlpha;
                    break;

                default:
                    Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                    break;
            }
        }
Ejemplo n.º 13
0
        public BlendStateDesc(BlendStateTypes type)
        {
            colorMask = ColorMask.Rgba;

            switch (type)
            {
                case BlendStateTypes.None:
                    blendEnable = false;
                    blendOp = BlendFuncMode.Add;
                    srcBlend = BlendFuncFactor.One;
                    dstBlend = BlendFuncFactor.One;

                    blendEnableAlpha = false;
                    blendOpAlpha = BlendFuncMode.Add;
                    srcBlendAlpha = BlendFuncFactor.One;
                    dstBlendAlpha = BlendFuncFactor.One;
                    break;

                case BlendStateTypes.Add:
                    blendEnable = true;
                    blendOp = BlendFuncMode.Add;
                    srcBlend = BlendFuncFactor.One;
                    dstBlend = BlendFuncFactor.One;

                    blendEnableAlpha = false;
                    blendOpAlpha = BlendFuncMode.Add;
                    srcBlendAlpha = BlendFuncFactor.One;
                    dstBlendAlpha = BlendFuncFactor.One;
                    break;

                case BlendStateTypes.Subtract:
                    blendEnable = true;
                    blendOp = BlendFuncMode.Subtract;
                    srcBlend = BlendFuncFactor.One;
                    dstBlend = BlendFuncFactor.One;

                    blendEnableAlpha = false;
                    blendOpAlpha = BlendFuncMode.Subtract;
                    srcBlendAlpha = BlendFuncFactor.One;
                    dstBlendAlpha = BlendFuncFactor.One;
                    break;

                case BlendStateTypes.RevSubtract:
                    blendEnable = true;
                    blendOp = BlendFuncMode.Subtract;
                    srcBlend = BlendFuncFactor.One;
                    dstBlend = BlendFuncFactor.One;

                    blendEnableAlpha = false;
                    blendOpAlpha = BlendFuncMode.Subtract;
                    srcBlendAlpha = BlendFuncFactor.One;
                    dstBlendAlpha = BlendFuncFactor.One;
                    break;

                case BlendStateTypes.Alpha:
                    blendEnable = true;
                    blendOp = BlendFuncMode.Add;
                    srcBlend = BlendFuncFactor.SrcAlpha;
                    dstBlend = BlendFuncFactor.OneMinusSrcAlpha;

                    blendEnableAlpha = false;
                    blendOpAlpha = BlendFuncMode.Add;
                    srcBlendAlpha = BlendFuncFactor.SrcAlpha;
                    dstBlendAlpha = BlendFuncFactor.OneMinusSrcAlpha;
                    break;

                default:
                    Debug.ThrowError("BlendStateDesc", "Unsuported BlendStateType");
                    break;
            }
        }