rasterize: fix toon shading when no texture is set (mario kart star powerup)

This commit is contained in:
zeromus 2009-06-20 19:27:22 +00:00
parent 6550d01a86
commit 0340f67a5f
1 changed files with 16 additions and 5 deletions

View File

@ -389,15 +389,26 @@ struct Shader
u = invu*w;
v = invv*w;
texColor = sampler.sample(u,v);
u32 toonColorVal; toonColorVal = gfx3d.rgbToonTable[materialColor.r];
u32 toonColorVal;
toonColorVal = gfx3d.rgbToonTable[materialColor.r];
FragmentColor toonColor;
toonColor.r = ((toonColorVal & 0x0000FF) >> 3);
toonColor.g = ((toonColorVal & 0x00FF00) >> 11);
toonColor.b = ((toonColorVal & 0xFF0000) >> 19);
if(sampler.texFormat == 0)
{
//if no texture is set then we dont need to modulate texture with toon
//but rather just use toon directly
dst = toonColor;
dst.a = materialColor.a;
}
else
{
dst.r = modulate_table[texColor.r][toonColor.r];
dst.g = modulate_table[texColor.g][toonColor.g];
dst.b = modulate_table[texColor.b][toonColor.b];
dst.a = modulate_table[texColor.a][materialColor.a];
}
if(gfx3d.shading == GFX3D::HIGHLIGHT)
{
dst.r = min<u8>(31, (dst.r + toonColor.r));