[Bf-blender-cvs] [0d8a4528f72] greasepencil-refactor: GPencil: Refactor: Use stroke mask to cut dots shape
Clément Foucault
noreply at git.blender.org
Tue Dec 31 19:31:07 CET 2019
Commit: 0d8a4528f721e5e70aa85d23d5af650df994eb0d
Author: Clément Foucault
Date: Mon Dec 30 17:50:05 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB0d8a4528f721e5e70aa85d23d5af650df994eb0d
GPencil: Refactor: Use stroke mask to cut dots shape
This removes the builtin fading of the dots. This should be reimplemented
as a material option for all stroke type instead.
===================================================================
M source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
M source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
===================================================================
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
index fe15a603455..cc0fb0bf930 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
@@ -111,12 +111,6 @@ void main()
fragColor *= stroke_round_cap_mask();
- if (GP_FLAG_TEST(matFlag, GP_STROKE_DOTS)) {
- const float rad_sqr_inv = 1.0 / 0.25;
- float dist = 1.0 - rad_sqr_inv * length_squared(finalUvs - 0.5);
- fragColor *= clamp(dist, 0.0, 1.0);
- }
-
/* For compatibility with colored alpha buffer.
* Note that we are limited to mono-chromatic alpha blending here
* because of the blend equation and the limit of 1 color target
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
index a3c4b71ce2a..584ac0c0699 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
@@ -143,9 +143,11 @@ void stroke_vertex()
{
int m = int(ma1.x);
bool is_dot = false;
+ bool is_squares = false;
if (m != -1.0) {
is_dot = GP_FLAG_TEST(materials[m].flag, GP_STROKE_ALIGNMENT);
+ is_squares = !GP_FLAG_TEST(materials[m].flag, GP_STROKE_DOTS);
}
/* Enpoints, we discard the vertices. */
@@ -207,8 +209,9 @@ void stroke_vertex()
gl_Position.xy += (x * x_axis + y * y_axis) * sizeViewportInv.xy * thickness;
- strokePt1 = strokePt2 = vec2(0.0);
- strokeThickness = 1e18;
+ strokePt1 = ss1;
+ strokePt2 = ss1 + vec2(0.5, 0.0);
+ strokeThickness = (is_squares) ? 1e18 : (thickness / gl_Position.w);
}
else {
/* Mitter tangent vector. */
More information about the Bf-blender-cvs
mailing list