Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_panel.c
| Context not available. | |||||
| #include "UI_interface_icons.h" | #include "UI_interface_icons.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "GPU_immediate.h" | |||||
| #include "interface_intern.h" | #include "interface_intern.h" | ||||
| /*********************** defines and structs ************************/ | /*********************** defines and structs ************************/ | ||||
| Context not available. | |||||
| int mode, float minx, float miny, float maxx, float maxy, float rad, | int mode, float minx, float miny, float maxx, float maxy, float rad, | ||||
| int roundboxtype, | int roundboxtype, | ||||
| const bool use_highlight, const bool use_shadow, | const bool use_highlight, const bool use_shadow, | ||||
| const unsigned char highlight_fade[3], | const unsigned char highlight_fade[3]) | ||||
| const unsigned char col[3]) | |||||
| { | { | ||||
| float vec[4][2] = { | float vec[4][2] = { | ||||
| {0.195, 0.02}, | {0.195, 0.02}, | ||||
| Context not available. | |||||
| {0.98, 0.805}}; | {0.98, 0.805}}; | ||||
| int a; | int a; | ||||
| VertexFormat *format = immVertexFormat(); | |||||
| unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | |||||
| unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); | |||||
| /* mult */ | /* mult */ | ||||
| for (a = 0; a < 4; a++) { | for (a = 0; a < 4; a++) { | ||||
| mul_v2_fl(vec[a], rad); | mul_v2_fl(vec[a], rad); | ||||
| } | } | ||||
| if (mode == GL_POLYGON) { | glBegin(mode); | ||||
| mode = GL_TRIANGLE_FAN; | |||||
| } | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); | |||||
| immBeginAtMost(mode, 24); | |||||
| immAttrib3ubv(color, col); | |||||
| /* start with corner right-top */ | /* start with corner right-top */ | ||||
| if (use_highlight) { | if (use_highlight) { | ||||
| if (roundboxtype & UI_CNR_TOP_RIGHT) { | if (roundboxtype & UI_CNR_TOP_RIGHT) { | ||||
| immVertex2f(pos, maxx, maxy - rad); | glVertex2f(maxx, maxy - rad); | ||||
| for (a = 0; a < 4; a++) { | for (a = 0; a < 4; a++) { | ||||
| immVertex2f(pos, maxx - vec[a][1], maxy - rad + vec[a][0]); | glVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]); | ||||
| } | } | ||||
| immVertex2f(pos, maxx - rad, maxy); | glVertex2f(maxx - rad, maxy); | ||||
| } | } | ||||
| else { | else { | ||||
| immVertex2f(pos, maxx, maxy); | glVertex2f(maxx, maxy); | ||||
| } | } | ||||
| /* corner left-top */ | /* corner left-top */ | ||||
| if (roundboxtype & UI_CNR_TOP_LEFT) { | if (roundboxtype & UI_CNR_TOP_LEFT) { | ||||
| immVertex2f(pos, minx + rad, maxy); | glVertex2f(minx + rad, maxy); | ||||
| for (a = 0; a < 4; a++) { | for (a = 0; a < 4; a++) { | ||||
| immVertex2f(pos, minx + rad - vec[a][0], maxy - vec[a][1]); | glVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]); | ||||
| } | } | ||||
| immVertex2f(pos, minx, maxy - rad); | glVertex2f(minx, maxy - rad); | ||||
| } | } | ||||
| else { | else { | ||||
| immVertex2f(pos, minx, maxy); | glVertex2f(minx, maxy); | ||||
| } | } | ||||
| } | } | ||||
| if (use_highlight && !use_shadow) { | if (use_highlight && !use_shadow) { | ||||
| if (highlight_fade) { | if (highlight_fade) { | ||||
| immAttrib3ubv(color, highlight_fade); | glColor3ubv(highlight_fade); | ||||
| } | } | ||||
| immVertex2f(pos, minx, miny + rad); | glVertex2f(minx, miny + rad); | ||||
| immEnd(); | glEnd(); | ||||
| immUnbindProgram(); | |||||
| return; | return; | ||||
| } | } | ||||
| /* corner left-bottom */ | /* corner left-bottom */ | ||||
| if (roundboxtype & UI_CNR_BOTTOM_LEFT) { | if (roundboxtype & UI_CNR_BOTTOM_LEFT) { | ||||
| immVertex2f(pos, minx, miny + rad); | glVertex2f(minx, miny + rad); | ||||
| for (a = 0; a < 4; a++) { | for (a = 0; a < 4; a++) { | ||||
| immVertex2f(pos, minx + vec[a][1], miny + rad - vec[a][0]); | glVertex2f(minx + vec[a][1], miny + rad - vec[a][0]); | ||||
| } | } | ||||
| immVertex2f(pos, minx + rad, miny); | glVertex2f(minx + rad, miny); | ||||
| } | } | ||||
| else { | else { | ||||
| immVertex2f(pos, minx, miny); | glVertex2f(minx, miny); | ||||
| } | } | ||||
| /* corner right-bottom */ | /* corner right-bottom */ | ||||
| if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { | if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { | ||||
| immVertex2f(pos, maxx - rad, miny); | glVertex2f(maxx - rad, miny); | ||||
| for (a = 0; a < 4; a++) { | for (a = 0; a < 4; a++) { | ||||
| immVertex2f(pos, maxx - rad + vec[a][0], miny + vec[a][1]); | glVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]); | ||||
| } | } | ||||
| immVertex2f(pos, maxx, miny + rad); | glVertex2f(maxx, miny + rad); | ||||
| } | } | ||||
| else { | else { | ||||
| immVertex2f(pos, maxx, miny); | glVertex2f(maxx, miny); | ||||
| } | } | ||||
| immEnd(); | glEnd(); | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| Context not available. | |||||
| if (is_active) | if (is_active) | ||||
| #endif | #endif | ||||
| { | { | ||||
| glColor3ubv(is_active ? theme_col_tab_active : theme_col_tab_inactive); | |||||
| ui_panel_category_draw_tab(GL_POLYGON, rct->xmin, rct->ymin, rct->xmax, rct->ymax, | ui_panel_category_draw_tab(GL_POLYGON, rct->xmin, rct->ymin, rct->xmax, rct->ymax, | ||||
| tab_curve_radius - px, roundboxtype, true, true, NULL, | tab_curve_radius - px, roundboxtype, true, true, NULL); | ||||
| is_active ? theme_col_tab_active : theme_col_tab_inactive); | |||||
| /* tab outline */ | /* tab outline */ | ||||
| glColor3ubv(theme_col_tab_outline); | |||||
| ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px, | ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px, | ||||
| tab_curve_radius, roundboxtype, true, true, NULL, theme_col_tab_outline); | tab_curve_radius, roundboxtype, true, true, NULL); | ||||
| /* tab highlight (3d look) */ | /* tab highlight (3d look) */ | ||||
| glColor3ubv(is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive); | |||||
| ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, | ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, | ||||
| tab_curve_radius, roundboxtype, true, false, | tab_curve_radius, roundboxtype, true, false, | ||||
| is_active ? theme_col_back : theme_col_tab_inactive, | is_active ? theme_col_back : theme_col_tab_inactive); | ||||
| is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive); | |||||
| } | } | ||||
| /* tab blackline */ | /* tab blackline */ | ||||
| Context not available. | |||||