public Texture(BufferReader reader, SectionHeader header, TxdFile parent)
        {
            this.reader = reader;

            reader.SkipStream(8);
            reader.PrewarmBuffer(64);

            Name      = reader.ReadBytes(32).GetNullTerminatedString();
            AlphaName = reader.ReadBytes(32).GetNullTerminatedString();

            FullName      = string.Format(FULLNAME_FORMAT, parent.FileNameWithoutExtension, Name);
            FullALphaName = string.Format(FULLNAME_FORMAT, parent.FileNameWithoutExtension, AlphaName);

            reader.PrewarmBuffer(12);
            rawRasterFormat = (RasterFormat)reader.ReadInt32();
            reader.Skip(4); //Alpha or four CC

            Width  = reader.ReadInt16();
            Height = reader.ReadInt16();

            reader.SkipStream(4); //BPP, Mipmaps, RasterType and DXTnumber

            offset = (int)reader.Position;
            reader.SkipStream(header.Size - 88);
        }
示例#2
0
        public void Add(TxdFile txd)
        {
            using (new Timing("Adding Textures (txd)")) {
                try { txds.Add(txd.FileNameWithoutExtension, txd); }
                catch { Log.Error("A Txd with the same name already exist in this collection: {0}", txd.FileName); };

                if (TextureNameOnly)
                {
                    foreach (var texture in txd)
                    {
                        try { textures.Add(texture.Name, texture); }
                        catch { Log.Warning("A texture with the same name already exist in this collection: {0}", texture.FullName); }
                        try { textures.Add(texture.AlphaName, texture); }
                        catch { Log.Warning("A texture with the same alpha name already exist in this collection: {0}", texture.FullALphaName); }
                    }
                }
            }
        }