OpenGL immediate mode: interface_draw.c
This commit is contained in:
@@ -316,8 +316,8 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx,
|
||||
void UI_draw_roundbox_gl_mode_3ubAlpha(int mode, float minx, float miny, float maxx, float maxy, float rad, unsigned char col[3], unsigned char alpha);
|
||||
void UI_draw_roundbox_gl_mode_3fvAlpha(int mode, float minx, float miny, float maxx, float maxy, float rad, float col[3], float alpha);
|
||||
void UI_draw_roundbox_gl_mode(int mode, float minx, float miny, float maxx, float maxy, float rad, float col[4]);
|
||||
void UI_draw_roundbox_shade_x(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
|
||||
void UI_draw_roundbox_shade_y(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight);
|
||||
void UI_draw_roundbox_shade_x(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown, float col[4]);
|
||||
void UI_draw_roundbox_shade_y(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeleft, float shaderight, float col[4]);
|
||||
void UI_draw_text_underline(int pos_x, int pos_y, int len, int height);
|
||||
|
||||
void UI_draw_safe_areas(
|
||||
|
||||
@@ -174,227 +174,251 @@ void UI_draw_roundbox_gl_mode(int mode, float minx, float miny, float maxx, floa
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
static void round_box_shade_col(const float col1[3], float const col2[3], const float fac)
|
||||
static void round_box_shade_col(unsigned attrib, const float col1[3], float const col2[3], const float fac)
|
||||
{
|
||||
float col[3] = {
|
||||
float col[4] = {
|
||||
fac * col1[0] + (1.0f - fac) * col2[0],
|
||||
fac * col1[1] + (1.0f - fac) * col2[1],
|
||||
fac * col1[2] + (1.0f - fac) * col2[2]
|
||||
fac * col1[2] + (1.0f - fac) * col2[2],
|
||||
1.0f
|
||||
};
|
||||
glColor3fv(col);
|
||||
immAttrib4fv(attrib, col);
|
||||
}
|
||||
|
||||
/* linear horizontal shade within button or in outline */
|
||||
/* view2d scrollers use it */
|
||||
void UI_draw_roundbox_shade_x(
|
||||
int mode, float minx, float miny, float maxx, float maxy,
|
||||
float rad, float shadetop, float shadedown)
|
||||
float rad, float shadetop, float shadedown, float col[4])
|
||||
{
|
||||
float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
|
||||
{0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
|
||||
const float div = maxy - miny;
|
||||
const float idiv = 1.0f / div;
|
||||
float coltop[3], coldown[3], color[4];
|
||||
float coltop[3], coldown[3];
|
||||
int vert_count = 0;
|
||||
int a;
|
||||
|
||||
|
||||
VertexFormat *format = immVertexFormat();
|
||||
unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
|
||||
unsigned color = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
|
||||
|
||||
/* mult */
|
||||
for (a = 0; a < 7; a++) {
|
||||
mul_v2_fl(vec[a], rad);
|
||||
}
|
||||
/* get current color, needs to be outside of glBegin/End */
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
|
||||
/* 'shade' defines strength of shading */
|
||||
coltop[0] = min_ff(1.0f, color[0] + shadetop);
|
||||
coltop[1] = min_ff(1.0f, color[1] + shadetop);
|
||||
coltop[2] = min_ff(1.0f, color[2] + shadetop);
|
||||
coldown[0] = max_ff(0.0f, color[0] + shadedown);
|
||||
coldown[1] = max_ff(0.0f, color[1] + shadedown);
|
||||
coldown[2] = max_ff(0.0f, color[2] + shadedown);
|
||||
coltop[0] = min_ff(1.0f, col[0] + shadetop);
|
||||
coltop[1] = min_ff(1.0f, col[1] + shadetop);
|
||||
coltop[2] = min_ff(1.0f, col[2] + shadetop);
|
||||
coldown[0] = max_ff(0.0f, col[0] + shadedown);
|
||||
coldown[1] = max_ff(0.0f, col[1] + shadedown);
|
||||
coldown[2] = max_ff(0.0f, col[2] + shadedown);
|
||||
|
||||
glBegin(mode);
|
||||
vert_count += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 9 : 1;
|
||||
vert_count += (roundboxtype & UI_CNR_TOP_RIGHT) ? 9 : 1;
|
||||
vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1;
|
||||
vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1;
|
||||
|
||||
immBegin(mode, vert_count);
|
||||
|
||||
/* start with corner right-bottom */
|
||||
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
|
||||
|
||||
round_box_shade_col(coltop, coldown, 0.0);
|
||||
glVertex2f(maxx - rad, miny);
|
||||
round_box_shade_col(color, coltop, coldown, 0.0);
|
||||
immVertex2f(pos, maxx - rad, miny);
|
||||
|
||||
for (a = 0; a < 7; a++) {
|
||||
round_box_shade_col(coltop, coldown, vec[a][1] * idiv);
|
||||
glVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]);
|
||||
round_box_shade_col(color, coltop, coldown, vec[a][1] * idiv);
|
||||
immVertex2f(pos, maxx - rad + vec[a][0], miny + vec[a][1]);
|
||||
}
|
||||
|
||||
round_box_shade_col(coltop, coldown, rad * idiv);
|
||||
glVertex2f(maxx, miny + rad);
|
||||
round_box_shade_col(color, coltop, coldown, rad * idiv);
|
||||
immVertex2f(pos, maxx, miny + rad);
|
||||
}
|
||||
else {
|
||||
round_box_shade_col(coltop, coldown, 0.0);
|
||||
glVertex2f(maxx, miny);
|
||||
round_box_shade_col(color, coltop, coldown, 0.0);
|
||||
immVertex2f(pos, maxx, miny);
|
||||
}
|
||||
|
||||
/* corner right-top */
|
||||
if (roundboxtype & UI_CNR_TOP_RIGHT) {
|
||||
|
||||
round_box_shade_col(coltop, coldown, (div - rad) * idiv);
|
||||
glVertex2f(maxx, maxy - rad);
|
||||
round_box_shade_col(color, coltop, coldown, (div - rad) * idiv);
|
||||
immVertex2f(pos, maxx, maxy - rad);
|
||||
|
||||
for (a = 0; a < 7; a++) {
|
||||
round_box_shade_col(coltop, coldown, (div - rad + vec[a][1]) * idiv);
|
||||
glVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]);
|
||||
round_box_shade_col(color, coltop, coldown, (div - rad + vec[a][1]) * idiv);
|
||||
immVertex2f(pos, maxx - vec[a][1], maxy - rad + vec[a][0]);
|
||||
}
|
||||
round_box_shade_col(coltop, coldown, 1.0);
|
||||
glVertex2f(maxx - rad, maxy);
|
||||
round_box_shade_col(color, coltop, coldown, 1.0);
|
||||
immVertex2f(pos, maxx - rad, maxy);
|
||||
}
|
||||
else {
|
||||
round_box_shade_col(coltop, coldown, 1.0);
|
||||
glVertex2f(maxx, maxy);
|
||||
round_box_shade_col(color, coltop, coldown, 1.0);
|
||||
immVertex2f(pos, maxx, maxy);
|
||||
}
|
||||
|
||||
/* corner left-top */
|
||||
if (roundboxtype & UI_CNR_TOP_LEFT) {
|
||||
|
||||
round_box_shade_col(coltop, coldown, 1.0);
|
||||
glVertex2f(minx + rad, maxy);
|
||||
round_box_shade_col(color, coltop, coldown, 1.0);
|
||||
immVertex2f(pos, minx + rad, maxy);
|
||||
|
||||
for (a = 0; a < 7; a++) {
|
||||
round_box_shade_col(coltop, coldown, (div - vec[a][1]) * idiv);
|
||||
glVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]);
|
||||
round_box_shade_col(color, coltop, coldown, (div - vec[a][1]) * idiv);
|
||||
immVertex2f(pos, minx + rad - vec[a][0], maxy - vec[a][1]);
|
||||
}
|
||||
|
||||
round_box_shade_col(coltop, coldown, (div - rad) * idiv);
|
||||
glVertex2f(minx, maxy - rad);
|
||||
round_box_shade_col(color, coltop, coldown, (div - rad) * idiv);
|
||||
immVertex2f(pos, minx, maxy - rad);
|
||||
}
|
||||
else {
|
||||
round_box_shade_col(coltop, coldown, 1.0);
|
||||
glVertex2f(minx, maxy);
|
||||
round_box_shade_col(color, coltop, coldown, 1.0);
|
||||
immVertex2f(pos, minx, maxy);
|
||||
}
|
||||
|
||||
/* corner left-bottom */
|
||||
if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
|
||||
|
||||
round_box_shade_col(coltop, coldown, rad * idiv);
|
||||
glVertex2f(minx, miny + rad);
|
||||
round_box_shade_col(color, coltop, coldown, rad * idiv);
|
||||
immVertex2f(pos, minx, miny + rad);
|
||||
|
||||
for (a = 0; a < 7; a++) {
|
||||
round_box_shade_col(coltop, coldown, (rad - vec[a][1]) * idiv);
|
||||
glVertex2f(minx + vec[a][1], miny + rad - vec[a][0]);
|
||||
round_box_shade_col(color, coltop, coldown, (rad - vec[a][1]) * idiv);
|
||||
immVertex2f(pos, minx + vec[a][1], miny + rad - vec[a][0]);
|
||||
}
|
||||
|
||||
round_box_shade_col(coltop, coldown, 0.0);
|
||||
glVertex2f(minx + rad, miny);
|
||||
round_box_shade_col(color, coltop, coldown, 0.0);
|
||||
immVertex2f(pos, minx + rad, miny);
|
||||
}
|
||||
else {
|
||||
round_box_shade_col(coltop, coldown, 0.0);
|
||||
glVertex2f(minx, miny);
|
||||
round_box_shade_col(color, coltop, coldown, 0.0);
|
||||
immVertex2f(pos, minx, miny);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
immEnd();
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
/* linear vertical shade within button or in outline */
|
||||
/* view2d scrollers use it */
|
||||
void UI_draw_roundbox_shade_y(
|
||||
int mode, float minx, float miny, float maxx, float maxy,
|
||||
float rad, float shadeLeft, float shadeRight)
|
||||
float rad, float shadeleft, float shaderight, float col[4])
|
||||
{
|
||||
float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
|
||||
{0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
|
||||
const float div = maxx - minx;
|
||||
const float idiv = 1.0f / div;
|
||||
float colLeft[3], colRight[3], color[4];
|
||||
float colLeft[3], colRight[3];
|
||||
int vert_count = 0;
|
||||
int a;
|
||||
|
||||
/* mult */
|
||||
for (a = 0; a < 7; a++) {
|
||||
mul_v2_fl(vec[a], rad);
|
||||
}
|
||||
/* get current color, needs to be outside of glBegin/End */
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
|
||||
VertexFormat *format = immVertexFormat();
|
||||
unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
|
||||
unsigned color = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
|
||||
|
||||
/* 'shade' defines strength of shading */
|
||||
colLeft[0] = min_ff(1.0f, color[0] + shadeLeft);
|
||||
colLeft[1] = min_ff(1.0f, color[1] + shadeLeft);
|
||||
colLeft[2] = min_ff(1.0f, color[2] + shadeLeft);
|
||||
colRight[0] = max_ff(0.0f, color[0] + shadeRight);
|
||||
colRight[1] = max_ff(0.0f, color[1] + shadeRight);
|
||||
colRight[2] = max_ff(0.0f, color[2] + shadeRight);
|
||||
colLeft[0] = min_ff(1.0f, col[0] + shadeleft);
|
||||
colLeft[1] = min_ff(1.0f, col[1] + shadeleft);
|
||||
colLeft[2] = min_ff(1.0f, col[2] + shadeleft);
|
||||
colRight[0] = max_ff(0.0f, col[0] + shaderight);
|
||||
colRight[1] = max_ff(0.0f, col[1] + shaderight);
|
||||
colRight[2] = max_ff(0.0f, col[2] + shaderight);
|
||||
|
||||
glBegin(mode);
|
||||
|
||||
vert_count += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 9 : 1;
|
||||
vert_count += (roundboxtype & UI_CNR_TOP_RIGHT) ? 9 : 1;
|
||||
vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1;
|
||||
vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1;
|
||||
|
||||
immBegin(mode, vert_count);
|
||||
|
||||
/* start with corner right-bottom */
|
||||
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
|
||||
round_box_shade_col(colLeft, colRight, 0.0);
|
||||
glVertex2f(maxx - rad, miny);
|
||||
round_box_shade_col(color, colLeft, colRight, 0.0);
|
||||
immVertex2f(pos, maxx - rad, miny);
|
||||
|
||||
for (a = 0; a < 7; a++) {
|
||||
round_box_shade_col(colLeft, colRight, vec[a][0] * idiv);
|
||||
glVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]);
|
||||
round_box_shade_col(color, colLeft, colRight, vec[a][0] * idiv);
|
||||
immVertex2f(pos, maxx - rad + vec[a][0], miny + vec[a][1]);
|
||||
}
|
||||
|
||||
round_box_shade_col(colLeft, colRight, rad * idiv);
|
||||
glVertex2f(maxx, miny + rad);
|
||||
round_box_shade_col(color, colLeft, colRight, rad * idiv);
|
||||
immVertex2f(pos, maxx, miny + rad);
|
||||
}
|
||||
else {
|
||||
round_box_shade_col(colLeft, colRight, 0.0);
|
||||
glVertex2f(maxx, miny);
|
||||
round_box_shade_col(color, colLeft, colRight, 0.0);
|
||||
immVertex2f(pos, maxx, miny);
|
||||
}
|
||||
|
||||
/* corner right-top */
|
||||
if (roundboxtype & UI_CNR_TOP_RIGHT) {
|
||||
round_box_shade_col(colLeft, colRight, 0.0);
|
||||
glVertex2f(maxx, maxy - rad);
|
||||
round_box_shade_col(color, colLeft, colRight, 0.0);
|
||||
immVertex2f(pos, maxx, maxy - rad);
|
||||
|
||||
for (a = 0; a < 7; a++) {
|
||||
|
||||
round_box_shade_col(colLeft, colRight, (div - rad - vec[a][0]) * idiv);
|
||||
glVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]);
|
||||
round_box_shade_col(color, colLeft, colRight, (div - rad - vec[a][0]) * idiv);
|
||||
immVertex2f(pos, maxx - vec[a][1], maxy - rad + vec[a][0]);
|
||||
}
|
||||
round_box_shade_col(colLeft, colRight, (div - rad) * idiv);
|
||||
glVertex2f(maxx - rad, maxy);
|
||||
round_box_shade_col(color, colLeft, colRight, (div - rad) * idiv);
|
||||
immVertex2f(pos, maxx - rad, maxy);
|
||||
}
|
||||
else {
|
||||
round_box_shade_col(colLeft, colRight, 0.0);
|
||||
glVertex2f(maxx, maxy);
|
||||
round_box_shade_col(color, colLeft, colRight, 0.0);
|
||||
immVertex2f(pos, maxx, maxy);
|
||||
}
|
||||
|
||||
/* corner left-top */
|
||||
if (roundboxtype & UI_CNR_TOP_LEFT) {
|
||||
round_box_shade_col(colLeft, colRight, (div - rad) * idiv);
|
||||
glVertex2f(minx + rad, maxy);
|
||||
round_box_shade_col(color, colLeft, colRight, (div - rad) * idiv);
|
||||
immVertex2f(pos, minx + rad, maxy);
|
||||
|
||||
for (a = 0; a < 7; a++) {
|
||||
round_box_shade_col(colLeft, colRight, (div - rad + vec[a][0]) * idiv);
|
||||
glVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]);
|
||||
round_box_shade_col(color, colLeft, colRight, (div - rad + vec[a][0]) * idiv);
|
||||
immVertex2f(pos, minx + rad - vec[a][0], maxy - vec[a][1]);
|
||||
}
|
||||
|
||||
round_box_shade_col(colLeft, colRight, 1.0);
|
||||
glVertex2f(minx, maxy - rad);
|
||||
round_box_shade_col(color, colLeft, colRight, 1.0);
|
||||
immVertex2f(pos, minx, maxy - rad);
|
||||
}
|
||||
else {
|
||||
round_box_shade_col(colLeft, colRight, 1.0);
|
||||
glVertex2f(minx, maxy);
|
||||
round_box_shade_col(color, colLeft, colRight, 1.0);
|
||||
immVertex2f(pos, minx, maxy);
|
||||
}
|
||||
|
||||
/* corner left-bottom */
|
||||
if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
|
||||
round_box_shade_col(colLeft, colRight, 1.0);
|
||||
glVertex2f(minx, miny + rad);
|
||||
round_box_shade_col(color, colLeft, colRight, 1.0);
|
||||
immVertex2f(pos, minx, miny + rad);
|
||||
|
||||
for (a = 0; a < 7; a++) {
|
||||
round_box_shade_col(colLeft, colRight, (vec[a][0]) * idiv);
|
||||
glVertex2f(minx + vec[a][1], miny + rad - vec[a][0]);
|
||||
round_box_shade_col(color, colLeft, colRight, (vec[a][0]) * idiv);
|
||||
immVertex2f(pos, minx + vec[a][1], miny + rad - vec[a][0]);
|
||||
}
|
||||
|
||||
round_box_shade_col(colLeft, colRight, 1.0);
|
||||
glVertex2f(minx + rad, miny);
|
||||
round_box_shade_col(color, colLeft, colRight, 1.0);
|
||||
immVertex2f(pos, minx + rad, miny);
|
||||
}
|
||||
else {
|
||||
round_box_shade_col(colLeft, colRight, 1.0);
|
||||
glVertex2f(minx, miny);
|
||||
round_box_shade_col(color, colLeft, colRight, 1.0);
|
||||
immVertex2f(pos, minx, miny);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
immEnd();
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
/* plain antialiased unfilled rectangle */
|
||||
|
||||
@@ -373,39 +373,39 @@ static void region_draw_azone_tab_plus(AZone *az)
|
||||
|
||||
static void region_draw_azone_tab(AZone *az)
|
||||
{
|
||||
float col[3];
|
||||
float col[4];
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
UI_GetThemeColor3fv(TH_HEADER, col);
|
||||
glColor4f(col[0], col[1], col[2], 0.5f);
|
||||
col[3] = 0.5f;
|
||||
|
||||
/* add code to draw region hidden as 'too small' */
|
||||
switch (az->edge) {
|
||||
case AE_TOP_TO_BOTTOMRIGHT:
|
||||
UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA);
|
||||
|
||||
UI_draw_roundbox_shade_x(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
|
||||
UI_draw_roundbox_shade_x(GL_TRIANGLE_FAN, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f, col);
|
||||
glColor4ub(0, 0, 0, 255);
|
||||
UI_draw_roundbox_unfilled((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f);
|
||||
break;
|
||||
case AE_BOTTOM_TO_TOPLEFT:
|
||||
UI_draw_roundbox_corner_set(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
|
||||
|
||||
UI_draw_roundbox_shade_x(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
|
||||
UI_draw_roundbox_shade_x(GL_TRIANGLE_FAN, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f, col);
|
||||
glColor4ub(0, 0, 0, 255);
|
||||
UI_draw_roundbox_unfilled((float)az->x1, 0.3f + (float)az->y1, (float)az->x2, 0.3f + (float)az->y2, 4.0f);
|
||||
break;
|
||||
case AE_LEFT_TO_TOPRIGHT:
|
||||
UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT | UI_RB_ALPHA);
|
||||
|
||||
UI_draw_roundbox_shade_x(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
|
||||
UI_draw_roundbox_shade_x(GL_TRIANGLE_FAN, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f, col);
|
||||
glColor4ub(0, 0, 0, 255);
|
||||
UI_draw_roundbox_unfilled((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
|
||||
break;
|
||||
case AE_RIGHT_TO_TOPLEFT:
|
||||
UI_draw_roundbox_corner_set(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_RB_ALPHA);
|
||||
|
||||
UI_draw_roundbox_shade_x(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
|
||||
UI_draw_roundbox_shade_x(GL_TRIANGLE_FAN, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f, col);
|
||||
glColor4ub(0, 0, 0, 255);
|
||||
UI_draw_roundbox_unfilled((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
|
||||
break;
|
||||
|
||||
@@ -339,7 +339,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc)
|
||||
static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float yminc, float ymaxc)
|
||||
{
|
||||
const bool non_solo = ((adt && (adt->flag & ADT_NLA_SOLO_TRACK)) && (nlt->flag & NLATRACK_SOLO) == 0);
|
||||
float color[3];
|
||||
float color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
/* get color of strip */
|
||||
nla_strip_get_color_inside(adt, strip, color);
|
||||
@@ -404,10 +404,9 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
|
||||
/* draw 'inside' of strip itself */
|
||||
if (non_solo == 0) {
|
||||
/* strip is in normal track */
|
||||
glColor3fv(color);
|
||||
UI_draw_roundbox_corner_set(UI_CNR_ALL); /* all corners rounded */
|
||||
|
||||
UI_draw_roundbox_shade_x(GL_POLYGON, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1);
|
||||
UI_draw_roundbox_shade_x(GL_TRIANGLE_FAN, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1, color);
|
||||
}
|
||||
else {
|
||||
/* strip is in disabled track - make less visible */
|
||||
@@ -436,10 +435,14 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
|
||||
if (strip->flag & NLASTRIP_FLAG_ACTIVE) {
|
||||
/* strip should appear 'sunken', so draw a light border around it */
|
||||
glColor3f(0.9f, 1.0f, 0.9f); // FIXME: hardcoded temp-hack colors
|
||||
color[0] = 0.9f;
|
||||
color[1] = 1.0f;
|
||||
color[2] = 0.9f;
|
||||
}
|
||||
else {
|
||||
/* strip should appear to stand out, so draw a dark border around it */
|
||||
glColor3f(0.0f, 0.0f, 0.0f);
|
||||
color[0] = color[1] = color[2] = 1.0f;
|
||||
}
|
||||
|
||||
/* - line style: dotted for muted */
|
||||
@@ -447,7 +450,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
|
||||
setlinestyle(4);
|
||||
|
||||
/* draw outline */
|
||||
UI_draw_roundbox_shade_x(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1);
|
||||
UI_draw_roundbox_shade_x(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1, color);
|
||||
|
||||
/* if action-clip strip, draw lines delimiting repeats too (in the same color as outline) */
|
||||
if ((strip->type == NLASTRIP_TYPE_CLIP) && IS_EQF(strip->repeat, 1.0f) == 0) {
|
||||
|
||||
@@ -758,6 +758,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
|
||||
View2D *v2d = &ar->v2d;
|
||||
float x1, x2, y1, y2;
|
||||
unsigned char col[3], background_col[3], is_single_image;
|
||||
float fcol[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
const float handsize_clamped = draw_seq_handle_size_get_clamped(seq, pixelx);
|
||||
|
||||
/* we need to know if this is a single image/color or not for drawing */
|
||||
@@ -855,11 +856,11 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
|
||||
glEnable(GL_LINE_STIPPLE);
|
||||
glLineStipple(1, 0x8888);
|
||||
}
|
||||
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
UI_draw_roundbox_shade_x(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0);
|
||||
|
||||
|
||||
rgb_uchar_to_float(fcol, col);
|
||||
|
||||
UI_draw_roundbox_shade_x(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0, fcol);
|
||||
|
||||
if (seq->flag & SEQ_MUTE) {
|
||||
glDisable(GL_LINE_STIPPLE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user