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
path: root/source
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2019-04-24 11:45:08 +0300
committerAntonioya <blendergit@gmail.com>2019-04-24 11:45:08 +0300
commit75919c9223431333d93b65f7dee4a39bc015832b (patch)
tree537f4c664b613aa35b9403ab5e65d8ba6a0f0a27 /source
parentd7672ad0f7f4f4bcf3cb13c72ff19425f3be9709 (diff)
GPencil: Add small offset to follow the drawing path for single points
The offset added allows to generate a vector to determine direction. This direction will be used when rotate the object to rotate texture. The solution is not 100% perfect, but it's far better that having an unpredictable rotation.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c8
1 files changed, 6 insertions, 2 deletions
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 ea33c004191..c1014bb5ca4 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -176,16 +176,20 @@ void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be,
/* use previous point to determine stroke direction */
bGPDspoint *pt2 = NULL;
+ float fpt[3];
if (i == 0) {
if (gps->totpoints > 1) {
/* extrapolate a point before first point */
- float fpt[3];
pt2 = &gps->points[1];
interp_v3_v3v3(fpt, &pt2->x, &pt->x, 1.5f);
GPU_vertbuf_attr_set(be->vbo, be->prev_pos_id, be->vbo_len, fpt);
}
else {
- GPU_vertbuf_attr_set(be->vbo, be->prev_pos_id, be->vbo_len, &pt->x);
+ /* add small offset to get a vector */
+ copy_v3_v3(fpt, &pt->x);
+ fpt[0] += 0.00001f;
+ fpt[1] += 0.00001f;
+ GPU_vertbuf_attr_set(be->vbo, be->prev_pos_id, be->vbo_len, fpt);
}
}
else {