diff options
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index bb0a753d9c6..294a50909cb 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -206,18 +206,21 @@ static void gp_draw_stroke_point(bGPDspoint *points, short thickness, short dfla static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness, short debug) { bGPDspoint *pt; - float oldpressure = 0.0f; + float curpressure = points[0].pressure; int i; /* draw stroke curve */ + glLineWidth(curpressure * thickness); glBegin(GL_LINE_STRIP); for (i = 0, pt = points; i < totpoints && pt; i++, pt++) { /* if there was a significant pressure change, stop the curve, change the thickness of the stroke, * and continue drawing again (since line-width cannot change in middle of GL_LINE_STRIP) + * Note: we want more visible levels of pressures when thickness is bigger. */ - if (fabsf(pt->pressure - oldpressure) > 0.2f) { + if (fabsf(pt->pressure - curpressure) > 0.2f / (float)thickness) { glEnd(); - glLineWidth(pt->pressure * thickness); + curpressure = pt->pressure; + glLineWidth(curpressure * thickness); glBegin(GL_LINE_STRIP); /* need to roll-back one point to ensure that there are no gaps in the stroke */ @@ -225,8 +228,6 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness /* now the point we want... */ glVertex3fv(&pt->x); - - oldpressure = pt->pressure; } else { glVertex3fv(&pt->x); |