diff --git a/src/bvh.rs b/src/bvh.rs index e7ee27e..23eeb7e 100644 --- a/src/bvh.rs +++ b/src/bvh.rs @@ -1,5 +1,5 @@ use crate::{node::Node, ray::*, EPSILON}; -use nalgebra::{point, Point3, Vector3}; +use nalgebra::{Point3, Vector3}; use std::collections::HashMap; use std::ops::Index; @@ -271,7 +271,7 @@ impl BVH { // Get the root node and assign it to index 0 let mut root = &bvh_nodes[root_node_index]; - (root.l_idx, root.r_idx) = (0, 0); //Root node has no children to begin with + root.l_idx = 0; //Root node has no children to begin with (root.first_prim, root.prim_count) = (0, n); //Make root include all n nodes tree.update_bvh_node_aabb(root_node_index); //Fit the root nodes AABB tree.subdivide(root_node_index); diff --git a/src/primitive.rs b/src/primitive.rs index 28cc6a1..324c13c 100644 --- a/src/primitive.rs +++ b/src/primitive.rs @@ -623,7 +623,7 @@ impl Mesh { trf = trf.sup(&triangle.v); trf = trf.sup(&triangle.w); } - AABB { bln, trf } + AABB::new(bln, trf) } pub fn from_file(filename: &str) -> Rc { @@ -881,18 +881,18 @@ impl Primitive for Gnonom { } fn get_aabb(&self) -> AABB { - AABB { - bln: Point3::new( + AABB::new( + Point3::new( -Self::GNONOM_WIDTH, -Self::GNONOM_WIDTH, -Self::GNONOM_WIDTH, ), - trf: Point3::new( + Point3::new( Self::GNONOM_LENGTH, Self::GNONOM_LENGTH, Self::GNONOM_LENGTH, ), - } + ) } }