From 83b0b4cb19d7f0137cde962ee81a900baf2bd953 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Wed, 30 Dec 2020 14:38:34 +0000 Subject: Add switchable texture sets. Fix minimap --- src/main/kotlin/Raycaster.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin/Raycaster.kt') diff --git a/src/main/kotlin/Raycaster.kt b/src/main/kotlin/Raycaster.kt index 8cc3781..ff2cc24 100644 --- a/src/main/kotlin/Raycaster.kt +++ b/src/main/kotlin/Raycaster.kt @@ -30,7 +30,8 @@ class Raycaster(private val stepPrecision: Int) { val texture = textureManager.getTexture(objectTypeHit) val textureXIndex = ((texture.width * (rayX + rayY)) % texture.width).toFlooredInt() - val distanceToWall = kotlin.math.sqrt((camera.xPos - rayX).pow(2) + (camera.yPos - rayY).pow(2)) + var distanceToWall = kotlin.math.sqrt((camera.xPos - rayX).pow(2) + (camera.yPos - rayY).pow(2)) +// distanceToWall *= (raySweepAngle-camera.rotation).cosine() val wallHeight = viewportHeightHalf / distanceToWall // Ceiling -- cgit v1.2.3