diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-07-26 07:35:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-26 07:35:09 +0200 |
commit | 9a17b65f26eea5b9d7176e7df205f72ed2ff6c0f (patch) | |
tree | f9f0f9100348b05c9eecfb179e0e59ab24a2d2f3 /src/mapgen_v6.cpp | |
parent | 0c99da4255319d898f3ed47bc7c42757df91e2df (diff) | |
download | minetest-9a17b65f26eea5b9d7176e7df205f72ed2ff6c0f.tar.gz minetest-9a17b65f26eea5b9d7176e7df205f72ed2ff6c0f.tar.bz2 minetest-9a17b65f26eea5b9d7176e7df205f72ed2ff6c0f.zip |
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
Diffstat (limited to 'src/mapgen_v6.cpp')
-rw-r--r-- | src/mapgen_v6.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index e8e0c583d..cbc4a19c3 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -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++) |