GPencil: Disable Stroke Textures in Solid mode

When solid mode is enabled, but Texture mode is disabled, the color of the stroke must not use the texture.
This commit is contained in:
Antonioya
2019-04-24 11:27:34 +02:00
parent 75919c9223
commit 8ba4c38643
2 changed files with 19 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ uniform vec2 gradient_s;
uniform vec4 colormix;
uniform float mix_stroke_factor;
uniform int shading_type[2];
in vec4 mColor;
in vec2 mTexCoord;
@@ -23,6 +24,11 @@ out vec4 fragColor;
#define GPENCIL_COLOR_TEXTURE 1
#define GPENCIL_COLOR_PATTERN 2
#define OB_SOLID 3
#define V3D_SHADING_TEXTURE_COLOR 3
bool no_texture = (shading_type[0] == OB_SOLID) && (shading_type[1] != V3D_SHADING_TEXTURE_COLOR);
/* Function to check the point inside ellipse */
float check_ellipse_point(vec2 pt, vec2 radius)
{
@@ -62,11 +68,11 @@ void main()
vec4 tmp_color = texture2D(myTexture, mTexCoord);
/* Solid */
if (color_type == GPENCIL_COLOR_SOLID) {
if ((color_type == GPENCIL_COLOR_SOLID) || (no_texture)) {
fragColor = mColor;
}
/* texture */
if (color_type == GPENCIL_COLOR_TEXTURE) {
if ((color_type == GPENCIL_COLOR_TEXTURE) && (!no_texture)) {
vec4 text_color = texture2D(myTexture, mTexCoord);
if (mix_stroke_factor > 0.0) {
fragColor.rgb = mix(text_color.rgb, colormix.rgb, mix_stroke_factor);
@@ -80,7 +86,7 @@ void main()
fragColor.a = min(fragColor.a * mColor.a, fragColor.a);
}
/* pattern */
if (color_type == GPENCIL_COLOR_PATTERN) {
if ((color_type == GPENCIL_COLOR_PATTERN) && (!no_texture)) {
vec4 text_color = texture2D(myTexture, mTexCoord);
fragColor = mColor;
/* mult both alpha factor to use strength factor with color alpha limit */

View File

@@ -5,6 +5,7 @@ uniform float gradient_f;
uniform vec4 colormix;
uniform float mix_stroke_factor;
uniform int shading_type[2];
in vec4 mColor;
in vec2 mTexCoord;
@@ -21,6 +22,11 @@ out vec4 fragColor;
#define ENDCAP 1.0
#define OB_SOLID 3
#define V3D_SHADING_TEXTURE_COLOR 3
bool no_texture = (shading_type[0] == OB_SOLID) && (shading_type[1] != V3D_SHADING_TEXTURE_COLOR);
void main()
{
@@ -33,8 +39,8 @@ void main()
discard;
}
}
/* Solid */
if (color_type == GPENCIL_COLOR_SOLID) {
if ((color_type == GPENCIL_COLOR_SOLID) || (no_texture)) {
fragColor = tColor;
}
@@ -48,7 +54,7 @@ void main()
}
/* texture */
if (color_type == GPENCIL_COLOR_TEXTURE) {
if ((color_type == GPENCIL_COLOR_TEXTURE) && (!no_texture)) {
if (mix_stroke_factor > 0.0) {
fragColor.rgb = mix(text_color.rgb, colormix.rgb, mix_stroke_factor);
fragColor.a = text_color.a;
@@ -61,7 +67,7 @@ void main()
fragColor.a = min(fragColor.a * tColor.a, fragColor.a);
}
/* pattern */
if (color_type == GPENCIL_COLOR_PATTERN) {
if ((color_type == GPENCIL_COLOR_PATTERN) && (!no_texture)) {
fragColor = tColor;
/* mult both alpha factor to use strength factor with color alpha limit */
fragColor.a = min(text_color.a * tColor.a, tColor.a);