From 175ea1ef854dde63222091072ed48d1b116d6c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Fri, 28 Sep 2018 14:38:53 +0200 Subject: [PATCH] Fix NO_SHADING --- demo2.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/demo2.cpp b/demo2.cpp index e5bb879..fa1e936 100644 --- a/demo2.cpp +++ b/demo2.cpp @@ -917,9 +917,9 @@ inline void pixelFunc(RCL_PixelInfo *pixel) mirror = 0; #endif -bool drawCeiling = false; + bool drawCeiling = false; -int16_t intensity = 0; + int16_t intensity = 0; if (!pixel->isWall) { @@ -951,14 +951,17 @@ int16_t intensity = 0; color = pixel->isFloor ? cFloor: cCeiling; #endif -#ifndef NO_MIRROR +#ifndef NO_SHADING + #ifndef NO_MIRROR intensity = pixel->isFloor ? 2 - (pixel->depth - mirror * 128) / RCL_UNITS_PER_SQUARE : 0; -#else + #else intensity = 2 - pixel->depth / RCL_UNITS_PER_SQUARE; + #endif + + color = addIntensity(color,intensity); #endif - color = addIntensity(color,intensity); mirror++; } @@ -1006,7 +1009,10 @@ int16_t intensity = 0; color = pixel->depth > TEXTURE_MAX_DISTANCE_FLOOR ? textureAverageColors[0] : sampleImage(textures[0],pixel->texCoords.x / FLOOR_TEXTURE_SCALE,pixel->texCoords.y / FLOOR_TEXTURE_SCALE); +#ifndef NO_SHADING color = addIntensity(color,intensity); +#endif + putSubsampledPixel(pixel->position.x,RESOLUTION_Y - pixel->position.y - 1,color); } #endif