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:
authorBastien Montagne <montagne29@wanadoo.fr>2017-04-26 21:51:17 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-04-26 21:57:18 +0300
commit224f148e224086c61e819525cd811572d4383ad1 (patch)
treef7c7592582f1f05c150b6c4a6d220aad181859ef /source/blender/editors/space_view3d/view3d_ruler.c
parent795e839d3b3ab473677624a22ae791cb6c82482d (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/view3d_ruler.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c18
1 files changed, 12 insertions, 6 deletions
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);