示例#1
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;
            }
        }
示例#2
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;
            }
        }