1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-22 20:57:46 +00:00

Export material names used in MDL files

This commit is contained in:
Joshua Goins 2023-03-31 21:31:03 -04:00
parent 2afb09570f
commit 8af6bfeb8b

View file

@ -322,6 +322,7 @@ pub struct Lod {
pub struct MDL {
pub lods: Vec<Lod>,
pub affected_bone_names: Vec<String>,
pub material_names: Vec<String>
}
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
})
}
}