diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index 5a236c045..a1475be1d 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -703,12 +703,15 @@ static void SoftRastRender() POLY *poly = &gfx3d.polylist->list[gfx3d.indexlist[i]]; int type = poly->type; - VERT* verts[4] = { + /*VERT* verts[4] = { &gfx3d.vertlist->list[poly->vertIndexes[0]], &gfx3d.vertlist->list[poly->vertIndexes[1]], &gfx3d.vertlist->list[poly->vertIndexes[2]], type==4?&gfx3d.vertlist->list[poly->vertIndexes[3]]:0 - }; + };*/ + VERT **verts = new VERT*[type]; + for(int j = 0; j < type; j++) + verts[j] = &gfx3d.vertlist->list[poly->vertIndexes[j]]; if(i == 0 || lastPolyAttr != poly->polyAttr) { @@ -749,7 +752,7 @@ static void SoftRastRender() //note that when we build our triangle vert lists, we reorder them for our renderer. //we should probably fix the renderer so we dont have to do this; //but then again, what does it matter? - if(type == 4) + /*if(type == 4) { if(backfacing) { @@ -792,7 +795,30 @@ static void SoftRastRender() SubmitVertex(2,verts[0]); triangle_from_devmaster(); } + }*/ + for(int j = 1; j < (type-1); j++) + { + VERT *vert0 = &gfx3d.vertlist->list[poly->vertIndexes[0]]; + VERT *vert1 = &gfx3d.vertlist->list[poly->vertIndexes[j]]; + VERT *vert2 = &gfx3d.vertlist->list[poly->vertIndexes[j+1]]; + + if(backfacing) + { + SubmitVertex(0, vert1); + SubmitVertex(1, vert2); + SubmitVertex(2, vert0); + } + else + { + SubmitVertex(0, vert2); + SubmitVertex(1, vert1); + SubmitVertex(2, vert0); + } + + triangle_from_devmaster(); } + + delete verts; }