From bfbc84ed7afbbeefd3507d0e9f16cc1574a6bfc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 1 Sep 2018 12:10:45 +0200 Subject: [PATCH] Fix floor depth --- raycastlib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/raycastlib.h b/raycastlib.h index ed8ab25..54361f4 100644 --- a/raycastlib.h +++ b/raycastlib.h @@ -586,8 +586,8 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray) for (int32_t i = y; i >= middleRow; --i) { p.position.y = i; - _pixelFunction(p); p.depth = (_camera.resolution.y - i) * _floorDepthStep + floorCameraDiff; + _pixelFunction(p); } } @@ -603,7 +603,7 @@ void render(Camera cam, ArrayFunction arrayFunc, PixelFunction pixelFunc, cam.position.y / UNITS_PER_SQUARE) -1 * cam.height; // TODO - _floorDepthStep = (10 * UNITS_PER_SQUARE) / cam.resolution.y; + _floorDepthStep = (16 * UNITS_PER_SQUARE) / cam.resolution.y; castRaysMultiHit(cam,arrayFunc,_columnFunction,constraints); }