The BVH building code is now largely split out into a separate type, BVHBase. The intent is that this will also be used by the BVH4 when I get around to it. The BVH itself now uses references instead of indexes, allocating and pointing directly into the MemArena. This allows the nodes to all be right next to their bounding boxes in memory.
27 lines
575 B
Rust
27 lines
575 B
Rust
mod bvh_base;
|
|
mod bvh;
|
|
mod light_array;
|
|
mod light_tree;
|
|
mod objects_split;
|
|
|
|
use math::{Vector, Point, Normal};
|
|
use shading::surface_closure::SurfaceClosure;
|
|
|
|
pub use self::bvh::BVH;
|
|
pub use self::light_tree::LightTree;
|
|
|
|
|
|
pub trait LightAccel {
|
|
/// Returns (index_of_light, selection_pdf, whittled_n)
|
|
fn select(&self,
|
|
inc: Vector,
|
|
pos: Point,
|
|
nor: Normal,
|
|
sc: &SurfaceClosure,
|
|
time: f32,
|
|
n: f32)
|
|
-> Option<(usize, f32, f32)>;
|
|
|
|
fn approximate_energy(&self) -> f32;
|
|
}
|