From 69bd39bd45d95b6918b28f8964174834156943a1 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Mon, 15 Nov 2021 15:55:16 +0100 Subject: [PATCH] fix fast biomes --- doc/rendering/world_renderer.md | 8 +++++++- .../data/world/biome/accessor/NoiseBiomeAccessor.kt | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/rendering/world_renderer.md b/doc/rendering/world_renderer.md index 07429ffb4..43e959055 100644 --- a/doc/rendering/world_renderer.md +++ b/doc/rendering/world_renderer.md @@ -9,7 +9,7 @@ - 3 Meshes per section (opaque; transparent; translucent) - Preparing in nearer to further away order - unload meshes if block changed and not in frustum - - only prepare if chunk is in frustum + - only prepare if chunk is in frust - don't prepare empty chunks - Light - Client side light engine @@ -40,3 +40,9 @@ - Greedy meshing - Model deciding (for pre flattening versions) - Assets manager: Create file from jar with all models inside and load models from there (make them moddable) + + +- ToDo: + - Unshelve + - Thread safety + - Build biome cache only in render distance diff --git a/src/main/java/de/bixilon/minosoft/data/world/biome/accessor/NoiseBiomeAccessor.kt b/src/main/java/de/bixilon/minosoft/data/world/biome/accessor/NoiseBiomeAccessor.kt index 18dabddb7..855edf4de 100644 --- a/src/main/java/de/bixilon/minosoft/data/world/biome/accessor/NoiseBiomeAccessor.kt +++ b/src/main/java/de/bixilon/minosoft/data/world/biome/accessor/NoiseBiomeAccessor.kt @@ -36,7 +36,7 @@ class NoiseBiomeAccessor(private val world: World) { return null } - return it.data[(biomeY / 4) * 16 + (((z and 0x0F) / 4) * 4 + ((x and 0x0F) / 4))] + return it.data[(biomeY and 0x0F) shr 2 and 0x3F shl 4 or ((z and 0x0F) shr 2 and 0x03 shl 2) or ((x and 0x0F) shr 2 and 0x03)] } return null }