1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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%
This commit is contained in:
Craig Robbins 2014-12-10 00:45:07 +10:00
parent a1ea017b51
commit c5f6f9f77a
3 changed files with 29 additions and 2 deletions

View file

@ -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]