Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2019-05-17 17:57:31 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-17 18:59:26 +0300
commitbc3139d79226896cf6c2b0813a1188eda70fad09 (patch)
treee5c7f1f878b4769def10e2ddbc75aacebda4afd5 /source/blender/draw/engines/workbench/workbench_effect_dof.c
parent043299ab69ca47a42fc8ca4f629727f8a6a2dd31 (diff)
Cycles/Eevee: unify depth of field settings for cameras
There is now a checkbox to enable/disable depth of field per camera. For Eevee this replace the scene level setting. For Cycles there is now only an F-Stop value, no longer a Radius. Existing files are converted based on Cycles or Eevee being set in the scene. Differential Revision: https://developer.blender.org/D4882
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_effect_dof.c')
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_dof.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c
index ee8c8a0343f..6886b73650c 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_dof.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c
@@ -136,7 +136,9 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera)
WORKBENCH_PrivateData *wpd = stl->g_data;
WORKBENCH_FramebufferList *fbl = vedata->fbl;
- if ((wpd->shading.flag & V3D_SHADING_DEPTH_OF_FIELD) == 0 || (camera == NULL)) {
+ Camera *cam = camera != NULL ? camera->data : NULL;
+ if ((wpd->shading.flag & V3D_SHADING_DEPTH_OF_FIELD) == 0 || (cam == NULL) ||
+ ((cam->dof.flag & CAM_DOF_ENABLED) == 0)) {
wpd->dof_enabled = false;
return;
}
@@ -231,11 +233,10 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera)
const DRWContextState *draw_ctx = DRW_context_state_get();
const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
RegionView3D *rv3d = draw_ctx->rv3d;
- Camera *cam = (Camera *)camera->data;
/* Parameters */
/* TODO UI Options */
- float fstop = cam->gpu_dof.fstop;
+ float fstop = cam->dof.aperture_fstop;
float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
float focus_dist = BKE_camera_object_dof_distance(camera);
float focal_len = cam->lens;
@@ -265,9 +266,9 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera)
wpd->dof_near_far[0] = -cam->clip_start;
wpd->dof_near_far[1] = -cam->clip_end;
- float blades = cam->gpu_dof.num_blades;
- float rotation = cam->gpu_dof.rotation;
- float ratio = 1.0f / cam->gpu_dof.ratio;
+ float blades = cam->dof.aperture_blades;
+ float rotation = cam->dof.aperture_rotation;
+ float ratio = 1.0f / cam->dof.aperture_ratio;
if (wpd->dof_ubo == NULL || blades != wpd->dof_blades || rotation != wpd->dof_rotation ||
ratio != wpd->dof_ratio) {