Fix T70077: GPenci Controls points are not displayed in right location

The problem was the unit matrix was not set in the uniform variable.
This commit is contained in:
Antonio Vazquez 2019-09-19 16:38:03 +02:00
parent d0c772f68b
commit 1bf0384111
Notes: blender-bot 2023-02-14 05:01:20 +01:00
Referenced by issue #70077, GPencil: Controls points are not displayed in right location
1 changed files with 5 additions and 3 deletions

View File

@ -1568,6 +1568,9 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
gp_style = BKE_material_gpencil_settings_get(ob, ob->actcol);
}
static float unit_mat[4][4] = {
{1.0, 0.0, 0.0, 0.0}, {0.0, 1.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}};
/* drawing strokes */
/* 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)
@ -1584,9 +1587,6 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
copy_v2_v2(stl->storage->gradient_s, brush->gpencil_settings->gradient_s);
stl->storage->alignment_mode = (gp_style) ? gp_style->alignment_mode : GP_STYLE_FOLLOW_PATH;
static float unit_mat[4][4] = {
{1.0, 0.0, 0.0, 0.0}, {0.0, 1.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}};
/* if only one point, don't need to draw buffer because the user has no time to see it */
if (gpd->runtime.sbuffer_used > 1) {
if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
@ -1682,6 +1682,8 @@ void gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
DRWShadingGroup *shgrp = DRW_shgroup_create(e_data->gpencil_edit_point_sh, psl->drawing_pass);
const float *viewport_size = DRW_viewport_size_get();
DRW_shgroup_uniform_vec2(shgrp, "Viewport", viewport_size, 1);
DRW_shgroup_uniform_mat4(shgrp, "gpModelMatrix", unit_mat);
/* Disable stencil for this type */
DRW_shgroup_state_disable(shgrp, DRW_STATE_WRITE_STENCIL | DRW_STATE_STENCIL_NEQUAL);
stl->g_data->batch_buffer_ctrlpoint = gpencil_get_buffer_ctrlpoint_geom(gpd);