tinybvh-rs
Opinionated rust wrapper for tinybvh.
Features
BVH,MBVHBVH8_CPU,CWBVH- Intersection
Unimplemented features:
- Optimize via
Verbose - Loading/saving from/to disk
For more information about each layout, have a look at the original tinybvh library.
Examples
BVH Wald
use ;
let primitives = vec!;
let bvh = BVHnew.unwrap;
// No intersection, ray pass between the primitives
let mut ray = new;
bvh.intersect;
println!; // 1e30
// Intersects left primitive
let mut ray = new;
bvh.intersect;
println!; // 1.0 / 0
// Intersects right primitive
let mut ray = new;
bvh.intersect;
println!; // 1.0 / 1
BVH8_CPU
let mut bvh = BVHnew.unwrap;
bvh.split_leaves; // Required or BVH8_CPU will return an error
let mbvh = BVHnew;
let bvh8 = BVHnew.unwrap;
bvh8.intersect;
CWBVH
let mut bvh = BVHnew.unwrap;
bvh.split_leaves; // Required or the CWBVH will return an error
let mbvh = BVHnew;
let cwbvh = BVHnew.unwrap;
println!;
println!;
Strided
If the vertices position are strided (located in a Vertex struct for instance),
you can enable the strided feature and use:
use ;
let vertices = ;
let positions = slice_attr!;
let bvh = BVHnew;