1. Architectural Role & Engine Purpose
The THM (Terrain Heightmap & Geomorphing File) format stores multi-resolution terrain quadtrees, bounding box hierarchies, and crack-free geomorphing morph weights in I.G.I. 2: Covert Strike.
In IGI 2, terrain rendering was redesigned to eliminate noticeable LOD "popping". The THM file provides precomputed quadtree metadata and morphing factors, allowing vertices between adjacent quadtree nodes to transition smoothly in height without visible seams or cracks.
2. Binary File Layout & Memory Map Diagram
A THM file contains quadtree dimensions, node bounding boxes, and geomorphing interpolation coefficients:
3. Crack-Free Geomorphing Terrain Pipeline Diagram
During the terrain render loop, geomorphing morph weights smoothly blend adjacent LOD levels:
4. C++ Struct Definitions
#pragma pack(push, 1)
struct ThmHeader {
char magic[4]; // "THM "
uint32_t version; // 2
uint32_t quadtree_depth; // Quadtree levels (e.g. 5)
uint32_t tile_count; // Number of quadtree nodes
float min_height; // Valley minimum
float max_height; // Mountain peak
};
static_assert(sizeof(ThmHeader) == 24, "ThmHeader must be 24 bytes");
#pragma pack(pop)