diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-10 16:16:59 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-10 16:17:26 +0300 |
commit | 9fd3435a93b45b80237419b1b218afdce72d4b9d (patch) | |
tree | a2d45089b59162a8926880e3d7a97312ee42261b /source/blender/editors | |
parent | 2d158a425dc5c9548a3622f9bc4f65d796c5244d (diff) |
First batch of PRIM_QUAD_XXX replacement by PRIM_TRIANGLES.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 69 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 11 |
3 files changed, 60 insertions, 27 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index ab77d3caa17..5c3dd83e2a1 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1922,29 +1922,62 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol static void ui_shadowbox(unsigned pos, unsigned color, float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha) { + /* v1-_ + * | -_v2 + * | | + * | | + * | | + * v7_______v3____v4 + * \ | / + * \ | _v5 + * v8______v6_- + */ + const float v1[2] = {maxx, maxy - 0.3f * shadsize}; + const float v2[2] = {maxx + shadsize, maxy - 0.75f * shadsize}; + const float v3[2] = {maxx, miny}; + const float v4[2] = {maxx + shadsize, miny}; + + const float v5[2] = {maxx + 0.7f * shadsize, miny - 0.7f * shadsize}; + + const float v6[2] = {maxx, miny - shadsize}; + const float v7[2] = {minx + 0.3f * shadsize, miny}; + const float v8[2] = {minx + 0.5f * shadsize, miny - shadsize}; + /* right quad */ immAttrib4ub(color, 0, 0, 0, alpha); - immVertex2f(pos, maxx, miny); - immVertex2f(pos, maxx, maxy - 0.3f * shadsize); + immVertex2fv(pos, v3); + immVertex2fv(pos, v1); immAttrib4ub(color, 0, 0, 0, 0); - immVertex2f(pos, maxx + shadsize, maxy - 0.75f * shadsize); - immVertex2f(pos, maxx + shadsize, miny); - - /* corner shape */ + immVertex2fv(pos, v2); + + immVertex2fv(pos, v2); + immVertex2fv(pos, v4); immAttrib4ub(color, 0, 0, 0, alpha); - immVertex2f(pos, maxx, miny); + immVertex2fv(pos, v3); + + /* corner shape */ + /* immAttrib4ub(color, 0, 0, 0, alpha); */ /* Not needed, done above in previous tri */ + immVertex2fv(pos, v3); immAttrib4ub(color, 0, 0, 0, 0); - immVertex2f(pos, maxx + shadsize, miny); - immVertex2f(pos, maxx + 0.7f * shadsize, miny - 0.7f * shadsize); - immVertex2f(pos, maxx, miny - shadsize); - - /* bottom quad */ + immVertex2fv(pos, v4); + immVertex2fv(pos, v5); + + immVertex2fv(pos, v5); + immVertex2fv(pos, v6); immAttrib4ub(color, 0, 0, 0, alpha); - immVertex2f(pos, minx + 0.3f * shadsize, miny); - immVertex2f(pos, maxx, miny); + immVertex2fv(pos, v3); + + /* bottom quad */ + /* immAttrib4ub(color, 0, 0, 0, alpha); */ /* Not needed, done above in previous tri */ + immVertex2fv(pos, v3); immAttrib4ub(color, 0, 0, 0, 0); - immVertex2f(pos, maxx, miny - shadsize); - immVertex2f(pos, minx + 0.5f * shadsize, miny - shadsize); + immVertex2fv(pos, v6); + immVertex2fv(pos, v8); + + immVertex2fv(pos, v8); + immAttrib4ub(color, 0, 0, 0, alpha); + immVertex2fv(pos, v7); + immVertex2fv(pos, v3); } void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) @@ -1957,8 +1990,7 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); -#ifdef WITH_GL_PROFILE_COMPAT - immBegin(PRIM_QUADS_XXX, 36); + immBegin(PRIM_TRIANGLES, 54); /* accumulated outline boxes to make shade not linear, is more pleasant */ ui_shadowbox(pos, color, minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8); @@ -1966,7 +1998,6 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, ui_shadowbox(pos, color, minx, miny, maxx, maxy, 5.0, (80 * alpha) >> 8); immEnd(); -#endif immUnbindProgram(); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index afe6d9ae121..bf620686c74 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1799,18 +1799,19 @@ static void outliner_back(ARegion *ar) int tot = (int)floor(ystart - ar->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y); if (tot > 0) { -#ifdef WITH_GL_PROFILE_COMPAT - immBegin(PRIM_QUADS_XXX, 4 * tot); + immBegin(PRIM_TRIANGLES, 6 * tot); while (tot--) { y1 -= 2 * UI_UNIT_Y; y2 = y1 + UI_UNIT_Y; immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y1); immVertex2f(pos, x2, y2); + + immVertex2f(pos, x1, y1); + immVertex2f(pos, x2, y2); immVertex2f(pos, x1, y2); } immEnd(); -#endif } immUnbindProgram(); } diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index a47fd3a2e34..9b149366670 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -196,8 +196,8 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) break; } - int sta = pid->cache->startframe, end = pid->cache->endframe; - int len = (end - sta + 1) * 4; + const int sta = pid->cache->startframe, end = pid->cache->endframe; + const int len = (end - sta + 1) * 6; glEnable(GL_BLEND); @@ -214,9 +214,8 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) immUniformColor4fv(col); -#ifdef WITH_GL_PROFILE_COMPAT if (len > 0) { - immBeginAtMost(PRIM_QUADS_XXX, len); + immBeginAtMost(PRIM_TRIANGLES, len); /* draw a quad for each cached frame */ for (int i = sta; i <= end; i++) { @@ -224,13 +223,15 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) immVertex2f(pos, (float)i - 0.5f, 0.0f); immVertex2f(pos, (float)i - 0.5f, 1.0f); immVertex2f(pos, (float)i + 0.5f, 1.0f); + + immVertex2f(pos, (float)i - 0.5f, 0.0f); + immVertex2f(pos, (float)i + 0.5f, 1.0f); immVertex2f(pos, (float)i + 0.5f, 0.0f); } } immEnd(); } -#endif glDisable(GL_BLEND); |