From aa88bdaa3e4736deb01e7b898fd0a574facb5921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Thu, 6 Sep 2018 09:57:38 +0200 Subject: [PATCH] Fix texture overflow --- raycastlib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/raycastlib.h b/raycastlib.h index 6c2a842..c90db01 100644 --- a/raycastlib.h +++ b/raycastlib.h @@ -745,7 +745,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray) p.hit = hit; if (_computeTextureCoords) - p.textureCoordY = UNITS_PER_SQUARE - ((i - z1ScreenNoClamp) * + p.textureCoordY = UNITS_PER_SQUARE - 1 -((i - z1ScreenNoClamp) * UNITS_PER_SQUARE) / wallScreenHeightNoClamp; _pixelFunction(p); @@ -766,7 +766,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray) p.hit = hit; if (_computeTextureCoords) - p.textureCoordY = UNITS_PER_SQUARE - ((i - z1ScreenCeilNoClamp) * + p.textureCoordY = UNITS_PER_SQUARE - 1 - ((i - z1ScreenCeilNoClamp) * UNITS_PER_SQUARE) / wallScreenHeightCeilNoClamp; _pixelFunction(p);