[Bf-blender-cvs] [d785c64] master: Fix T38124: Grease Pencil Line thickness
Bastien Montagne
noreply at git.blender.org
Sun Jan 12 19:03:27 CET 2014
Commit: d785c64397bc6ec19cea0563fa1de982bdda28c6
Author: Bastien Montagne
Date: Sun Jan 12 18:52:14 2014 +0100
https://developer.blender.org/rBd785c64397bc6ec19cea0563fa1de982bdda28c6
Fix T38124: Grease Pencil Line thickness
Issue was in GP draw code: line thickness was not initiated properly (and a null one makes OGL draw a unity-width line).
Also tweaked threshold (when to start a new, width-different OGL linestrip), to make it inversaly proportional to thickness
(so that now, it's 0.2 for a thickness of 1, 0.1 for a thickness of 2, etc.), avoids too big steps when using large thickness.
===================================================================
M source/blender/editors/gpencil/drawgpencil.c
===================================================================
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index bb0a753..294a509 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);
More information about the Bf-blender-cvs
mailing list