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