summaryrefslogtreecommitdiff
path: root/src/content_mapblock.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-04-29 20:36:09 +0200
committerGitHub <noreply@github.com>2017-04-29 20:36:09 +0200
commit95409da87d009c352f27c737621972c2225796c9 (patch)
treec7ba89f77a18316f33cd71637398ae3f0f86bf0d /src/content_mapblock.cpp
parentc729543ec4ab5cba167b97f0b8c796de3de88a26 (diff)
downloadminetest-95409da87d009c352f27c737621972c2225796c9.tar.gz
minetest-95409da87d009c352f27c737621972c2225796c9.tar.bz2
minetest-95409da87d009c352f27c737621972c2225796c9.zip
Optimize updateFastFaceRow processing by removing some TileSpec copy (#5678)
* Optimize updateFastFaceRow processing by removing some TileSpec copy It permit to decrease this function from 54% runtime to 45% and reduce copy from 14% runtime to 12.5% getTileInfo also reduced from 27% to 23% * makeFastFace should use a const ref too this trigger a const pointer need in the underlying function Also fix some code style and prevent calculating 4 times the same position at a point * Reduce a comparison cost for lights in updateFastFaceRow
Diffstat (limited to 'src/content_mapblock.cpp')
-rw-r--r--src/content_mapblock.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp
index 6673e2bd9..8be0a7d7b 100644
--- a/src/content_mapblock.cpp
+++ b/src/content_mapblock.cpp
@@ -76,7 +76,7 @@ MapblockMeshGenerator::MapblockMeshGenerator(MeshMakeData *input, MeshCollector
void MapblockMeshGenerator::useTile(int index, bool disable_backface_culling)
{
- tile = getNodeTileN(n, p, index, data);
+ getNodeTileN(n, p, index, data, tile);
if (!data->m_smooth_lighting)
color = encode_light(light, f->light_source);
for (int layer = 0; layer < MAX_TILE_LAYERS; layer++) {
@@ -88,14 +88,14 @@ void MapblockMeshGenerator::useTile(int index, bool disable_backface_culling)
void MapblockMeshGenerator::useDefaultTile(bool set_color)
{
- tile = getNodeTile(n, p, v3s16(0, 0, 0), data);
+ getNodeTile(n, p, v3s16(0, 0, 0), data, tile);
if (set_color && !data->m_smooth_lighting)
color = encode_light(light, f->light_source);
}
-TileSpec MapblockMeshGenerator::getTile(const v3s16& direction)
+void MapblockMeshGenerator::getTile(const v3s16& direction, TileSpec &tile)
{
- return getNodeTile(n, p, direction, data);
+ getNodeTile(n, p, direction, data, tile);
}
void MapblockMeshGenerator::drawQuad(v3f *coords, const v3s16 &normal)
@@ -660,7 +660,7 @@ void MapblockMeshGenerator::drawGlasslikeFramedNode()
{
TileSpec tiles[6];
for (int face = 0; face < 6; face++)
- tiles[face] = getTile(g_6dirs[face]);
+ getTile(g_6dirs[face], tiles[face]);
TileSpec glass_tiles[6];
if (tiles[1].layers[0].texture &&
@@ -1193,7 +1193,7 @@ void MapblockMeshGenerator::drawNodeboxNode()
TileSpec tiles[6];
for (int face = 0; face < 6; face++) {
// Handles facedir rotation for textures
- tiles[face] = getTile(tile_dirs[face]);
+ getTile(tile_dirs[face], tiles[face]);
}
// locate possible neighboring nodes to connect to