parse_wmo

Function parse_wmo 

Source
pub fn parse_wmo<R: Read + Seek>(reader: &mut R) -> Result<ParsedWmo, WmoError>
Expand description

Parse a WMO file (root or group) with automatic type detection

This is the main entry point for parsing WMO files. It will:

  1. Discover all chunks in the file (Stage 1)
  2. Determine if it’s a root or group file
  3. Parse with the appropriate parser (Stage 2)

§Example

use std::fs::File;
use std::io::BufReader;
use wow_wmo::{parse_wmo, ParsedWmo};

let file = File::open("example.wmo")?;
let mut reader = BufReader::new(file);
let wmo = parse_wmo(&mut reader)?;

match wmo {
    ParsedWmo::Root(root) => {
        println!("Root file with {} groups", root.n_groups);
    }
    ParsedWmo::Group(group) => {
        println!("Group {} with {} vertices", group.group_index, group.n_vertices);
    }
}