Skip to content

Commit

Permalink
Merge pull request #62 from redpenguinyt/master
Browse files Browse the repository at this point in the history
Updated ahash to 0.8.7 (0.8.3 has been yanked) and made clippy happy
  • Loading branch information
Twinklebear authored Jan 20, 2024
2 parents 85c04c4 + 80743a4 commit 552ba7e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use_f64 = []

[dependencies]
arbitrary = { version = "1.3.0", optional = true }
ahash = { version = "0.8.3", optional = true }
ahash = { version = "0.8.7", optional = true }
log = { version = "0.4.17", optional = true }

[dev-dependencies]
Expand Down
7 changes: 3 additions & 4 deletions examples/print_mesh.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
fn main() {
let obj_file = std::env::args()
.skip(1)
.next()
.nth(1)
.expect("A .obj file to print is required");

let (models, materials) =
tobj::load_obj(&obj_file, &tobj::LoadOptions::default()).expect("Failed to OBJ load file");
tobj::load_obj(obj_file, &tobj::LoadOptions::default()).expect("Failed to OBJ load file");

// Note: If you don't mind missing the materials, you can generate a default.
let materials = materials.expect("Failed to load MTL file");
Expand All @@ -15,7 +14,7 @@ fn main() {

for (i, m) in models.iter().enumerate() {
let mesh = &m.mesh;
println!("");
println!();
println!("model[{}].name = \'{}\'", i, m.name);
println!("model[{}].mesh.material_id = {:?}", i, mesh.material_id);

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ fn export_faces(
}
Face::Polygon(ref indices) => {
if load_options.triangulate {
let a = indices.get(0).ok_or(LoadError::InvalidPolygon)?;
let a = indices.first().ok_or(LoadError::InvalidPolygon)?;
let mut b = indices.get(1).ok_or(LoadError::InvalidPolygon)?;
for c in indices.iter().skip(2) {
add_vertex(&mut mesh, &mut index_map, a, pos, v_color, texcoord, normal)?;
Expand Down Expand Up @@ -1327,7 +1327,7 @@ fn export_faces_multi_index(
}
Face::Polygon(ref indices) => {
if load_options.triangulate {
let a = indices.get(0).ok_or(LoadError::InvalidPolygon)?;
let a = indices.first().ok_or(LoadError::InvalidPolygon)?;
let mut b = indices.get(1).ok_or(LoadError::InvalidPolygon)?;
for c in indices.iter().skip(2) {
add_vertex_multi_index(
Expand Down
7 changes: 4 additions & 3 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use std::{

use crate as tobj;

const CORNELL_BOX_OBJ: &'static str = include_str!("../obj/cornell_box.obj");
const CORNELL_BOX_MTL1: &'static str = include_str!("../obj/cornell_box.mtl");
const CORNELL_BOX_MTL2: &'static str = include_str!("../obj/cornell_box2.mtl");
const CORNELL_BOX_OBJ: &str = include_str!("../obj/cornell_box.obj");
const CORNELL_BOX_MTL1: &str = include_str!("../obj/cornell_box.mtl");
const CORNELL_BOX_MTL2: &str = include_str!("../obj/cornell_box2.mtl");

// Set the tolerance for float comparison
use crate::Float;
Expand Down Expand Up @@ -271,6 +271,7 @@ fn multiple_face_formats() {
assert!(tri.texcoords.is_empty());
}

#[allow(clippy::excessive_precision)]
fn validate_cornell(models: Vec<tobj::Model>, mats: Vec<tobj::Material>) {
// Verify the floor loaded properly
assert_eq!(models[0].name, "floor");
Expand Down

0 comments on commit 552ba7e

Please sign in to comment.