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:
Diffstat (limited to 'source/blender/draw/engines/gpencil')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c6
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_draw_utils.c9
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c2
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_shader_fx.c3
-rw-r--r--source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl6
5 files changed, 15 insertions, 11 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 18950f00823..d5f8d062593 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -375,7 +375,7 @@ GPUBatch *gpencil_get_buffer_stroke_geom(bGPdata *gpd, short thickness)
Object *ob = draw_ctx->obact;
tGPspoint *points = gpd->runtime.sbuffer;
- int totpoints = gpd->runtime.sbuffer_size;
+ int totpoints = gpd->runtime.sbuffer_used;
/* if cyclic needs more vertex */
int cyclic_add = (gpd->runtime.sbuffer_sflag & GP_STROKE_CYCLIC) ? 1 : 0;
int totvertex = totpoints + cyclic_add + 2;
@@ -477,7 +477,7 @@ GPUBatch *gpencil_get_buffer_point_geom(bGPdata *gpd, short thickness)
Object *ob = draw_ctx->obact;
tGPspoint *points = gpd->runtime.sbuffer;
- int totpoints = gpd->runtime.sbuffer_size;
+ int totpoints = gpd->runtime.sbuffer_used;
static GPUVertFormat format = {0};
static uint pos_id, color_id, thickness_id, uvdata_id, prev_pos_id;
@@ -621,7 +621,7 @@ GPUBatch *gpencil_get_buffer_fill_geom(bGPdata *gpd)
}
const tGPspoint *points = gpd->runtime.sbuffer;
- int totpoints = gpd->runtime.sbuffer_size;
+ int totpoints = gpd->runtime.sbuffer_used;
if (totpoints < 3) {
return NULL;
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 181d2efbabb..2892d0dbbaa 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1456,7 +1456,8 @@ void gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
/* Check if stencil is required */
static bool gpencil_is_stencil_required(MaterialGPencilStyle *gp_style)
{
- return (bool)(gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID);
+ return (bool)((gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID) &&
+ ((gp_style->flag & GP_STYLE_DISABLE_STENCIL) == 0));
}
/* draw stroke in drawing buffer */
@@ -1493,7 +1494,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
/* Check if may need to draw the active stroke cache, only if this layer is the active layer
* that is being edited. (Stroke buffer is currently stored in gp-data)
*/
- if (gpd->runtime.sbuffer_size > 0) {
+ if (gpd->runtime.sbuffer_used > 0) {
if ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) {
/* It should also be noted that sbuffer contains temporary point types
* i.e. tGPspoints NOT bGPDspoints
@@ -1506,7 +1507,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
stl->storage->alignment_mode = (gp_style) ? gp_style->alignment_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) {
+ if (gpd->runtime.sbuffer_used > 1) {
if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
stl->g_data->shgrps_drawing_stroke = gpencil_shgroup_stroke_create(
vedata,
@@ -1562,7 +1563,7 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
DRW_shgroup_call(
stl->g_data->shgrps_drawing_stroke, stl->g_data->batch_buffer_stroke, NULL);
- if ((gpd->runtime.sbuffer_size >= 3) &&
+ if ((gpd->runtime.sbuffer_used >= 3) &&
(gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
((gpd->runtime.sbuffer_sflag & GP_STROKE_NOFILL) == 0) &&
((brush->gpencil_settings->flag & GP_BRUSH_DISSABLE_LASSO) == 0) &&
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 5d7ec490fb6..16162645f3d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -430,7 +430,7 @@ void GPENCIL_cache_init(void *vedata)
/* need the original to avoid cow overhead while drawing */
bGPdata *gpd_orig = (bGPdata *)DEG_get_original_id(&obact_gpd->id);
if (((gpd_orig->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) &&
- (gpd_orig->runtime.sbuffer_size > 0) &&
+ (gpd_orig->runtime.sbuffer_used > 0) &&
((gpd_orig->flag & GP_DATA_STROKE_POLYGON) == 0) && !DRW_state_is_depth() &&
(stl->storage->background_ready == true)) {
stl->g_data->session_flag |= GP_DRW_PAINT_PAINTING;
diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index 306444303e2..0f4043ce278 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -463,12 +463,11 @@ static void gpencil_fx_shadow(ShaderFxData *fx,
DRW_shgroup_uniform_vec3(fx_shgrp, "loc", fxd->runtime.loc, 1);
}
- const int nowave = -1;
if (fxd->flag & FX_SHADOW_USE_WAVE) {
DRW_shgroup_uniform_int(fx_shgrp, "orientation", &fxd->orientation, 1);
}
else {
- DRW_shgroup_uniform_int(fx_shgrp, "orientation", &nowave, 1);
+ DRW_shgroup_uniform_int_copy(fx_shgrp, "orientation", -1);
}
DRW_shgroup_uniform_float(fx_shgrp, "amplitude", &fxd->amplitude, 1);
DRW_shgroup_uniform_float(fx_shgrp, "period", &fxd->period, 1);
diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
index b226d4f93bc..01d4fe40195 100644
--- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
@@ -42,7 +42,11 @@ void main()
vec2 tc = uv - center;
float dist = length(tc);
- float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / (loc.z * defaultpixsize)) :
+ float locpixsize = abs((loc.z * defaultpixsize));
+ if (locpixsize == 0) {
+ locpixsize = 1;
+ }
+ float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / locpixsize) :
(radius / defaultpixsize);
pxradius = max(pxradius, 1);