[Bf-blender-cvs] [75919c92234] master: GPencil: Add small offset to follow the drawing path for single points
Antonioya
noreply at git.blender.org
Wed Apr 24 10:45:15 CEST 2019
Commit: 75919c9223431333d93b65f7dee4a39bc015832b
Author: Antonioya
Date: Wed Apr 24 10:45:08 2019 +0200
Branches: master
https://developer.blender.org/rB75919c9223431333d93b65f7dee4a39bc015832b
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.
===================================================================
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 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 {
More information about the Bf-blender-cvs
mailing list