diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2020-12-30 14:38:34 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2020-12-30 14:38:34 +0000 |
| commit | 83b0b4cb19d7f0137cde962ee81a900baf2bd953 (patch) | |
| tree | 838204167415de676190a1534767497f084e7a7b /src/main/kotlin/Raycaster.kt | |
| parent | ad192fe7068081ed88f8616581bf450d601e99b1 (diff) | |
| download | kotlin-raycaster-83b0b4cb19d7f0137cde962ee81a900baf2bd953.tar.xz kotlin-raycaster-83b0b4cb19d7f0137cde962ee81a900baf2bd953.zip | |
Add switchable texture sets. Fix minimap
Diffstat (limited to 'src/main/kotlin/Raycaster.kt')
| -rw-r--r-- | src/main/kotlin/Raycaster.kt | 3 |
1 files changed, 2 insertions, 1 deletions
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 |