diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-05 15:25:34 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-05 15:25:34 +0400 |
commit | 0eeeab515b6b46f907016091b3a89bf5e320c400 (patch) | |
tree | 5adf8bbd7a0de3a6557fc629006352c1f5fa0c5f /source/blender/blenkernel/intern/cdderivedmesh.c | |
parent | a7258c96512d45f2392e13f5d5c8fb6edf651a00 (diff) |
bugfix [#23506] Bevel Modifier display problem
This is a more general problem that drawing functions would skip faces when the original index could not be found, screw result for example wasnt visible in editmode too.
Fixed by adding a material set argument to DerivedMesh->drawMappedFaces(), this was already being done in some of the other drawing functions.
Diffstat (limited to 'source/blender/blenkernel/intern/cdderivedmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index e2ecf21bd62..b9ca7bfafe3 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -777,7 +777,7 @@ static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tfa cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } -static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) +static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; MVert *mv = cddm->mvert; @@ -798,16 +798,16 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us DEBUG_VBO( "Using legacy code. cdDM_drawMappedFaces\n" ); for(i = 0; i < dm->numFaceData; i++, mf++) { int drawSmooth = (mf->flag & ME_SMOOTH); + int draw= 1; - if(index) { - orig = *index++; - if(setDrawOptions && orig == ORIGINDEX_NONE) - { if(nors) nors += 3; continue; } - } - else - orig = i; + orig= (index==NULL) ? i : *index++; + + if(orig == ORIGINDEX_NONE) + draw= setMaterial(mf->mat_nr + 1, NULL); + else if (setDrawOptions != NULL) + draw= setDrawOptions(userData, orig, &drawSmooth); - if(!setDrawOptions || setDrawOptions(userData, orig, &drawSmooth)) { + if(draw) { unsigned char *cp = NULL; if(useColors && mc) @@ -887,22 +887,19 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us for( i = 0; i < tottri; i++ ) { //int actualFace = dm->drawObject->faceRemap[i]; int actualFace = next_actualFace; - int drawSmooth = (mf[actualFace].flag & ME_SMOOTH); + MFace *mface= mf + actualFace; + int drawSmooth= (mface->flag & ME_SMOOTH); int draw = 1; if(i != tottri-1) next_actualFace= dm->drawObject->faceRemap[i+1]; - - if(index) { - orig = index[actualFace]; - if(orig == ORIGINDEX_NONE) - draw = 0; - } - else - orig = actualFace; - - if(draw && !setDrawOptions(userData, orig, &drawSmooth)) - draw = 0; + + orig= (index==NULL) ? actualFace : index[actualFace]; + + if(orig == ORIGINDEX_NONE) + draw= setMaterial(mface->mat_nr + 1, NULL); + else if (setDrawOptions != NULL) + draw= setDrawOptions(userData, orig, &drawSmooth); /* Goal is to draw as long of a contiguous triangle array as possible, so draw when we hit either an @@ -974,8 +971,12 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo else if(setDrawOptions) { orig = (index)? index[a]: a; - if(orig == ORIGINDEX_NONE) - continue; + if(orig == ORIGINDEX_NONE) { + /* since the material is set by setMaterial(), faces with no + * origin can be assumed to be generated by a modifier */ + + /* continue */ + } else if(!setDrawOptions(userData, orig)) continue; } |