Fixed Portable C versio of ShadowMap Layer Mixer

This commit is contained in:
ptitSeb 2016-04-09 13:20:13 +02:00
parent df746ab6d1
commit 87a67eccf5

19
Sources/Engine/Light/LayerMixer.cpp Normal file → Executable file
View File

@ -57,7 +57,6 @@ extern INDEX shd_iDithering;
extern const UBYTE *pubClipByte; extern const UBYTE *pubClipByte;
extern UBYTE aubSqrt[ SQRTTABLESIZE]; extern UBYTE aubSqrt[ SQRTTABLESIZE];
extern UWORD auw1oSqrt[SQRTTABLESIZE]; extern UWORD auw1oSqrt[SQRTTABLESIZE];
extern UWORD auw1oSqrt[SQRTTABLESIZE];
// static FLOAT3D _v00; // static FLOAT3D _v00;
// internal class for layer mixing // internal class for layer mixing
@ -464,9 +463,9 @@ skipPixel:
SLONG slL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases SLONG slL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases
SLONG slIntensity = _slLightMax; SLONG slIntensity = _slLightMax;
slL = aubSqrt[slL]; slL = aubSqrt[slL];
if( slL>_slHotSpot) slIntensity = ((255-slL)*_slLightStep)>>8; if( slL>_slHotSpot) slIntensity = ((255-slL)*_slLightStep);
// add the intensity to the pixel // add the intensity to the pixel
AddToCluster( pubLayer, slIntensity/255.0f); AddToCluster( pubLayer, (slIntensity>>8)/255.0f);
} }
// go to the next pixel // go to the next pixel
pubLayer+=4; pubLayer+=4;
@ -682,9 +681,9 @@ skipPixel:
SLONG slL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases SLONG slL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases
SLONG slIntensity = _slLightMax; SLONG slIntensity = _slLightMax;
slL = aubSqrt[slL]; slL = aubSqrt[slL];
if( slL>_slHotSpot) slIntensity = ((255-slL)*_slLightStep)>>8; if( slL>_slHotSpot) slIntensity = ((255-slL)*_slLightStep);
// add the intensity to the pixel // add the intensity to the pixel
AddToCluster( pubLayer, slIntensity/255.0f); AddToCluster( pubLayer, (slIntensity>>8)/255.0f);
} }
// go to the next pixel // go to the next pixel
pubLayer+=4; pubLayer+=4;
@ -899,9 +898,10 @@ skipPixel:
SLONG sl1oL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases SLONG sl1oL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases
sl1oL = auw1oSqrt[sl1oL]; sl1oL = auw1oSqrt[sl1oL];
SLONG slIntensity = _slLightMax; SLONG slIntensity = _slLightMax;
if( sl1oL<slMax1oL) slIntensity = ((sl1oL-256)*_slLightStep)>>16; if( sl1oL<256) slIntensity = 0;
else if( sl1oL<slMax1oL) slIntensity = ((sl1oL-256)*_slLightStep)/*>>16*/;
// add the intensity to the pixel // add the intensity to the pixel
AddToCluster( pubLayer, slIntensity/255.0f); AddToCluster( pubLayer, (slIntensity>>8)/255.0f);
} }
// advance to next pixel // advance to next pixel
pubLayer+=4; pubLayer+=4;
@ -1119,9 +1119,10 @@ skipPixel:
SLONG sl1oL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases SLONG sl1oL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases
sl1oL = auw1oSqrt[sl1oL]; sl1oL = auw1oSqrt[sl1oL];
SLONG slIntensity = _slLightMax; SLONG slIntensity = _slLightMax;
if( sl1oL<slMax1oL) slIntensity = ((sl1oL-256)*_slLightStep)>>16; if( sl1oL<256) slIntensity = 0;
else if( sl1oL<slMax1oL) slIntensity = ((sl1oL-256)*_slLightStep)/*>>16*/;
// add the intensity to the pixel // add the intensity to the pixel
AddToCluster( pubLayer, slIntensity/255.0f); AddToCluster( pubLayer, (slIntensity>>8)/255.0f);
} }
// advance to next pixel // advance to next pixel
pubLayer+=4; pubLayer+=4;