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/editderivedmesh.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/editderivedmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/editderivedmesh.c | 13 |
1 files changed, 7 insertions, 6 deletions
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 */ |