diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-02 20:06:31 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-02 20:09:01 +0300 |
commit | 30e4009f0a5e7738ea6851b76b5a85e5d5f19710 (patch) | |
tree | 558d588761544f2721498b1ca14550387e286e0a | |
parent | ddba5c27a754a7cd419d2f1d1b71871269b41f86 (diff) |
Cycles: Solve dependency between camera and object synchronization
IN theory object might depend on camera location (spatial adaptive subdivisions
for example) which became not possible to achieve after camera in volume support.
Should be no functional changes for artists.
-rw-r--r-- | intern/cycles/render/camera.cpp | 16 | ||||
-rw-r--r-- | intern/cycles/render/camera.h | 1 | ||||
-rw-r--r-- | intern/cycles/render/scene.cpp | 16 |
3 files changed, 24 insertions, 9 deletions
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index 9d03a9e360e..ea9b853d454 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -278,11 +278,20 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) kcam->nearclip = nearclip; kcam->cliplength = (farclip == FLT_MAX)? FLT_MAX: farclip - nearclip; - need_device_update = false; - previous_need_motion = need_motion; - /* Camera in volume. */ kcam->is_inside_volume = 0; + + previous_need_motion = need_motion; +} + +void Camera::device_update_volume(Device *device, + DeviceScene *dscene, + Scene *scene) +{ + if(!need_device_update) { + return; + } + KernelCamera *kcam = &dscene->data.cam; BoundBox viewplane_boundbox = viewplane_bounds_get(); for(size_t i = 0; i < scene->objects.size(); ++i) { Object *object = scene->objects[i]; @@ -294,6 +303,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) break; } } + need_device_update = false; } void Camera::device_free(Device *device, DeviceScene *dscene) diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h index 1b431e88ac4..e1faee3543d 100644 --- a/intern/cycles/render/camera.h +++ b/intern/cycles/render/camera.h @@ -116,6 +116,7 @@ public: void update(); void device_update(Device *device, DeviceScene *dscene, Scene *scene); + void device_update_volume(Device *device, DeviceScene *dscene, Scene *scene); void device_free(Device *device, DeviceScene *dscene); bool modified(const Camera& cam); diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp index bb7c03cbe6d..64d6fa4b9b9 100644 --- a/intern/cycles/render/scene.cpp +++ b/intern/cycles/render/scene.cpp @@ -165,6 +165,11 @@ void Scene::device_update(Device *device_, Progress& progress) if(progress.get_cancel() || device->have_error()) return; + progress.set_status("Updating Camera"); + camera->device_update(device, &dscene, this); + + if(progress.get_cancel() || device->have_error()) return; + progress.set_status("Updating Objects"); object_manager->device_update(device, &dscene, this, progress); @@ -185,6 +190,11 @@ void Scene::device_update(Device *device_, Progress& progress) if(progress.get_cancel() || device->have_error()) return; + progress.set_status("Updating Camera Volume"); + camera->device_update_volume(device, &dscene, this); + + if(progress.get_cancel() || device->have_error()) return; + progress.set_status("Updating Hair Systems"); curve_system_manager->device_update(device, &dscene, this, progress); @@ -195,12 +205,6 @@ void Scene::device_update(Device *device_, Progress& progress) if(progress.get_cancel() || device->have_error()) return; - /* TODO(sergey): Make sure camera is not needed above. */ - progress.set_status("Updating Camera"); - camera->device_update(device, &dscene, this); - - if(progress.get_cancel() || device->have_error()) return; - progress.set_status("Updating Lights"); light_manager->device_update(device, &dscene, this, progress); |