video/jagblit.c: Implemented gouraud shading.

This commit is contained in:
Ville Linde 2013-02-13 22:53:43 +00:00
parent 87bd8632b5
commit 18da9b0de2

View File

@ -296,6 +296,22 @@ void jaguar_state::FUNCNAME(UINT32 command, UINT32 a1flags, UINT32 a2flags)
adest_xmask = (COMMAND & 0x00000800) ? a2_xmask : a1_xmask;
adest_ymask = (COMMAND & 0x00000800) ? a2_ymask : a1_ymask;
int gouraud_color[4];
gouraud_color[0] = (m_blitter_regs[B_PATD_H] >> 16) & 0xff00;
gouraud_color[1] = m_blitter_regs[B_PATD_H] & 0xff00;
gouraud_color[2] = (m_blitter_regs[B_PATD_L] >> 16) & 0xff00;
gouraud_color[3] = m_blitter_regs[B_PATD_L] & 0xff00;
int gouraud_inten[4];
gouraud_inten[3] = m_blitter_regs[B_I0] & 0xffffff;
gouraud_inten[2] = m_blitter_regs[B_I1] & 0xffffff;
gouraud_inten[1] = m_blitter_regs[B_I2] & 0xffffff;
gouraud_inten[0] = m_blitter_regs[B_I3] & 0xffffff;
int gouraud_iinc = m_blitter_regs[B_IINC] & 0xffffff;
if (gouraud_iinc & 0x800000)
gouraud_iinc |= 0xff000000;
if (LOG_BLITS)
{
logerror("%s:Blit!\n", machine().describe_context());
@ -447,11 +463,24 @@ void jaguar_state::FUNCNAME(UINT32 command, UINT32 a1flags, UINT32 a2flags)
intensity = 0xff;
writedata = (srcdata & 0xff00) | intensity;
}
/* handle gouraud shading */
if (COMMAND & 0x1000)
{
int p = asrc_phrase_mode ? (asrc_x & 3) : 3;
writedata = ((gouraud_inten[p] >> 16) & 0xff) | gouraud_color[p];
int intensity = gouraud_inten[p];
intensity += gouraud_iinc;
if (intensity < 0) intensity = 0;
if (intensity > 0xffffff) intensity = 0xffffff;
gouraud_inten[p] = intensity;
}
}
else
writedata = dstdata;
if (adest_phrase_mode || (command & 0x10000000) || !inhibit)
if ((command & 0x10000000) || !inhibit)
{
/* write to the destination */
WRITE_PIXEL(adestflags, writedata);