diff options
Diffstat (limited to 'intern/cycles/render/camera.cpp')
-rw-r--r-- | intern/cycles/render/camera.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index ea9b853d454..89505221862 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -80,6 +80,7 @@ Camera::Camera() need_update = true; need_device_update = true; + need_flags_update = true; previous_need_motion = -1; } @@ -162,8 +163,8 @@ void Camera::update() transform_perspective(&rastertocamera, make_float3(0, 0, 0)); } else { - dx = make_float3(0, 0, 0); - dy = make_float3(0, 0, 0); + dx = make_float3(0.0f, 0.0f, 0.0f); + dy = make_float3(0.0f, 0.0f, 0.0f); } dx = transform_direction(&cameratoworld, dx); @@ -171,6 +172,7 @@ void Camera::update() need_update = false; need_device_update = true; + need_flags_update = true; } void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) @@ -179,7 +181,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) update(); - if (previous_need_motion != need_motion) { + if(previous_need_motion != need_motion) { /* scene's motion model could have been changed since previous device * camera update this could happen for example in case when one render * layer has got motion pass and another not */ @@ -284,11 +286,11 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) previous_need_motion = need_motion; } -void Camera::device_update_volume(Device *device, +void Camera::device_update_volume(Device * /*device*/, DeviceScene *dscene, Scene *scene) { - if(!need_device_update) { + if(!need_device_update && !need_flags_update) { return; } KernelCamera *kcam = &dscene->data.cam; @@ -304,9 +306,10 @@ void Camera::device_update_volume(Device *device, } } need_device_update = false; + need_flags_update = false; } -void Camera::device_free(Device *device, DeviceScene *dscene) +void Camera::device_free(Device * /*device*/, DeviceScene * /*dscene*/) { /* nothing to free, only writing to constant memory */ } @@ -368,7 +371,7 @@ float3 Camera::transform_raster_to_world(float raster_x, float raster_y) */ P += nearclip * D / Pclip.z; } - else if (type == CAMERA_ORTHOGRAPHIC) { + else if(type == CAMERA_ORTHOGRAPHIC) { D = make_float3(0.0f, 0.0f, 1.0f); /* TODO(sergey): Aperture support? */ P = transform_perspective(&rastertocamera, @@ -400,7 +403,7 @@ BoundBox Camera::viewplane_bounds_get() bounds.grow(transform_raster_to_world((float)width, (float)height)); bounds.grow(transform_raster_to_world((float)width, 0.0f)); if(type == CAMERA_PERSPECTIVE) { - /* Center point has the most distancei in local Z axis, + /* Center point has the most distance in local Z axis, * use it to construct bounding box/ */ bounds.grow(transform_raster_to_world(0.5f*width, 0.5f*height)); @@ -409,15 +412,4 @@ BoundBox Camera::viewplane_bounds_get() return bounds; } -Transform Camera::transform_from_viewplane(BoundBox2D &viewplane) -{ - return - transform_scale(1.0f / (viewplane.right - viewplane.left), - 1.0f / (viewplane.top - viewplane.bottom), - 1.0f) * - transform_translate(-viewplane.left, - -viewplane.bottom, - 0.0f); -} - CCL_NAMESPACE_END |