X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2Fchunk.cpp;h=baad4466cde01790851b5f8877e2350d4e8a53b5;hb=1daba5b2fa044c1822d104fb65eeb88b6aeb5499;hp=7ef09c7a465d7f21d2051895af1954c7b62cf342;hpb=9240fdf2e68ee014da0d0a89a7fb2f29ebf28e2d;p=blank.git diff --git a/src/world/chunk.cpp b/src/world/chunk.cpp index 7ef09c7..baad446 100644 --- a/src/world/chunk.cpp +++ b/src/world/chunk.cpp @@ -668,7 +668,11 @@ void ChunkRenderer::LoadTextures(const AssetLoader &loader, const TextureIndex & void ChunkRenderer::Update(int dt) { for (int i = 0, updates = 0; updates < dt && i < index.TotalChunks(); ++i) { - if (index[i] && index[i]->ShouldUpdateModel()) { + if (!index[i]) continue; + if (!index[i]->Lighted() && index.HasAllSurrounding(index[i]->Position())) { + index[i]->ScanLights(); + } + if (index[i]->ShouldUpdateModel()) { index[i]->Update(models[i]); ++updates; } @@ -1012,7 +1016,7 @@ Chunk::Pos ChunkStore::NextMissing() noexcept { void ChunkStore::Clean() { for (auto i = loaded.begin(), end = loaded.end(); i != end;) { - if (i->Referenced()) { + if (i->Referenced() || i->ShouldUpdateSave()) { ++i; } else { auto chunk = i;