Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_draw.c
| Context not available. | |||||
| /** | /** | ||||
| * Only for edge lines between areas, and the blended join arrows. | * Only for edge lines between areas, and the blended join arrows. | ||||
| */ | */ | ||||
| void ED_screen_draw(wmWindow *win) | void ED_screen_draw_edges(wmWindow *win) | ||||
| { | { | ||||
| bScreen *screen = WM_window_get_active_screen(win); | bScreen *screen = WM_window_get_active_screen(win); | ||||
| const int winsize_x = WM_window_pixels_x(win); | const int winsize_x = WM_window_pixels_x(win); | ||||
| const int winsize_y = WM_window_pixels_y(win); | const int winsize_y = WM_window_pixels_y(win); | ||||
| ScrArea *sa; | ScrArea *sa; | ||||
| ScrArea *sa1 = NULL; | |||||
| ScrArea *sa2 = NULL; | |||||
| ScrArea *sa3 = NULL; | |||||
| wmSubWindowSet(win, screen->mainwin); | wmSubWindowSet(win, screen->mainwin); | ||||
| Context not available. | |||||
| for (sa = screen->areabase.first; sa; sa = sa->next) { | for (sa = screen->areabase.first; sa; sa = sa->next) { | ||||
| drawscredge_area(sa, winsize_x, winsize_y, pos); | drawscredge_area(sa, winsize_x, winsize_y, pos); | ||||
| /* gather area split/join info */ | |||||
| if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa; | |||||
| if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa; | |||||
| if (sa->flag & (AREA_FLAG_DRAWSPLIT_H | AREA_FLAG_DRAWSPLIT_V)) sa3 = sa; | |||||
| } | } | ||||
| immUnbindProgram(); | |||||
| screen->do_draw = false; | |||||
| } | |||||
| void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2) | |||||
| { | |||||
| unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| glLineWidth(1); | |||||
| /* blended join arrow */ | /* blended join arrow */ | ||||
| if (sa1 && sa2) { | int dir = area_getorientation(sa1, sa2); | ||||
| int dir = area_getorientation(sa1, sa2); | int dira = -1; | ||||
| int dira = -1; | if (dir != -1) { | ||||
| if (dir != -1) { | switch (dir) { | ||||
| switch (dir) { | case 0: /* W */ | ||||
| case 0: /* W */ | dir = 'r'; | ||||
| dir = 'r'; | dira = 'l'; | ||||
| dira = 'l'; | break; | ||||
| break; | case 1: /* N */ | ||||
| case 1: /* N */ | dir = 'd'; | ||||
| dir = 'd'; | dira = 'u'; | ||||
| dira = 'u'; | break; | ||||
| break; | case 2: /* E */ | ||||
| case 2: /* E */ | dir = 'l'; | ||||
| dir = 'l'; | dira = 'r'; | ||||
| dira = 'r'; | break; | ||||
| break; | case 3: /* S */ | ||||
| case 3: /* S */ | dir = 'u'; | ||||
| dir = 'u'; | dira = 'd'; | ||||
| dira = 'd'; | break; | ||||
| break; | |||||
| } | |||||
| } | } | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| Context not available. | |||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||
| /* splitpoint */ | immUnbindProgram(); | ||||
| if (sa3) { | } | ||||
| glEnable(GL_BLEND); | |||||
| immUniformColor4ub(255, 255, 255, 100); | |||||
| immBegin(GWN_PRIM_LINES, 2); | void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) | ||||
| { | |||||
| unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) { | /* splitpoint */ | ||||
| immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y); | glEnable(GL_BLEND); | ||||
| immVertex2f(pos, sa3->totrct.xmax, win->eventstate->y); | immUniformColor4ub(255, 255, 255, 100); | ||||
| immEnd(); | immBegin(GWN_PRIM_LINES, 2); | ||||
| immUniformColor4ub(0, 0, 0, 100); | if (dir == 'h') { | ||||
| float y = (1 - fac) * sa->totrct.ymin + fac * sa->totrct.ymax; | |||||
| immBegin(GWN_PRIM_LINES, 2); | immVertex2f(pos, sa->totrct.xmin, y); | ||||
| immVertex2f(pos, sa->totrct.xmax, y); | |||||
| immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y + 1); | immEnd(); | ||||
| immVertex2f(pos, sa3->totrct.xmax, win->eventstate->y + 1); | |||||
| } | immUniformColor4ub(0, 0, 0, 100); | ||||
| else { | |||||
| immVertex2f(pos, win->eventstate->x, sa3->totrct.ymin); | |||||
| immVertex2f(pos, win->eventstate->x, sa3->totrct.ymax); | |||||
| immEnd(); | immBegin(GWN_PRIM_LINES, 2); | ||||
| immUniformColor4ub(0, 0, 0, 100); | immVertex2f(pos, sa->totrct.xmin, y + 1); | ||||
| immVertex2f(pos, sa->totrct.xmax, y + 1); | |||||
| immBegin(GWN_PRIM_LINES, 2); | immEnd(); | ||||
| } | |||||
| else { | |||||
| BLI_assert(dir == 'v'); | |||||
| float x = (1 - fac) * sa->totrct.xmin + fac * sa->totrct.xmax; | |||||
| immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymin); | immVertex2f(pos, x, sa->totrct.ymin); | ||||
| immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymax); | immVertex2f(pos, x, sa->totrct.ymax); | ||||
| } | |||||
| immEnd(); | immEnd(); | ||||
| glDisable(GL_BLEND); | immUniformColor4ub(0, 0, 0, 100); | ||||
| immBegin(GWN_PRIM_LINES, 2); | |||||
| immVertex2f(pos, x + 1, sa->totrct.ymin); | |||||
| immVertex2f(pos, x + 1, sa->totrct.ymax); | |||||
| immEnd(); | |||||
| } | } | ||||
| immUnbindProgram(); | glDisable(GL_BLEND); | ||||
| screen->do_draw = false; | immUnbindProgram(); | ||||
| } | } | ||||
| Context not available. | |||||