Blender V2.61 - r43446
|
#include <bvh_build.h>
Classes | |
struct | NodeSpec |
struct | ObjectSplit |
struct | Reference |
struct | SpatialBin |
struct | SpatialSplit |
Public Member Functions | |
BVHBuild (const vector< Object * > &objects, vector< int > &prim_index, vector< int > &prim_object, const BVHParams ¶ms, Progress &progress) | |
~BVHBuild () | |
BVHNode * | run () |
Protected Member Functions | |
void | add_reference_mesh (NodeSpec &root, Mesh *mesh, int i) |
void | add_reference_object (NodeSpec &root, Object *ob, int i) |
void | add_references (NodeSpec &root) |
BVHNode * | build_node (const NodeSpec &spec, int level, float progress_start, float progress_end) |
BVHNode * | create_leaf_node (const NodeSpec &spec) |
BVHNode * | create_object_leaf_nodes (const Reference *ref, int num) |
void | progress_update (float progress_start, float progress_end) |
ObjectSplit | find_object_split (const NodeSpec &spec, float nodeSAH) |
void | do_object_split (NodeSpec &left, NodeSpec &right, const NodeSpec &spec, const ObjectSplit &split) |
SpatialSplit | find_spatial_split (const NodeSpec &spec, float nodeSAH) |
void | do_spatial_split (NodeSpec &left, NodeSpec &right, const NodeSpec &spec, const SpatialSplit &split) |
void | split_reference (Reference &left, Reference &right, const Reference &ref, int dim, float pos) |
Protected Attributes | |
vector< Object * > | objects |
vector< Reference > | references |
vector< int > & | prim_index |
vector< int > & | prim_object |
BVHParams | params |
Progress & | progress |
double | progress_start_time |
int | progress_num_duplicates |
float | spatial_min_overlap |
vector< BoundBox > | spatial_right_bounds |
SpatialBin | spatial_bins [3][BVHParams::NUM_SPATIAL_BINS] |
Definition at line 37 of file bvh_build.h.
CCL_NAMESPACE_BEGIN BVHBuild::BVHBuild | ( | const vector< Object * > & | objects, |
vector< int > & | prim_index, | ||
vector< int > & | prim_object, | ||
const BVHParams & | params, | ||
Progress & | progress | ||
) |
Definition at line 36 of file bvh_build.cpp.
References progress_num_duplicates, and spatial_min_overlap.
BVHBuild::~BVHBuild | ( | ) |
Definition at line 50 of file bvh_build.cpp.
Definition at line 56 of file bvh_build.cpp.
References BVHBuild::Reference::bounds, BVHBuild::NodeSpec::bounds, BoundBox::grow(), i, BVHBuild::Reference::prim_index, BVHBuild::Reference::prim_object, references, Mesh::triangles, Mesh::Triangle::v, BoundBox::valid(), and Mesh::verts.
Referenced by add_references().
Definition at line 77 of file bvh_build.cpp.
References BVHBuild::Reference::bounds, Object::bounds, BVHBuild::NodeSpec::bounds, BoundBox::grow(), i, BVHBuild::Reference::prim_index, BVHBuild::Reference::prim_object, and references.
Referenced by add_references().
void BVHBuild::add_references | ( | NodeSpec & | root | ) | [protected] |
Definition at line 89 of file bvh_build.cpp.
References add_reference_mesh(), add_reference_object(), BVHBuild::NodeSpec::bounds, BoundBox::grow(), i, make_float3(), Object::mesh, BVHBuild::NodeSpec::num, objects, params, progress, references, BVHParams::top_level, Mesh::transform_applied, and BoundBox::valid().
Referenced by run().
BVHNode * BVHBuild::build_node | ( | const NodeSpec & | spec, |
int | level, | ||
float | progress_start, | ||
float | progress_end | ||
) | [protected] |
Definition at line 160 of file bvh_build.cpp.
References BoundBox::area(), BVHBuild::NodeSpec::bounds, create_leaf_node(), BVHNode::deleteSubtree(), do_object_split(), do_spatial_split(), find_object_split(), find_spatial_split(), BoundBox::intersect(), left(), lerp(), BVHParams::MAX_DEPTH, BVHParams::max_leaf_size, BVHParams::MAX_SPATIAL_DEPTH, min, BVHParams::min_leaf_size, BVHParams::node_cost(), NULL, BVHBuild::NodeSpec::num, params, progress, progress_num_duplicates, progress_update(), BVHBuild::SpatialSplit::sah, spatial_min_overlap, BVHParams::triangle_cost(), and BVHParams::use_spatial_split.
Referenced by run().
Definition at line 244 of file bvh_build.cpp.
References bounds(), BVHBuild::NodeSpec::bounds, create_object_leaf_nodes(), BoundBox::grow(), i, NULL, BVHBuild::NodeSpec::num, objects, prim_index, prim_object, and references.
Referenced by build_node().
Definition at line 219 of file bvh_build.cpp.
References bounds(), BoundBox::grow(), BVHNode::m_bounds, objects, prim_index, BVHBuild::Reference::prim_object, and prim_object.
Referenced by create_leaf_node().
void BVHBuild::do_object_split | ( | NodeSpec & | left, |
NodeSpec & | right, | ||
const NodeSpec & | spec, | ||
const ObjectSplit & | split | ||
) | [protected] |
Definition at line 329 of file bvh_build.cpp.
References BVHBuild::NodeSpec::bounds, bvh_reference_sort(), BVHBuild::ObjectSplit::dim, BVHBuild::ObjectSplit::left_bounds, BVHBuild::NodeSpec::num, BVHBuild::ObjectSplit::num_left, references, and BVHBuild::ObjectSplit::right_bounds.
Referenced by build_node().
void BVHBuild::do_spatial_split | ( | NodeSpec & | left, |
NodeSpec & | right, | ||
const NodeSpec & | spec, | ||
const SpatialSplit & | split | ||
) | [protected] |
Definition at line 428 of file bvh_build.cpp.
References BoundBox::area(), BVHBuild::Reference::bounds, bounds(), BVHBuild::NodeSpec::bounds, BVHBuild::SpatialSplit::dim, BoundBox::grow(), i, min, BVHBuild::NodeSpec::num, params, BVHBuild::SpatialSplit::pos, references, split_reference(), swap(), and BVHParams::triangle_cost().
Referenced by build_node().
BVHBuild::ObjectSplit BVHBuild::find_object_split | ( | const NodeSpec & | spec, |
float | nodeSAH | ||
) | [protected] |
Definition at line 288 of file bvh_build.cpp.
References BoundBox::area(), bounds(), bvh_reference_sort(), BVHBuild::ObjectSplit::dim, BoundBox::grow(), i, BVHBuild::ObjectSplit::left_bounds, BVHBuild::NodeSpec::num, BVHBuild::ObjectSplit::num_left, params, references, BVHBuild::ObjectSplit::right_bounds, BVHBuild::ObjectSplit::sah, spatial_right_bounds, split(), and BVHParams::triangle_cost().
Referenced by build_node().
BVHBuild::SpatialSplit BVHBuild::find_spatial_split | ( | const NodeSpec & | spec, |
float | nodeSAH | ||
) | [protected] |
Definition at line 346 of file bvh_build.cpp.
References BoundBox::area(), BVHBuild::Reference::bounds, BVHBuild::SpatialBin::bounds, bounds(), BVHBuild::NodeSpec::bounds, clamp, BVHBuild::SpatialSplit::dim, BVHBuild::SpatialBin::enter, BVHBuild::SpatialBin::exit, BoundBox::grow(), i, make_int3(), BoundBox::max, BoundBox::min, BVHBuild::NodeSpec::num, BVHParams::NUM_SPATIAL_BINS, params, BVHBuild::SpatialSplit::pos, references, BVHBuild::SpatialSplit::sah, spatial_bins, spatial_right_bounds, split(), split_reference(), BVHParams::triangle_cost(), float3::x, float3::y, and float3::z.
Referenced by build_node().
void BVHBuild::progress_update | ( | float | progress_start, |
float | progress_end | ||
) | [protected] |
Definition at line 147 of file bvh_build.cpp.
References progress, progress_num_duplicates, progress_start_time, references, string_printf(), and time_dt().
Referenced by build_node().
BVHNode * BVHBuild::run | ( | ) |
Definition at line 122 of file bvh_build.cpp.
References add_references(), BoundBox::area(), BVHBuild::NodeSpec::bounds, build_node(), max, NULL, BVHBuild::NodeSpec::num, BVHParams::NUM_SPATIAL_BINS, params, progress, progress_num_duplicates, progress_start_time, MakeCursor::root, spatial_min_overlap, spatial_right_bounds, BVHParams::spatial_split_alpha, time_dt(), BVHParams::top_level, and BVHParams::use_spatial_split.
Referenced by BVH::build().
void BVHBuild::split_reference | ( | Reference & | left, |
Reference & | right, | ||
const Reference & | ref, | ||
int | dim, | ||
float | pos | ||
) | [protected] |
Definition at line 507 of file bvh_build.cpp.
References BVHBuild::Reference::bounds, clamp, BoundBox::grow(), i, BoundBox::intersect(), lerp(), BoundBox::max, Object::mesh, BoundBox::min, objects, BVHBuild::Reference::prim_index, BVHBuild::Reference::prim_object, Mesh::triangles, and Mesh::verts.
Referenced by do_spatial_split(), and find_spatial_split().
vector<Object*> BVHBuild::objects [protected] |
Definition at line 128 of file bvh_build.h.
Referenced by add_references(), create_leaf_node(), create_object_leaf_nodes(), and split_reference().
BVHParams BVHBuild::params [protected] |
Definition at line 136 of file bvh_build.h.
Referenced by add_references(), build_node(), do_spatial_split(), find_object_split(), find_spatial_split(), and run().
vector<int>& BVHBuild::prim_index [protected] |
Definition at line 132 of file bvh_build.h.
Referenced by create_leaf_node(), and create_object_leaf_nodes().
vector<int>& BVHBuild::prim_object [protected] |
Definition at line 133 of file bvh_build.h.
Referenced by create_leaf_node(), and create_object_leaf_nodes().
Progress& BVHBuild::progress [protected] |
Definition at line 139 of file bvh_build.h.
Referenced by add_references(), build_node(), progress_update(), and run().
int BVHBuild::progress_num_duplicates [protected] |
Definition at line 141 of file bvh_build.h.
Referenced by build_node(), BVHBuild(), progress_update(), and run().
double BVHBuild::progress_start_time [protected] |
Definition at line 140 of file bvh_build.h.
Referenced by progress_update(), and run().
vector<Reference> BVHBuild::references [protected] |
Definition at line 129 of file bvh_build.h.
Referenced by add_reference_mesh(), add_reference_object(), add_references(), create_leaf_node(), do_object_split(), do_spatial_split(), find_object_split(), find_spatial_split(), and progress_update().
SpatialBin BVHBuild::spatial_bins[3][BVHParams::NUM_SPATIAL_BINS] [protected] |
Definition at line 146 of file bvh_build.h.
Referenced by find_spatial_split().
float BVHBuild::spatial_min_overlap [protected] |
Definition at line 144 of file bvh_build.h.
Referenced by build_node(), BVHBuild(), and run().
vector<BoundBox> BVHBuild::spatial_right_bounds [protected] |
Definition at line 145 of file bvh_build.h.
Referenced by find_object_split(), find_spatial_split(), and run().