mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Avoid copying empty blocks for mesh-generation (#16286)
This commit is contained in:
parent
8eceabd812
commit
0ea89d4112
1 changed files with 2 additions and 13 deletions
|
@ -11,18 +11,6 @@
|
|||
#include "util/directiontables.h"
|
||||
#include "porting.h"
|
||||
|
||||
// Data placeholder used for copying from non-existent blocks
|
||||
static struct BlockPlaceholder {
|
||||
MapNode data[MapBlock::nodecount];
|
||||
|
||||
BlockPlaceholder()
|
||||
{
|
||||
for (std::size_t i = 0; i < MapBlock::nodecount; i++)
|
||||
data[i] = MapNode(CONTENT_IGNORE);
|
||||
}
|
||||
|
||||
} block_placeholder;
|
||||
|
||||
/*
|
||||
QueuedMeshUpdate
|
||||
*/
|
||||
|
@ -188,7 +176,8 @@ void MeshUpdateQueue::fillDataFromMapBlocks(QueuedMeshUpdate *q)
|
|||
for (pos.Z = q->p.Z - 1; pos.Z <= q->p.Z + mesh_grid.cell_size; pos.Z++)
|
||||
for (pos.Y = q->p.Y - 1; pos.Y <= q->p.Y + mesh_grid.cell_size; pos.Y++) {
|
||||
MapBlock *block = q->map_blocks[i++];
|
||||
data->fillBlockData(pos, block ? block->getData() : block_placeholder.data);
|
||||
if (block)
|
||||
data->fillBlockData(pos, block->getData());
|
||||
}
|
||||
|
||||
data->setCrack(q->crack_level, q->crack_pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue