1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +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

@ -259,8 +259,8 @@ static u16 getSmoothLightCombined(v3s16 p, MeshMakeData *data)
light_source_max = f.light_source;
// Check f.solidness because fast-style leaves look better this way
if (f.param_type == CPT_LIGHT && f.solidness != 2) {
light_day += decode_light(n.getLight(LIGHTBANK_DAY, ndef));
light_night += decode_light(n.getLight(LIGHTBANK_NIGHT, ndef));
light_day += decode_light(n.getLightNoChecks(LIGHTBANK_DAY, &f));
light_night += decode_light(n.getLightNoChecks(LIGHTBANK_NIGHT, &f));
light_count++;
} else {
ambient_occlusion++;