[Bf-blender-cvs] [30e4009] master: Cycles: Solve dependency between camera and object synchronization

Sergey Sharybin noreply at git.blender.org
Mon Feb 2 18:09:27 CET 2015


Commit: 30e4009f0a5e7738ea6851b76b5a85e5d5f19710
Author: Sergey Sharybin
Date:   Mon Feb 2 22:06:31 2015 +0500
Branches: master
https://developer.blender.org/rB30e4009f0a5e7738ea6851b76b5a85e5d5f19710

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.

===================================================================

M	intern/cycles/render/camera.cpp
M	intern/cycles/render/camera.h
M	intern/cycles/render/scene.cpp

===================================================================

diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 9d03a9e..ea9b853 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 1b431e8..e1faee3 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 bb7c03c..64d6fa4 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);




More information about the Bf-blender-cvs mailing list