Textures

From owdev
Jump to: navigation, search

Textures are stored as type 004.

Most of them though have only a 32-byte header here. The actual texture then is stored as type 04D.

Type 004

 struct texture_header {
   uint8  flags;            // see enum IMAGE_FLAGS
   uint8  unk2;            // ?
   uint8  nr_mips;         // only virtual in primary files since the mips are in another file
   uint8  format;          // see below
   uint8  nr_surfaces;     // 1 = regular, 6 = cubemaps
   uint8  unk3;            // ?
   uint8  identifier;      // subtract 1 to get 04D identifier (bits 32 to 48); if it's 1, the file has mips.
   uint8  unk4;            // ?
   uint16 width;           //
   uint16 height;          //
   uint32 data_sz;         // only if data is in this file, if it's zero there's an accompanying 04D file.
   uint64 ref1;            // Key?
   uint64 unk5;            // padding?
 }
 struct IMAGE_FLAGS {
   UNK1 = 0x01
   DIFFUSE = 0x02
   UNK2 = 0x04
   CUBEMAP = 0x08
   UNK4 = 0x10
   WORLD = 0x20
   MULTISURFACE = 0x40
   UNK5 = 0x80
}
byte albedo = DIFFUSE | WORLD
byte animated = DIFFUSE | MULTISURFACE
byte particle = DIFFUSE

Formats

generally dxgi_format enum

Type 04D

 struct raw_texture_header {
   uint32 nr_mips;         // mips contained are virtual in primary file
   uint32 nr_sufaces;      // surfaces contained
   uint32 size_data;       // size of data blob
   uint32 size_header;     // ?
 }

Deshuffling

todo