[ClientWorld] Now removes far uninitialized chunks.
This commit is contained in:
parent
e84cf25fdb
commit
1ea2c350e4
@ -54,22 +54,10 @@ void ClientWorld::update(bool allowWorldReload) {
|
||||
ClientChunk::chunkUpdateTime = time;
|
||||
}
|
||||
|
||||
// FIXME
|
||||
// Update loaded chunks
|
||||
// std::list<gk::Vector3i> chunksToRemove;
|
||||
// for (auto &it : m_chunks) {
|
||||
// if (World::isReloadRequested && allowWorldReload)
|
||||
// it.second->setChanged(true);
|
||||
//
|
||||
// if (it.second->isReadyForMeshing())
|
||||
// it.second->update();
|
||||
//
|
||||
// if (it.second->isTooFar() && !it.second->isInitialized())
|
||||
// chunksToRemove.emplace_back(gk::Vector3i{it.second->x(), it.second->y(), it.second->z()});
|
||||
// }
|
||||
//
|
||||
// for (auto &it : chunksToRemove)
|
||||
// removeChunk(it);
|
||||
for (auto it = m_chunksToRemove.begin() ; it != m_chunksToRemove.end() ;) {
|
||||
removeChunk(*it);
|
||||
it = m_chunksToRemove.erase(it);
|
||||
}
|
||||
|
||||
if (allowWorldReload) {
|
||||
if (World::isReloadRequested) {
|
||||
@ -317,9 +305,13 @@ void ClientWorld::draw(gk::RenderTarget &target, gk::RenderStates states) const
|
||||
|
||||
// Nope, too far, don't render it
|
||||
if(glm::length(center) > (Config::renderDistance + 1) * CHUNK_WIDTH) {
|
||||
if(floor(glm::length(center)) > (Config::renderDistance + 3) * CHUNK_WIDTH)
|
||||
if(floor(glm::length(center)) > (Config::renderDistance + 2) * CHUNK_WIDTH) {
|
||||
it.second->setTooFar(true);
|
||||
|
||||
if (!it.second->isInitialized())
|
||||
m_chunksToRemove.emplace(gk::Vector3i{it.second->x(), it.second->y(), it.second->z()});
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,8 @@ class ClientWorld : public World, public gk::Drawable {
|
||||
mutable gk::Vector4d m_closestInitializedChunk{0, 0, 0, 1000000};
|
||||
|
||||
const Sky *m_sky = nullptr;
|
||||
|
||||
mutable std::set<gk::Vector3i> m_chunksToRemove;
|
||||
};
|
||||
|
||||
#endif // CLIENTWORLD_HPP_
|
||||
|
Loading…
x
Reference in New Issue
Block a user