[Bf-blender-cvs] [6fead84d002] greasepencil-refactor: GPencil: Refactor: Fix issue with negative pressure

Clément Foucault noreply at git.blender.org
Tue Dec 31 19:31:13 CET 2019


Commit: 6fead84d002d08830e92262ec58e5265e669753b
Author: Clément Foucault
Date:   Mon Dec 30 18:52:56 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB6fead84d002d08830e92262ec58e5265e669753b

GPencil: Refactor: Fix issue with negative pressure

This happens to be a thing in some test file. Maybe at some point we will
patch them but for now we just fix the symptomes.

===================================================================

M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c

===================================================================

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 4aeffbd62a3..bebc81510ca 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -126,7 +126,7 @@ static void gpencil_buffer_add_point(
   /* Rotation are in [-90°..90°] range, so we can encode the sign of the angle + the cosine
    * because the cosine will always be positive. */
   vert->v_rot = cosf(pt->uv_rot) * signf(pt->uv_rot);
-  vert->thickness = gps->thickness * pt->pressure * (round_cap1 ? 1.0 : -1.0);
+  vert->thickness = max_ff(0.0f, gps->thickness * pt->pressure) * (round_cap1 ? 1.0 : -1.0);
   /* Tag endpoint material to -1 so they get discarded by vertex shader. */
   vert->mat = (is_endpoint) ? -1 : (gps->mat_nr % GPENCIL_MATERIAL_BUFFER_LEN);
 }



More information about the Bf-blender-cvs mailing list