Move load_obj() into submudule
This commit is contained in:
parent
12e26887c1
commit
08484306fd
22
src/mesh.rs
22
src/mesh.rs
|
|
@ -1,12 +1,8 @@
|
|||
use nalgebra::{convert, Point3, RealField, Vector2, Vector3};
|
||||
use obj::{IndexTuple, Obj, SimplePolygon};
|
||||
use nalgebra::{Point3, RealField, Vector2, Vector3};
|
||||
|
||||
use super::materials::Material;
|
||||
use super::raycasting::{Intersect, IntersectionInfo, Ray};
|
||||
|
||||
use alga::general::SupersetOf;
|
||||
use std::io::Result;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -81,6 +77,19 @@ impl<T: RealField> Intersect<T> for Triangle<T> {
|
|||
}
|
||||
}
|
||||
|
||||
mod wavefront_obj {
|
||||
use crate::materials::Material;
|
||||
|
||||
use super::Triangle;
|
||||
|
||||
use alga::general::SupersetOf;
|
||||
use nalgebra::{convert, Point3, RealField, Vector3};
|
||||
use obj::{IndexTuple, Obj, SimplePolygon};
|
||||
|
||||
use std::io::Result;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
fn get_vertex_and_normal<T: RealField>(
|
||||
index_tuple: &IndexTuple,
|
||||
vertex_positions: &Vec<[f32; 3]>,
|
||||
|
|
@ -150,6 +159,9 @@ where
|
|||
.flat_map(|poly| get_triangles(poly, &obj.position, &obj.normal, material.clone()))
|
||||
.collect())
|
||||
}
|
||||
}
|
||||
|
||||
pub use wavefront_obj::load_obj;
|
||||
|
||||
fn indices_with_index_of_largest_element_last<T: RealField>(v: &Vector3<T>) -> [usize; 3] {
|
||||
if v.x > v.y {
|
||||
|
|
|
|||
Loading…
Reference in New Issue