Browse Source

update all chunks at once

fix/style
Martin Dørum 3 years ago
parent
commit
6e1b068d1c
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      libswan/src/LightServer.cc

+ 7
- 2
libswan/src/LightServer.cc View File

@@ -237,8 +237,6 @@ void LightServer::processUpdatedChunk(LightChunk &chunk, ChunkPos cpos) {
auto end = std::chrono::steady_clock::now();
auto dur = std::chrono::duration<double, std::milli>(end - start);
info << "Generating light for " << cpos << " took " << dur.count() << "ms";

cb_.onLightChunkUpdated(chunk, cpos);
}

void LightServer::run() {
@@ -267,6 +265,13 @@ void LightServer::run() {
}
}

for (auto &pos: updated_chunks_) {
auto ch = chunks_.find(pos);
if (ch != chunks_.end()) {
cb_.onLightChunkUpdated(ch->second, pos);
}
}

updated_chunks_.clear();
}
}

Loading…
Cancel
Save