Public Types | |
using | Index = typename Node::Index |
using | Ray = bvh::v2::Ray<Scalar, Node::dimension> |
using | Scalar = typename Node::Scalar |
Public Member Functions | |
Bvh ()=default | |
Bvh (Bvh &&)=default | |
Bvh | extract_bvh (size_t root_id) const |
Extracts the BVH rooted at the given node index. | |
BVH_ALWAYS_INLINE const Node & | get_root () const |
Returns the root node of this BVH. | |
template<bool IsAnyHit, bool IsRobust, typename Stack , typename LeafFn , typename InnerFn = IgnoreArgs> | |
void | intersect (const Ray &ray, Index start, Stack &, LeafFn &&, InnerFn &&={}) const |
Intersects the BVH with a single ray, using the given function to intersect the contents of a leaf. | |
bool | operator!= (const Bvh &other) const |
Bvh & | operator= (Bvh &&)=default |
bool | operator== (const Bvh &other) const |
template<typename LeafFn = IgnoreArgs> | |
void | refit (LeafFn &&={}) |
Refits the BVH, using the given function object to recompute the bounding box of the leaves. | |
void | serialize (OutputStream &) const |
template<typename LeafFn = IgnoreArgs, typename InnerFn = IgnoreArgs> | |
void | traverse_bottom_up (LeafFn &&={}, InnerFn &&={}) |
Traverses this BVH from the bottom to the top, using the given function objects to process leaves and inner nodes. | |
template<bool IsAnyHit, typename Stack , typename LeafFn , typename InnerFn > | |
void | traverse_top_down (Index start, Stack &, LeafFn &&, InnerFn &&) const |
Traverses the BVH from the given index in start using the provided stack. | |
Static Public Member Functions | |
static Bvh | deserialize (InputStream &) |
static BVH_ALWAYS_INLINE size_t | get_left_sibling_id (size_t node_id) |
Returns the index of the left sibling of the node. | |
static BVH_ALWAYS_INLINE size_t | get_right_sibling_id (size_t node_id) |
Returns the index of the right sibling of the node. | |
static BVH_ALWAYS_INLINE size_t | get_sibling_id (size_t node_id) |
Returns the index of a sibling of a node. | |
static BVH_ALWAYS_INLINE bool | is_left_sibling (size_t node_id) |
Returns whether the node located at the given index is the left child of its parent. | |
Public Attributes | |
std::vector< Node > | nodes |
std::vector< size_t > | prim_ids |
#include <bvh/v2/bvh.h>
using bvh::v2::Bvh< Node >::Index = typename Node::Index |
using bvh::v2::Bvh< Node >::Ray = bvh::v2::Ray<Scalar, Node::dimension> |
using bvh::v2::Bvh< Node >::Scalar = typename Node::Scalar |
|
default |
|
inlinestatic |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inlinestatic |
|
inline |
Intersects the BVH with a single ray, using the given function to intersect the contents of a leaf.
The algorithm starts at the node index start
and uses the given stack object. When IsAnyHit
is true, the function stops at the first intersection (useful for shadow rays), otherwise it finds the closest intersection. When IsRobust
is true, a slower but numerically robust ray-box test is used, otherwise a fast, but less precise test is used.
|
inlinestatic |
|
inline |
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Traverses the BVH from the given index in start
using the provided stack.
Every leaf encountered on the way is processed using the given LeafFn
function, and every pair of nodes is processed with the function in HitFn
, which returns a triplet of booleans indicating whether the first child should be processed, whether the second child should be processed, and whether to traverse the second child first instead of the other way around.
std::vector<Node> bvh::v2::Bvh< Node >::nodes |
std::vector<size_t> bvh::v2::Bvh< Node >::prim_ids |