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:
authorFalk David <falkdavid@gmx.de>2021-04-21 13:16:16 +0300
committerFalk David <falkdavid@gmx.de>2021-04-21 13:16:32 +0300
commit183e3f6bb93e97a281a9bb2baf168631163577d0 (patch)
treeb4bb7cb1f723b82ff69251356a995f116600253c /source/blender/draw/intern/draw_cache_impl_gpencil.c
parentd17bff849d3fc2c5b2af27d9909aee13893d97d3 (diff)
Fix T86968: Last UV factor in cyclic strokes
The UV factor of the last point of a cyclic stroke was using the factor of the first point leading to unwanted scaling artifacts. The fix sets the uv factor of the last point to the currect value (last UV factor + length between last and first point). Reviewed By: antoniov, fclem Maniphest Tasks: T86968 Differential Revision: https://developer.blender.org/D10850
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_gpencil.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_gpencil.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c
index c07271a0d33..49b5e0fecd3 100644
--- a/source/blender/draw/intern/draw_cache_impl_gpencil.c
+++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c
@@ -348,7 +348,14 @@ static void gpencil_buffer_add_stroke(gpStrokeVert *verts,
}
/* Draw line to first point to complete the loop for cyclic strokes. */
if (is_cyclic) {
- gpencil_buffer_add_point(verts, cols, gps, &pts[0], v++, false);
+ gpencil_buffer_add_point(verts, cols, gps, &pts[0], v, false);
+ /* UV factor needs to be adjusted for the last point to not be equal to the UV factor of the
+ * first point. It should be the factor of the last point plus the distance from the last point
+ * to the first.
+ */
+ gpStrokeVert *vert = &verts[v];
+ vert->u_stroke = verts[v - 1].u_stroke + len_v3v3(&pts[pts_len - 1].x, &pts[0].x);
+ v++;
}
/* Last adjacency point (not drawn). */
adj_idx = (is_cyclic) ? 1 : max_ii(0, pts_len - 2);