[ServerChunk] Only update light with all neighbours.
Also wait for m_readyToSend to be true.
This commit is contained in:
parent
1ea2c350e4
commit
0144b928b3
@ -41,7 +41,8 @@ ServerChunk::ServerChunk(s32 x, s32 y, s32 z, ServerWorld &world) : Chunk(x, y,
|
||||
}
|
||||
|
||||
void ServerChunk::update() {
|
||||
m_lightmap.updateLights();
|
||||
if (areAllNeighboursInitialized())
|
||||
m_lightmap.updateLights();
|
||||
|
||||
if (m_hasChanged || m_lightmap.hasChanged()) {
|
||||
// gkDebug() << "Chunk update at" << m_x << m_y << m_z << "| D:" << m_hasChanged << "| L:" << m_lightmap.hasChanged();
|
||||
@ -49,7 +50,7 @@ void ServerChunk::update() {
|
||||
m_hasChanged = false;
|
||||
m_lightmap.resetChangedFlag();
|
||||
|
||||
if (m_isInitialized)
|
||||
if (m_isInitialized && m_isReadyToSend)
|
||||
m_world.addChunkToProcess(this);
|
||||
}
|
||||
}
|
||||
|
@ -57,12 +57,15 @@ class ServerChunk : public Chunk {
|
||||
bool hasBeenModified() const { return m_hasBeenModified; }
|
||||
void setModified(bool hasBeenModified) { m_hasBeenModified = hasBeenModified; }
|
||||
|
||||
void setReadyToSend() { m_isReadyToSend = true; }
|
||||
|
||||
void addTickingBlock(int x, int y, int z, const ServerBlock &block) { m_tickingBlocks.emplace(gk::Vector3i{x, y, z}, block); }
|
||||
|
||||
private:
|
||||
ServerWorld &m_world;
|
||||
|
||||
bool m_hasBeenModified = false;
|
||||
bool m_isReadyToSend = false;
|
||||
|
||||
Random_t m_random;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user