From 925f21342709522afa334218e97e0b31f87f1516 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 7 Mar 2012 12:48:52 +0000 Subject: 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. --- source/blender/blenkernel/intern/editderivedmesh.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/editderivedmesh.c') diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index ae52322a0c5..06712d38890 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -579,10 +579,11 @@ static void emDM_foreachMappedFaceCenter( static void emDM_drawMappedFaces( DerivedMesh *dm, - DMSetDrawOptionsShading setDrawOptions, + DMSetDrawOptions setDrawOptions, DMSetMaterial setMaterial, DMCompareDrawOptions compareDrawOptions, - void *userData, int UNUSED(useColors)) + void *userData, + DMDrawFlag flag) { EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm; BMFace *efa; @@ -615,9 +616,9 @@ static void emDM_drawMappedFaces( int drawSmooth; efa = l[0]->f; - drawSmooth= BM_elem_flag_test(efa, BM_ELEM_SMOOTH); + drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH); - draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, BM_elem_index_get(efa), &drawSmooth); + draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, BM_elem_index_get(efa)); if (draw) { const GLenum poly_type= GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */ if (draw==2) { /* enabled with stipple */ @@ -687,9 +688,9 @@ static void emDM_drawMappedFaces( int drawSmooth; efa = l[0]->f; - drawSmooth= BM_elem_flag_test(efa, BM_ELEM_SMOOTH); + drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH); - draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, BM_elem_index_get(efa), &drawSmooth); + draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, BM_elem_index_get(efa)); if (draw) { const GLenum poly_type= GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */ if (draw==2) { /* enabled with stipple */ -- cgit v1.2.3