[Bf-blender-cvs] [549a547f548] greasepencil-refactor: GPencil: Refactor: Add Stroke dot UV random rotation support

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


Commit: 549a547f548bb891def773455d490eae121e7e07
Author: Clément Foucault
Date:   Mon Dec 30 18:44:38 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB549a547f548bb891def773455d490eae121e7e07

GPencil: Refactor: Add Stroke dot UV random rotation support

Note: This fixes a bug that was cropping the dots texture.

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

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 584ac0c0699..9bc861ea614 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
@@ -205,6 +205,11 @@ void stroke_vertex()
       x_axis = vec2(1.0, 0.0);
     }
 
+    /* Rotation: Encoded as Cos + Sin sign. */
+    float rot_sin = sqrt(1.0 - uv1.w * uv1.w) * sign(uv1.w);
+    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);
 
     gl_Position.xy += (x * x_axis + y * y_axis) * sizeViewportInv.xy * thickness;



More information about the Bf-blender-cvs mailing list