diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-02-12 20:54:41 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-02-12 20:54:41 +0300 |
commit | 5e613198e59124986ab3e4bdb8829f77e2284450 (patch) | |
tree | 6659b06236acf73a8c687ea15867a83f1c63983c /source/blender/blenkernel/intern/camera.c | |
parent | d40ac45610edef50885ce73034f7c035f48cc9c1 (diff) |
Viewport compositing - first code
This commit introduces a few ready made effects for the 3D viewport
and OpenGL rendering.
Included effects are Depth of Field, accessible from camera view
and screen space ambient occlusion. Those effects can be turned on and
tweaked from the shading panel in the 3D viewport.
Off screen rendering will use the settings of the current camera.
WIP documentation can be found here:
http://wiki.blender.org/index.php/User:Psy-Fi/Framebuffer_Post-processing
Diffstat (limited to 'source/blender/blenkernel/intern/camera.c')
-rw-r--r-- | source/blender/blenkernel/intern/camera.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index e424823d8dc..e1d771dad65 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -49,6 +49,8 @@ #include "BKE_main.h" #include "BKE_screen.h" +#include "GPU_compositing.h" + /****************************** Camera Datablock *****************************/ void *BKE_camera_add(Main *bmain, const char *name) @@ -66,7 +68,9 @@ void *BKE_camera_add(Main *bmain, const char *name) cam->ortho_scale = 6.0; cam->flag |= CAM_SHOWPASSEPARTOUT; cam->passepartalpha = 0.5f; - + + GPU_fx_compositor_init_dof_settings(&cam->gpu_dof); + return cam; } @@ -686,3 +690,18 @@ bool BKE_camera_view_frame_fit_to_coords( return camera_frame_fit_calc_from_data(¶ms, &data_cb, r_co, r_scale); } +void BKE_camera_to_gpu_dof(struct Object *camera, struct GPUFXSettings *r_fx_settings) +{ + if (camera->type == OB_CAMERA) { + Camera *cam = camera->data; + r_fx_settings->dof = &cam->gpu_dof; + r_fx_settings->dof->focal_length = cam->lens; + r_fx_settings->dof->sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); + if (cam->dof_ob) { + r_fx_settings->dof->focus_distance = len_v3v3(cam->dof_ob->obmat[3], camera->obmat[3]); + } + else { + r_fx_settings->dof->focus_distance = cam->YF_dofdist; + } + } +} |