Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/mesh.cpp
| Context not available. | |||||
| #include "mesh.h" | #include "mesh.h" | ||||
| #include "object.h" | #include "object.h" | ||||
| #include "scene.h" | #include "scene.h" | ||||
| #include "embree.h" | |||||
| #include "osl_globals.h" | #include "osl_globals.h" | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| void Mesh::compute_bvh(SceneParams *params, Progress *progress, int n, int total) | void Mesh::compute_bvh(Scene *scene, SceneParams *params, Progress *progress, int n, int total) | ||||
| { | { | ||||
| if(progress->get_cancel()) | if(progress->get_cancel()) | ||||
| return; | return; | ||||
| Context not available. | |||||
| delete bvh; | delete bvh; | ||||
| bvh = BVH::create(bparams, objects); | bvh = BVH::create(bparams, objects); | ||||
| bvh->build(*progress); | bvh->build(*progress); | ||||
| } | } | ||||
| if(params->use_embree) { | |||||
| /* Embree */ | |||||
| scene->embree->embree_create_scene(objects, &bvh->pack); | |||||
| } | |||||
| } | } | ||||
| need_update = false; | need_update = false; | ||||
| Context not available. | |||||
| bvh->build(progress); | bvh->build(progress); | ||||
| if(progress.get_cancel()) return; | if(progress.get_cancel()) return; | ||||
| if(scene->params.use_embree) { | |||||
| /* Embree */ | |||||
| scene->embree->embree_create_scene(scene->objects, &bvh->pack); | |||||
| dscene->data.embree_scene = scene->embree->embree_scene; | |||||
| } | |||||
| else { | |||||
| dscene->data.embree_scene = NULL; | |||||
| } | |||||
| /* copy to device */ | /* copy to device */ | ||||
| progress.set_status("Updating Scene BVH", "Copying BVH to device"); | progress.set_status("Updating Scene BVH", "Copying BVH to device"); | ||||
| Context not available. | |||||
| foreach(Mesh *mesh, scene->meshes) { | foreach(Mesh *mesh, scene->meshes) { | ||||
| if(mesh->need_update) { | if(mesh->need_update) { | ||||
| pool.push(function_bind(&Mesh::compute_bvh, mesh, &scene->params, &progress, i, num_bvh)); | pool.push(function_bind(&Mesh::compute_bvh, mesh, scene, &scene->params, &progress, i, num_bvh)); | ||||
| i++; | i++; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||