Type alias for the ray index type.

Makes things easier to play with.
This commit is contained in:
Nathan Vegdahl 2019-06-23 19:26:30 +09:00
parent 630a79aca5
commit eef29c2b2f
2 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,7 @@ use float4::Float4;
use crate::math::{Matrix4x4, Point, Vector}; use crate::math::{Matrix4x4, Point, Vector};
type RayIndexType = u16;
type FlagType = u8; type FlagType = u8;
const OCCLUSION_FLAG: FlagType = 1; const OCCLUSION_FLAG: FlagType = 1;
const DONE_FLAG: FlagType = 1 << 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. /// Pushes the given ray index onto the end of the specified lane.
pub fn push_ray_index(&mut self, ray_idx: usize, lane: usize) { pub fn push_ray_index(&mut self, ray_idx: usize, lane: usize) {
assert!(self.lanes.len() > lane); 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 /// Takes the given list of lane indices, and pushes any excess indices on
@ -282,7 +283,7 @@ impl RayStack {
/// A lane within a RayStack. /// A lane within a RayStack.
#[derive(Debug)] #[derive(Debug)]
struct Lane { struct Lane {
idxs: Vec<u16>, idxs: Vec<RayIndexType>,
end_len: usize, end_len: usize,
} }