Skip to content

Commit

Permalink
Fixed type error
Browse files Browse the repository at this point in the history
The argument of mtllib is no longer wrapped by Option. The control logic has been adjusted accordingly
  • Loading branch information
joshlengel authored Mar 27, 2024
1 parent f5a11b4 commit fb5645c
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1743,25 +1743,22 @@ where
}
Some("mtllib") => {
// File name can include spaces so we cannot rely on a SplitWhitespace iterator
if let Some(mtllib) = line.split_once(' ').unwrap_or_default().1.trim() {
let mat_file = Path::new(mtllib).to_path_buf();
match material_loader(mat_file.as_path()) {
Ok((mut mats, map)) => {
// Merge the loaded material lib with any currently loaded ones,
// offsetting the indices of the appended
// materials by our current length
let mat_offset = materials.len();
materials.append(&mut mats);
for m in map {
mat_map.insert(m.0, m.1 + mat_offset);
}
}
Err(e) => {
mtlresult = Err(e);
let mtllib = line.split_once(' ').unwrap_or_default().1.trim();
let mat_file = Path::new(mtllib).to_path_buf();
match material_loader(mat_file.as_path()) {
Ok((mut mats, map)) => {
// Merge the loaded material lib with any currently loaded ones,
// offsetting the indices of the appended
// materials by our current length
let mat_offset = materials.len();
materials.append(&mut mats);
for m in map {
mat_map.insert(m.0, m.1 + mat_offset);
}
}
} else {
return Err(LoadError::MaterialParseError);
Err(e) => {
mtlresult = Err(e);
}
}
}
Some("usemtl") => {
Expand Down

0 comments on commit fb5645c

Please sign in to comment.