From 87a67eccf53c8a86315f8dc84011b6910aecdd8e Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 9 Apr 2016 13:20:13 +0200 Subject: [PATCH] Fixed Portable C versio of ShadowMap Layer Mixer --- Sources/Engine/Light/LayerMixer.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) mode change 100644 => 100755 Sources/Engine/Light/LayerMixer.cpp diff --git a/Sources/Engine/Light/LayerMixer.cpp b/Sources/Engine/Light/LayerMixer.cpp old mode 100644 new mode 100755 index 66762a2..ef84ebb --- a/Sources/Engine/Light/LayerMixer.cpp +++ b/Sources/Engine/Light/LayerMixer.cpp @@ -57,7 +57,6 @@ extern INDEX shd_iDithering; extern const UBYTE *pubClipByte; extern UBYTE aubSqrt[ SQRTTABLESIZE]; extern UWORD auw1oSqrt[SQRTTABLESIZE]; -extern UWORD auw1oSqrt[SQRTTABLESIZE]; // static FLOAT3D _v00; // internal class for layer mixing @@ -464,9 +463,9 @@ skipPixel: SLONG slL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases SLONG slIntensity = _slLightMax; slL = aubSqrt[slL]; - if( slL>_slHotSpot) slIntensity = ((255-slL)*_slLightStep)>>8; + if( slL>_slHotSpot) slIntensity = ((255-slL)*_slLightStep); // add the intensity to the pixel - AddToCluster( pubLayer, slIntensity/255.0f); + AddToCluster( pubLayer, (slIntensity>>8)/255.0f); } // go to the next pixel pubLayer+=4; @@ -682,9 +681,9 @@ skipPixel: SLONG slL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases SLONG slIntensity = _slLightMax; slL = aubSqrt[slL]; - if( slL>_slHotSpot) slIntensity = ((255-slL)*_slLightStep)>>8; + if( slL>_slHotSpot) slIntensity = ((255-slL)*_slLightStep); // add the intensity to the pixel - AddToCluster( pubLayer, slIntensity/255.0f); + AddToCluster( pubLayer, (slIntensity>>8)/255.0f); } // go to the next pixel pubLayer+=4; @@ -899,9 +898,10 @@ skipPixel: SLONG sl1oL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases sl1oL = auw1oSqrt[sl1oL]; SLONG slIntensity = _slLightMax; - if( sl1oL>16; + if( sl1oL<256) slIntensity = 0; + else if( sl1oL>16*/; // add the intensity to the pixel - AddToCluster( pubLayer, slIntensity/255.0f); + AddToCluster( pubLayer, (slIntensity>>8)/255.0f); } // advance to next pixel pubLayer+=4; @@ -1119,9 +1119,10 @@ skipPixel: SLONG sl1oL = (slL2Point>>SHIFTX)&(SQRTTABLESIZE-1); // and is just for degenerate cases sl1oL = auw1oSqrt[sl1oL]; SLONG slIntensity = _slLightMax; - if( sl1oL>16; + if( sl1oL<256) slIntensity = 0; + else if( sl1oL>16*/; // add the intensity to the pixel - AddToCluster( pubLayer, slIntensity/255.0f); + AddToCluster( pubLayer, (slIntensity>>8)/255.0f); } // advance to next pixel pubLayer+=4;