예제 #1
0
        bool ICustomSerialization.Serialize(BinarySerializer Serializer)
        {
            PICARegister[] Cmd0 = new PICARegister[]
            {
                PICARegister.GPUREG_TEXUNIT0_TYPE,
                PICARegister.GPUREG_TEXUNIT1_TYPE,
                PICARegister.GPUREG_TEXUNIT2_TYPE
            };

            PICARegister[] Cmd1 = new PICARegister[]
            {
                PICARegister.GPUREG_TEXUNIT0_BORDER_COLOR,
                PICARegister.GPUREG_TEXUNIT1_BORDER_COLOR,
                PICARegister.GPUREG_TEXUNIT2_BORDER_COLOR
            };

            PICACommandWriter Writer = new PICACommandWriter();

            uint Filter;

            Filter  = ((uint)MagFilter & 1) << 1;
            Filter |= ((uint)MinFilter & 1) << 2;
            Filter |= ((uint)MipFilter & 1) << 24;

            Filter |= ((uint)WrapV & 7) << 8;
            Filter |= ((uint)WrapU & 7) << 12;

            uint LOD;

            LOD  = (uint)((int)(LODBias * 0x100) & 0x1fff);
            LOD |= ((uint)MinLOD & 0xf) << 24;

            Writer.SetCommand(Cmd0[MapperIndex], 0, 1);
            Writer.SetCommand(Cmd1[MapperIndex], true,
                              BorderColor.ToUInt32(),
                              0,
                              Filter,
                              LOD,
                              0,
                              0,
                              0,
                              0,
                              0,
                              0);

            Commands = Writer.GetBuffer();

            CommandsLength = Commands.Length * 4;

            //TODO: Don't assume it uses the Standard sampler, could be the Shadow sampler too
            GfxTextureSamplerStd Samp = (GfxTextureSamplerStd)Sampler;

            Samp.LODBias     = LODBias;
            Samp.BorderColor = BorderColor.ToVector4();
            Samp.MinFilter   = GetMinFilter();

            return(false);
        }
예제 #2
0
        bool ICustomSerialization.Serialize(BinarySerializer Serializer)
        {
            PICACommandWriter Writer = new PICACommandWriter();

            uint UpdateColor = 0;

            if (TextureEnvironments[1].Stage.UpdateColorBuffer)
            {
                UpdateColor |= 0x100;
            }
            if (TextureEnvironments[2].Stage.UpdateColorBuffer)
            {
                UpdateColor |= 0x200;
            }
            if (TextureEnvironments[3].Stage.UpdateColorBuffer)
            {
                UpdateColor |= 0x400;
            }
            if (TextureEnvironments[4].Stage.UpdateColorBuffer)
            {
                UpdateColor |= 0x800;
            }

            if (TextureEnvironments[1].Stage.UpdateAlphaBuffer)
            {
                UpdateColor |= 0x1000;
            }
            if (TextureEnvironments[2].Stage.UpdateAlphaBuffer)
            {
                UpdateColor |= 0x2000;
            }
            if (TextureEnvironments[3].Stage.UpdateAlphaBuffer)
            {
                UpdateColor |= 0x4000;
            }
            if (TextureEnvironments[4].Stage.UpdateAlphaBuffer)
            {
                UpdateColor |= 0x8000;
            }

            Writer.SetCommand(PICARegister.GPUREG_TEXENV_BUFFER_COLOR, TexEnvBufferColor.ToUInt32());

            Writer.SetCommand(PICARegister.GPUREG_TEXENV_UPDATE_BUFFER, UpdateColor, 2);

            Writer.SetCommand(PICARegister.GPUREG_LIGHTING_CONFIG0, 0x400u, 2);

            Commands = Writer.GetBuffer();

            TexEnvBufferColorF = TexEnvBufferColor.ToVector4();

            return(false);
        }
예제 #3
0
        bool ICustomSerialization.Serialize(BinarySerializer Serializer)
        {
            PICACommandWriter Writer = new PICACommandWriter();

            uint LogicalOp = (uint)LogicalOperation & 0xf;

            Writer.SetCommand(PICARegister.GPUREG_COLOR_OPERATION, true,
                              ColorOperation.ToUInt32(),
                              Function.ToUInt32(),
                              LogicalOp,
                              Color.ToUInt32());

            Commands = new uint[6];

            Buffer.BlockCopy(Writer.GetBuffer(), 0, Commands, 0, 5);

            Commands = Writer.GetBuffer();

            ColorF = Color.ToVector4();

            return(false);
        }