Limit force shadow update to urgent blocks (#12692)

This commit is contained in:
x2048 2022-08-14 20:29:20 +02:00 committed by sfan5
parent 3f3049fdba
commit 08e3d16a58
3 changed files with 7 additions and 1 deletions

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

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

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