Sketching out the structures for ray traversal tracking.

This commit is contained in:
Nathan Vegdahl 2019-06-22 04:19:55 +09:00
parent 3d4ac7f57b
commit 1a29b16aa2

View File

@ -98,6 +98,30 @@ impl RayBatch {
} }
} }
/// A structure used for tracking traversal of a ray batch through a scene.
#[derive(Debug)]
pub struct RayStack {
lanes: Vec<Vec<u16>>,
tasks: Vec<RayTask>,
}
/// A task within a RayStack.
#[derive(Debug)]
pub enum RayTask {
// A barrier represents a division when traversing into a new system.
// For example, when traversing from the top-level BVH into an object's
// local BVH. It helps with keeping track of where we're at and aids in
// debugging.
Barrier,
// A task for handling a set of rays.
//
// Specifies the lane that the relevant ray pointers are in, and the
// starting index within that lane. The relevant pointers are always
// `&[start_idx..]` within the given lane.
Rays { lane: usize, start_idx: usize },
}
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct Ray { pub struct Ray {
pub orig: Point, pub orig: Point,