mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 05:09:46 -06:00
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:
21
GPU2D.cpp
21
GPU2D.cpp
@ -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];
|
||||
|
Reference in New Issue
Block a user