rasterize: fix an alpha blending case

This commit is contained in:
zeromus 2009-07-13 04:19:42 +00:00
parent 80a2a480c3
commit b7ffd2a806
1 changed files with 4 additions and 5 deletions

View File

@ -64,6 +64,8 @@ template<typename T> T _max(T a, T b, T c) { return max(max(a,b),c); }
template<typename T> T _min(T a, T b, T c, T d) { return min(_min(a,b,d),c); } template<typename T> T _min(T a, T b, T c, T d) { return min(_min(a,b,d),c); }
template<typename T> T _max(T a, T b, T c, T d) { return max(_max(a,b,d),c); } template<typename T> T _max(T a, T b, T c, T d) { return max(_max(a,b,d),c); }
static const int kUnsetTranslucentPolyID = 255;
static int polynum; static int polynum;
static u8 modulate_table[32][32]; static u8 modulate_table[32][32];
@ -392,9 +394,6 @@ struct Shader
u = invu*w; u = invu*w;
v = invv*w; v = invv*w;
texColor = sampler.sample(u,v); texColor = sampler.sample(u,v);
if(texColor.r != 0x1f || texColor.g != 0x1f || texColor.b != 0x1f) {
int zzz=9;
}
FragmentColor toonColor = toonTable[materialColor.r]; FragmentColor toonColor = toonTable[materialColor.r];
if(sampler.texFormat == 0) if(sampler.texFormat == 0)
{ {
@ -444,7 +443,7 @@ static FORCEINLINE void alphaBlend(FragmentColor & dst, const FragmentColor & sr
u8 dstAlpha = dst.a; u8 dstAlpha = dst.a;
if(gfx3d.enableAlphaBlending) if(gfx3d.enableAlphaBlending)
{ {
if(src.a == 0) if(src.a == 0 || dst.a == 0)
{ {
dst = src; dst = src;
} }
@ -1233,7 +1232,7 @@ static void SoftRastRender()
//special value for uninitialized translucent polyid. without this, fires in spiderman2 dont display //special value for uninitialized translucent polyid. without this, fires in spiderman2 dont display
//I am not sure whether it is right, though. previously this was cleared to 0, as a guess, //I am not sure whether it is right, though. previously this was cleared to 0, as a guess,
//but in spiderman2 some fires with polyid 0 try to render on top of the background //but in spiderman2 some fires with polyid 0 try to render on top of the background
clearFragment.polyid.translucent = 255; clearFragment.polyid.translucent = kUnsetTranslucentPolyID;
clearFragment.depth = gfx3d.clearDepth; clearFragment.depth = gfx3d.clearDepth;
clearFragment.stencil = 0; clearFragment.stencil = 0;
for(int i=0;i<256*192;i++) for(int i=0;i<256*192;i++)