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

VoxelManip cleanups (const ref, const move) + function removal (#6169)

* VoxelManip cleanups (const ref, const move) permitting to improve a little bit performance

* VoxelArea: precalculate extent (performance enhancement)

This permits to reduce extend high cost to zero and drop many v3s16 object creation/removal to calculate extent
It rebalance the client thread update to updateFastFaceRow instead of MapBlockMesh generation
This will also benefits to mapgen
This commit is contained in:
Loïc Blot 2017-07-26 07:35:09 +02:00 committed by GitHub
parent 0c99da4255
commit 9a17b65f26
13 changed files with 85 additions and 198 deletions

View file

@ -206,7 +206,7 @@ void MapgenV6Params::writeParams(Settings *settings) const
// Returns Y one under area minimum if not found
s16 MapgenV6::find_stone_level(v2s16 p2d)
{
v3s16 em = vm->m_area.getExtent();
const v3s16 &em = vm->m_area.getExtent();
s16 y_nodes_max = vm->m_area.MaxEdge.Y;
s16 y_nodes_min = vm->m_area.MinEdge.Y;
u32 i = vm->m_area.index(p2d.X, y_nodes_max, p2d.Y);
@ -681,7 +681,7 @@ int MapgenV6::generateGround()
BiomeV6Type bt = getBiome(v2s16(x, z));
// Fill ground with stone
v3s16 em = vm->m_area.getExtent();
const v3s16 &em = vm->m_area.getExtent();
u32 i = vm->m_area.index(x, node_min.Y, z);
for (s16 y = node_min.Y; y <= node_max.Y; y++) {
if (vm->m_data[i].getContent() == CONTENT_IGNORE) {
@ -750,7 +750,7 @@ void MapgenV6::addMud()
// Add mud on ground
s16 mudcount = 0;
v3s16 em = vm->m_area.getExtent();
const v3s16 &em = vm->m_area.getExtent();
s16 y_start = surface_y + 1;
u32 i = vm->m_area.index(x, y_start, z);
for (s16 y = y_start; y <= node_max.Y; y++) {
@ -784,7 +784,7 @@ void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos)
// Node position in 2d
v2s16 p2d = v2s16(node_min.X, node_min.Z) + v2s16(x, z);
v3s16 em = vm->m_area.getExtent();
const v3s16 &em = vm->m_area.getExtent();
u32 i = vm->m_area.index(p2d.X, node_max.Y, p2d.Y);
s16 y = node_max.Y;
@ -947,7 +947,7 @@ void MapgenV6::placeTreesAndJungleGrass()
if (c_junglegrass == CONTENT_IGNORE)
c_junglegrass = CONTENT_AIR;
MapNode n_junglegrass(c_junglegrass);
v3s16 em = vm->m_area.getExtent();
const v3s16 &em = vm->m_area.getExtent();
// Divide area into parts
s16 div = 8;
@ -1055,7 +1055,7 @@ void MapgenV6::growGrass() // Add surface nodes
MapNode n_dirt_with_snow(c_dirt_with_snow);
MapNode n_snowblock(c_snowblock);
MapNode n_snow(c_snow);
v3s16 em = vm->m_area.getExtent();
const v3s16 &em = vm->m_area.getExtent();
u32 index = 0;
for (s16 z = full_node_min.Z; z <= full_node_max.Z; z++)