Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-03-07 16:48:52 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-03-07 16:48:52 +0400
commit925f21342709522afa334218e97e0b31f87f1516 (patch)
tree5fd06cc9a34227079fa47d8c9a7554c6441a7d32 /source/blender/blenkernel/intern/subsurf_ccg.c
parent43711d856891c46c1dc898554f40534d9b5f529f (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/subsurf_ccg.c')
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 8edd6362d50..75636ab5c23 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2111,16 +2111,17 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm)
}
static void ccgDM_drawMappedFaces(DerivedMesh *dm,
- DMSetDrawOptionsShading setDrawOptions,
+ DMSetDrawOptions setDrawOptions,
DMSetMaterial setMaterial,
DMCompareDrawOptions compareDrawOptions,
- void *userData, int useColors)
+ void *userData, DMDrawFlag flag)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
MCol *mcol= NULL;
int i, gridSize = ccgSubSurf_getGridSize(ss);
DMFlagMat *faceFlags = ccgdm->faceFlags;
+ int useColors = flag & DM_DRAW_USE_COLORS;
int gridFaces = gridSize - 1, totface;
/* currently unused -- each original face is handled separately */
@@ -2142,7 +2143,8 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
- if(faceFlags) drawSmooth = (faceFlags[origIndex].flag & ME_SMOOTH);
+ if(flag & DM_DRAW_ALWAYS_SMOOTH) drawSmooth = 1;
+ else if(faceFlags) drawSmooth = (faceFlags[origIndex].flag & ME_SMOOTH);
else drawSmooth = 1;
if(mcol) {
@@ -2156,7 +2158,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm,
if(index == ORIGINDEX_NONE)
draw= setMaterial(faceFlags ? faceFlags[origIndex].mat_nr + 1: 1, NULL); /* XXX, no faceFlags no material */
else if (setDrawOptions)
- draw= setDrawOptions(userData, index, &drawSmooth);
+ draw= setDrawOptions(userData, index);
if (draw) {
if (draw==2) {