diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-03-06 19:41:47 +0100 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-03-06 19:41:47 +0100 |
commit | ed385ce0f57fd121342362cbcd01bdda665f6c28 (patch) | |
tree | 87a6acdad67824a5654e7cc98d06276575c53326 | |
parent | a9cc55ca6d196ef0e3e36ccacfaf258d663d1322 (diff) |
fix shitty texture mapping
-rw-r--r-- | GPU3D_Soft.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/GPU3D_Soft.cpp b/GPU3D_Soft.cpp index 09c37e3..0368ee9 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]); } } |