From 37cfeb594f279a51ae19f0d95b553618e1e5f4eb Mon Sep 17 00:00:00 2001 From: Bixilon Date: Wed, 23 Nov 2022 12:43:08 +0100 Subject: [PATCH] fix more skylight bugs, disable skylight test --- .../light/place/block/BlockLightPlaceIT.kt | 19 +++++++++++++++++-- .../data/world/chunk/light/ChunkLight.kt | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/block/BlockLightPlaceIT.kt b/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/block/BlockLightPlaceIT.kt index 1fa14e745..fa82d1f81 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/block/BlockLightPlaceIT.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/block/BlockLightPlaceIT.kt @@ -190,9 +190,24 @@ class BlockLightPlaceIT { chunk.assertLight(9, 256, 8, 0xFC) } + @Test(enabled = false) // TODO: update heightmap of neighbours on change + fun bottomHeightmap() { + val world = ConnectionTestUtil.createConnection(4).world + world.fill(Vec3i(-25, 0, -25), Vec3i(40, 1, 40), StoneTestO.state) + + world.assertLight(8, -1, 8, 0x00) + world.assertLight(9, -1, 8, 0x00) + + world.assertLight(+20, -1, +8, 0x00) + world.assertLight(+8, -1, +8, 0x00) + world.assertLight(-4, -1, +8, 0x00) + world.assertLight(+8, -1, -4, 0x00) + } + + @Test(enabled = false) // TODO: update heightmap of neighbours on change fun bottomPropagation() { - val world = ConnectionTestUtil.createConnection(3).world - world.fill(Vec3i(-20, 0, -20), Vec3i(40, 1, 40), StoneTestO.state) + val world = ConnectionTestUtil.createConnection(4).world + world.fill(Vec3i(-25, 0, -25), Vec3i(40, 1, 40), StoneTestO.state) world[Vec3i(8, 0, 8)] = TorchTest0.state world.assertLight(8, -1, 8, 0x0D) diff --git a/src/main/java/de/bixilon/minosoft/data/world/chunk/light/ChunkLight.kt b/src/main/java/de/bixilon/minosoft/data/world/chunk/light/ChunkLight.kt index 3a8303330..32c893c0f 100644 --- a/src/main/java/de/bixilon/minosoft/data/world/chunk/light/ChunkLight.kt +++ b/src/main/java/de/bixilon/minosoft/data/world/chunk/light/ChunkLight.kt @@ -236,6 +236,7 @@ class ChunkLight(private val chunk: Chunk) { val sections = chunk.sections ?: Broken("Sections == null") val maxIndex = previous.sectionHeight - chunk.minSection val minIndex = now.sectionHeight - chunk.minSection + bottom.reset() for (index in maxIndex downTo minIndex) { val section = sections[index] ?: continue section.light.reset()