rasterize: tweak around alpha blending again, mostly reverting to the older form

This commit is contained in:
zeromus 2009-07-06 06:54:41 +00:00
parent 2a9f14b516
commit 8f2825ca2f
1 changed files with 9 additions and 7 deletions

View File

@ -450,10 +450,11 @@ static FORCEINLINE void alphaBlend(FragmentColor & dst, const FragmentColor & sr
} }
else else
{ {
//TODO - check decal table for src.a = 0 case, maybe it is wrong for the shader also u8 alpha = src.a+1;
dst.r = decal_table[src.a][src.r][dst.r]; u8 invAlpha = 32 - alpha;
dst.g = decal_table[src.a][src.g][dst.g]; dst.r = (alpha*src.r + invAlpha*dst.r)>>5;
dst.b = decal_table[src.a][src.b][dst.b]; dst.g = (alpha*src.g + invAlpha*dst.g)>>5;
dst.b = (alpha*src.b + invAlpha*dst.b)>>5;
} }
dst.a = max(src.a,dst.a); dst.a = max(src.a,dst.a);
@ -574,6 +575,7 @@ static FORCEINLINE void pixel(int adr,float r, float g, float b, float invu, flo
{ {
destFragment.polyid.opaque = polyAttr.polyid; destFragment.polyid.opaque = polyAttr.polyid;
destFragment.isTranslucentPoly = polyAttr.translucent?1:0; destFragment.isTranslucentPoly = polyAttr.translucent?1:0;
destFragmentColor = shaderOutput;
} }
else else
{ {
@ -595,10 +597,10 @@ static FORCEINLINE void pixel(int adr,float r, float g, float b, float invu, flo
//but, it looks bad in that game. this is actually correct //but, it looks bad in that game. this is actually correct
//if this isnt correct, then complex shape cart shadows in mario kart don't work right //if this isnt correct, then complex shape cart shadows in mario kart don't work right
destFragment.polyid.translucent = polyAttr.polyid; destFragment.polyid.translucent = polyAttr.polyid;
}
//alpha blending and write color //alpha blending and write color
alphaBlend(destFragmentColor, shaderOutput); alphaBlend(destFragmentColor, shaderOutput);
}
//depth writing //depth writing
if(isOpaquePixel || polyAttr.translucentDepthWrite) if(isOpaquePixel || polyAttr.translucentDepthWrite)