bugfix [#24133] r32303, Mirror Modifier + EditMode + VBO's Problem.
drawing the triangle arrays were only broken up by hidden faces, but switches in material were ignored. now check for materual context changes.
This commit is contained in:
@@ -872,34 +872,51 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
|
||||
if( !GPU_buffer_legacy(dm) ) {
|
||||
int tottri = dm->drawObject->nelements/3;
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
if(tottri == 0) {
|
||||
/* avoid buffer problems in following code */
|
||||
}
|
||||
if(setDrawOptions == NULL) {
|
||||
/* just draw the entire face array */
|
||||
glDrawArrays(GL_TRIANGLES, 0, (tottri-1) * 3);
|
||||
}
|
||||
else {
|
||||
/* we need to check if the next material changes */
|
||||
int next_actualFace= dm->drawObject->faceRemap[0];
|
||||
|
||||
for( i = 0; i < tottri; i++ ) {
|
||||
//int actualFace = dm->drawObject->faceRemap[i];
|
||||
int actualFace = next_actualFace;
|
||||
int drawSmooth = (mf[actualFace].flag & ME_SMOOTH);
|
||||
int draw = 1;
|
||||
|
||||
for( i = 0; i < tottri; i++ ) {
|
||||
int actualFace = dm->drawObject->faceRemap[i];
|
||||
int drawSmooth = (mf[actualFace].flag & ME_SMOOTH);
|
||||
int draw = 1;
|
||||
|
||||
if(index) {
|
||||
orig = index[actualFace];
|
||||
if(setDrawOptions && orig == ORIGINDEX_NONE)
|
||||
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;
|
||||
}
|
||||
else
|
||||
orig = actualFace;
|
||||
|
||||
if(draw && setDrawOptions && !setDrawOptions(userData, orig, &drawSmooth))
|
||||
draw = 0;
|
||||
|
||||
/* Goal is to draw as long of a contiguous triangle
|
||||
array as possible, so draw when we hit either an
|
||||
invisible triangle or at the end of the array */
|
||||
if(!draw || i == tottri - 1) {
|
||||
if(prevstart != i)
|
||||
/* Add one to the length (via `draw')
|
||||
if we're drawing at the end of the array */
|
||||
glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3);
|
||||
prevstart = i + 1;
|
||||
|
||||
/* Goal is to draw as long of a contiguous triangle
|
||||
array as possible, so draw when we hit either an
|
||||
invisible triangle or at the end of the array */
|
||||
if(!draw || i == tottri - 1 || mf[actualFace].mat_nr != mf[next_actualFace].mat_nr) {
|
||||
if(prevstart != i)
|
||||
/* Add one to the length (via `draw')
|
||||
if we're drawing at the end of the array */
|
||||
glDrawArrays(GL_TRIANGLES,prevstart*3, (i-prevstart+draw)*3);
|
||||
prevstart = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
}
|
||||
GPU_buffer_unbind();
|
||||
|
||||
Reference in New Issue
Block a user