diff options
Diffstat (limited to 'source/blender/draw/engines/gpencil')
4 files changed, 16 insertions, 15 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 60b9f323e90..cc0c5e114bf 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c @@ -134,7 +134,7 @@ void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be, bGPDstroke *gps, short thickness, const float ink[4], - const bool follow) + const int follow_mode) { int totvertex = gps->totpoints; if (be->vbo == NULL) { @@ -178,7 +178,7 @@ void DRW_gpencil_get_point_geom(GpencilBatchCacheElem *be, /* use previous point to determine stroke direction */ bGPDspoint *pt2 = NULL; float fpt[3]; - if (!follow) { + if (follow_mode != GP_STYLE_FOLLOW_PATH) { /* add small offset to get a vector */ copy_v3_v3(fpt, &pt->x); fpt[0] += 0.00001f; diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 70fb6b57d42..5747de72d7a 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -725,8 +725,8 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, DRW_shgroup_uniform_float(grp, "mix_stroke_factor", &stl->shgroups[id].mix_stroke_factor, 1); /* lock rotation of dots and boxes */ - stl->shgroups[id].use_follow_path = (gp_style->flag & GP_STYLE_COLOR_LOCK_DOTS) ? 0 : 1; - DRW_shgroup_uniform_int(grp, "use_follow_path", &stl->shgroups[id].use_follow_path, 1); + stl->shgroups[id].follow_mode = gp_style->follow_mode; + DRW_shgroup_uniform_int(grp, "follow_mode", &stl->shgroups[id].follow_mode, 1); } else { stl->storage->obj_scale = 1.0f; @@ -758,7 +758,7 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, DRW_shgroup_uniform_float(grp, "mix_stroke_factor", &stl->storage->mix_stroke_factor, 1); /* lock rotation of dots and boxes */ - DRW_shgroup_uniform_int(grp, "use_follow_path", &stl->storage->use_follow_path, 1); + DRW_shgroup_uniform_int(grp, "follow_mode", &stl->storage->follow_mode, 1); } DRW_shgroup_uniform_vec4(grp, "colormix", gp_style->stroke_rgba, 1); @@ -870,7 +870,7 @@ static void gpencil_add_stroke_vertexdata(GpencilBatchCache *cache, float ink[4]; short sthickness; MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1); - const bool follow = ((gp_style) && (gp_style->flag & GP_STYLE_COLOR_LOCK_DOTS)) ? 0 : 1; + const int follow_mode = (gp_style) ? gp_style->follow_mode : GP_STYLE_FOLLOW_PATH; /* set color using base color, tint color and opacity */ if (cache->is_dirty) { @@ -920,7 +920,7 @@ static void gpencil_add_stroke_vertexdata(GpencilBatchCache *cache, else { /* create vertex data */ const int old_len = cache->b_point.vbo_len; - DRW_gpencil_get_point_geom(&cache->b_point, gps, sthickness, ink, follow); + DRW_gpencil_get_point_geom(&cache->b_point, gps, sthickness, ink, follow_mode); /* add to list of groups */ if (old_len < cache->b_point.vbo_len) { @@ -1491,7 +1491,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, /* save gradient info */ stl->storage->gradient_f = brush->gpencil_settings->gradient_f; copy_v2_v2(stl->storage->gradient_s, brush->gpencil_settings->gradient_s); - stl->storage->use_follow_path = (gp_style->flag & GP_STYLE_COLOR_LOCK_DOTS) ? 0 : 1; + stl->storage->follow_mode = (gp_style) ? gp_style->follow_mode : GP_STYLE_FOLLOW_PATH; /* if only one point, don't need to draw buffer because the user has no time to see it */ if (gpd->runtime.sbuffer_size > 1) { diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h index 83af4ebb2ad..b4df86b5a4c 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.h +++ b/source/blender/draw/engines/gpencil/gpencil_engine.h @@ -129,7 +129,7 @@ typedef struct GPENCIL_shgroup { int caps_mode[2]; float obj_scale; int xray_mode; - int use_follow_path; + int follow_mode; float gradient_f; float gradient_s[2]; @@ -182,7 +182,7 @@ typedef struct GPENCIL_Storage { float gradient_f; float gradient_s[2]; - int use_follow_path; + int follow_mode; float mix_stroke_factor; @@ -438,7 +438,7 @@ void DRW_gpencil_get_point_geom(struct GpencilBatchCacheElem *be, struct bGPDstroke *gps, short thickness, const float ink[4], - const bool follow); + const int follow_mode); void DRW_gpencil_get_stroke_geom(struct GpencilBatchCacheElem *be, struct bGPDstroke *gps, short thickness, diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl index e6eb638dd64..fed24665be5 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_geom.glsl @@ -1,6 +1,6 @@ uniform vec2 Viewport; uniform int xraymode; -uniform int use_follow_path; +uniform int follow_mode; layout(points) in; layout(triangle_strip, max_vertices = 4) out; @@ -20,6 +20,9 @@ out vec2 mTexCoord; #define M_2PI 6.28318530717958647692 /* 2*pi */ #define FALSE 0 +/* keep this definition equals to GP_STYLE_FOLLOW_NONE value */ +#define NONE 2 + /* project 3d point to 2d on screen space */ vec2 toScreenSpace(vec4 vertex) { @@ -69,11 +72,9 @@ float getAngle(vec2 pt0, vec2 pt1) return 0.0; } - /* disable, but keep for future follow modes - if (use_follow_path == FALSE) { + if (follow_mode == NONE) { return 0.0; } - */ /* default horizontal line (x-axis) in screen space */ vec2 v0 = vec2(1.0, 0.0); |