Ejemplo n.º 1
0
        public Material(string name, BxlytHeader header)
        {
            ParentLayout      = header;
            Name              = name;
            TextureMaps       = new TextureRef[0];
            TextureTransforms = new BxlytTextureTransform[0];
            ProjTexGenParams  = new ProjectionTexGenParam[0];
            TevStages         = new TevStage[0];
            TexCoordGens      = new TexCoordGen[0];

            TevConstantColors = new STColor8[5];
            for (int i = 0; i < 5; i++)
            {
                TevConstantColors[i] = STColor8.White;
            }
            BlackColor = new STColor8(0, 0, 0, 0);
            WhiteColor = STColor8.White;
        }
Ejemplo n.º 2
0
        public Material()
        {
            TextureMaps       = new TextureRef[0];
            TextureTransforms = new BxlytTextureTransform[0];
            TextureMaps       = new TextureRef[0];
            TextureTransforms = new BxlytTextureTransform[0];
            ProjTexGenParams  = new ProjectionTexGenParam[0];
            TevStages         = new TevStage[0];
            TexCoordGens      = new TexCoordGen[0];

            TevConstantColors = new STColor8[5];
            for (int i = 0; i < 5; i++)
            {
                TevConstantColors[i] = STColor8.White;
            }
            BlackColor = new STColor8(0, 0, 0, 0);
            WhiteColor = STColor8.White;
        }
Ejemplo n.º 3
0
        public Material(FileReader reader, BxlytHeader header) : base()
        {
            ParentLayout = header;

            Name              = reader.ReadString(20, true);
            BlackColor        = reader.ReadColor8RGBA();
            WhiteColor        = reader.ReadColor8RGBA();
            TevConstantColors = reader.ReadColor8sRGBA(5);
            flags             = reader.ReadUInt32();

            uint texCount         = Convert.ToUInt32(flags & 3);
            uint mtxCount         = Convert.ToUInt32(flags >> 2) & 3;
            uint texCoordGenCount = Convert.ToUInt32(flags >> 4) & 3;
            uint tevStageCount    = Convert.ToUInt32(flags >> 6) & 0x7;

            EnableAlphaCompare = Convert.ToBoolean((flags >> 9) & 0x1);
            EnableBlend        = Convert.ToBoolean((flags >> 10) & 0x1);
            var useTextureOnly = Convert.ToBoolean((flags >> 11) & 0x1);

            EnableBlendLogic = Convert.ToBoolean((flags >> 12) & 0x1);
            EnableIndParams  = Convert.ToBoolean((flags >> 14) & 0x1);
            var projTexGenParamCount = Convert.ToUInt32((flags >> 15) & 0x3);

            EnableFontShadowParams = Convert.ToBoolean((flags >> 17) & 0x1);
            AlphaInterpolation     = Convert.ToBoolean((flags >> 18) & 0x1);


            Console.WriteLine($"MAT1 {Name}");
            Console.WriteLine($"texCount {texCount}");
            Console.WriteLine($"mtxCount {mtxCount}");
            Console.WriteLine($"texCoordGenCount {texCoordGenCount}");
            Console.WriteLine($"tevStageCount {tevStageCount}");
            Console.WriteLine($"hasAlphaCompare {EnableAlphaCompare}");
            Console.WriteLine($"hasBlendMode {EnableBlend}");
            Console.WriteLine($"useTextureOnly {useTextureOnly}");
            Console.WriteLine($"seperateBlendMode {EnableBlendLogic}");
            Console.WriteLine($"hasIndParam {EnableIndParams}");
            Console.WriteLine($"projTexGenParamCount {projTexGenParamCount}");
            Console.WriteLine($"hasFontShadowParam {EnableFontShadowParams}");
            Console.WriteLine($"AlphaInterpolation {AlphaInterpolation}");


            TextureMaps       = new TextureRef[texCount];
            TextureTransforms = new BxlytTextureTransform[mtxCount];
            TexCoordGens      = new TexCoordGen[texCoordGenCount];
            TevStages         = new TevStage[tevStageCount];
            ProjTexGenParams  = new ProjectionTexGenParam[projTexGenParamCount];

            for (int i = 0; i < texCount; i++)
            {
                TextureMaps[i] = new TextureRef(reader, header);
            }

            for (int i = 0; i < mtxCount; i++)
            {
                TextureTransforms[i] = new BxlytTextureTransform(reader);
            }

            for (int i = 0; i < texCoordGenCount; i++)
            {
                TexCoordGens[i] = new TexCoordGen(reader, header);
            }

            for (int i = 0; i < tevStageCount; i++)
            {
                TevStages[i] = new TevStage(reader, header);
            }

            if (EnableAlphaCompare)
            {
                AlphaCompare = new BxlytAlphaCompare(reader, header);
            }
            if (EnableBlend)
            {
                BlendMode = new BxlytBlendMode(reader, header);
            }
            if (EnableBlendLogic)
            {
                BlendModeLogic = new BxlytBlendMode(reader, header);
            }
            if (EnableIndParams)
            {
                IndParameter = new IndirectParameter(reader, header);
            }

            for (int i = 0; i < projTexGenParamCount; i++)
            {
                ProjTexGenParams[i] = new ProjectionTexGenParam(reader, header);
            }

            if (EnableFontShadowParams)
            {
                FontShadowParameter = new FontShadowParameter(reader, header);
            }
        }