36 #include <cugar/linalg/vector.h> 38 #include <cugar/basic/cuda/pointers.h> 91 std::vector<node_type> m_nodes;
92 std::vector<bbox_type> m_bboxes;
112 void set_params(
const uint32 max_leaf_size) { m_max_leaf_size = max_leaf_size; }
121 template <
typename Iterator>
123 const Iterator
begin,
129 uint32
index(
const uint32 i) {
return m_points[i].m_index; }
137 float center(
const uint32 dim)
const {
return (m_bbox[0][dim] + m_bbox[1][dim])*0.5f; }
147 typedef std::stack<Node> Node_stack;
156 uint32 m_max_leaf_size;
157 std::vector<Point> m_points;
183 const float2 f1 = *(
reinterpret_cast<const volatile float2*
>( node ) + 1);
184 const float4 f2 = *(
reinterpret_cast<const volatile float4*
>( node ) + 1);
188 const float2 f1 = cuda::load<cuda::LOAD_CG>(
reinterpret_cast<const float2*
>( node ) + 1);
189 const float4 f2 = cuda::load<cuda::LOAD_CG>(
reinterpret_cast<const float4*
>( node ) + 1);
203 const float2 f1 = make_float2( bbox[0].x, bbox[0].y );
204 const float4 f2 = make_float4( bbox[0].z, bbox[1].x, bbox[1].y, bbox[1].z );
205 *(
reinterpret_cast<volatile float2*
>( node ) + 1) = f1;
206 *(
reinterpret_cast<volatile float4*
>( node ) + 1) = f2;
209 const float2 f1 = make_float2( bbox[0].x, bbox[0].y );
210 const float4 f2 = make_float4( bbox[0].z, bbox[1].x, bbox[1].y, bbox[1].z );
211 cuda::store<cuda::STORE_CG>(
reinterpret_cast<float2*
>( node ) + 1, f1 );
212 cuda::store<cuda::STORE_CG>(
reinterpret_cast<float4*
>( node ) + 1, f2 );
235 #include <cugar/bvh/bvh_inline.h> void set_params(const uint32 max_leaf_size)
Definition: bvh.h:112
thrust::device_vector< T >::iterator begin(thrust::device_vector< T > &vec)
Definition: thrust_view.h:89
Definition: bvh_node.h:45
void build_skip_nodes(const Bvh_node *nodes, uint32 *skip_nodes)
build skip nodes for a tree
Definition: bvh_inline.h:53
Entry point to the generic Bounding Volume Hierarchy library.
Definition: bvh_node.h:80
uint32 index(const uint32 i)
Definition: bvh.h:129
Bvh_builder()
Definition: bvh.h:107
Define CUDA based scan primitives.
Defines an axis-aligned bounding box class.
Define a vector_view POD type and plain_view() for std::vector.
Definition: diff.h:38
Definition: bvh_inline.h:31
float compute_sah_cost(const Bvh< 3 > &bvh, uint32 node_index=0)
compute SAH cost of a subtree
Definition: bvh_inline.h:184