1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Cache grouped sparse buffers (#15594)

continuation of #15531
This commit is contained in:
sfan5 2025-01-14 23:40:57 +01:00 committed by GitHub
parent 7053348e31
commit cf074dd271
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 178 additions and 61 deletions

View file

@ -564,7 +564,8 @@ void Client::step(float dtime)
std::vector<MinimapMapblock*> minimap_mapblocks;
bool do_mapper_update = true;
MapSector *sector = m_env.getMap().emergeSector(v2s16(r.p.X, r.p.Z));
ClientMap &map = m_env.getClientMap();
MapSector *sector = map.emergeSector(v2s16(r.p.X, r.p.Z));
MapBlock *block = sector->getBlockNoCreateNoEx(r.p.Y);
@ -576,6 +577,8 @@ void Client::step(float dtime)
if (block) {
// Delete the old mesh
if (block->mesh)
map.invalidateMapBlockMesh(block->mesh);
delete block->mesh;
block->mesh = nullptr;
block->solid_sides = r.solid_sides;
@ -590,9 +593,9 @@ void Client::step(float dtime)
if (r.mesh->getMesh(l)->getMeshBufferCount() != 0)
is_empty = false;
if (is_empty)
if (is_empty) {
delete r.mesh;
else {
} else {
// Replace with the new mesh
block->mesh = r.mesh;
if (r.urgent)