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; u = invu*w;
v = invv*w; v = invv*w;
texColor = sampler.sample(u,v); texColor = sampler.sample(u,v);
u32 toonColorVal; toonColorVal = gfx3d.rgbToonTable[materialColor.r]; u32 toonColorVal;
toonColorVal = gfx3d.rgbToonTable[materialColor.r];
FragmentColor toonColor; FragmentColor toonColor;
toonColor.r = ((toonColorVal & 0x0000FF) >> 3); toonColor.r = ((toonColorVal & 0x0000FF) >> 3);
toonColor.g = ((toonColorVal & 0x00FF00) >> 11); toonColor.g = ((toonColorVal & 0x00FF00) >> 11);
toonColor.b = ((toonColorVal & 0xFF0000) >> 19); toonColor.b = ((toonColorVal & 0xFF0000) >> 19);
dst.r = modulate_table[texColor.r][toonColor.r]; if(sampler.texFormat == 0)
dst.g = modulate_table[texColor.g][toonColor.g]; {
dst.b = modulate_table[texColor.b][toonColor.b]; //if no texture is set then we dont need to modulate texture with toon
dst.a = modulate_table[texColor.a][materialColor.a]; //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) if(gfx3d.shading == GFX3D::HIGHLIGHT)
{ {
dst.r = min<u8>(31, (dst.r + toonColor.r)); dst.r = min<u8>(31, (dst.r + toonColor.r));