some debuts of 3D drawing.

it can draw non-strip polygons, filled with a fixed color. oh and it doesn't work if they're facing back.
This commit is contained in:
StapleButter
2017-02-11 03:54:08 +01:00
parent 78f49d061a
commit 050ba5dfbe
6 changed files with 183 additions and 9 deletions

View File

@ -290,7 +290,7 @@ void GPU2D::DrawScanlineBGMode(u32 line, u32* spritebuf, u16* dst)
if (DispCnt & 0x0100)
{
if ((!Num) && (DispCnt & 0x8))
{} // TODO
DrawBG_3D(line, dst);
else
DrawBG_Text(line, dst, 0);
}
@ -333,6 +333,25 @@ void GPU2D::DrawScanline_Mode1(u32 line, u16* dst)
}
void GPU2D::DrawBG_3D(u32 line, u16* dst)
{
// TODO: scroll, etc
u8* src = GPU3D::GetLine(line);
for (int i = 0; i < 256; i++)
{
// TODO: color buffer should be 18bit!!
u8 r = *src++;
u8 g = *src++;
u8 b = *src++;
u8 a = *src++;
if (a == 0) continue;
dst[i] = (r >> 1) | ((g >> 1) << 5) | ((b >> 1) << 10);
}
}
void GPU2D::DrawBG_Text(u32 line, u16* dst, u32 bgnum)
{
u16 bgcnt = BGCnt[bgnum];