Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/bvh/bvh_build.cpp
| Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | |||||
| void BVHBuild::add_references(BVHRange& root) | void BVHBuild::add_references(BVHRange& root) | ||||
| { | { | ||||
| /* reserve space for references */ | /* reserve space for references */ | ||||
| size_t num_alloc_references = 0; | size_t num_alloc_references = 0; | ||||
| foreach(Object *ob, objects) { | foreach(Object *ob, objects) { | ||||
| if(params.top_level) { | if(params.top_level) { | ||||
| if(ob->mesh->transform_applied) { | if(!ob->mesh->is_instanced()) { | ||||
| num_alloc_references += ob->mesh->triangles.size(); | num_alloc_references += ob->mesh->triangles.size(); | ||||
| num_alloc_references += count_curve_segments(ob->mesh); | num_alloc_references += count_curve_segments(ob->mesh); | ||||
| } | } | ||||
| else | else | ||||
| num_alloc_references++; | num_alloc_references++; | ||||
| } | } | ||||
| else { | else { | ||||
| num_alloc_references += ob->mesh->triangles.size(); | num_alloc_references += ob->mesh->triangles.size(); | ||||
| num_alloc_references += count_curve_segments(ob->mesh); | num_alloc_references += count_curve_segments(ob->mesh); | ||||
| } | } | ||||
| } | } | ||||
| references.reserve(num_alloc_references); | references.reserve(num_alloc_references); | ||||
| /* add references from objects */ | /* add references from objects */ | ||||
| BoundBox bounds = BoundBox::empty, center = BoundBox::empty; | BoundBox bounds = BoundBox::empty, center = BoundBox::empty; | ||||
| int i = 0; | int i = 0; | ||||
| foreach(Object *ob, objects) { | foreach(Object *ob, objects) { | ||||
| if(params.top_level) { | if(params.top_level) { | ||||
| if(ob->mesh->transform_applied) | if(!ob->mesh->is_instanced()) | ||||
| add_reference_mesh(bounds, center, ob->mesh, i); | add_reference_mesh(bounds, center, ob->mesh, i); | ||||
| else | else | ||||
| add_reference_object(bounds, center, ob, i); | add_reference_object(bounds, center, ob, i); | ||||
| } | } | ||||
| else | else | ||||
| add_reference_mesh(bounds, center, ob->mesh, i); | add_reference_mesh(bounds, center, ob->mesh, i); | ||||
| i++; | i++; | ||||
| ▲ Show 20 Lines • Show All 474 Lines • Show Last 20 Lines | |||||