Added a table for alpha conversion from 5-bit to 4-bit. Avoids having the 3D layer slightly transparent where it should be opaque.

This commit is contained in:
luigi__ 2009-01-14 22:33:43 +00:00
parent f5556d2a16
commit 0bdad85503
3 changed files with 21 additions and 1 deletions

View File

@ -1451,7 +1451,7 @@ static void OGLGetLine(int line, int start, int end_inclusive, u16* dst, u8* dst
// u32 dstpixel;
dst[j] = (screen3D[t+2] | (screen3D[t+1] << 5) | (screen3D[t+0] << 10) | ((screen3D[t+3] > 0) ? 0x8000 : 0x0000));
dstAlpha[j] = (screen3D[t+3] / 2);
dstAlpha[j] = alpha_5bit_to_4bit[screen3D[t+3]];
//old debug reminder: display alpha channel
//u32 r = screen3D[t+3];

View File

@ -65,6 +65,25 @@ CACHE_ALIGN const u8 material_3bit_to_8bit[] = {
0x00, 0x24, 0x49, 0x6D, 0x92, 0xB6, 0xDB, 0xFF
};
CACHE_ALIGN const u8 alpha_5bit_to_4bit[] = {
0x00, 0x00,
0x01, 0x01,
0x02, 0x02,
0x03, 0x03,
0x04, 0x04,
0x05, 0x05,
0x06, 0x06,
0x07, 0x07,
0x08, 0x08,
0x09, 0x09,
0x0A, 0x0A,
0x0B, 0x0B,
0x0C, 0x0C,
0x0D, 0x0D,
0x0E, 0x0E,
0x10, 0x10
};
//private acceleration tables
static float float16table[65536];
static float float10Table[1024];

View File

@ -152,6 +152,7 @@ extern CACHE_ALIGN u8 mixTable555[32][32][32];
extern CACHE_ALIGN const int material_5bit_to_31bit[32];
extern CACHE_ALIGN const u8 material_5bit_to_8bit[32];
extern CACHE_ALIGN const u8 material_3bit_to_8bit[8];
extern CACHE_ALIGN const u8 alpha_5bit_to_4bit[32];
//GE commands:
void gfx3d_glViewPort(unsigned long v);