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/windowmanager/intern/wm_gesture.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/windowmanager/intern/wm_gesture.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index cfe62846bfd..0ee0e415782 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -178,7 +178,10 @@ static void wm_gesture_draw_line(wmGesture *gt) 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.4f, 0.4f, 0.4f, 1.0f); immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f); immUniform1f("dash_width", 8.0f); @@ -223,7 +226,10 @@ static void wm_gesture_draw_rect(wmGesture *gt) 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.4f, 0.4f, 0.4f, 1.0f); immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f); immUniform1f("dash_width", 8.0f); @@ -285,7 +291,10 @@ static void wm_gesture_draw_circle(wmGesture *gt) 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.4f, 0.4f, 0.4f, 1.0f); immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f); immUniform1f("dash_width", 4.0f); @@ -397,7 +406,10 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled) 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.4f, 0.4f, 0.4f, 1.0f); immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f); immUniform1f("dash_width", 2.0f); @@ -442,7 +454,10 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt) 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.4f, 0.4f, 0.4f, 1.0f); immUniform4f("color2", 1.0f, 1.0f, 1.0f, 1.0f); immUniform1f("dash_width", 8.0f); |