1. Architectural Role & Engine Purpose
The TEX (Texture File) format stores all 2D bitmap textures, character skins, weapon surfaces, foliage alpha maps, and particle textures in Project I.G.I. 1.
In the IGI 1 engine, textures are stored in Version 2 or Version 7 container formats. The format supports 16-bit high-color surfaces (RGB 5:6:5, ARGB 1:5:5:5 for 1-bit alpha test cutouts, ARGB 4:4:4:4 for soft glass/smoke), as well as 8-bit paletted textures with dedicated 256-entry color tables.
2. Binary File Layout & Memory Map Diagram
A TEX file begins with a 16-byte or 32-byte header, followed by an optional color palette, and a complete mipmap cascade:
3. Engine Texture Ingestion & Direct3D 7 Stage Pipeline Diagram
The texture loading pipeline converts disk formats into native DirectDraw surfaces and binds them to Direct3D texture stages:
4. Architectural Mechanics & Engine Implementation Details
Innerloop designed the TEX texture pipeline around Direct3D 7 fixed-function hardware acceleration:
- Precomputed Mip Pyramids: All mipmap levels are pre-calculated offline during packaging, ensuring that level loading requires zero CPU overhead for image downsampling or filtering.
- Color-Key & 1-Bit Alpha: Foliage, fences, and character eyelashes utilize ARGB 1:5:5:5 textures. The high bit controls the alpha test comparison against
D3DRENDERSTATE_ALPHAREF, enabling fast cutouts without full depth sorting. - Texture Clamping & Wrapping: Texture addressing modes (Wrap vs Clamp) are driven by the material definition in the corresponding
.mtpfile.
5. C++ Struct Definitions
#pragma pack(push, 1)
struct TexHeader {
uint16_t version; // 2 or 7
uint16_t format; // 1=565, 2=1555, 3=4444, 4=8-bit paletted
uint16_t width; // Width in pixels
uint16_t height; // Height in pixels
uint16_t mip_levels; // Total mip levels in file
uint16_t flags; // Surface flags
uint32_t reserved;
};
static_assert(sizeof(TexHeader) == 16, "TexHeader must be 16 bytes");
#pragma pack(pop)