From ed385ce0f57fd121342362cbcd01bdda665f6c28 Mon Sep 17 00:00:00 2001 From: StapleButter Date: Mon, 6 Mar 2017 19:41:47 +0100 Subject: [PATCH] fix shitty texture mapping --- GPU3D_Soft.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/GPU3D_Soft.cpp b/GPU3D_Soft.cpp index 09c37e32..0368ee91 100644 --- a/GPU3D_Soft.cpp +++ b/GPU3D_Soft.cpp @@ -547,14 +547,13 @@ void RenderPolygon(Polygon* polygon) // temp. if (xl > 255) continue; - s32 xdiv = 0x1000 / (xr - xl); - - //printf("y%d: %d->%d %08X %08X\n", y, xl, xr, lfactor, rfactor); + //s32 xdiv = 0x1000 / (xr - xl); for (s32 x = xl; x < xr; x++) { - //s32 xfactor = ((x - xl) << 12) / (xr - xl); - s32 xfactor = (x - xl) * xdiv; + //if (x!=xl && x!=(xr-1)) continue; + s32 xfactor = ((x - xl) << 12) / (xr - xl); + //s32 xfactor = (x - xl) * xdiv; s32 z = zl + (((s64)(zr - zl) * xfactor) >> 12); //z = wl + (((s64)(wr - wl) * xfactor) >> 12); @@ -613,17 +612,6 @@ void RenderFrame(Vertex* vertices, Polygon* polygons, int npolys) for (int i = 0; i < npolys; i++) { - /*printf("polygon %d: %d %d %d\n", i, polygons[i].Vertices[0]->Color[0], polygons[i].Vertices[0]->Color[1], polygons[i].Vertices[0]->Color[2]); - for (int j = 0; j < polygons[i].NumVertices; j++) - printf(" %d: %f %f %f\n", - j, - polygons[i].Vertices[j]->Position[0]/4096.0f, - polygons[i].Vertices[j]->Position[1]/4096.0f, - polygons[i].Vertices[j]->Position[2]/4096.0f); -*/ - //printf("polygon %d\n", i); - //if (!polygons[i].Vertices[0]->Clipped) continue; - //printf("polygon %d\n", i); RenderPolygon(&polygons[i]); } }