Limit force shadow update to urgent blocks (#12692)

This commit is contained in:
x2048 2022-08-14 20:29:20 +02:00 committed by GitHub
parent 2690585e99
commit aa2fdc6ef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

@ -574,6 +574,7 @@ void Client::step(float dtime)
else { else {
// Replace with the new mesh // Replace with the new mesh
block->mesh = r.mesh; block->mesh = r.mesh;
if (r.urgent)
force_update_shadows = true; force_update_shadows = true;
} }
} }

@ -113,6 +113,7 @@ bool MeshUpdateQueue::addBlock(Map *map, v3s16 p, bool ack_block_to_server, bool
q->ack_block_to_server = true; q->ack_block_to_server = true;
q->crack_level = m_client->getCrackLevel(); q->crack_level = m_client->getCrackLevel();
q->crack_pos = m_client->getCrackPos(); q->crack_pos = m_client->getCrackPos();
q->urgent |= urgent;
return true; return true;
} }
} }
@ -125,6 +126,7 @@ bool MeshUpdateQueue::addBlock(Map *map, v3s16 p, bool ack_block_to_server, bool
q->ack_block_to_server = ack_block_to_server; q->ack_block_to_server = ack_block_to_server;
q->crack_level = m_client->getCrackLevel(); q->crack_level = m_client->getCrackLevel();
q->crack_pos = m_client->getCrackPos(); q->crack_pos = m_client->getCrackPos();
q->urgent = urgent;
m_queue.push_back(q); m_queue.push_back(q);
// This queue entry is a new reference to the cached blocks // This queue entry is a new reference to the cached blocks
@ -310,6 +312,7 @@ void MeshUpdateThread::doUpdate()
r.p = q->p; r.p = q->p;
r.mesh = mesh_new; r.mesh = mesh_new;
r.ack_block_to_server = q->ack_block_to_server; r.ack_block_to_server = q->ack_block_to_server;
r.urgent = q->urgent;
m_queue_out.push_back(r); m_queue_out.push_back(r);

@ -45,6 +45,7 @@ struct QueuedMeshUpdate
int crack_level = -1; int crack_level = -1;
v3s16 crack_pos; v3s16 crack_pos;
MeshMakeData *data = nullptr; // This is generated in MeshUpdateQueue::pop() MeshMakeData *data = nullptr; // This is generated in MeshUpdateQueue::pop()
bool urgent = false;
QueuedMeshUpdate() = default; QueuedMeshUpdate() = default;
~QueuedMeshUpdate(); ~QueuedMeshUpdate();
@ -105,6 +106,7 @@ struct MeshUpdateResult
v3s16 p = v3s16(-1338, -1338, -1338); v3s16 p = v3s16(-1338, -1338, -1338);
MapBlockMesh *mesh = nullptr; MapBlockMesh *mesh = nullptr;
bool ack_block_to_server = false; bool ack_block_to_server = false;
bool urgent = false;
MeshUpdateResult() = default; MeshUpdateResult() = default;
}; };