Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_draw.c
| Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| /* swap */ | /* swap */ | ||||
| #define WIN_NONE_OK 0 | #define WIN_NONE_OK 0 | ||||
| #define WIN_BACK_OK 1 | #define WIN_BACK_OK 1 | ||||
| #define WIN_FRONT_OK 2 | #define WIN_FRONT_OK 2 | ||||
| #define WIN_BOTH_OK 3 | #define WIN_BOTH_OK 3 | ||||
| #define USE_TEXTURE_RECTANGLE 1 | |||||
| /* ******************* drawing, overlays *************** */ | /* ******************* drawing, overlays *************** */ | ||||
| static void wm_paintcursor_draw(bContext *C, ARegion *ar) | static void wm_paintcursor_draw(bContext *C, ARegion *ar) | ||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| if (wm->paintcursors.first) { | if (wm->paintcursors.first) { | ||||
| ▲ Show 20 Lines • Show All 328 Lines • ▼ Show 20 Lines | #endif | ||||
| glTexImage2D(triple->target, 0, GL_RGB8, triple->x, triple->y, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); | glTexImage2D(triple->target, 0, GL_RGB8, triple->x, triple->y, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); | ||||
| glBindTexture(triple->target, 0); | glBindTexture(triple->target, 0); | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* TODO: fix interface - T49861 */ | void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha) | ||||
| void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha, bool UNUSED(is_interlace)) | |||||
| { | { | ||||
| const int sizex = WM_window_pixels_x(win); | const int sizex = WM_window_pixels_x(win); | ||||
| const int sizey = WM_window_pixels_y(win); | const int sizey = WM_window_pixels_y(win); | ||||
| /* wmOrtho for the screen has this same offset */ | /* wmOrtho for the screen has this same offset */ | ||||
| float ratiox = sizex; | float ratiox = sizex; | ||||
| float ratioy = sizey; | float ratioy = sizey; | ||||
| float halfx = GLA_PIXEL_OFS; | float halfx = GLA_PIXEL_OFS; | ||||
| ▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| float fac = ED_region_blend_factor(ar); | float fac = ED_region_blend_factor(ar); | ||||
| /* region blend always is 1, except when blend timer is running */ | /* region blend always is 1, except when blend timer is running */ | ||||
| if (fac < 1.0f) { | if (fac < 1.0f) { | ||||
| wmSubWindowScissorSet(win, win->screen->mainwin, &ar->winrct, true); | wmSubWindowScissorSet(win, win->screen->mainwin, &ar->winrct, true); | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| wm_triple_draw_textures(win, triple, 1.0f - fac, false); | wm_triple_draw_textures(win, triple, 1.0f - fac); | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||
| } | } | ||||
| static void wm_method_draw_triple(bContext *C, wmWindow *win) | static void wm_method_draw_triple(bContext *C, wmWindow *win) | ||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| wmDrawData *dd, *dd_next, *drawdata = win->drawdata.first; | wmDrawData *dd, *dd_next, *drawdata = win->drawdata.first; | ||||
| bScreen *screen = win->screen; | bScreen *screen = win->screen; | ||||
| ScrArea *sa; | ScrArea *sa; | ||||
| ARegion *ar; | ARegion *ar; | ||||
| bool copytex = false; | bool copytex = false; | ||||
| if (drawdata && drawdata->triple) { | if (drawdata && drawdata->triple) { | ||||
| #if 0 /* why do we need to clear before overwriting? */ | #if 0 /* why do we need to clear before overwriting? */ | ||||
| glClearColor(1, 1, 0, 0); | glClearColor(1, 1, 0, 0); | ||||
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | ||||
| #endif | #endif | ||||
| wmSubWindowSet(win, screen->mainwin); | wmSubWindowSet(win, screen->mainwin); | ||||
| wm_triple_draw_textures(win, drawdata->triple, 1.0f, false); | wm_triple_draw_textures(win, drawdata->triple, 1.0f); | ||||
| } | } | ||||
| else { | else { | ||||
| /* we run it when we start OR when we turn stereo on */ | /* we run it when we start OR when we turn stereo on */ | ||||
| if (drawdata == NULL) { | if (drawdata == NULL) { | ||||
| drawdata = MEM_callocN(sizeof(wmDrawData), "wmDrawData"); | drawdata = MEM_callocN(sizeof(wmDrawData), "wmDrawData"); | ||||
| BLI_addhead(&win->drawdata, drawdata); | BLI_addhead(&win->drawdata, drawdata); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | if (drawdata && drawdata->triple) { | ||||
| if (id == 0) { | if (id == 0) { | ||||
| #if 0 /* why do we need to clear before overwriting? */ | #if 0 /* why do we need to clear before overwriting? */ | ||||
| glClearColor(0, 0, 0, 0); | glClearColor(0, 0, 0, 0); | ||||
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | ||||
| #endif | #endif | ||||
| wmSubWindowSet(win, screen->mainwin); | wmSubWindowSet(win, screen->mainwin); | ||||
| wm_triple_draw_textures(win, drawdata->triple, 1.0f, false); | wm_triple_draw_textures(win, drawdata->triple, 1.0f); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* we run it when we start OR when we turn stereo on */ | /* we run it when we start OR when we turn stereo on */ | ||||
| if (drawdata == NULL) { | if (drawdata == NULL) { | ||||
| drawdata = MEM_callocN(sizeof(wmDrawData), "wmDrawData"); | drawdata = MEM_callocN(sizeof(wmDrawData), "wmDrawData"); | ||||
| BLI_addtail(&win->drawdata, drawdata); | BLI_addtail(&win->drawdata, drawdata); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 358 Lines • Show Last 20 Lines | |||||