diff --git a/demo2.cpp b/demo2.cpp index 88c708f..e393650 100644 --- a/demo2.cpp +++ b/demo2.cpp @@ -31,6 +31,9 @@ //#define NO_SHADING /* ^ Turns off shading (fog) which increases FPS. */ +//#define NO_MIRROR + /* ^ Turns off the floor mirror effect, which should increase FPS. */ + //#define USE_DIST_APPROX 1 /* ^ Turns on distance approximation, which won't compute exact distances but only approximations - this should increase performance a little, but @@ -925,6 +928,8 @@ bool shotFired = false; uint8_t previousColumn = 255; ///< Helper for pixelIntensity. int8_t pixelIntensity = 0; ///< Precomputed column intensity addition. +int16_t mirror = 0; + /** Function for drawing a single pixel (like fragment shader). */ @@ -935,9 +940,25 @@ inline void pixelFunc(PixelInfo *pixel) uint8_t c = 0; +#ifndef NO_MIRROR + if (pixel->position.y == 0) + mirror = 0; +#endif + if (!pixel->isWall) { c = pixel->isFloor ? cFloor: cCeiling; + +#ifndef NO_MIRROR + int16_t intensity = pixel->isFloor ? + -1 * (pixel->depth - mirror * 64) / UNITS_PER_SQUARE : 0; +#else + int16_t intensity = -1 * pixel->depth / (UNITS_PER_SQUARE * 2); +#endif + + c = addIntensity(c,intensity); + + mirror++; } else { @@ -1006,8 +1027,8 @@ int main() for (uint8_t i = 0; i < TEXTURES; ++i) textureAverageColors[i] = computeAverageColor(textures[i]); - cFloor = rgbToIndex(0,1,1); - cCeiling = rgbToIndex(1,0,1); + cFloor = rgbToIndex(3,3,2); + cCeiling = rgbToIndex(3,2,0); player.setPositionSquare(6,5); player.mCamera.height = CAMERA_COLL_HEIGHT_BELOW;