diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-26 21:51:17 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-26 21:57:18 +0300 |
commit | 224f148e224086c61e819525cd811572d4383ad1 (patch) | |
tree | f7c7592582f1f05c150b6c4a6d220aad181859ef /source/blender/editors/space_sequencer/sequencer_draw.c | |
parent | 795e839d3b3ab473677624a22ae791cb6c82482d (diff) |
2D dashed line shader: changed to use viewport side instead of scale.
The scale version was working(ish), but it was not really extendable to
a 3D line version of the shader.
Also note that sequencer view still keeps its 'UI scale' adaptation
(dashes grow together with UI scale setting). Would be nice to do that
everywhere ultimately imho, but nothing urgent here.
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_draw.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 0dcfe2d2076..6a9437bb892 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1033,10 +1033,6 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons glLineWidth(1.0f); /* border */ - float mvp[4][4]; - gpuGetModelViewProjectionMatrix(mvp); - const float view_scale = mat4_to_xy_scale(mvp) * (U.pixelsize * 72.0f); - VertexFormat *format = immVertexFormat(); unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); unsigned int line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); @@ -1047,13 +1043,15 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); - immUniform1f("view_scale", view_scale); + float viewport_size[4]; + glGetFloatv(GL_VIEWPORT, viewport_size); + immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); UI_GetThemeColor4fv(TH_BACK, color1); immUniform4fv("color1", color1); immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f); - immUniform1f("dash_width", 1.0f); - immUniform1f("dash_width_on", 0.5f); + immUniform1f("dash_width", 6.0f); + immUniform1f("dash_width_on", 3.0f); imm_draw_line_box_dashed(pos, line_origin, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f); |