1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Check if a block is already in the emege queue before checking occlusion culling and trying to reemerge (#15949)

This commit is contained in:
lhofhansl 2025-03-28 11:31:54 -07:00 committed by GitHub
parent b0bc6ce637
commit 8f8d7c4088
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -339,6 +339,15 @@ void RemoteClient::GetNextBlocks (
if (d >= d_opt && block->isAir())
continue;
}
const bool want_emerge = !block || !block->isGenerated();
// if the block is already in the emerge queue we don't have to check again
if (want_emerge && emerge->isBlockInQueue(p)) {
nearest_emerged_d = d;
continue;
}
/*
Check occlusion cache first.
*/
@ -357,7 +366,7 @@ void RemoteClient::GetNextBlocks (
/*
Add inexistent block to emerge queue.
*/
if (!block || !block->isGenerated()) {
if (want_emerge) {
if (emerge->enqueueBlockEmerge(peer_id, p, generate)) {
if (nearest_emerged_d == -1)
nearest_emerged_d = d;