[Bf-blender-cvs] [a6d30c064df] greasepencil-refactor: GPencil: Refactor: Fix dot UV rotation at the end of strokes

Clément Foucault noreply at git.blender.org
Tue Dec 31 19:31:18 CET 2019


Commit: a6d30c064dffd8cfe3554c077aa76a317aa0baf6
Author: Clément Foucault
Date:   Mon Dec 30 20:49:59 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBa6d30c064dffd8cfe3554c077aa76a317aa0baf6

GPencil: Refactor: Fix dot UV rotation at the end of strokes

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

M	source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl

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

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
index 4cf332b8a1d..e3ab346c83f 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
@@ -182,7 +182,7 @@ void stroke_vertex()
   /* Screenspace Lines tangents. */
   float line_len;
   vec2 line = safe_normalize_len(ss2 - ss1, line_len);
-  vec2 line_adj = safe_normalize((x == -1.0) ? (ss1 - ss_adj) : (ss_adj - ss2));
+  vec2 line_adj = safe_normalize((use_curr) ? (ss1 - ss_adj) : (ss_adj - ss2));
 
   float thickness = abs((use_curr) ? thickness1 : thickness2);
   thickness = stroke_thickness_modulate(thickness);
@@ -190,11 +190,11 @@ void stroke_vertex()
   finalUvs = vec2(x, y) * 0.5 + 0.5;
 
   if (is_dot) {
-    vec2 x_axis;
-    vec2 y_axis;
     int alignement = materials[m].flag & GP_STROKE_ALIGNMENT;
+
+    vec2 x_axis;
     if (alignement == GP_STROKE_ALIGNMENT_STROKE) {
-      x_axis = line;
+      x_axis = (ma2.x == -1.0) ? line_adj : line;
     }
     else if (alignement == GP_STROKE_ALIGNMENT_OBJECT) {
       vec4 ndc_x = point_world_to_ndc(wpos1 + model_mat[0].xyz);
@@ -210,7 +210,7 @@ void stroke_vertex()
     float rot_cos = abs(uv1.w);
     x_axis = mat2(rot_cos, -rot_sin, rot_sin, rot_cos) * x_axis;
 
-    y_axis = rotate_90deg(x_axis);
+    vec2 y_axis = rotate_90deg(x_axis);
 
     gl_Position.xy += (x * x_axis + y * y_axis) * sizeViewportInv.xy * thickness;



More information about the Bf-blender-cvs mailing list