]> git.localhorst.tv Git - blank.git/blobdiff - src/world/chunk.cpp
split geometry lib
[blank.git] / src / world / chunk.cpp
index 800012e601cfa1cdc966b70f09ebd5876982e002..8340d56cd50b1888b6798108fd747d028d3baa37 100644 (file)
@@ -8,6 +8,7 @@
 #include "Generator.hpp"
 #include "WorldCollision.hpp"
 #include "../app/Assets.hpp"
+#include "../geometry/distance.hpp"
 #include "../graphics/BlockLighting.hpp"
 #include "../graphics/BlockMesh.hpp"
 #include "../graphics/Viewport.hpp"
@@ -636,9 +637,13 @@ bool ChunkLoader::LoadOne() {
                        for (iter.x = begin.x; iter.x < end.x; ++iter.x) {
                                if (index->IsBorder(iter)) continue;
                                Chunk *light_chunk = index->Get(iter);
-                               if (!light_chunk || light_chunk->Lighted()) continue;
+                               if (!light_chunk) continue;
                                if (index->HasAllSurrounding(iter)) {
-                                       light_chunk->ScanLights();
+                                       if (!light_chunk->Lighted()) {
+                                               light_chunk->ScanLights();
+                                       } else {
+                                               light_chunk->InvalidateMesh();
+                                       }
                                }
                        }
                }
@@ -671,7 +676,7 @@ int ChunkRenderer::MissingChunks() const noexcept {
        return index.MissingChunks();
 }
 
-void ChunkRenderer::LoadTextures(const AssetLoader &loader, const TextureIndex &tex_index) {
+void ChunkRenderer::LoadTextures(const AssetLoader &loader, const ResourceIndex &tex_index) {
        block_tex.Bind();
        loader.LoadTextures(tex_index, block_tex);
        block_tex.FilterNearest();