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:
parent
2afb09570f
commit
8af6bfeb8b
1 changed files with 17 additions and 0 deletions
17
src/model.rs
17
src/model.rs
|
@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue