aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-06-07 01:52:07 +0200
committersapier <Sapier at GMX dot net>2014-06-23 00:13:41 +0200
commit496cb115b11fcf55b70abbf2c527f65ddf42cc75 (patch)
tree2d86a7d3fffa9091056ac760201f55319565720a
parent5d06bdf8ac3b38b1ffb400fd771a245589d92ad1 (diff)
downloadminetest-496cb115b11fcf55b70abbf2c527f65ddf42cc75.tar.gz
minetest-496cb115b11fcf55b70abbf2c527f65ddf42cc75.tar.bz2
minetest-496cb115b11fcf55b70abbf2c527f65ddf42cc75.zip
Speedup getTileInfo by up to 30%
-rw-r--r--src/mapblock_mesh.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp
index 1f2f6cd8c..0ef0280f0 100644
--- a/src/mapblock_mesh.cpp
+++ b/src/mapblock_mesh.cpp
@@ -770,9 +770,13 @@ static void getTileInfo(
v3s16 blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
MapNode n0 = vmanip.getNodeNoEx(blockpos_nodes + p);
+
+ // Don't even try to get n1 if n0 is already CONTENT_IGNORE
+ if (n0.getContent() == CONTENT_IGNORE ) {
+ makes_face = false;
+ return;
+ }
MapNode n1 = vmanip.getNodeNoEx(blockpos_nodes + p + face_dir);
- TileSpec tile0 = getNodeTile(n0, p, face_dir, data);
- TileSpec tile1 = getNodeTile(n1, p + face_dir, -face_dir, data);
// This is hackish
bool equivalent = false;
@@ -789,14 +793,14 @@ static void getTileInfo(
if(mf == 1)
{
- tile = tile0;
+ tile = getNodeTile(n0, p, face_dir, data);
p_corrected = p;
face_dir_corrected = face_dir;
light_source = ndef->get(n0).light_source;
}
else
{
- tile = tile1;
+ tile = getNodeTile(n1, p + face_dir, -face_dir, data);
p_corrected = p + face_dir;
face_dir_corrected = -face_dir;
light_source = ndef->get(n1).light_source;