diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-20 11:41:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-20 11:41:41 +0300 |
commit | da53eb3748b42a5d77e1074b767dbd64d79ccc4a (patch) | |
tree | 1d294d961d3d488feb91db49272150c2655c6139 /source/blender/editors/manipulator_library | |
parent | a3716f5945b4ea0451281e9ae4ba9e43d2793938 (diff) |
Manipulator: tweak shape drawing
Draw triangles over wire for a more subtle outline.
Diffstat (limited to 'source/blender/editors/manipulator_library')
-rw-r--r-- | source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c index 2951ad84c0d..ce6992e7ad9 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c @@ -114,8 +114,8 @@ static void button2d_draw_intern( /* We shouldn't need the +1, but a NULL char is set. */ char *polys = MEM_mallocN(polys_len + 1, __func__); RNA_property_string_get(mpr->ptr, prop, polys); - button->shape_batch[0] = GPU_batch_tris_from_poly_2d_encoded((uchar *)polys, polys_len, NULL); - button->shape_batch[1] = GPU_batch_wire_from_poly_2d_encoded((uchar *)polys, polys_len, NULL); + button->shape_batch[0] = GPU_batch_wire_from_poly_2d_encoded((uchar *)polys, polys_len, NULL); + button->shape_batch[1] = GPU_batch_tris_from_poly_2d_encoded((uchar *)polys, polys_len, NULL); MEM_freeN(polys); } } @@ -137,17 +137,17 @@ static void button2d_draw_intern( glEnable(GL_LINE_SMOOTH); glLineWidth(1.0f); for (uint i = 0; i < ARRAY_SIZE(button->shape_batch) && button->shape_batch[i]; i++) { + /* Invert line color for wire. */ + color[0] = 1.0f - color[0]; + color[1] = 1.0f - color[1]; + color[2] = 1.0f - color[2]; + GWN_batch_program_set_builtin(button->shape_batch[i], GPU_SHADER_2D_UNIFORM_COLOR); GWN_batch_uniform_4f(button->shape_batch[i], "color", UNPACK4(color)); GWN_batch_draw(button->shape_batch[i]); - if (i == 0) { - /* Invert line color. */ - color[0] = 1.0f - color[0]; - color[1] = 1.0f - color[1]; - color[2] = 1.0f - color[2]; - } } glDisable(GL_POLYGON_SMOOTH); + glDisable(GL_LINE_SMOOTH); gpuPopMatrix(); } else if (button->icon != ICON_NONE) { |