Example #1
0
        public static GfxTestFunc ToGfxTestFunc(this PICATestFunc TestFunc)
        {
            //Too much to ask to use the same values the GPU use?
            //Really hate to convert between those stupid inconsistent enumerations.
            switch (TestFunc)
            {
            case PICATestFunc.Never:    return(GfxTestFunc.Never);

            case PICATestFunc.Always:   return(GfxTestFunc.Always);

            case PICATestFunc.Less:     return(GfxTestFunc.Less);

            case PICATestFunc.Lequal:   return(GfxTestFunc.Lequal);

            case PICATestFunc.Equal:    return(GfxTestFunc.Equal);

            case PICATestFunc.Gequal:   return(GfxTestFunc.Gequal);

            case PICATestFunc.Greater:  return(GfxTestFunc.Greater);

            case PICATestFunc.Notequal: return(GfxTestFunc.Notequal);

            default: throw new ArgumentException($"Invalid PICA Test Function {TestFunc}!");
            }
        }
Example #2
0
        public PICAAlphaTest(uint Param)
        {
            Enabled = (Param & 1) != 0;

            Function = (PICATestFunc)((Param >> 4) & 7);

            Reference = (byte)(Param >> 8);
        }
Example #3
0
 public PICAStencilTest(uint Param)
 {
     Enabled    = (Param & 1) != 0;
     Function   = (PICATestFunc)((Param >> 4) & 7);
     BufferMask = (byte)(Param >> 8);
     Reference  = (byte)(Param >> 16);
     Mask       = (byte)(Param >> 24);
 }
Example #4
0
        public PICADepthColorMask(uint Param)
        {
            Enabled = (Param & 1) != 0;

            DepthFunc = (PICATestFunc)((Param >> 4) & 7);

            RedWrite   = (Param & 0x0100) != 0;
            GreenWrite = (Param & 0x0200) != 0;
            BlueWrite  = (Param & 0x0400) != 0;
            AlphaWrite = (Param & 0x0800) != 0;
            DepthWrite = (Param & 0x1000) != 0;
        }
Example #5
0
        public MTDepthStencil(BinaryReader Reader)
        {
            byte DepthStencilTest = Reader.ReadByte();

            DepthTest  = (DepthStencilTest & 1) != 0;
            DepthWrite = (DepthStencilTest & 2) != 0;

            DepthFunc   = ((MTTestFunction)((DepthStencilTest >> 2) & 7)).ToPICATestFunc();
            StencilFunc = ((MTTestFunction)((DepthStencilTest >> 5) & 7)).ToPICATestFunc();

            StencilRef = Reader.ReadSByte();

            Reader.ReadUInt16();
            Reader.ReadUInt16();
            Reader.ReadUInt16();
        }
Example #6
0
        private static AlphaFunction ConvertAlphaFunction(PICATestFunc func)
        {
            switch (func)
            {
            case PICATestFunc.Always: return(AlphaFunction.Always);

            case PICATestFunc.Equal: return(AlphaFunction.Equal);

            case PICATestFunc.Gequal: return(AlphaFunction.Gequal);

            case PICATestFunc.Greater: return(AlphaFunction.Greater);

            case PICATestFunc.Lequal: return(AlphaFunction.Lequal);

            case PICATestFunc.Less: return(AlphaFunction.Less);

            case PICATestFunc.Never: return(AlphaFunction.Never);

            case PICATestFunc.Notequal: return(AlphaFunction.Notequal);

            default: return(AlphaFunction.Always);
            }
        }
Example #7
0
        public static All ToFunction(this PICATestFunc Func)
        {
            switch (Func)
            {
            case PICATestFunc.Never:    return(All.Never);

            case PICATestFunc.Always:   return(All.Always);

            case PICATestFunc.Equal:    return(All.Equal);

            case PICATestFunc.Notequal: return(All.Notequal);

            case PICATestFunc.Less:     return(All.Less);

            case PICATestFunc.Lequal:   return(All.Lequal);

            case PICATestFunc.Greater:  return(All.Greater);

            case PICATestFunc.Gequal:   return(All.Gequal);

            default: throw new ArgumentException("Invalid function!");
            }
        }
Example #8
0
 public static DepthFunction ToDepthFunction(this PICATestFunc Func)
 {
     return((DepthFunction)ToFunction(Func));
 }
Example #9
0
 public static StencilFunction ToStencilFunction(this PICATestFunc Func)
 {
     return((StencilFunction)ToFunction(Func));
 }
Example #10
0
 public static AlphaFunction ToAlphaFunction(this PICATestFunc Func)
 {
     return((AlphaFunction)ToFunction(Func));
 }