diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-07 16:48:52 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-07 16:48:52 +0400 |
commit | 925f21342709522afa334218e97e0b31f87f1516 (patch) | |
tree | 5fd06cc9a34227079fa47d8c9a7554c6441a7d32 /source/blender/blenkernel/intern/cdderivedmesh.c | |
parent | 43711d856891c46c1dc898554f40534d9b5f529f (diff) |
Code cleanup: simplify the DerivedMesh.drawMappedFaces interface.
This function pointer's 'setDrawOptions' parameter took a slightly
different type than the other drawing callbacks. In particular, it
could set a 'drawSmooth' value to indicate that smoothing should
always be enabled, overriding the face flag. However, all callbacks
either did not set this value, or set it unconditionally to
1. Replaced this by adding a new 'flag' parameter to drawFacesMapped,
which can be set to DM_DRAW_ALWAYS_SMOOTH where appropriate.
Also removed the 'useColors' parameter and replaced it with another
flag value, DM_DRAW_USE_COLORS.
Removed the 'wpaint__setSolidDrawOptions' callback, was only being
used to set the shading to smooth.
Diffstat (limited to 'source/blender/blenkernel/intern/cdderivedmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 6b3b11fe0b9..e2b61d81967 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -796,16 +796,17 @@ static void cdDM_drawFacesTex(DerivedMesh *dm, } static void cdDM_drawMappedFaces(DerivedMesh *dm, - DMSetDrawOptionsShading setDrawOptions, + DMSetDrawOptions setDrawOptions, DMSetMaterial setMaterial, DMCompareDrawOptions compareDrawOptions, - void *userData, int useColors) + void *userData, DMDrawFlag flag) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; MVert *mv = cddm->mvert; MFace *mf = cddm->mface; MCol *mc; float *nors= DM_get_tessface_data_layer(dm, CD_NORMAL); + int useColors = flag & DM_DRAW_USE_COLORS; int i, orig, *index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX); mc = DM_get_tessface_data_layer(dm, CD_ID_MCOL); @@ -821,7 +822,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, if( GPU_buffer_legacy(dm) || G.f & G_BACKBUFSEL) { DEBUG_VBO( "Using legacy code. cdDM_drawMappedFaces\n" ); for(i = 0; i < dm->numTessFaceData; i++, mf++) { - int drawSmooth = (mf->flag & ME_SMOOTH); + int drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mf->flag & ME_SMOOTH); int draw= 1; orig= (index==NULL) ? i : *index++; @@ -829,7 +830,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, if(orig == ORIGINDEX_NONE) draw= setMaterial(mf->mat_nr + 1, NULL); else if (setDrawOptions != NULL) - draw= setDrawOptions(userData, orig, &drawSmooth); + draw= setDrawOptions(userData, orig); if(draw) { unsigned char *cp = NULL; @@ -914,7 +915,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, //int actualFace = dm->drawObject->triangle_to_mface[i]; int actualFace = next_actualFace; MFace *mface= mf + actualFace; - int drawSmooth= (mface->flag & ME_SMOOTH); + /*int drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mface->flag & ME_SMOOTH);*/ /* UNUSED */ int draw = 1; int flush = 0; @@ -926,7 +927,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, if(orig == ORIGINDEX_NONE) draw= setMaterial(mface->mat_nr + 1, NULL); else if (setDrawOptions != NULL) - draw= setDrawOptions(userData, orig, &drawSmooth); + draw= setDrawOptions(userData, orig); /* Goal is to draw as long of a contiguous triangle array as possible, so draw when we hit either an |