diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-04 16:00:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-04 16:00:11 +0400 |
commit | b9076b87d28a741e09bd7da66bf9d1a1fe07c38d (patch) | |
tree | b29486893b7f4b844355c2cd82a2fd8f10dbb7fa | |
parent | 5a0dca41e5aed566ce6427c863c2f3072f7d044c (diff) |
pass colors to glColor as vectors where possible.
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 16 | ||||
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 17 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 6 |
4 files changed, 23 insertions, 24 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 8bd650b1a42..baf89f9f494 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -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 ); } } diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 1a9ef4be70f..b93e4b07302 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -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); } } diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 022fa8b64c3..7c66cec5730 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -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); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b3a6d44233f..7148c16faa8 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -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); |