Fix T57835: Textured-fill layer opacity not working

This was an unsupported feature.
This commit is contained in:
Antonioya
2018-11-18 16:28:57 +01:00
parent 5e61fd7c23
commit 1b7b1d60c5
2 changed files with 10 additions and 3 deletions

View File

@@ -279,7 +279,8 @@ static void DRW_gpencil_recalc_geometry_caches(Object *ob, MaterialGPencilStyle
/* create shading group for filling */
static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass,
GPUShader *shader, bGPdata *gpd, MaterialGPencilStyle *gp_style, int id)
GPUShader *shader, bGPdata *gpd, bGPDlayer *gpl,
MaterialGPencilStyle *gp_style, int id)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
@@ -330,6 +331,7 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
DRW_shgroup_uniform_vec2(grp, "texture_scale", gp_style->texture_scale, 1);
DRW_shgroup_uniform_vec2(grp, "texture_offset", gp_style->texture_offset, 1);
DRW_shgroup_uniform_float(grp, "texture_opacity", &gp_style->texture_opacity, 1);
DRW_shgroup_uniform_float(grp, "layer_opacity", &gpl->opacity, 1);
stl->shgroups[id].texture_mix = gp_style->flag & GP_STYLE_COLOR_TEX_MIX ? 1 : 0;
DRW_shgroup_uniform_int(grp, "texture_mix", &stl->shgroups[id].texture_mix, 1);
@@ -841,7 +843,8 @@ static void gpencil_draw_strokes(
(gp_style->flag & GP_STYLE_FILL_SHOW))
{
stl->shgroups[id].shgrps_fill = DRW_gpencil_shgroup_fill_create(
e_data, vedata, psl->stroke_pass, e_data->gpencil_fill_sh, gpd, gp_style, id);
e_data, vedata, psl->stroke_pass, e_data->gpencil_fill_sh,
gpd, gpl, gp_style, id);
}
else {
stl->shgroups[id].shgrps_fill = NULL;

View File

@@ -15,6 +15,7 @@ uniform int texture_mix;
uniform int texture_flip;
uniform float texture_opacity;
uniform int xraymode;
uniform float layer_opacity;
uniform sampler2D myTexture;
uniform int texture_clamp;
@@ -66,6 +67,7 @@ void set_color(in vec4 color, in vec4 color2, in vec4 tcolor, in float mixv, in
ocolor = (flip == 0) ? mix(color, color2, factor) : mix(color2, color, factor);
}
}
ocolor.a *= layer_opacity;
}
void main()
@@ -115,15 +117,17 @@ void main()
}
/* mix with texture */
fragColor = (texture_mix == 1) ? mix(chesscolor, text_color, mix_factor) : chesscolor;
fragColor.a *= layer_opacity;
}
/* texture */
if (fill_type == TEXTURE) {
fragColor = (texture_mix == 1) ? mix(text_color, finalColor, mix_factor) : text_color;
fragColor.a *= layer_opacity;
}
/* pattern */
if (fill_type == PATTERN) {
fragColor = finalColor;
fragColor.a = min(text_color.a, finalColor.a);
fragColor.a = min(text_color.a, finalColor.a) * layer_opacity;
}
}