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 13:04:35 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-04-26 13:04:35 +0300
commit621b8bdf86412786e561a5e25fb7583ed61e2b0d (patch)
treecbd5b5373c10424abef88d90d576fc2a79cd6866 /source/blender/windowmanager/intern/wm_gesture.c
parent80b49c15217f0f1b37bd195ccec5c59f54d167ab (diff)
Tweak 2D line dashed shader to take a scale parameter.
Even though in some cases this does not seems useful, in others (like zommed 2D views) we have to correct MVP matrix scaling to get fixed dashes size. Note that we could do that differently (commented about it in shader), would also have been cleaner to extract that MVP scale from within the shader, but there does not seem to be a way to initialize uniform values from within a shader, and would rather avoid recomputing the scale for every run (especially since 3DViewport does not need it e.g.). Part of D2647.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_gesture.c')
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 84c98f4071d..38b843772ab 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -178,6 +178,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
+ immUniform1f("view_scale", 1.0f);
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);
@@ -240,6 +241,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
+ immUniform1f("view_scale", 1.0f);
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);
@@ -301,6 +303,7 @@ static void wm_gesture_draw_circle(wmGesture *gt)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
+ immUniform1f("view_scale", 1.0f);
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);
@@ -401,7 +404,7 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
numverts++;
}
- /* Nothing to drawe, do early output. */
+ /* Nothing to draw, do early output. */
if (numverts < 2) {
return;
}
@@ -412,6 +415,7 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
+ immUniform1f("view_scale", 1.0f);
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);
@@ -456,6 +460,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
+ immUniform1f("view_scale", 1.0f);
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);