rasterize: fixes to shadows

This commit is contained in:
zeromus 2009-07-18 18:19:17 +00:00
parent 706af15ebe
commit d8b3a0581d
1 changed files with 3 additions and 18 deletions

View File

@ -539,33 +539,18 @@ static FORCEINLINE void pixel(int adr,float r, float g, float b, float invu, flo
{ {
if(polyAttr.polyid == 0) if(polyAttr.polyid == 0)
{ {
destFragment.stencil = 1;
goto rejected_fragment; goto rejected_fragment;
} }
else else
{ {
//some shadow volumes are rendering two-sided
//and this is the only way to fix them.
//rendering two-sided makes no sense, since the back side
//will clear the stencil bit and cause the shadow to get drawn in
//empty space.
//but yet, it is done, and gbatek even suggests that we should do it
if(polyAttr.backfacing)
goto rejected_fragment;
//now, if we arent supposed to draw shadow here, then bail out //now, if we arent supposed to draw shadow here, then bail out
if(destFragment.stencil == 1) if(destFragment.stencil == 0)
{ {
destFragment.stencil = 0;
goto rejected_fragment; goto rejected_fragment;
} }
destFragment.stencil = 0; destFragment.stencil = 0;
} }
//reset the shadow flag to keep the shadow from getting drawn more than once
//if(polyAttr.polyid == 0)
// destFragment.stencil = 1;
} }
//handle polyids //handle polyids
@ -611,10 +596,10 @@ static FORCEINLINE void pixel(int adr,float r, float g, float b, float invu, flo
depth_fail: depth_fail:
//handle stencil-writing in shadow mode //handle stencil-writing in shadow mode
/* if((shader.mode == 3) && (polyAttr.polyid == 0)) if((shader.mode == 3) && (polyAttr.polyid == 0))
{ {
destFragment.stencil = 1; destFragment.stencil = 1;
}*/ }
rejected_fragment: rejected_fragment:
done_with_pixel: done_with_pixel: