[Bf-blender-cvs] [6ebab4a90a9] greasepencil-object: Fix simple points drawing with line mode
Antonio Vazquez
noreply at git.blender.org
Thu Mar 22 16:20:45 CET 2018
Commit: 6ebab4a90a93f7ebdb57c39a668c72e0793b1008
Author: Antonio Vazquez
Date: Thu Mar 22 16:20:32 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB6ebab4a90a93f7ebdb57c39a668c72e0793b1008
Fix simple points drawing with line mode
If using line mode, simple points must be drawn with point shader, not line shader.
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 75fd24ce556..773450dbc9a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -786,7 +786,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
else {
stl->shgroups[id].shgrps_fill = NULL;
}
- if (gps->palcolor->mode == PAC_MODE_LINE) {
+ if ((gps->palcolor->mode == PAC_MODE_LINE) && (gps->totpoints > 1)) {
stl->shgroups[id].shgrps_stroke = DRW_gpencil_shgroup_stroke_create(e_data, vedata, psl->stroke_pass, e_data->gpencil_stroke_sh, ob, gpd, gps->palcolor, id, false);
}
else {
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 ad90a30af4a..0d6d2b22a55 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -8,6 +8,7 @@ out vec4 fragColor;
#define texture2D texture
+#define GPENCIL_MODE_LINE 0
#define GPENCIL_MODE_DOTS 1
#define GPENCIL_MODE_BOX 2
@@ -23,7 +24,7 @@ void main()
const float rad_squared = 0.25;
// round point with jaggy edges
- if ((mode == GPENCIL_MODE_DOTS) && (dist_squared > rad_squared))
+ if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared))
discard;
vec4 tmp_color = texture2D(myTexture, mTexCoord);
More information about the Bf-blender-cvs
mailing list