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/editors/space_view3d/space_view3d.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/editors/space_view3d/space_view3d.c')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 25085368dac..ff212a1d74e 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -56,6 +56,7 @@ #include "GPU_extensions.h" #include "GPU_material.h" +#include "GPU_compositing.h" #include "BIF_gl.h" @@ -418,6 +419,11 @@ static void view3d_free(SpaceLink *sl) BKE_previewimg_free(&vd->defmaterial->preview); MEM_freeN(vd->defmaterial); } + + if (vd->fx_settings.ssao) + MEM_freeN(vd->fx_settings.ssao); + if (vd->fx_settings.dof) + MEM_freeN(vd->fx_settings.dof); } @@ -459,7 +465,11 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl) } v3dn->properties_storage = NULL; - + if (v3dn->fx_settings.dof) + v3dn->fx_settings.dof = MEM_dupallocN(v3do->fx_settings.dof); + if (v3dn->fx_settings.ssao) + v3dn->fx_settings.ssao = MEM_dupallocN(v3do->fx_settings.ssao); + return (SpaceLink *)v3dn; } @@ -559,6 +569,11 @@ static void view3d_main_area_exit(wmWindowManager *wm, ARegion *ar) GPU_offscreen_free(rv3d->gpuoffscreen); rv3d->gpuoffscreen = NULL; } + + if (rv3d->compositor) { + GPU_fx_compositor_destroy(rv3d->compositor); + rv3d->compositor = NULL; + } } static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) @@ -713,6 +728,9 @@ static void view3d_main_area_free(ARegion *ar) if (rv3d->gpuoffscreen) { GPU_offscreen_free(rv3d->gpuoffscreen); } + if (rv3d->compositor) { + GPU_fx_compositor_destroy(rv3d->compositor); + } MEM_freeN(rv3d); ar->regiondata = NULL; @@ -736,6 +754,7 @@ static void *view3d_main_area_duplicate(void *poin) new->render_engine = NULL; new->sms = NULL; new->smooth_timer = NULL; + new->compositor = NULL; return new; } |