use super::*;
#[derive(Clone, Data, Debug, PartialEq)]
pub struct Ray {
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub origin: Vector3D,
#[get(type(copy))]
#[get_mut(pub(crate))]
pub direction: Vector3D,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub t_min: f64,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub t_max: f64,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub depth: u32,
}
#[derive(Clone, Data, Debug, PartialEq)]
pub struct Hit {
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub t: f64,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub position: Vector3D,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub normal: Vector3D,
#[get(pub(crate), type(clone))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) material: Material,
}
#[derive(Clone, Data, Debug, PartialEq)]
pub struct Occluder {
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub kind: OccluderKind,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub center: Vector3D,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub extent: Vector3D,
#[get(type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub vertices: [Vector3D; 3],
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) material: Material,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub(crate) struct RayTraceNode {
#[get(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) lower: Vector3D,
#[get(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) upper: Vector3D,
#[get(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) start: usize,
#[get(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) count: usize,
#[get(pub(crate), type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) escape: usize,
}
#[derive(Debug)]
pub(crate) struct BvhBuild {
pub(crate) lower: Vec<Vector3D>,
pub(crate) upper: Vec<Vector3D>,
pub(crate) centroids: Vec<Vector3D>,
}
#[derive(Clone, Copy, Debug)]
pub(crate) struct BvhRange {
pub(crate) start: usize,
pub(crate) count: usize,
}
#[derive(Clone, Copy, Debug)]
pub(crate) struct BvhSubtree {
pub(crate) bounds: (Vector3D, Vector3D),
pub(crate) range: BvhRange,
pub(crate) depth: usize,
}
#[derive(Clone, Copy, Debug)]
pub(crate) struct SahSplit {
pub(crate) axis: usize,
pub(crate) boundary: f64,
}
#[derive(Debug)]
pub(crate) struct BvhBuildContext<'a> {
pub(crate) nodes: &'a mut Vec<RayTraceNode>,
pub(crate) indices: &'a mut [usize],
pub(crate) build: &'a BvhBuild,
}
#[derive(Clone, Debug, Getter, PartialEq)]
pub struct RayTraceScene {
#[get(pub(crate))]
pub(crate) occluders: Vec<Occluder>,
#[get(pub(crate))]
pub(crate) nodes: Vec<RayTraceNode>,
#[get(pub(crate))]
pub(crate) indices: Vec<usize>,
#[get(pub(crate))]
pub(crate) shadow_points: Vec<(Vector3D, f64)>,
}