GFX3D: Save the opaque polygon count in POLYLIST.

This commit is contained in:
rogerman 2016-12-26 14:19:45 -08:00
parent f50f9d38fd
commit 8159da3f0c
2 changed files with 6 additions and 3 deletions

View File

@ -389,6 +389,7 @@ static void twiddleLists()
polylist = &polylists[listTwiddle];
vertlist = &vertlists[listTwiddle];
polylist->count = 0;
polylist->opaqueCount = 0;
vertlist->count = 0;
}
@ -2241,7 +2242,8 @@ static void gfx3d_doFlush()
if (!poly.isTranslucent())
gfx3d.indexlist.list[ctr++] = i;
}
const size_t opaqueCount = ctr;
polylist->opaqueCount = ctr;
//then look for translucent polys
for (size_t i = 0; i < polycount; i++)
@ -2259,13 +2261,13 @@ static void gfx3d_doFlush()
//now we have to sort the opaque polys by y-value.
//(test case: harvest moon island of happiness character cretor UI)
//should this be done after clipping??
std::stable_sort(gfx3d.indexlist.list, gfx3d.indexlist.list + opaqueCount, gfx3d_ysort_compare);
std::stable_sort(gfx3d.indexlist.list, gfx3d.indexlist.list + polylist->opaqueCount, gfx3d_ysort_compare);
if (!gfx3d.state.sortmode)
{
//if we are autosorting translucent polys, we need to do this also
//TODO - this is unverified behavior. need a test case
std::stable_sort(gfx3d.indexlist.list + opaqueCount, gfx3d.indexlist.list + polycount, gfx3d_ysort_compare);
std::stable_sort(gfx3d.indexlist.list + polylist->opaqueCount, gfx3d.indexlist.list + polycount, gfx3d_ysort_compare);
}
//switch to the new lists

View File

@ -477,6 +477,7 @@ struct POLY {
struct POLYLIST {
POLY list[POLYLIST_SIZE];
size_t count;
size_t opaqueCount;
};
//just a vert with a 4 float position