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:
authorClément Foucault <foucault.clem@gmail.com>2017-03-18 03:55:41 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-03-18 03:56:34 +0300
commit4137f30928dcfda4539d3d80df2c3e079eed12ec (patch)
treeb5b7fb2cef587ea9c2cdd5789350d42b3f71a9ce /source/blender/draw/engines/clay/clay.c
parentcddde85f2c5f25f3672a9c985b5174b19670e7af (diff)
Object Mode: Add stencil test to remove object outlines inside the silouhette.
It also adds nice occluded silouhette information for selected objects that are behind visible objects. This methods is really heavy because it needs to render the wires twices.
Diffstat (limited to 'source/blender/draw/engines/clay/clay.c')
-rw-r--r--source/blender/draw/engines/clay/clay.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/source/blender/draw/engines/clay/clay.c b/source/blender/draw/engines/clay/clay.c
index a91027cb314..a40805a50c1 100644
--- a/source/blender/draw/engines/clay/clay.c
+++ b/source/blender/draw/engines/clay/clay.c
@@ -597,7 +597,11 @@ static DRWShadingGroup *CLAY_object_shgrp_get(Object *ob, CLAY_StorageList *stl,
}
static DRWShadingGroup *depth_shgrp;
+static DRWShadingGroup *depth_shgrp_select;
+static DRWShadingGroup *depth_shgrp_active;
static DRWShadingGroup *depth_shgrp_cull;
+static DRWShadingGroup *depth_shgrp_cull_select;
+static DRWShadingGroup *depth_shgrp_cull_active;
static void CLAY_cache_init(void)
{
@@ -607,11 +611,23 @@ static void CLAY_cache_init(void)
/* Depth Pass */
{
- psl->depth_pass_cull = DRW_pass_create("Depth Pass Cull", DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_CULL_BACK);
psl->depth_pass = DRW_pass_create("Depth Pass", DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
+ depth_shgrp = DRW_shgroup_create(data.depth_sh, psl->depth_pass);
+
+ depth_shgrp_select = DRW_shgroup_create(data.depth_sh, psl->depth_pass);
+ DRW_shgroup_state_set(depth_shgrp_select, DRW_STATE_WRITE_STENCIL_SELECT);
+
+ depth_shgrp_active = DRW_shgroup_create(data.depth_sh, psl->depth_pass);
+ DRW_shgroup_state_set(depth_shgrp_active, DRW_STATE_WRITE_STENCIL_ACTIVE);
+ psl->depth_pass_cull = DRW_pass_create("Depth Pass Cull", DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_CULL_BACK);
depth_shgrp_cull = DRW_shgroup_create(data.depth_sh, psl->depth_pass_cull);
- depth_shgrp = DRW_shgroup_create(data.depth_sh, psl->depth_pass);
+
+ depth_shgrp_cull_select = DRW_shgroup_create(data.depth_sh, psl->depth_pass_cull);
+ DRW_shgroup_state_set(depth_shgrp_cull_select, DRW_STATE_WRITE_STENCIL_SELECT);
+
+ depth_shgrp_cull_active = DRW_shgroup_create(data.depth_sh, psl->depth_pass_cull);
+ DRW_shgroup_state_set(depth_shgrp_cull_active, DRW_STATE_WRITE_STENCIL_ACTIVE);
}
/* Clay Pass */
@@ -642,7 +658,13 @@ static void CLAY_cache_populate(Object *ob)
geom = DRW_cache_surface_get(ob);
/* Depth Prepass */
- DRW_shgroup_call_add((do_cull) ? depth_shgrp_cull : depth_shgrp, geom, ob->obmat);
+ /* waiting for proper flag */
+ // if ((ob->base_flag & BASE_ACTIVE) != 0)
+ // DRW_shgroup_call_add((do_cull) ? depth_shgrp_cull_active : depth_shgrp_active, geom, ob->obmat);
+ if ((ob->base_flag & BASE_SELECTED) != 0)
+ DRW_shgroup_call_add((do_cull) ? depth_shgrp_cull_select : depth_shgrp_select, geom, ob->obmat);
+ else
+ DRW_shgroup_call_add((do_cull) ? depth_shgrp_cull : depth_shgrp, geom, ob->obmat);
/* Shading */
clay_shgrp = CLAY_object_shgrp_get(ob, stl, psl);