aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-08-14 20:29:20 +0200
committersfan5 <sfan5@live.de>2022-09-14 13:48:06 +0200
commit08e3d16a58434b1871330d862f21d5897c6af744 (patch)
tree25bb2f7c5aa204355e6f0e34eea79d58bc945fce /src
parent3f3049fdba4a0a38f5c518e0a760b7e632400657 (diff)
downloadminetest-08e3d16a58434b1871330d862f21d5897c6af744.tar.gz
minetest-08e3d16a58434b1871330d862f21d5897c6af744.tar.bz2
minetest-08e3d16a58434b1871330d862f21d5897c6af744.zip
Limit force shadow update to urgent blocks (#12692)
Diffstat (limited to 'src')
-rw-r--r--src/client/client.cpp3
-rw-r--r--src/client/mesh_generator_thread.cpp3
-rw-r--r--src/client/mesh_generator_thread.h2
3 files changed, 7 insertions, 1 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 31bbf2463..b7d1cbfe0 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -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 {
diff --git a/src/client/mesh_generator_thread.cpp b/src/client/mesh_generator_thread.cpp
index c1bd7388e..ec567c8c1 100644
--- a/src/client/mesh_generator_thread.cpp
+++ b/src/client/mesh_generator_thread.cpp
@@ -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);
diff --git a/src/client/mesh_generator_thread.h b/src/client/mesh_generator_thread.h
index 552b2a9f0..09400196d 100644
--- a/src/client/mesh_generator_thread.h
+++ b/src/client/mesh_generator_thread.h
@@ -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;
};