Beispiel #1
0
        public PICABlendFunction(uint Param)
        {
            ColorEquation = (PICABlendEquation)((Param >> 0) & 7);
            AlphaEquation = (PICABlendEquation)((Param >> 8) & 7);

            ColorSrcFunc = (PICABlendFunc)((Param >> 16) & 0xf);
            ColorDstFunc = (PICABlendFunc)((Param >> 20) & 0xf);

            AlphaSrcFunc = (PICABlendFunc)((Param >> 24) & 0xf);
            AlphaDstFunc = (PICABlendFunc)((Param >> 28) & 0xf);
        }
Beispiel #2
0
        private uint GetGLBlend(PICABlendEquation BlendEquation)
        {
            switch (BlendEquation)
            {
            case PICABlendEquation.FuncAdd:             return(0x8006);

            case PICABlendEquation.FuncSubtract:        return(0x800a);

            case PICABlendEquation.FuncReverseSubtract: return(0x800b);

            case PICABlendEquation.Min:                 return(0x8007);

            case PICABlendEquation.Max:                 return(0x8008);
            }

            return(0);
        }
Beispiel #3
0
        public static BlendEquationMode ToBlendEquation(this PICABlendEquation Equation)
        {
            switch (Equation)
            {
            case PICABlendEquation.FuncAdd:             return(BlendEquationMode.FuncAdd);

            case PICABlendEquation.FuncSubtract:        return(BlendEquationMode.FuncSubtract);

            case PICABlendEquation.FuncReverseSubtract: return(BlendEquationMode.FuncReverseSubtract);

            case PICABlendEquation.Min:                 return(BlendEquationMode.Min);

            case PICABlendEquation.Max:                 return(BlendEquationMode.Max);

            default: throw new ArgumentException("Invalid Blend equation!");
            }
        }
Beispiel #4
0
        public MTAlphaBlend(BinaryReader Reader)
        {
            //First 4 bytes seems to use bit 0 for something else, so we need to rsh the value by 1?
            BlendMode = (PICABlendMode)(Reader.ReadByte() >> 1);

            MTBlendFunction   ColorSrcFunc = (MTBlendFunction)(Reader.ReadByte() >> 1);
            MTBlendFunction   ColorDstFunc = (MTBlendFunction)(Reader.ReadByte() >> 1);
            PICABlendEquation ColorEqu     = (PICABlendEquation)(Reader.ReadByte() >> 1);

            MTBlendFunction   AlphaSrcFunc = (MTBlendFunction)Reader.ReadByte();
            MTBlendFunction   AlphaDstFunc = (MTBlendFunction)Reader.ReadByte();
            PICABlendEquation AlphaEqu     = (PICABlendEquation)Reader.ReadByte();

            byte Padding = Reader.ReadByte(); //?

            byte[] BufferRW =
            {
                Reader.ReadByte(),
                Reader.ReadByte(), //Always 0xf?
                Reader.ReadByte(), //Always 0xf?
                Reader.ReadByte(), //Always 0xf?
                Reader.ReadByte(), //Always 0xf?
                Reader.ReadByte(), //Always 0xf?
                Reader.ReadByte(), //Always 0xf?
                Reader.ReadByte()  //Always 0xf?
            };

            BlendFunction.ColorEquation = ColorEqu;
            BlendFunction.AlphaEquation = AlphaEqu;

            BlendFunction.ColorSrcFunc = ColorSrcFunc.ToPICABlendFunc(false);
            BlendFunction.ColorDstFunc = ColorDstFunc.ToPICABlendFunc(false);

            BlendFunction.AlphaSrcFunc = ColorSrcFunc.ToPICABlendFunc(true);
            BlendFunction.AlphaDstFunc = ColorDstFunc.ToPICABlendFunc(true);

            RedWrite   = (BufferRW[0] & 1) != 0;
            GreenWrite = (BufferRW[0] & 2) != 0;
            BlueWrite  = (BufferRW[0] & 4) != 0;
            AlphaWrite = (BufferRW[0] & 8) != 0;
        }