//Children, can be either child nodes or array start- and end indices.
uint32_tleft_idx;
uint32_tright_idx;
//Parent
uint32_tparent;
};
structindex_range_t
{
uint32_tstart;
uint32_tend;
uint32_tparent;//Parent node index
uint32_tpadding;
};
/**
* Bins are used in the split(...) method of the MeshBVH for the Binned SAH Split algorithm.
*/
structbin_t
{
math::Boundsbounds;
intobject_count;
};
{
/**
* @brief An abstraction class for the huge, but well reusable parts of a BVH. Included are a construction algorithm based on the binned SAH split, as well as a stackless traversal method.
...
...
@@ -55,7 +20,44 @@ namespace glare
template<typenameTPrimitive>
classBVH
{
public:
public:
structNode
{
enumclassType
{
eInner=0,
eLeaf=1
};
math::Boundsbounds;
Typetype;
//Children, can be either child nodes or array start- and end indices.
uint32_tleft_idx;
uint32_tright_idx;
//Parent
uint32_tparent;
};
structIndexRange
{
uint32_tstart;
uint32_tend;
uint32_tparent;//Parent node index
uint32_tpadding;
};
/**
* Bins are used in the split(...) method of the MeshBVH for the Binned SAH Split algorithm.
*/
structBin
{
math::Boundsbounds;
intobject_count;
};
BVH(){};
~BVH(){};
...
...
@@ -65,7 +67,7 @@ namespace glare
* @param centroid_from_id A function that should return a centroid coordinate for the parameter id (referring to the index in the primitive list).
* @param node_from_range A function that builds a bvh_node_t containing all primitives from index "start" to index "end".