pub struct RootAdt {Show 20 fields
pub version: AdtVersion,
pub mhdr: MhdrChunk,
pub mcin: McinChunk,
pub textures: Vec<String>,
pub models: Vec<String>,
pub model_indices: Vec<u32>,
pub wmos: Vec<String>,
pub wmo_indices: Vec<u32>,
pub doodad_placements: Vec<DoodadPlacement>,
pub wmo_placements: Vec<WmoPlacement>,
pub mcnk_chunks: Vec<McnkChunk>,
pub flight_bounds: Option<MfboChunk>,
pub water_data: Option<Mh2oChunk>,
pub texture_flags: Option<MtxfChunk>,
pub texture_amplifier: Option<MampChunk>,
pub texture_params: Option<MtxpChunk>,
pub blend_mesh_headers: Option<MbmhChunk>,
pub blend_mesh_bounds: Option<MbbbChunk>,
pub blend_mesh_vertices: Option<MbnvChunk>,
pub blend_mesh_indices: Option<MbmiChunk>,
}Expand description
Parsed root ADT file (main terrain file for all versions).
Contains all terrain data for a single 16×16 yard area:
- Heightmaps and vertex normals
- Texture layers and alpha blending
- Object placements (M2 models and WMOs)
- Version-specific features (water, flight bounds, etc.)
§Guarantees
versioncorrectly identifies format version- All required chunks present (MHDR, MCIN, MTEX, MCNK)
- Version-specific chunks only present for compatible versions
- All indices valid within their respective arrays
- MCNK count ∈ [1, 256]
§Example
use wow_adt::api::{parse_adt, ParsedAdt};
use std::fs::File;
let mut file = File::open("terrain.adt")?;
let adt = parse_adt(&mut file)?;
if let ParsedAdt::Root(root) = adt {
println!("Version: {:?}", root.version);
println!("Terrain chunks: {}", root.mcnk_chunks.len());
if let Some(water) = &root.water_data {
// Access water data by chunk index
for (idx, entry) in water.entries.iter().enumerate() {
if entry.header.has_liquid() {
let row = idx / 16;
let col = idx % 16;
println!("Chunk ({}, {}) has {} water layer(s)",
row, col, entry.instances.len());
}
}
}
}Fields§
§version: AdtVersionDetected ADT version
mhdr: MhdrChunkMHDR - Header with chunk offsets
mcin: McinChunkMCIN - MCNK chunk index (256 entries)
textures: Vec<String>Texture filenames from MTEX chunk
models: Vec<String>M2 model filenames from MMDX chunk
model_indices: Vec<u32>M2 model filename offsets from MMID chunk
wmos: Vec<String>WMO filenames from MWMO chunk
wmo_indices: Vec<u32>WMO filename offsets from MWID chunk
doodad_placements: Vec<DoodadPlacement>M2 model placements from MDDF chunk
wmo_placements: Vec<WmoPlacement>WMO placements from MODF chunk
mcnk_chunks: Vec<McnkChunk>MCNK terrain chunks (1-256 chunks)
flight_bounds: Option<MfboChunk>MFBO - Flight boundaries (TBC+)
water_data: Option<Mh2oChunk>MH2O - Advanced water system (WotLK+)
Contains 256 entries (one per MCNK chunk) with liquid layer data. Each entry has header, instances, and optional attributes.
texture_flags: Option<MtxfChunk>MTXF - Texture flags (WotLK 3.x+)
Rendering flags for each texture controlling specularity, environment mapping, and animation.
texture_amplifier: Option<MampChunk>MAMP - Texture amplifier (Cataclysm+)
texture_params: Option<MtxpChunk>MTXP - Texture parameters (MoP+)
blend_mesh_headers: Option<MbmhChunk>MBMH - Blend mesh headers (MoP 5.x+)
Headers describing blend mesh batches for smooth texture transitions. Each entry contains map_object_id, texture_id, and index/vertex ranges.
blend_mesh_bounds: Option<MbbbChunk>MBBB - Blend mesh bounding boxes (MoP 5.x+)
Bounding boxes for visibility culling of blend meshes. Each entry has map_object_id and min/max coordinates.
blend_mesh_vertices: Option<MbnvChunk>MBNV - Blend mesh vertices (MoP 5.x+)
Vertex data for blend mesh system with position, normal, UV coordinates, and 3 RGBA color channels for texture blending.
blend_mesh_indices: Option<MbmiChunk>MBMI - Blend mesh indices (MoP 5.x+)
Triangle indices (u16) referencing MBNV vertex array. MCBB chunks in MCNK reference ranges within this array.
Implementations§
Source§impl RootAdt
impl RootAdt
Sourcepub fn has_flight_bounds(&self) -> bool
pub fn has_flight_bounds(&self) -> bool
Check if this ADT has flight boundaries.
Sourcepub fn terrain_chunk_count(&self) -> usize
pub fn terrain_chunk_count(&self) -> usize
Get number of terrain chunks.
Sourcepub fn texture_count(&self) -> usize
pub fn texture_count(&self) -> usize
Get number of textures.
Sourcepub fn model_count(&self) -> usize
pub fn model_count(&self) -> usize
Get number of M2 models.
Sourcepub fn textures_mut(&mut self) -> &mut Vec<String>
pub fn textures_mut(&mut self) -> &mut Vec<String>
Get mutable access to textures for replacement workflows.
Use this to modify texture filenames in place. After modification,
serialize using AdtBuilder::from_parsed().
§Example
use wow_adt::api::parse_adt;
root.textures_mut()[0] = "terrain/grass_new.blp".to_string();Sourcepub fn models_mut(&mut self) -> &mut Vec<String>
pub fn models_mut(&mut self) -> &mut Vec<String>
Get mutable access to M2 model filenames.
Sourcepub fn doodad_placements_mut(&mut self) -> &mut Vec<DoodadPlacement>
pub fn doodad_placements_mut(&mut self) -> &mut Vec<DoodadPlacement>
Get mutable access to M2 model placements.
Use this to add, remove, or modify doodad placements.
§Example
use wow_adt::api::parse_adt;
root.doodad_placements_mut()[0].position[2] += 10.0; // Z coordinateSourcepub fn wmo_placements_mut(&mut self) -> &mut Vec<WmoPlacement>
pub fn wmo_placements_mut(&mut self) -> &mut Vec<WmoPlacement>
Get mutable access to WMO placements.
Sourcepub fn mcnk_chunks_mut(&mut self) -> &mut Vec<McnkChunk>
pub fn mcnk_chunks_mut(&mut self) -> &mut Vec<McnkChunk>
Get mutable access to MCNK terrain chunks.
Use this to modify terrain geometry, heights, textures, etc.
§Example
use wow_adt::api::parse_adt;
if let Some(heights) = &mut root.mcnk_chunks_mut()[0].heights {
for height in &mut heights.heights {
*height += 5.0;
}
}Sourcepub fn water_data_mut(&mut self) -> Option<&mut Mh2oChunk>
pub fn water_data_mut(&mut self) -> Option<&mut Mh2oChunk>
Get mutable access to water data (WotLK+).
Returns None if this ADT has no water data.
Sourcepub fn flight_bounds_mut(&mut self) -> Option<&mut MfboChunk>
pub fn flight_bounds_mut(&mut self) -> Option<&mut MfboChunk>
Get mutable access to flight boundaries (TBC+).
Returns None if this ADT has no flight bounds.
Sourcepub fn texture_flags_mut(&mut self) -> Option<&mut MtxfChunk>
pub fn texture_flags_mut(&mut self) -> Option<&mut MtxfChunk>
Get mutable access to texture flags (WotLK+).
Sourcepub fn texture_amplifier_mut(&mut self) -> Option<&mut MampChunk>
pub fn texture_amplifier_mut(&mut self) -> Option<&mut MampChunk>
Get mutable access to texture amplifier (Cataclysm+).
Sourcepub fn texture_params_mut(&mut self) -> Option<&mut MtxpChunk>
pub fn texture_params_mut(&mut self) -> Option<&mut MtxpChunk>
Get mutable access to texture parameters (MoP+).