From 615f142c3fe08de55bc0d8195c8d0a0054f47d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Mon, 10 Sep 2018 13:35:39 +0200 Subject: [PATCH] Add horizon info --- raycastlib.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/raycastlib.h b/raycastlib.h index a2f8e71..1b1e9b2 100644 --- a/raycastlib.h +++ b/raycastlib.h @@ -137,6 +137,7 @@ typedef struct Vector2D position; ///< On-screen position. int8_t isWall; ///< Whether the pixel is a wall or a floor/ceiling. int8_t isFloor; ///< Whether the pixel is floor or ceiling. + int8_t isHorizon; ///< Whether the pixel is floor going towards horizon. Unit depth; ///< Corrected depth. HitResult hit; ///< Corresponding ray hit. Unit textureCoordY; ///< Normalized (0 to UNITS_PER_SQUARE - 1) tex coord. @@ -789,6 +790,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray) p.isWall = 0; p.isFloor = 1; + p.isHorizon = 0; Unit floorCameraDiff = absVal(worldZPrev) * VERTICAL_DEPTH_MULTIPLY; @@ -877,6 +879,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray) p.isWall = 0; p.isFloor = 1; + p.isHorizon = 1; Unit floorCameraDiff = absVal(worldZPrev) * VERTICAL_DEPTH_MULTIPLY; Unit horizon = (y2 < _middleRow || _ceilFunction == 0) ? _middleRow : y2;