AdtFileType

Enum AdtFileType 

Source
pub enum AdtFileType {
    Root,
    Tex0,
    Tex1,
    Obj0,
    Obj1,
    Lod,
}
Expand description

ADT file type in Cataclysm+ split file architecture.

Starting with World of Warcraft 4.0 (Cataclysm), ADT files were split into multiple specialized files to improve loading performance and enable streaming.

§File Type Responsibilities

  • Root: Core terrain geometry (heightmaps, vertex normals, hole masks)
  • Tex0: Texture filenames, layer definitions, alpha maps
  • Tex1: Height textures, shadow maps, additional texture data
  • Obj0: M2 model placements (MDDF), WMO placements (MODF)
  • Obj1: Additional object placement data
  • Lod: Level-of-detail data for distant terrain rendering

§Version Compatibility

  • 1.x - 3.x: All data in single root file (detected as Root)
  • 4.x - 5.x: Split file architecture with specialized types

Variants§

§

Root

Root ADT file containing core terrain data.

Contains MCNK chunks with heightmaps, normals, and terrain structure. Present in all WoW versions.

§

Tex0

Texture file 0 containing primary texture data.

Contains MTEX (texture filenames) and MCLY (layer definitions). Cataclysm+ only.

§

Tex1

Texture file 1 containing additional texture data.

Contains height textures, shadow maps, and auxiliary texture information. Cataclysm+ only.

§

Obj0

Object file 0 containing M2 and WMO placement data.

Contains MDDF (M2 doodad placements) and MODF (WMO placements). Cataclysm+ only.

§

Obj1

Object file 1 containing additional object data.

Contains supplementary object placement information. Cataclysm+ only.

§

Lod

Level-of-detail file for distant terrain rendering.

Contains simplified geometry for rendering distant terrain tiles. Cataclysm+ only.

Implementations§

Source§

impl AdtFileType

Source

pub fn detect_from_chunks(chunks: &HashMap<ChunkId, Vec<ChunkLocation>>) -> Self

Detect file type from chunk location map.

Analyzes which chunks are present in the file to determine its type. This method works without knowing the filename.

§Detection Logic
  1. Has MCNK chunks → Root file (terrain data)
  2. Has MTEX but no MCNK → Tex0/Tex1 file (texture data)
  3. Has MDDF/MODF but no MCNK → Obj0/Obj1 file (object placements)
  4. Minimal chunks → Lod file (level-of-detail data)
§Arguments
  • chunks - Map of chunk IDs to their locations
§Returns

Detected file type based on chunk presence patterns.

§Examples
use wow_adt::file_type::AdtFileType;
use wow_adt::chunk_id::ChunkId;
use wow_adt::chunk_discovery::ChunkLocation;
use std::collections::HashMap;

let mut chunks = HashMap::new();
chunks.insert(ChunkId::MCNK, vec![ChunkLocation { offset: 1024, size: 500 }]);

let file_type = AdtFileType::detect_from_chunks(&chunks);
assert_eq!(file_type, AdtFileType::Root);
Source

pub fn from_discovery(discovery: &ChunkDiscovery) -> Self

Detect file type from chunk discovery result.

Convenience method that extracts chunk locations from ChunkDiscovery and performs file type detection.

§Arguments
  • discovery - Chunk discovery result from Phase 1 parsing
§Returns

Detected file type based on discovered chunks.

§Examples
use wow_adt::file_type::AdtFileType;
use wow_adt::chunk_discovery::{ChunkDiscovery, ChunkLocation};
use wow_adt::chunk_id::ChunkId;
use std::collections::HashMap;

let mut discovery = ChunkDiscovery::new(1000);
let mut chunks = HashMap::new();
chunks.insert(ChunkId::MCNK, vec![ChunkLocation { offset: 100, size: 500 }]);
discovery.chunks = chunks;

let file_type = AdtFileType::from_discovery(&discovery);
assert_eq!(file_type, AdtFileType::Root);
Source

pub fn from_filename(filename: &str) -> Self

Detect file type from filename pattern.

Faster detection method when filename is available. Recognizes standard Cataclysm+ naming conventions.

§Filename Patterns
  • MapName_XX_YY.adt → Root
  • MapName_XX_YY_tex0.adt → Tex0
  • MapName_XX_YY_tex1.adt → Tex1
  • MapName_XX_YY_obj0.adt → Obj0
  • MapName_XX_YY_obj1.adt → Obj1
  • MapName_XX_YY_lod.adt → Lod
§Arguments
  • filename - ADT filename (case-insensitive)
§Returns

File type based on filename pattern. Defaults to Root if no pattern matches.

§Examples
use wow_adt::file_type::AdtFileType;

assert_eq!(
    AdtFileType::from_filename("Azeroth_32_48_tex0.adt"),
    AdtFileType::Tex0
);

assert_eq!(
    AdtFileType::from_filename("Kalimdor_16_32.adt"),
    AdtFileType::Root
);
Source

pub const fn description(&self) -> &'static str

Get human-readable description of file type.

§Returns

Static string describing the file type’s purpose.

§Examples
use wow_adt::file_type::AdtFileType;

assert_eq!(
    AdtFileType::Root.description(),
    "Root ADT (terrain data)"
);
Source

pub const fn is_split_file(&self) -> bool

Check if file type is part of split file architecture.

§Returns

true for Cataclysm+ split files (Tex0, Tex1, Obj0, Obj1, Lod). false for root files (present in all versions).

Source

pub const fn has_terrain_geometry(&self) -> bool

Check if file type contains terrain geometry.

§Returns

true for Root and Lod files containing heightmap data.

Source

pub const fn has_texture_data(&self) -> bool

Check if file type contains texture data.

§Returns

true for Tex0 and Tex1 files containing texture definitions.

Source

pub const fn has_object_data(&self) -> bool

Check if file type contains object placement data.

§Returns

true for Obj0 and Obj1 files containing M2/WMO placements.

Trait Implementations§

Source§

impl Clone for AdtFileType

Source§

fn clone(&self) -> AdtFileType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AdtFileType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for AdtFileType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for AdtFileType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AdtFileType

Source§

fn eq(&self, other: &AdtFileType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for AdtFileType

Source§

impl Eq for AdtFileType

Source§

impl StructuralPartialEq for AdtFileType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CustomError for T
where T: Display + Debug + Send + Sync + 'static,

Source§

fn as_any(&self) -> &(dyn Any + Sync + Send + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + Sync + Send + 'static)

Source§

fn as_box_any(self: Box<T>) -> Box<dyn Any + Sync + Send>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.