Skip to content

Commit

Permalink
Emit material name for the level OBJ
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Dec 15, 2023
1 parent 8302320 commit d0db0b5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/convert/level_obj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ impl VertexCollector<'_> {
pub fn save(path: &Path, level: &Level, config: &Config) {
if let Some(palette) = config.palette {
let mat_path = path.with_extension("mtl");
let mat_name = mat_path.file_name().unwrap().to_str().unwrap();
let mut dest = BufWriter::new(File::create(&mat_path).unwrap());
writeln!(dest, "mtllib {}", mat_name).unwrap();
for (i, color) in palette.chunks(3).enumerate() {
writeln!(dest, "newmtl t{}", i).unwrap();
writeln!(
Expand Down

0 comments on commit d0db0b5

Please sign in to comment.