From a4492a36563d5ec2427075f0949036a163825b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sun, 16 Sep 2018 17:23:57 +0200 Subject: [PATCH] Small optimization --- raycastlib.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/raycastlib.h b/raycastlib.h index bbc754a..3fe7147 100644 --- a/raycastlib.h +++ b/raycastlib.h @@ -1000,8 +1000,10 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray) Unit wallLength = pref##Z2Screen - pref##Z1Screen - 1;\ wallLength = wallLength != 0 ? wallLength : 1;\ Unit wallPosition = absVal(pref##Z1Screen - pref##PosY) inc (-1);\ - Unit coordStep = UNITS_PER_SQUARE / wallLength;\ - p.texCoords.y = wallPosition * coordStep;\ + Unit coordStep = COMPUTE_WALL_TEXCOORDS ? \ + UNITS_PER_SQUARE / wallLength : 1;\ + p.texCoords.y = COMPUTE_WALL_TEXCOORDS ?\ + wallPosition * coordStep : 0;\ if (coordStep < MIN_TEXTURE_STEP) /* two versions of the loop */ \ for (i = pref##PosY inc 1; i comp##= limit; inc##inc i)\ { /* more expensive texture coord computing */\