示例#1
0
            public Material(FileReader reader, Header header) : base()
            {
                ParentLayout = header;

                TextureMaps       = new List <TextureRef>();
                TextureTransforms = new List <TextureTransform>();

                Name = reader.ReadString(0x14).Replace("\0", string.Empty);

                ForeColor      = reader.ReadColor16RGBA();
                BackColor      = reader.ReadColor16RGBA();
                ColorRegister3 = reader.ReadColor16RGBA();
                TevColor1      = reader.ReadColor8RGBA();
                TevColor2      = reader.ReadColor8RGBA();
                TevColor3      = reader.ReadColor8RGBA();
                TevColor4      = reader.ReadColor8RGBA();
                flags          = reader.ReadUInt32();

                uint texCount = Convert.ToUInt32(flags & 3);
                uint mtxCount = Convert.ToUInt32(flags >> 2) & 3;

                for (int i = 0; i < texCount; i++)
                {
                    TextureMaps.Add(new TextureRef(reader));
                }

                for (int i = 0; i < mtxCount; i++)
                {
                    TextureTransforms.Add(new TextureTransform(reader));
                }
            }
示例#2
0
            public PIC1(FileReader reader, BRLYT.Header header) : base(reader)
            {
                ParentLayout = header;

                ColorTopLeft     = STColor8.FromBytes(reader.ReadBytes(4));
                ColorTopRight    = STColor8.FromBytes(reader.ReadBytes(4));
                ColorBottomLeft  = STColor8.FromBytes(reader.ReadBytes(4));
                ColorBottomRight = STColor8.FromBytes(reader.ReadBytes(4));
                MaterialIndex    = reader.ReadUInt16();
                byte numUVs = reader.ReadByte();

                reader.Seek(1); //padding

                TexCoords = new TexCoord[numUVs];
                for (int i = 0; i < numUVs; i++)
                {
                    TexCoords[i] = new TexCoord()
                    {
                        TopLeft     = reader.ReadVec2SY(),
                        TopRight    = reader.ReadVec2SY(),
                        BottomLeft  = reader.ReadVec2SY(),
                        BottomRight = reader.ReadVec2SY(),
                    };
                }
            }
示例#3
0
            public Material(FileReader reader, Header header) : base()
            {
                ParentLayout = header;

                TextureTransforms = new List <TextureTransform>();

                Name = reader.ReadString(0x14, true);

                BlackColor16   = reader.ReadColor16RGBA();
                WhiteColor16   = reader.ReadColor16RGBA();
                ColorRegister3 = reader.ReadColor16RGBA();
                TevColor1      = reader.ReadColor8RGBA();
                TevColor2      = reader.ReadColor8RGBA();
                TevColor3      = reader.ReadColor8RGBA();
                TevColor4      = reader.ReadColor8RGBA();
                flags          = reader.ReadUInt32();


                uint indSrtCount      = ExtractBits(flags, 2, 17);
                uint texCoordGenCount = ExtractBits(flags, 4, 20);
                uint mtxCount         = ExtractBits(flags, 4, 24);
                uint texCount         = ExtractBits(flags, 4, 28);

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

                for (int i = 0; i < mtxCount; i++)
                {
                    TextureTransforms.Add(new TextureTransform(reader));
                }
            }