Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_draw.c
| Show First 20 Lines • Show All 638 Lines • ▼ Show 20 Lines | #else | ||||
| int w = BLI_rcti_size_x(rect); | int w = BLI_rcti_size_x(rect); | ||||
| int h = BLI_rcti_size_y(rect); | int h = BLI_rcti_size_y(rect); | ||||
| /* scissor doesn't seem to be doing the right thing...? */ | /* scissor doesn't seem to be doing the right thing...? */ | ||||
| #if 0 | #if 0 | ||||
| /* prevent drawing outside widget area */ | /* prevent drawing outside widget area */ | ||||
| GLint scissor[4]; | GLint scissor[4]; | ||||
| glGetIntegerv(GL_SCISSOR_BOX, scissor); | glGetIntegerv(GL_SCISSOR_BOX, scissor); | ||||
| glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h); | glScissor(rect->xmin, rect->ymin, w, h); | ||||
| #endif | #endif | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| if (w != ibuf->x || h != ibuf->y) { | if (w != ibuf->x || h != ibuf->y) { | ||||
| facx = (float)w / (float)ibuf->x; | facx = (float)w / (float)ibuf->x; | ||||
| facy = (float)h / (float)ibuf->y; | facy = (float)h / (float)ibuf->y; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | else { | ||||
| immEnd(); | immEnd(); | ||||
| } | } | ||||
| glDisable(GL_LINE_SMOOTH); | glDisable(GL_LINE_SMOOTH); | ||||
| } | } | ||||
| #define HISTOGRAM_TOT_GRID_LINES 4 | #define HISTOGRAM_TOT_GRID_LINES 4 | ||||
| void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| { | { | ||||
| Histogram *hist = (Histogram *)but->poin; | Histogram *hist = (Histogram *)but->poin; | ||||
| int res = hist->x_resolution; | int res = hist->x_resolution; | ||||
| const bool is_line = (hist->flag & HISTO_FLAG_LINE) != 0; | const bool is_line = (hist->flag & HISTO_FLAG_LINE) != 0; | ||||
| rctf rect = { | rctf rect = { | ||||
| .xmin = (float)recti->xmin + 1, | .xmin = (float)recti->xmin + 1, | ||||
| .xmax = (float)recti->xmax - 1, | .xmax = (float)recti->xmax - 1, | ||||
| Show All 10 Lines | void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| float color[4]; | float color[4]; | ||||
| UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); | UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); | ||||
| UI_draw_roundbox_corner_set(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | ||||
| /* need scissor test, histogram can draw outside of boundary */ | /* need scissor test, histogram can draw outside of boundary */ | ||||
| GLint scissor[4]; | GLint scissor[4]; | ||||
| glGetIntegerv(GL_SCISSOR_BOX, scissor); | glGetIntegerv(GL_SCISSOR_BOX, scissor); | ||||
| glScissor(ar->winrct.xmin + (rect.xmin - 1), | glScissor((rect.xmin - 1), | ||||
| ar->winrct.ymin + (rect.ymin - 1), | (rect.ymin - 1), | ||||
| (rect.xmax + 1) - (rect.xmin - 1), | (rect.xmax + 1) - (rect.xmin - 1), | ||||
| (rect.ymax + 1) - (rect.ymin - 1)); | (rect.ymax + 1) - (rect.ymin - 1)); | ||||
| Gwn_VertFormat *format = immVertexFormat(); | Gwn_VertFormat *format = immVertexFormat(); | ||||
| unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | static void waveform_draw_one(float *waveform, int nbr, const float col[3]) | ||||
| Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO); | Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO); | ||||
| GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); | GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f); | GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f); | ||||
| GWN_batch_draw(batch); | GWN_batch_draw(batch); | ||||
| GWN_batch_discard(batch); | GWN_batch_discard(batch); | ||||
| } | } | ||||
| void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| { | { | ||||
| Scopes *scopes = (Scopes *)but->poin; | Scopes *scopes = (Scopes *)but->poin; | ||||
| GLint scissor[4]; | GLint scissor[4]; | ||||
| float colors[3][3]; | float colors[3][3]; | ||||
| float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}}; | float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}}; | ||||
| float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */ | float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */ | ||||
| float min, max; | float min, max; | ||||
| Show All 33 Lines | void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| float color[4]; | float color[4]; | ||||
| UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); | UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); | ||||
| UI_draw_roundbox_corner_set(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | ||||
| /* need scissor test, waveform can draw outside of boundary */ | /* need scissor test, waveform can draw outside of boundary */ | ||||
| glGetIntegerv(GL_SCISSOR_BOX, scissor); | glGetIntegerv(GL_SCISSOR_BOX, scissor); | ||||
| glScissor(ar->winrct.xmin + (rect.xmin - 1), | glScissor((rect.xmin - 1), | ||||
| ar->winrct.ymin + (rect.ymin - 1), | (rect.ymin - 1), | ||||
| (rect.xmax + 1) - (rect.xmin - 1), | (rect.xmax + 1) - (rect.xmin - 1), | ||||
| (rect.ymax + 1) - (rect.ymin - 1)); | (rect.ymax + 1) - (rect.ymin - 1)); | ||||
| /* draw scale numbers first before binding any shader */ | /* draw scale numbers first before binding any shader */ | ||||
| for (int i = 0; i < 6; i++) { | for (int i = 0; i < 6; i++) { | ||||
| char str[4]; | char str[4]; | ||||
| BLI_snprintf(str, sizeof(str), "%-3d", i * 20); | BLI_snprintf(str, sizeof(str), "%-3d", i * 20); | ||||
| str[3] = '\0'; | str[3] = '\0'; | ||||
| ▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | static void vectorscope_draw_target(unsigned int pos, float centerx, float centery, float diam, const float colf[3]) | ||||
| immEnd(); | immEnd(); | ||||
| immBegin(GWN_PRIM_LINE_STRIP, 3); | immBegin(GWN_PRIM_LINE_STRIP, 3); | ||||
| immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle)); | immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle)); | ||||
| immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle), polar_to_y(centery, diam, tampli + dampli, tangle - dangle)); | immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle), polar_to_y(centery, diam, tampli + dampli, tangle - dangle)); | ||||
| immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2)); | immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2)); | ||||
| immEnd(); | immEnd(); | ||||
| } | } | ||||
| void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| { | { | ||||
| const float skin_rad = DEG2RADF(123.0f); /* angle in radians of the skin tone line */ | const float skin_rad = DEG2RADF(123.0f); /* angle in radians of the skin tone line */ | ||||
| Scopes *scopes = (Scopes *)but->poin; | Scopes *scopes = (Scopes *)but->poin; | ||||
| const float colors[6][3] = { | const float colors[6][3] = { | ||||
| {0.75, 0.0, 0.0}, {0.75, 0.75, 0.0}, {0.0, 0.75, 0.0}, | {0.75, 0.0, 0.0}, {0.75, 0.75, 0.0}, {0.0, 0.75, 0.0}, | ||||
| {0.0, 0.75, 0.75}, {0.0, 0.0, 0.75}, {0.75, 0.0, 0.75}}; | {0.0, 0.75, 0.75}, {0.0, 0.0, 0.75}, {0.75, 0.0, 0.75}}; | ||||
| Show All 18 Lines | void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| float color[4]; | float color[4]; | ||||
| UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); | UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); | ||||
| UI_draw_roundbox_corner_set(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | ||||
| /* need scissor test, hvectorscope can draw outside of boundary */ | /* need scissor test, hvectorscope can draw outside of boundary */ | ||||
| GLint scissor[4]; | GLint scissor[4]; | ||||
| glGetIntegerv(GL_SCISSOR_BOX, scissor); | glGetIntegerv(GL_SCISSOR_BOX, scissor); | ||||
| glScissor(ar->winrct.xmin + (rect.xmin - 1), | glScissor((rect.xmin - 1), | ||||
| ar->winrct.ymin + (rect.ymin - 1), | (rect.ymin - 1), | ||||
| (rect.xmax + 1) - (rect.xmin - 1), | (rect.xmax + 1) - (rect.xmin - 1), | ||||
| (rect.ymax + 1) - (rect.ymin - 1)); | (rect.ymax + 1) - (rect.ymin - 1)); | ||||
| Gwn_VertFormat *format = immVertexFormat(); | Gwn_VertFormat *format = immVertexFormat(); | ||||
| unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| ▲ Show 20 Lines • Show All 409 Lines • ▼ Show 20 Lines | void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti *rect) | ||||
| } | } | ||||
| CurveMap *cuma = &cumap->cm[cumap->cur]; | CurveMap *cuma = &cumap->cm[cumap->cur]; | ||||
| /* need scissor test, curve can draw outside of boundary */ | /* need scissor test, curve can draw outside of boundary */ | ||||
| GLint scissor[4]; | GLint scissor[4]; | ||||
| glGetIntegerv(GL_SCISSOR_BOX, scissor); | glGetIntegerv(GL_SCISSOR_BOX, scissor); | ||||
| rcti scissor_new = { | rcti scissor_new = { | ||||
| .xmin = ar->winrct.xmin + rect->xmin, | .xmin = rect->xmin, | ||||
| .ymin = ar->winrct.ymin + rect->ymin, | .ymin = rect->ymin, | ||||
| .xmax = ar->winrct.xmin + rect->xmax, | .xmax = rect->xmax, | ||||
| .ymax = ar->winrct.ymin + rect->ymax | .ymax = rect->ymax | ||||
| }; | }; | ||||
| BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new); | rcti scissor_region = {0, ar->winx, 0, ar->winy}; | ||||
| BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new); | |||||
| glScissor(scissor_new.xmin, | glScissor(scissor_new.xmin, | ||||
| scissor_new.ymin, | scissor_new.ymin, | ||||
| BLI_rcti_size_x(&scissor_new), | BLI_rcti_size_x(&scissor_new), | ||||
| BLI_rcti_size_y(&scissor_new)); | BLI_rcti_size_y(&scissor_new)); | ||||
| /* calculate offset and zoom */ | /* calculate offset and zoom */ | ||||
| float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / BLI_rctf_size_x(&cumap->curr); | float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / BLI_rctf_size_x(&cumap->curr); | ||||
| float zoomy = (BLI_rcti_size_y(rect) - 2.0f) / BLI_rctf_size_y(&cumap->curr); | float zoomy = (BLI_rcti_size_y(rect) - 2.0f) / BLI_rctf_size_y(&cumap->curr); | ||||
| ▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | #endif | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| immUniformColor3ubv((unsigned char *)wcol->outline); | immUniformColor3ubv((unsigned char *)wcol->outline); | ||||
| imm_draw_box_wire_2d(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); | imm_draw_box_wire_2d(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| { | { | ||||
| bool ok = false; | bool ok = false; | ||||
| MovieClipScopes *scopes = (MovieClipScopes *)but->poin; | MovieClipScopes *scopes = (MovieClipScopes *)but->poin; | ||||
| rctf rect = { | rctf rect = { | ||||
| .xmin = (float)recti->xmin + 1, | .xmin = (float)recti->xmin + 1, | ||||
| .xmax = (float)recti->xmax - 1, | .xmax = (float)recti->xmax - 1, | ||||
| .ymin = (float)recti->ymin + 1, | .ymin = (float)recti->ymin + 1, | ||||
| .ymax = (float)recti->ymax - 1 | .ymax = (float)recti->ymax - 1 | ||||
| }; | }; | ||||
| int width = BLI_rctf_size_x(&rect) + 1; | int width = BLI_rctf_size_x(&rect) + 1; | ||||
| int height = BLI_rctf_size_y(&rect); | int height = BLI_rctf_size_y(&rect); | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||||
| /* need scissor test, preview image can draw outside of boundary */ | /* need scissor test, preview image can draw outside of boundary */ | ||||
| GLint scissor[4]; | GLint scissor[4]; | ||||
| glGetIntegerv(GL_SCISSOR_BOX, scissor); | glGetIntegerv(GL_SCISSOR_BOX, scissor); | ||||
| glScissor(ar->winrct.xmin + (rect.xmin - 1), | glScissor((rect.xmin - 1), | ||||
| ar->winrct.ymin + (rect.ymin - 1), | (rect.ymin - 1), | ||||
| (rect.xmax + 1) - (rect.xmin - 1), | (rect.xmax + 1) - (rect.xmin - 1), | ||||
| (rect.ymax + 1) - (rect.ymin - 1)); | (rect.ymax + 1) - (rect.ymin - 1)); | ||||
| if (scopes->track_disabled) { | if (scopes->track_disabled) { | ||||
| float color[4] = {0.7f, 0.3f, 0.3f, 0.3f}; | float color[4] = {0.7f, 0.3f, 0.3f, 0.3f}; | ||||
| UI_draw_roundbox_corner_set(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | ||||
| Show All 20 Lines | if (tmpibuf) { | ||||
| IMB_freeImBuf(tmpibuf); | IMB_freeImBuf(tmpibuf); | ||||
| } | } | ||||
| } | } | ||||
| if (!ok && scopes->track_preview) { | if (!ok && scopes->track_preview) { | ||||
| gpuPushMatrix(); | gpuPushMatrix(); | ||||
| /* draw content of pattern area */ | /* draw content of pattern area */ | ||||
| glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, scissor[2], scissor[3]); | glScissor(rect.xmin, rect.ymin, scissor[2], scissor[3]); | ||||
| if (width > 0 && height > 0) { | if (width > 0 && height > 0) { | ||||
| ImBuf *drawibuf = scopes->track_preview; | ImBuf *drawibuf = scopes->track_preview; | ||||
| float col_sel[4], col_outline[4]; | float col_sel[4], col_outline[4]; | ||||
| if (scopes->use_track_mask) { | if (scopes->use_track_mask) { | ||||
| float color[4] = {0.0f, 0.0f, 0.0f, 0.3f}; | float color[4] = {0.0f, 0.0f, 0.0f, 0.3f}; | ||||
| UI_draw_roundbox_corner_set(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color); | ||||
| } | } | ||||
| IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); | IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); | ||||
| immDrawPixelsTex(&state, rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, drawibuf->rect, 1.0f, 1.0f, NULL); | immDrawPixelsTex(&state, rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, drawibuf->rect, 1.0f, 1.0f, NULL); | ||||
| /* draw cross for pixel position */ | /* draw cross for pixel position */ | ||||
| gpuTranslate2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]); | gpuTranslate2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]); | ||||
| glScissor(ar->winrct.xmin + rect.xmin, | glScissor(rect.xmin, | ||||
| ar->winrct.ymin + rect.ymin, | rect.ymin, | ||||
| BLI_rctf_size_x(&rect), | BLI_rctf_size_x(&rect), | ||||
| BLI_rctf_size_y(&rect)); | BLI_rctf_size_y(&rect)); | ||||
| Gwn_VertFormat *format = immVertexFormat(); | Gwn_VertFormat *format = immVertexFormat(); | ||||
| unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); | ||||
| unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); | unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| }; | }; | ||||
| GLint scissor[4]; | GLint scissor[4]; | ||||
| /* need scissor test, can draw outside of boundary */ | /* need scissor test, can draw outside of boundary */ | ||||
| glGetIntegerv(GL_SCISSOR_BOX, scissor); | glGetIntegerv(GL_SCISSOR_BOX, scissor); | ||||
| rcti scissor_new = { | rcti scissor_new = { | ||||
| .xmin = ar->winrct.xmin + recti->xmin, | .xmin = recti->xmin, | ||||
| .ymin = ar->winrct.ymin + recti->ymin, | .ymin = recti->ymin, | ||||
| .xmax = ar->winrct.xmin + recti->xmax, | .xmax = recti->xmax, | ||||
| .ymax = ar->winrct.ymin + recti->ymax | .ymax = recti->ymax | ||||
| }; | }; | ||||
| BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new); | rcti scissor_region = {0, ar->winx, 0, ar->winy}; | ||||
| BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new); | |||||
| glScissor(scissor_new.xmin, | glScissor(scissor_new.xmin, | ||||
| scissor_new.ymin, | scissor_new.ymin, | ||||
| BLI_rcti_size_x(&scissor_new), | BLI_rcti_size_x(&scissor_new), | ||||
| BLI_rcti_size_y(&scissor_new)); | BLI_rcti_size_y(&scissor_new)); | ||||
| float x = 0.5f * (recti->xmin + recti->xmax); | float x = 0.5f * (recti->xmin + recti->xmax); | ||||
| float y = 0.5f * (recti->ymin + recti->ymax); | float y = 0.5f * (recti->ymin + recti->ymax); | ||||
| ▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines | |||||