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_view3d | |
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_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 9 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ruler.c | 18 |
2 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index df4723f3df3..1490de0fb48 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -596,7 +596,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); - immUniform1f("view_scale", 1.0f); + float viewport_size[4]; + glGetFloatv(GL_VIEWPORT, viewport_size); + immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); + immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f); immUniform1f("dash_width", 6.0f); immUniform1f("dash_width_on", 3.0f); @@ -770,7 +773,9 @@ static void drawrenderborder(ARegion *ar, View3D *v3d) immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); - immUniform1f("view_scale", 1.0f); + float viewport_size[4]; + glGetFloatv(GL_VIEWPORT, viewport_size); + immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); immUniform4f("color1", 1.0f, 0.25f, 0.25f, 1.0f); immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f); diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 11579e6a670..9bdc75802ba 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -465,11 +465,14 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); - immUniform1f("view_scale", 1.0f); + float viewport_size[4]; + glGetFloatv(GL_VIEWPORT, viewport_size); + immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); + immUniform4f("color1", 0.67f, 0.67f, 0.67f, 1.0f); immUniform4fv("color2", is_act ? color_act : color_base); - immUniform1f("dash_width", 8.0f); - immUniform1f("dash_width_on", 4.0f); + immUniform1f("dash_width", 6.0f); + immUniform1f("dash_width_on", 3.0f); immBegin(PRIM_LINES, 4); @@ -611,11 +614,14 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); - immUniform1f("view_scale", 1.0f); + float viewport_size[4]; + glGetFloatv(GL_VIEWPORT, viewport_size); + immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); + immUniform4f("color1", 0.67f, 0.67f, 0.67f, 1.0f); immUniform4fv("color2", is_act ? color_act : color_base); - immUniform1f("dash_width", 8.0f); - immUniform1f("dash_width_on", 4.0f); + immUniform1f("dash_width", 6.0f); + immUniform1f("dash_width_on", 3.0f); immBegin(PRIM_LINES, 2); |