Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
 public GL()
 {
     int num;
     camera = new GLExCamera();
     camera.viewMatrix = camera.Result;
     this.rstateScissor = new RasterizerState();
     this.rstateScissor.CullMode = CullMode.None;
     this.rstateScissor.ScissorTestEnable = true;
     this.color = new float[4];
     this.clearColor = Color.Black;
     this.ColorWriteChannels = Microsoft.Xna.Framework.Graphics.ColorWriteChannels.All;
     this.AlphaDestinationBlend = Blend.InverseSourceAlpha;
     this.depthFunc = CompareFunction.Always;
     this.vertex = new Vertex[8];
     sTextures.Add(null);
     this.matrixStack = new Stack<Matrix>();
     this.matrixStack.Push(Matrix.Identity);
     this.effect = new BasicEffect(device);
     this.effect.VertexColorEnabled = true;
     this.effect.Projection = Microsoft.Xna.Framework.Matrix.CreateOrthographicOffCenter(0f, LSystem.screenRect.width, LSystem.screenRect.height, 0f, -1.0f, 1.0f);
     this.alphaTestEffect = new AlphaTestEffect(device);
     this.alphaTestEffect.VertexColorEnabled = true;
     device.RasterizerState = RasterizerState.CullNone;
     device.DepthStencilState = DepthStencilState.None;
     for (num = 0; num < this.vertex.Length; num++)
     {
         this.vertex[num] = new Vertex();
     }
     for (num = 0; num < 4; num++)
     {
         this.color[num] = 1f;
     }
     EnableTextures();
 }
Exemplo n.º 3
0
 public void GLColorMask(bool red, bool green, bool blue, bool alpha)
 {
     this.ColorWriteChannels = (((red ? Microsoft.Xna.Framework.Graphics.ColorWriteChannels.Red : Microsoft.Xna.Framework.Graphics.ColorWriteChannels.None) | (green ? Microsoft.Xna.Framework.Graphics.ColorWriteChannels.Green : Microsoft.Xna.Framework.Graphics.ColorWriteChannels.None)) | (blue ? Microsoft.Xna.Framework.Graphics.ColorWriteChannels.Blue : Microsoft.Xna.Framework.Graphics.ColorWriteChannels.None)) | (alpha ? Microsoft.Xna.Framework.Graphics.ColorWriteChannels.Alpha : Microsoft.Xna.Framework.Graphics.ColorWriteChannels.None);
 }
Exemplo 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;
            }
        }