diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-08-10 02:47:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-08-10 02:59:12 +0300 |
commit | 1d6b99b157c40810cda903f455a4fa0720434674 (patch) | |
tree | 385c2749eec384800c4b85ef0d09b2311a468f14 /source/blender/editors/manipulator_library/manipulator_types | |
parent | 7cb65cc03833f1bda969a55f68983c542691be02 (diff) |
Cleanup: don't abbreviate color w/ manipulator API
Diffstat (limited to 'source/blender/editors/manipulator_library/manipulator_types')
5 files changed, 44 insertions, 40 deletions
diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c index 61fb7e45533..d8af351b4e3 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c @@ -101,13 +101,13 @@ static void arrow2d_draw_geom(wmManipulator *mpr, const float matrix[4][4], cons static void manipulator_arrow2d_draw(const bContext *UNUSED(C), wmManipulator *mpr) { - float col[4]; + float color[4]; - manipulator_color_get(mpr, mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT, col); + manipulator_color_get(mpr, mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT, color); glLineWidth(mpr->line_width); glEnable(GL_BLEND); - arrow2d_draw_geom(mpr, mpr->matrix_basis, col); + arrow2d_draw_geom(mpr, mpr->matrix_basis, color); glDisable(GL_BLEND); if (mpr->interaction_data) { diff --git a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c index 9ebdcb7fa33..11e9982fede 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c @@ -111,7 +111,7 @@ static void rect_transform_draw_corners( } static void rect_transform_draw_interaction( - const float col[4], const int highlighted, + const float color[4], const int highlighted, const float half_w, const float half_h, const float w, const float h, const float line_width) { @@ -168,26 +168,30 @@ static void rect_transform_draw_interaction( } Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + struct { + uint pos, col; + } attr_id = { + .pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT), + .col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT), + }; immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); glLineWidth(line_width + 3.0f); immBegin(GWN_PRIM_LINE_STRIP, 3); - immAttrib3f(color, 0.0f, 0.0f, 0.0f); - immVertex2fv(pos, verts[0]); - immVertex2fv(pos, verts[1]); - immVertex2fv(pos, verts[2]); + immAttrib3f(attr_id.col, 0.0f, 0.0f, 0.0f); + immVertex2fv(attr_id.pos, verts[0]); + immVertex2fv(attr_id.pos, verts[1]); + immVertex2fv(attr_id.pos, verts[2]); immEnd(); glLineWidth(line_width); immBegin(GWN_PRIM_LINE_STRIP, 3); - immAttrib3fv(color, col); - immVertex2fv(pos, verts[0]); - immVertex2fv(pos, verts[1]); - immVertex2fv(pos, verts[2]); + immAttrib3fv(attr_id.col, color); + immVertex2fv(attr_id.pos, verts[0]); + immVertex2fv(attr_id.pos, verts[1]); + immVertex2fv(attr_id.pos, verts[2]); immEnd(); immUnbindProgram(); @@ -242,10 +246,10 @@ static void manipulator_rect_transform_draw_intern( /* corner manipulators */ { - float col[4]; - manipulator_color_get(mpr, highlight, col); + float color[4]; + manipulator_color_get(mpr, highlight, color); glLineWidth(mpr->line_width); - rect_transform_draw_corners(&r, w, h, col); + rect_transform_draw_corners(&r, w, h, color); } if (select) { diff --git a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c index 0e8b8722b34..f7511c581ed 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c @@ -110,7 +110,7 @@ static void dial_calc_matrix(const wmManipulator *mpr, float mat[4][4]) /* -------------------------------------------------------------------- */ static void dial_geom_draw( - const wmManipulator *mpr, const float col[4], const bool select, + const wmManipulator *mpr, const float color[4], const bool select, float axis_modal_mat[4][4], float clip_plane[4]) { #ifdef USE_MANIPULATOR_CUSTOM_DIAL @@ -135,7 +135,7 @@ static void dial_geom_draw( immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); } - immUniformColor4fv(col); + immUniformColor4fv(color); if (filled) { imm_draw_circle_fill(pos, 0, 0, 1.0, DIAL_RESOLUTION); @@ -153,7 +153,7 @@ static void dial_geom_draw( /** * Draws a line from (0, 0, 0) to \a co_outer, at \a angle. */ -static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[3], const float col[4]) +static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[3], const float color[4]) { glLineWidth(1.0f); @@ -164,7 +164,7 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[ immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - immUniformColor4fv(col); + immUniformColor4fv(color); immBegin(GWN_PRIM_LINE_STRIP, 2); immVertex3f(pos, 0.0f, 0.0f, 0.0f); @@ -274,11 +274,11 @@ static void dial_draw_intern( { float matrix_basis_adjust[4][4]; float matrix_final[4][4]; - float col[4]; + float color[4]; BLI_assert(CTX_wm_area(C)->spacetype == SPACE_VIEW3D); - manipulator_color_get(mpr, highlight, col); + manipulator_color_get(mpr, highlight, color); dial_calc_matrix(mpr, matrix_basis_adjust); @@ -311,8 +311,8 @@ static void dial_draw_intern( for (int i = 0; i < 2; i++) { dial_ghostarc_draw(mpr, angle_ofs, angle_delta, (const float [4]){0.8f, 0.8f, 0.8f, 0.4f}); - dial_ghostarc_draw_helpline(angle_ofs, co_outer, col); /* starting position */ - dial_ghostarc_draw_helpline(angle_ofs + angle_delta, co_outer, col); /* starting position + current value */ + dial_ghostarc_draw_helpline(angle_ofs, co_outer, color); /* starting position */ + dial_ghostarc_draw_helpline(angle_ofs + angle_delta, co_outer, color); /* starting position + current value */ if (i == 0) { const int draw_options = RNA_enum_get(mpr->ptr, "draw_options"); @@ -326,7 +326,7 @@ static void dial_draw_intern( } /* draw actual dial manipulator */ - dial_geom_draw(mpr, col, select, matrix_basis_adjust, clip_plane); + dial_geom_draw(mpr, color, select, matrix_basis_adjust, clip_plane); gpuPopMatrix(); } diff --git a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c index e39b26078c9..7a002a9cfc8 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c @@ -87,7 +87,7 @@ typedef struct GrabInteraction { /* -------------------------------------------------------------------- */ static void grab_geom_draw( - const wmManipulator *mpr, const float col[4], const bool select) + const wmManipulator *mpr, const float color[4], const bool select) { #ifdef USE_MANIPULATOR_CUSTOM_DIAL UNUSED_VARS(grab3d, col, axis_modal_mat); @@ -104,7 +104,7 @@ static void grab_geom_draw( immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - immUniformColor4fv(col); + immUniformColor4fv(color); if (draw_style == ED_MANIPULATOR_GRAB_STYLE_RING_2D) { if (filled) { @@ -154,10 +154,10 @@ static void grab3d_draw_intern( const bContext *UNUSED(C), wmManipulator *mpr, const bool select, const bool highlight) { - float col[4]; + float color[4]; float matrix_final[4][4]; - manipulator_color_get(mpr, highlight, col); + manipulator_color_get(mpr, highlight, color); WM_manipulator_calc_matrix_final(mpr, matrix_final); @@ -165,7 +165,7 @@ static void grab3d_draw_intern( gpuMultMatrix(matrix_final); glEnable(GL_BLEND); - grab_geom_draw(mpr, col, select); + grab_geom_draw(mpr, color, select); glDisable(GL_BLEND); gpuPopMatrix(); diff --git a/source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c index d7378f9dedb..fc9b08b31cf 100644 --- a/source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c +++ b/source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c @@ -88,13 +88,13 @@ static void manipulator_primitive_draw_intern( wmManipulator *mpr, const bool UNUSED(select), const bool highlight) { - float col_inner[4], col_outer[4]; + float color_inner[4], color_outer[4]; float matrix_final[4][4]; const int draw_style = RNA_enum_get(mpr->ptr, "draw_style"); - manipulator_color_get(mpr, highlight, col_outer); - copy_v4_v4(col_inner, col_outer); - col_inner[3] *= 0.5f; + manipulator_color_get(mpr, highlight, color_outer); + copy_v4_v4(color_inner, color_outer); + color_inner[3] *= 0.5f; WM_manipulator_calc_matrix_final(mpr, matrix_final); @@ -102,7 +102,7 @@ static void manipulator_primitive_draw_intern( gpuMultMatrix(matrix_final); glEnable(GL_BLEND); - manipulator_primitive_draw_geom(col_inner, col_outer, draw_style); + manipulator_primitive_draw_geom(color_inner, color_outer, draw_style); glDisable(GL_BLEND); gpuPopMatrix(); @@ -110,9 +110,9 @@ static void manipulator_primitive_draw_intern( if (mpr->interaction_data) { ManipulatorInteraction *inter = mpr->interaction_data; - copy_v4_fl(col_inner, 0.5f); - copy_v3_fl(col_outer, 0.5f); - col_outer[3] = 0.8f; + copy_v4_fl(color_inner, 0.5f); + copy_v3_fl(color_outer, 0.5f); + color_outer[3] = 0.8f; WM_manipulator_calc_matrix_final_params( mpr, &((struct WM_ManipulatorMatrixParams) { @@ -124,7 +124,7 @@ static void manipulator_primitive_draw_intern( gpuMultMatrix(matrix_final); glEnable(GL_BLEND); - manipulator_primitive_draw_geom(col_inner, col_outer, draw_style); + manipulator_primitive_draw_geom(color_inner, color_outer, draw_style); glDisable(GL_BLEND); gpuPopMatrix(); |