Cycles: Cleanup, split one gigantic function into two smaller ones

This commit is contained in:
Sergey Sharybin 2017-01-20 17:52:48 +01:00
parent 094d916c60
commit a1c21e0b50
2 changed files with 186 additions and 177 deletions

@ -112,14 +112,12 @@ BVHBuild::~BVHBuild()
/* Adding References */
void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
void BVHBuild::add_reference_triangles(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
{
if(params.primitive_mask & PRIMITIVE_ALL_TRIANGLE) {
Attribute *attr_mP = NULL;
if(mesh->has_motion_blur())
if(mesh->has_motion_blur()) {
attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
}
const size_t num_triangles = mesh->num_triangles();
for(uint j = 0; j < num_triangles; j++) {
Mesh::Triangle t = mesh->get_triangle(j);
@ -220,14 +218,14 @@ void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh,
}
}
}
}
}
if(params.primitive_mask & PRIMITIVE_ALL_CURVE) {
void BVHBuild::add_reference_curves(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
{
Attribute *curve_attr_mP = NULL;
if(mesh->has_motion_blur())
if(mesh->has_motion_blur()) {
curve_attr_mP = mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
}
size_t num_curves = mesh->num_curves();
for(uint j = 0; j < num_curves; j++) {
const Mesh::Curve curve = mesh->get_curve(j);
@ -333,6 +331,15 @@ void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh,
}
}
}
}
void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
{
if(params.primitive_mask & PRIMITIVE_ALL_TRIANGLE) {
add_reference_triangles(root, center, mesh, i);
}
if(params.primitive_mask & PRIMITIVE_ALL_CURVE) {
add_reference_curves(root, center, mesh, i);
}
}

@ -63,6 +63,8 @@ protected:
friend class BVHObjectBinning;
/* Adding references. */
void add_reference_triangles(BoundBox& root, BoundBox& center, Mesh *mesh, int i);
void add_reference_curves(BoundBox& root, BoundBox& center, Mesh *mesh, int i);
void add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i);
void add_reference_object(BoundBox& root, BoundBox& center, Object *ob, int i);
void add_references(BVHRange& root);