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-27 16:27:00 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-04-27 16:28:30 +0300
commitcbaacc08dc51913141cf927139b3dc004af8df73 (patch)
tree26ef5332cbbcf1389449f8a93d66373e88ad54c1 /source/blender/editors/transform/transform_constraints.c
parentb649f53a62d7cbcad8c07a8827cbcae5db22775a (diff)
Getting rid of setlinestyle: transform code.
Note that I also made 'dash anchor point' consistent (the static one, not the mouse one), in previous code somtimes dashed were anchored to the static center point, in others, to the moving mouse position, the later was rather disturbing imho...
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r--source/blender/editors/transform/transform_constraints.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 328d6afb6a4..a2cb1bdd6d0 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -728,22 +728,34 @@ void drawConstraint(TransInfo *t)
if (depth_test_enabled)
glDisable(GL_DEPTH_TEST);
- unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ VertexFormat *format = immVertexFormat();
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 3, KEEP_FLOAT);
- immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- immUniformColor3ub(255, 255, 255);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
- setlinestyle(1);
+ immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_COLOR);
+
+ float viewport_size[4];
+ glGetFloatv(GL_VIEWPORT, viewport_size);
+ immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
+
+ immUniform4f("color1", 1.0f, 1.0f, 1.0f, 1.0f);
+ immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f);
+ immUniform1f("dash_width", 2.0f);
+ immUniform1f("dash_width_on", 1.0f);
immBegin(PRIM_LINES, 2);
+ immAttrib3fv(line_origin, t->center_global);
immVertex3fv(pos, t->center_global);
immVertex3fv(pos, vec);
immEnd();
- setlinestyle(0);
-
immUnbindProgram();
+ glDisable(GL_BLEND);
+
if (depth_test_enabled)
glEnable(GL_DEPTH_TEST);
}