Skip to content

Commit

Permalink
Limit force shadow update to urgent blocks (minetest#12692)
Browse files Browse the repository at this point in the history
  • Loading branch information
x2048 committed Aug 14, 2022
1 parent 2690585 commit aa2fdc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/client/mesh_generator_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/client/mesh_generator_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
};
Expand Down

0 comments on commit aa2fdc6

Please sign in to comment.