diff options
author | Craig Robbins <kde.psych@gmail.com> | 2014-12-10 00:45:07 +1000 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2014-12-10 00:52:02 +1000 |
commit | c5f6f9f77ac1df4b223649fcaca9a66333aa8786 (patch) | |
tree | 87c5efb5da53fb26c1cfca4ab717258ab12ad897 /src/mapnode.cpp | |
parent | a1ea017b512ea8f99c40dca52a57ff58054c5acc (diff) | |
download | minetest-c5f6f9f77ac1df4b223649fcaca9a66333aa8786.tar.gz minetest-c5f6f9f77ac1df4b223649fcaca9a66333aa8786.tar.bz2 minetest-c5f6f9f77ac1df4b223649fcaca9a66333aa8786.zip |
Increase performance of getLight() by at least 2x
Leads to the following increases:
getSmoothLight() approx. 40% increase
getTileInfo() approx. 25% increase
MapBlockMesh::MapBlockMesh() 25-30%
Diffstat (limited to 'src/mapnode.cpp')
-rw-r--r-- | src/mapnode.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp index fbf0ac8c9..4e8feb047 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -88,6 +88,12 @@ u8 MapNode::getLight(enum LightBank bank, INodeDefManager *nodemgr) const return MYMAX(f.light_source, light); } +u8 MapNode::getLightNoChecks(enum LightBank bank, const ContentFeatures *f) +{ + return MYMAX(f->light_source, + bank == LIGHTBANK_DAY ? param1 & 0x0f : (param1 >> 4) & 0x0f); +} + bool MapNode::getLightBanks(u8 &lightday, u8 &lightnight, INodeDefManager *nodemgr) const { // Select the brightest of [light source, propagated light] |