From eef29c2b2f7739434433eece6a04c8f5ee0cb7ae Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sun, 23 Jun 2019 19:26:30 +0900 Subject: [PATCH] Type alias for the ray index type. Makes things easier to play with. --- src/accel/bvh4.rs | 2 +- src/ray.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/accel/bvh4.rs b/src/accel/bvh4.rs index c739d38..86b2389 100644 --- a/src/accel/bvh4.rs +++ b/src/accel/bvh4.rs @@ -206,7 +206,7 @@ impl<'a> BVH4<'a> { ([0, 1, 2, 3, 4, 5, 6, 7], 0) } }); - + trav_time += timer.tick() as f64; if hit_count > 0 { diff --git a/src/ray.rs b/src/ray.rs index 1881dba..585b0cc 100644 --- a/src/ray.rs +++ b/src/ray.rs @@ -4,6 +4,7 @@ use float4::Float4; use crate::math::{Matrix4x4, Point, Vector}; +type RayIndexType = u16; type FlagType = u8; const OCCLUSION_FLAG: FlagType = 1; const DONE_FLAG: FlagType = 1 << 1; @@ -229,7 +230,7 @@ impl RayStack { /// Pushes the given ray index onto the end of the specified lane. pub fn push_ray_index(&mut self, ray_idx: usize, lane: usize) { assert!(self.lanes.len() > lane); - self.lanes[lane].idxs.push(ray_idx as u16); + self.lanes[lane].idxs.push(ray_idx as RayIndexType); } /// Takes the given list of lane indices, and pushes any excess indices on @@ -282,7 +283,7 @@ impl RayStack { /// A lane within a RayStack. #[derive(Debug)] struct Lane { - idxs: Vec, + idxs: Vec, end_len: usize, }