diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2019-04-20 12:58:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-20 13:03:57 +0300 |
commit | f2792e91f034ed01469aa025503a4352a1e4455c (patch) | |
tree | f2278ce2ba38ee1cb74790386285a97ccb6e6cf6 /source/blender/draw | |
parent | 08f4cdebe40a5ad5f45f37a07bf0f64c17cecb34 (diff) |
3D View: add opacity for sculpt mask display
This matches vertex/texture paint opacity options.
Useful because 0.75 is sometimes too dark to see the surface shading.
Resolves T63746
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/modes/sculpt_mode.c | 8 | ||||
-rw-r--r-- | source/blender/draw/modes/shaders/sculpt_mask_vert.glsl | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c index b25a8af795b..e2b73a0fac7 100644 --- a/source/blender/draw/modes/sculpt_mode.c +++ b/source/blender/draw/modes/sculpt_mode.c @@ -135,9 +135,15 @@ static void SCULPT_cache_init(void *vedata) } { + const DRWContextState *draw_ctx = DRW_context_state_get(); + View3D *v3d = draw_ctx->v3d; + DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_MULTIPLY; psl->pass = DRW_pass_create("Sculpt Pass", state); - stl->g_data->group_smooth = DRW_shgroup_create(e_data.shader_smooth, psl->pass); + + DRWShadingGroup *shgrp = DRW_shgroup_create(e_data.shader_smooth, psl->pass); + DRW_shgroup_uniform_float(shgrp, "maskOpacity", &v3d->overlay.sculpt_mode_mask_opacity, 1); + stl->g_data->group_smooth = shgrp; } } diff --git a/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl b/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl index 5ae97ec5cb9..e5e34fee57e 100644 --- a/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl +++ b/source/blender/draw/modes/shaders/sculpt_mask_vert.glsl @@ -1,5 +1,6 @@ uniform mat4 ModelViewProjectionMatrix; +uniform float maskOpacity; in vec3 pos; in float msk; @@ -10,6 +11,6 @@ void main() { gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); - float mask = 1.0 - msk * 0.75; + float mask = 1.0 - (msk * maskOpacity); finalColor = vec4(mask, mask, mask, 1.0); } |