pass colors to glColor as vectors where possible.

This commit is contained in:
2011-05-04 12:00:11 +00:00
parent 5a0dca41e5
commit b9076b87d2
4 changed files with 23 additions and 24 deletions

View File

@@ -594,26 +594,26 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha
glBegin(glmode = new_glmode);
}
glColor3ub(cp1[0], cp1[1], cp1[2]);
glColor3ubv(cp1+0);
glVertex3fv(mvert[mface->v1].co);
glColor3ub(cp1[4], cp1[5], cp1[6]);
glColor3ubv(cp1+4);
glVertex3fv(mvert[mface->v2].co);
glColor3ub(cp1[8], cp1[9], cp1[10]);
glColor3ubv(cp1+8);
glVertex3fv(mvert[mface->v3].co);
if(mface->v4) {
glColor3ub(cp1[12], cp1[13], cp1[14]);
glColor3ubv(cp1+12);
glVertex3fv(mvert[mface->v4].co);
}
if(useTwoSided) {
glColor3ub(cp2[8], cp2[9], cp2[10]);
glColor3ubv(cp2+8);
glVertex3fv(mvert[mface->v3].co );
glColor3ub(cp2[4], cp2[5], cp2[6]);
glColor3ubv(cp2+4);
glVertex3fv(mvert[mface->v2].co );
glColor3ub(cp2[0], cp2[1], cp2[2]);
glColor3ubv(cp2+0);
glVertex3fv(mvert[mface->v1].co );
if(mface->v4) {
glColor3ub(cp2[12], cp2[13], cp2[14]);
glColor3ubv(cp2+12);
glVertex3fv(mvert[mface->v4].co );
}
}

View File

@@ -486,7 +486,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int
bGPDstroke *gps;
/* set color first (may need to reset it again later too) */
glColor4f(color[0], color[1], color[2], color[3]);
glColor4fv(color);
for (gps= gpf->strokes.first; gps; gps= gps->next) {
/* check if stroke can be drawn - checks here generally fall into pairs */
@@ -579,7 +579,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
glLineWidth(lthick);
QUATCOPY(color, gpl->color); // just for copying 4 array elements
QUATCOPY(tcolor, gpl->color); // additional copy of color (for ghosting)
glColor4f(color[0], color[1], color[2], color[3]);
glColor4fv(color);
glPointSize((float)(gpl->thickness + 2));
/* apply xray layer setting */
@@ -620,7 +620,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
}
/* restore alpha */
glColor4f(color[0], color[1], color[2], color[3]);
glColor4fv(color);
}
else {
/* draw the strokes for the ghost frames (at half of the alpha set by user) */
@@ -635,7 +635,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
}
/* restore alpha */
glColor4f(color[0], color[1], color[2], color[3]);
glColor4fv(color);
}
}

View File

@@ -129,7 +129,7 @@ static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
}
/* This function is for brightening/darkening a given color (like UI_ThemeColorShade()) */
static void cp_shade_color3ub (char cp[], int offset)
static void cp_shade_color3ub (unsigned char cp[3], const int offset)
{
int r, g, b;
@@ -152,7 +152,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
case PCHAN_COLOR_NORMAL:
{
if (bcolor) {
char cp[3];
unsigned char cp[3];
if (boneflag & BONE_DRAW_ACTIVE) {
VECCOPY(cp, bcolor->active);
@@ -169,7 +169,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
cp_shade_color3ub(cp, -50);
}
glColor3ub(cp[0], cp[1], cp[2]);
glColor3ubv(cp);
}
else {
if (boneflag & BONE_DRAW_ACTIVE && boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_BONE_POSE, 40);
@@ -185,8 +185,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
case PCHAN_COLOR_SOLID:
{
if (bcolor) {
char *cp= bcolor->solid;
glColor3ub(cp[0], cp[1], cp[2]);
glColor3ubv((unsigned char *)bcolor->solid);
}
else
UI_ThemeColor(TH_BONE_SOLID);
@@ -215,7 +214,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
case PCHAN_COLOR_SPHEREBONE_BASE:
{
if (bcolor) {
char cp[3];
unsigned char cp[3];
if (boneflag & BONE_DRAW_ACTIVE) {
VECCOPY(cp, bcolor->active);
@@ -227,7 +226,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
VECCOPY(cp, bcolor->solid);
}
glColor3ub(cp[0], cp[1], cp[2]);
glColor3ubv(cp);
}
else {
if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorShade(TH_BONE_POSE, 40);
@@ -241,7 +240,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
case PCHAN_COLOR_SPHEREBONE_END:
{
if (bcolor) {
char cp[3];
unsigned char cp[3];
if (boneflag & BONE_DRAW_ACTIVE) {
VECCOPY(cp, bcolor->active);
@@ -256,7 +255,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
cp_shade_color3ub(cp, -30);
}
glColor3ub(cp[0], cp[1], cp[2]);
glColor3ubv(cp);
}
else {
if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorShade(TH_BONE_POSE, 10);

View File

@@ -2725,7 +2725,7 @@ static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata)
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glColor4f(rc->tex_col[0], rc->tex_col[1], rc->tex_col[2], rc->tex_col[3]);
glColor4fv(rc->tex_col);
glTexCoord2f(0,0);
glVertex2f(-r3, -r3);
glTexCoord2f(1,0);
@@ -2739,7 +2739,7 @@ static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata)
}
if(rc->mode == WM_RADIALCONTROL_ANGLE) {
glColor4f(rc->col[0], rc->col[1], rc->col[2], rc->col[3]);
glColor4fv(rc->col);
glEnable(GL_LINE_SMOOTH);
glRotatef(-angle, 0, 0, 1);
fdrawline(0.0f, 0.0f, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
@@ -2748,7 +2748,7 @@ static void wm_radial_control_paint(bContext *C, int x, int y, void *customdata)
glDisable(GL_LINE_SMOOTH);
}
glColor4f(rc->col[0], rc->col[1], rc->col[2], rc->col[3]);
glColor4fv(rc->col);
glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r1, 40);
glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r2, 40);
glDisable(GL_BLEND);