diff --git a/src/model.rs b/src/model.rs index c7e1b90..2c99218 100755 --- a/src/model.rs +++ b/src/model.rs @@ -322,6 +322,7 @@ pub struct Lod { pub struct MDL { pub lods: Vec, pub affected_bone_names: Vec, + pub material_names: Vec } impl MDL { @@ -373,6 +374,21 @@ impl MDL { affected_bone_names.push(string); } + let mut material_names = vec![]; + + for mut offset in model.material_name_offsets { + let mut string = String::new(); + + let mut next_char = model.header.strings[offset as usize] as char; + while next_char != '\0' { + string.push(next_char); + offset += 1; + next_char = model.header.strings[offset as usize] as char; + } + + material_names.push(string); + } + let mut lods = vec![]; for i in 0..model.header.lod_count { @@ -465,6 +481,7 @@ impl MDL { Some(MDL { lods, affected_bone_names, + material_names }) } }