[Bf-blender-cvs] [c5fd6acfce6] blender2.8: Getting rid of setlinestyle: ed_util's pos-to-mouse dashed line.
Bastien Montagne
noreply at git.blender.org
Sat Apr 29 20:42:34 CEST 2017
Commit: c5fd6acfce6b332af220d17fb113e8a2ccaed131
Author: Bastien Montagne
Date: Sat Apr 29 19:40:32 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBc5fd6acfce6b332af220d17fb113e8a2ccaed131
Getting rid of setlinestyle: ed_util's pos-to-mouse dashed line.
===================================================================
M source/blender/editors/util/ed_util.c
===================================================================
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 0cb8f82f940..aa0d0faf4f5 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -318,21 +318,35 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info
const float mval_dst[2] = {win->eventstate->x - ar->winrct.xmin,
win->eventstate->y - ar->winrct.ymin};
- setlinestyle(3);
-
VertexFormat *format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint shdr_dashed_pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ uint shdr_dashed_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT);
+ float color1[4];
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
- immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- immUniformThemeColor(TH_VIEW_OVERLAY);
+ 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_VIEW_OVERLAY, color1);
+ immUniform4fv("color1", color1);
+ immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f);
+ immUniform1f("dash_width", 6.0f);
+ immUniform1f("dash_width_on", 3.0f);
immBegin(PRIM_LINES, 2);
- immVertex2fv(pos, mval_dst);
- immVertex2fv(pos, mval_src);
+ immAttrib2fv(shdr_dashed_origin, mval_src);
+ immVertex2fv(shdr_dashed_pos, mval_src);
+ immVertex2fv(shdr_dashed_pos, mval_dst);
immEnd();
+
immUnbindProgram();
- setlinestyle(0);
+ glDisable(GL_BLEND);
}
/**
More information about the Bf-blender-cvs
mailing list