summaryrefslogtreecommitdiff
path: root/src/voxel.h
diff options
context:
space:
mode:
authorgregorycu <gregory.currie@gmail.com>2015-02-23 23:20:06 +1000
committerCraig Robbins <kde.psych@gmail.com>2015-02-23 23:20:31 +1000
commit577701cabd6382bb97dc05e9c9244b5ce8202ca3 (patch)
treedb20283fff1b8563fe4c5f11f16ddbe30702b0d1 /src/voxel.h
parent3b6480c5b0c968ad9f5a7cfb7ca494989be03629 (diff)
downloadminetest-577701cabd6382bb97dc05e9c9244b5ce8202ca3.tar.gz
minetest-577701cabd6382bb97dc05e9c9244b5ce8202ca3.tar.bz2
minetest-577701cabd6382bb97dc05e9c9244b5ce8202ca3.zip
Optimise MapBlockMesh related functions
Directely or indirectly optimises the following functions: * MapBlockMesh::MapBlockMesh * MapBlockMesh::getTileInfo * MapBlockMesh::makeFastFace * MapBlockMesh::getSmoothLightCombined
Diffstat (limited to 'src/voxel.h')
-rw-r--r--src/voxel.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/voxel.h b/src/voxel.h
index 52274ac19..054644889 100644
--- a/src/voxel.h
+++ b/src/voxel.h
@@ -413,10 +413,21 @@ public:
}
// Stuff explodes if non-emerged area is touched with this.
// Emerge first, and check VOXELFLAG_NO_DATA if appropriate.
- MapNode & getNodeRefUnsafe(v3s16 p)
+ MapNode & getNodeRefUnsafe(const v3s16 &p)
{
return m_data[m_area.index(p)];
}
+
+ const MapNode & getNodeRefUnsafeCheckFlags(const v3s16 &p)
+ {
+ s32 index = m_area.index(p);
+
+ if (m_flags[index] & VOXELFLAG_NO_DATA)
+ return ContentIgnoreNode;
+
+ return m_data[index];
+ }
+
u8 & getFlagsRefUnsafe(v3s16 p)
{
return m_flags[m_area.index(p)];
@@ -569,6 +580,8 @@ public:
*/
u8 *m_flags;
+ static const MapNode ContentIgnoreNode;
+
//TODO: Use these or remove them
//TODO: Would these make any speed improvement?
//bool m_pressure_route_valid;