diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-05-22 22:22:26 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-05-22 22:22:26 +0200 |
commit | b66ac09e431fccfb8d4cf5977245b3538d2382f4 (patch) | |
tree | 738e6919256b24d4075a9c0d7d4b1483b384412a | |
parent | 189973f5649fe7e2c3ad6073792f0ef049bdfe67 (diff) |
make the renderer truly per-scanline
-rw-r--r-- | src/GPU3D_Soft.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp index d16138b..f8c741b 100644 --- a/src/GPU3D_Soft.cpp +++ b/src/GPU3D_Soft.cpp @@ -1427,6 +1427,18 @@ void RenderPolygon(RendererPolygon* rp) } } +void RenderScanline(s32 y, int npolys) +{ + for (int i = 0; i < npolys; i++) + { + RendererPolygon* rp = &PolygonList[i]; + Polygon* polygon = rp->PolyData; + + if (y >= polygon->YTop && (y < polygon->YBottom || (y == polygon->YTop && polygon->YBottom == polygon->YTop))) + RenderPolygonScanline(rp, y); + } +} + void RenderFrame(Vertex* vertices, Polygon* polygons, int npolys) { u32 polyid = RenderClearAttr1 & 0x3F000000; @@ -1483,15 +1495,22 @@ void RenderFrame(Vertex* vertices, Polygon* polygons, int npolys) } } + // TODO: Y-sorting of translucent polygons + + int j = 0; for (int i = 0; i < npolys; i++) { - SetupPolygon(&PolygonList[i], &polygons[i]); + if (polygons[i].Translucent) continue; + SetupPolygon(&PolygonList[j++], &polygons[i]); } - - // TODO: Y-sorting of translucent polygons - for (int i = 0; i < npolys; i++) { + if (!polygons[i].Translucent) continue; + SetupPolygon(&PolygonList[j++], &polygons[i]); + } + + /*for (int i = 0; i < npolys; i++) + { if (polygons[i].Translucent) continue; RenderPolygon(&PolygonList[i]); } @@ -1500,6 +1519,10 @@ void RenderFrame(Vertex* vertices, Polygon* polygons, int npolys) { if (!polygons[i].Translucent) continue; RenderPolygon(&PolygonList[i]); + }*/ + for (s32 y = 0; y < 192; y++) + { + RenderScanline(y, npolys); } } |