From c903d801f8154860ecc3d15d5278ec5937d6e074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 29 Sep 2018 08:13:00 +0200 Subject: [PATCH] Fix empty pixels --- raycastlib.h | 3 +-- test.c | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/raycastlib.h b/raycastlib.h index 4ea8917..8207ee6 100644 --- a/raycastlib.h +++ b/raycastlib.h @@ -1191,7 +1191,6 @@ static inline int16_t _RCL_drawWall( i += increment) { // more expensive texture coord computing - pixelInfo->position.y = i; #if RCL_COMPUTE_WALL_TEXCOORDS == 1 @@ -1523,7 +1522,7 @@ void _RCL_columnFunctionSimple(RCL_HitResult *hits, uint16_t hitCount, -1,_RCL_camResYLimit,p.hit.arrayValue,1,&p); y = RCL_max(y,limit); // take max, in case no wall was drawn - y = RCL_max(y,_RCL_middleRow + 1); + y = RCL_max(y,wallStart); // draw floor diff --git a/test.c b/test.c index 3b80e3a..dd5532b 100644 --- a/test.c +++ b/test.c @@ -17,9 +17,9 @@ RCL_Unit testArrayFunc(int16_t x, int16_t y) { if (x > 12 || y > 12) - return x * y; + return x * y * RCL_UNITS_PER_SQUARE; - return (x < 0 || y < 0 || x > 9 || y > 9) ? 1 : 0; + return (x < 0 || y < 0 || x > 9 || y > 9) ? RCL_UNITS_PER_SQUARE : 0; } RCL_Unit testArrayFunc2(int16_t x, int16_t y) @@ -206,6 +206,7 @@ int testPixelCount(RCL_Unit camX, RCL_Unit camY, RCL_Unit camZ, RCL_Camera c; RCL_initRayConstraints(&constraints); + constraints.maxSteps = 32; RCL_initCamera(&c); c.position.x = camX; c.position.y = camY; @@ -338,11 +339,11 @@ int main() if (!testPixelCount( 3 * RCL_UNITS_PER_SQUARE + 100, 4 * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 3, - RCL_UNITS_PER_SQUARE, - 312, + RCL_UNITS_PER_SQUARE / 2, + 512, 0, - 200, - 63, + 120, + 60, 0)) return 1;