[Bf-blender-cvs] [8ba4c38643e] master: GPencil: Disable Stroke Textures in Solid mode

Antonioya noreply at git.blender.org
Wed Apr 24 11:27:45 CEST 2019


Commit: 8ba4c38643efeda42391f23328a54f258adcc9cd
Author: Antonioya
Date:   Wed Apr 24 11:27:34 2019 +0200
Branches: master
https://developer.blender.org/rB8ba4c38643efeda42391f23328a54f258adcc9cd

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.

===================================================================

M	source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
M	source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl

===================================================================

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
index b7206ac2e80..7054717b8d6 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -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 */
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
index 8964bee69ff..3110f975cc6 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -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);



More information about the Bf-blender-cvs mailing list