Skip to content

Commit

Permalink
Fixing crate imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshi7190 committed Aug 7, 2024
1 parent ad92ba4 commit 2d5cba4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions nusamai/src/sink/obj/obj_writer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;

use super::{material, ClassFeatures, VertexData};
use crate::pipeline::{feedback, PipelineError};
Expand All @@ -10,17 +13,16 @@ pub fn write_obj<W: Write>(
features: ClassFeatures,
feature_vertex_data: Vec<(u32, Vec<VertexData>)>,
file_name: String,
file_path: std::path::PathBuf,
file_path: PathBuf,
has_split: bool,
) -> Result<(), PipelineError> {
let dir_name = file_path.to_str().unwrap();
let mut mtl_writer = std::fs::File::create(format!("{}/{}.mtl", dir_name, file_name))?;
let mut mtl_writer = File::create(format!("{}/{}.mtl", dir_name, file_name))?;

Check warning on line 20 in nusamai/src/sink/obj/obj_writer.rs

View check run for this annotation

Codecov / codecov/patch

nusamai/src/sink/obj/obj_writer.rs#L10-L20

Added lines #L10 - L20 were not covered by tests

let mut global_vertex_offset = 0;

let mut texture_cache: std::collections::HashMap<String, Vec<u8>> =
std::collections::HashMap::new();
let mut material_written: std::collections::HashSet<String> = std::collections::HashSet::new();
let mut texture_cache: HashMap<String, Vec<u8>> = HashMap::new();
let mut material_written: HashSet<String> = HashSet::new();

Check warning on line 25 in nusamai/src/sink/obj/obj_writer.rs

View check run for this annotation

Codecov / codecov/patch

nusamai/src/sink/obj/obj_writer.rs#L22-L25

Added lines #L22 - L25 were not covered by tests

for (feature_id, feature_data) in &feature_vertex_data {

Check warning on line 27 in nusamai/src/sink/obj/obj_writer.rs

View check run for this annotation

Codecov / codecov/patch

nusamai/src/sink/obj/obj_writer.rs#L27

Added line #L27 was not covered by tests
// Writing of object name (option)
Expand Down Expand Up @@ -48,8 +50,7 @@ pub fn write_obj<W: Write>(
}

// Grouping of surfaces by material_id
let mut faces_by_material: std::collections::HashMap<usize, Vec<(usize, &VertexData)>> =
std::collections::HashMap::new();
let mut faces_by_material: HashMap<usize, Vec<(usize, &VertexData)>> = HashMap::new();
for (i, vertex) in feature_data.iter().enumerate() {
faces_by_material
.entry(vertex.material_id)
Expand Down

0 comments on commit 2d5cba4

Please sign in to comment.