wow-m2
A Rust library for parsing, validating, and converting World of Warcraft M2 model files.
Overview
wow-m2 provides comprehensive support for M2 model files across all World of Warcraft expansions from Classic (1.12.1) through The War Within (11.x). The library handles:
- M2 Models (
.m2/.mdx) - 3D character, creature, and object models - Skin Files (
.skin) - Level-of-detail and submesh information - Animation Files (
.anim) - External animation sequences - BLP Textures (
.blp) - Texture files used by models
Features
- ✅ Parse and validate M2 models from all WoW versions
- ✅ Convert models between different game versions
- ✅ Support for all chunk types (bones, animations, textures, etc.)
- ✅ Comprehensive error handling with detailed context
- ✅ Zero-copy parsing where possible for performance
- ✅ Optional serde support for serialization
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Or use cargo add:
Usage
Basic Example
use ;
// Load a model
let model = load?;
// Print basic information
println!;
println!;
println!;
// Convert to a different version
let converter = new;
let converted = converter.convert?;
converted.save?;
Working with Skin Files
use Skin;
// Load a skin file
let skin = load?;
// Access submesh information
for submesh in &skin.submeshes
Version Support
The library supports parsing versions by both numeric format and expansion names:
use M2Version;
// Using version numbers
let version = from_string?; // WotLK
// Using expansion names
let version = from_expansion_name?;
let version = from_expansion_name?;
Supported Versions
| Expansion | Version Range | Support |
|---|---|---|
| Classic | 1.12.x | ✅ Full |
| TBC | 2.4.x | ✅ Full |
| WotLK | 3.3.x | ✅ Full |
| Cataclysm | 4.3.x | ✅ Full |
| MoP | 5.4.x | ✅ Full |
| WoD | 6.2.x | ✅ Full |
| Legion | 7.3.x | ✅ Full |
| BfA | 8.3.x | ✅ Full |
| Shadowlands | 9.x | ✅ Full |
| Dragonflight | 10.x | ✅ Full |
| The War Within | 11.x | ✅ Full |
Examples
See the examples/ directory for more detailed examples:
convert_model.rs- Convert models between versionsanalyze_model.rs- Analyze model structure and contentsvalidate_model.rs- Validate model integrity
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Contributing
See CONTRIBUTING.md for guidelines.