Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-01-12 21:52:14 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-01-12 22:03:38 +0400
commitd785c64397bc6ec19cea0563fa1de982bdda28c6 (patch)
tree4645a9f4b7279016145be727378d84fcff302ae8 /source/blender/editors/gpencil/drawgpencil.c
parent190809d8abcd9780a69d8bb001dcf342111ee350 (diff)
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.
Diffstat (limited to 'source/blender/editors/gpencil/drawgpencil.c')
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c11
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);