UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
if(seq->scene==curscene) {
- UI_GetColorPtrBlendShade3ubv(col, col, col, 1.0, 20);
+ UI_GetColorPtrShade3ubv(col, col, 20);
}
break;
glRectf(x1_chan, y1_chan, x2_chan, y2_chan);
- UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
+ UI_GetColorPtrShade3ubv(col, col, -30);
glColor4ubv(col);
fdrawbox(x1_chan, y1_chan, x2_chan, y2_chan);
/* feint pinstripes, helps see exactly which is extended and which isn't,
* especially when the extension is very small */
if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16);
+ else UI_GetColorPtrShade3ubv(col, col, -16);
glColor3ubv((GLubyte *)col);
/* feint pinstripes, helps see exactly which is extended and which isn't,
* especially when the extension is very small */
- if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16);
+ if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24);
+ else UI_GetColorPtrShade3ubv(col, col, -16);
glColor3ubv((GLubyte *)col);
glBegin(GL_QUADS);
if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
- else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 0);
+ else if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50);
+ /* else UI_GetColorPtrShade3ubv(col, col, 0); */ /* DO NOTHING */
glColor3ubv(col);
if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -5);
+ else UI_GetColorPtrShade3ubv(col, col, -5);
glColor3ubv((GLubyte *)col);
glVertex2f(x1,ymid2);
glVertex2f(x2,ymid2);
- if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -15);
- else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 25);
+ if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15);
+ else UI_GetColorPtrShade3ubv(col, col, 25);
glColor3ubv((GLubyte *)col);
col[0]= 255; col[1]= col[2]= 40;
}
else
- UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120+outline_tint);
+ UI_GetColorPtrShade3ubv(col, col, 120+outline_tint);
}
else
- UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint);
+ UI_GetColorPtrShade3ubv(col, col, outline_tint);
glColor3ubv((GLubyte *)col);
static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, float dx)
{
- float v1[2], v2[2];
+ float verts[2][2];
x+= (wx);
y+= (wy);
- v1[1]= 0.0f;
- v2[1]= (float)ar->winy;
+ /* set fixed 'Y' */
+ verts[0][1]= 0.0f;
+ verts[1][1]= (float)ar->winy;
- v1[0] = v2[0] = x-dx*floorf(x/dx);
-
- glBegin(GL_LINES);
-
- while(v1[0] < ar->winx) {
- glVertex2fv(v1);
- glVertex2fv(v2);
- v1[0] = v2[0] = v1[0] + dx;
- }
+ /* iter over 'X' */
+ verts[0][0] = verts[1][0] = x-dx*floorf(x/dx);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, verts);
- v1[0]= 0.0f;
- v2[0]= (float)ar->winx;
+ while(verts[0][0] < ar->winx) {
+ glDrawArrays(GL_LINES, 0, 2);
+ verts[0][0] = verts[1][0] = verts[0][0] + dx;
+ }
- v1[1]= v2[1]= y-dx*floorf(y/dx);
+ /* set fixed 'X' */
+ verts[0][0]= 0.0f;
+ verts[1][0]= (float)ar->winx;
- while(v1[1] < ar->winy) {
- glVertex2fv(v1);
- glVertex2fv(v2);
- v1[1] = v2[1] = v1[1] + dx;
+ /* iter over 'Y' */
+ verts[0][1]= verts[1][1]= y-dx*floorf(y/dx);
+ while(verts[0][1] < ar->winy) {
+ glDrawArrays(GL_LINES, 0, 2);
+ verts[0][1] = verts[1][1] = verts[0][1] + dx;
}
- glEnd();
+ glDisableClientState(GL_VERTEX_ARRAY);
}
-#define GRID_MIN_PX 6.0f
+#define GRID_MIN_PX 1.0f
static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **grid_unit)
{
static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
{
float vert[3], grid, grid_scale;
- int a, gridlines, emphasise;
- unsigned char col[3], col2[3];
- short draw_line = 0;
+ int a, gridlines;
+ unsigned char col_grid[3], col_bg[3];
+ unsigned char col_grid_emphasise[3], col_grid_light[3]; /* cache */
+ short draw_line= FALSE;
+ const short show_floor= (v3d->gridflag & V3D_SHOW_FLOOR) != 0;
vert[2]= 0.0;
}
if(v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select
-
+
gridlines= v3d->gridlines/2;
grid= gridlines * grid_scale;
- UI_GetThemeColor3ubv(TH_GRID, col);
- UI_GetThemeColor3ubv(TH_BACK, col2);
-
+ /* only draw center axis if there are no grid lines, saves loop for no reason */
+ if(show_floor == 0) {
+ gridlines= FALSE;
+ }
+
+ UI_GetThemeColor3ubv(TH_GRID, col_grid);
+ UI_GetThemeColor3ubv(TH_BACK, col_bg);
+
/* emphasise division lines lighter instead of darker, if background is darker than grid */
- if ( ((col[0]+col[1]+col[2])/3+10) > (col2[0]+col2[1]+col2[2])/3 )
- emphasise = 20;
- else
- emphasise = -10;
-
+ UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
+ UI_GetColorPtrShade3ubv(col_grid, col_grid_emphasise,
+ (((col_grid[0]+col_grid[1]+col_grid[2])+30) > (col_bg[0]+col_bg[1]+col_bg[2])) ? 20 : -10);
+
/* draw the Y axis and/or grid lines */
for(a= -gridlines;a<=gridlines;a++) {
if(a==0) {
/* check for the 'show Y axis' preference */
if (v3d->gridflag & V3D_SHOW_Y) {
- UI_make_axis_color(col, col2, 'Y');
- glColor3ubv(col2);
-
- draw_line = 1;
- } else if (v3d->gridflag & V3D_SHOW_FLOOR) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- } else {
- draw_line = 0;
+ UI_make_axis_color(col_grid, col_bg, 'Y');
+ glColor3ubv(col_bg);
+
+ draw_line = TRUE;
}
- } else {
+ else if (show_floor) {
+ glColor3ubv(col_grid_emphasise);
+ }
+ else {
+ draw_line = FALSE;
+ }
+ }
+ else {
/* check for the 'show grid floor' preference */
- if (v3d->gridflag & V3D_SHOW_FLOOR) {
- if( (a % 10)==0) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- }
- else UI_ThemeColorShade(TH_GRID, 10);
-
- draw_line = 1;
- } else {
- draw_line = 0;
+ if (show_floor) {
+ glColor3ubv((a % 10) ? col_grid_light : col_grid_emphasise);
+ draw_line = TRUE;
+ }
+ else {
+ draw_line = FALSE;
}
}
if(a==0) {
/* check for the 'show X axis' preference */
if (v3d->gridflag & V3D_SHOW_X) {
- UI_make_axis_color(col, col2, 'X');
- glColor3ubv(col2);
-
- draw_line = 1;
- } else if (v3d->gridflag & V3D_SHOW_FLOOR) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- } else {
- draw_line = 0;
+ UI_make_axis_color(col_grid, col_bg, 'X');
+ glColor3ubv(col_bg);
+
+ draw_line = TRUE;
}
- } else {
+ else if (show_floor) {
+ glColor3ubv(col_grid_emphasise);
+ }
+ else {
+ draw_line = FALSE;
+ }
+ }
+ else {
/* check for the 'show grid floor' preference */
- if (v3d->gridflag & V3D_SHOW_FLOOR) {
- if( (a % 10)==0) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- }
- else UI_ThemeColorShade(TH_GRID, 10);
-
- draw_line = 1;
- } else {
- draw_line = 0;
+ if (show_floor) {
+ glColor3ubv((a % 10) ? col_grid_light : col_grid_emphasise);
+ draw_line = TRUE;
+ }
+ else {
+ draw_line = FALSE;
}
}
/* draw the Z axis line */
/* check for the 'show Z axis' preference */
if (v3d->gridflag & V3D_SHOW_Z) {
- UI_make_axis_color(col, col2, 'Z');
- glColor3ubv(col2);
+ UI_make_axis_color(col_grid, col_bg, 'Z');
+ glColor3ubv(col_bg);
glBegin(GL_LINE_STRIP);
- vert[0]= 0;
- vert[1]= 0;
+ vert[0]= 0.0f;
+ vert[1]= 0.0f;
vert[2]= grid;
glVertex3fv(vert );
vert[2]= -grid;