Workbench: Support transparency from object color alpha

Support the alpha channel use of the object color in solid mode.

The Transparency effect is still using the Xray algorithm and not
true Alpha blending.
This commit is contained in:
2019-01-29 19:56:22 +01:00
parent ea3f5af962
commit 2cc69a5e20
2 changed files with 12 additions and 3 deletions

View File

@@ -938,8 +938,17 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
else if (ELEM(wpd->shading.color_type,
V3D_SHADING_SINGLE_COLOR, V3D_SHADING_OBJECT_COLOR, V3D_SHADING_RANDOM_COLOR))
{
/* Draw solid color */
material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type, 0);
if ((ob->col[3] < 1.0f) &&
(wpd->shading.color_type == V3D_SHADING_OBJECT_COLOR))
{
wpd->shading.xray_alpha = ob->col[3];
material = workbench_forward_get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type, 0);
has_transp_mat = true;
}
else {
/* Draw solid color */
material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type, 0);
}
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
}

View File

@@ -62,7 +62,7 @@
#define SHADOW_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_SHADOW)
#define GHOST_ENABLED(psl) (!DRW_pass_is_empty(psl->ghost_prepass_pass) || !DRW_pass_is_empty(psl->ghost_prepass_hair_pass))
#define CULL_BACKFACE_ENABLED(wpd) ((wpd->shading.flag & V3D_SHADING_BACKFACE_CULLING) != 0)
#define OIT_ENABLED(wpd) (wpd->shading.color_type == V3D_SHADING_MATERIAL_COLOR)
#define OIT_ENABLED(wpd) (ELEM(wpd->shading.color_type, V3D_SHADING_MATERIAL_COLOR, V3D_SHADING_OBJECT_COLOR))
#define IS_NAVIGATING(wpd) ((DRW_context_state_get()->rv3d) && (DRW_context_state_get()->rv3d->rflag & RV3D_NAVIGATING))
#define FXAA_ENABLED(wpd) ((!DRW_state_is_opengl_render()) && \