diff options
| author | Jude Melton-Houghton <jwmhjwmh@gmail.com> | 2022-10-09 10:50:26 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-09 10:50:26 -0400 |
| commit | 9676364c1fe5fe5eae69c55e7d7a45392decfb2d (patch) | |
| tree | b21c99ce54820b24bfef9028c39b01f28ed3c1ca /src/mapgen | |
| parent | 440d966b939059dfa51604eb68d61eecb12baeb4 (diff) | |
| download | minetest-9676364c1fe5fe5eae69c55e7d7a45392decfb2d.tar.xz | |
Optimize lighting calculation (#12797)
Diffstat (limited to 'src/mapgen')
| -rw-r--r-- | src/mapgen/mapgen.cpp | 6 | ||||
| -rw-r--r-- | src/mapgen/mapgen_singlenode.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 99db50426..943ac4c4f 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -450,7 +450,7 @@ void Mapgen::lightSpread(VoxelArea &a, std::queue<std::pair<v3s16, u8>> &queue, // we hit a solid block that light cannot pass through. if ((light_day <= (n.param1 & 0x0F) && light_night <= (n.param1 & 0xF0)) || - !ndef->get(n).light_propagates) + !ndef->getLightingFlags(n).light_propagates) return; // MYMAX still needed here because we only exit early if both banks have @@ -500,7 +500,7 @@ void Mapgen::propagateSunlight(v3s16 nmin, v3s16 nmax, bool propagate_shadow) for (int y = a.MaxEdge.Y; y >= a.MinEdge.Y; y--) { MapNode &n = vm->m_data[i]; - if (!ndef->get(n).sunlight_propagates) + if (!ndef->getLightingFlags(n).sunlight_propagates) break; n.param1 = LIGHT_SUN; VoxelArea::add_y(em, i, -1); @@ -525,7 +525,7 @@ void Mapgen::spreadLight(const v3s16 &nmin, const v3s16 &nmax) if (n.getContent() == CONTENT_IGNORE) continue; - const ContentFeatures &cf = ndef->get(n); + ContentLightingFlags cf = ndef->getLightingFlags(n); if (!cf.light_propagates) continue; diff --git a/src/mapgen/mapgen_singlenode.cpp b/src/mapgen/mapgen_singlenode.cpp index 5382423fa..3a4199035 100644 --- a/src/mapgen/mapgen_singlenode.cpp +++ b/src/mapgen/mapgen_singlenode.cpp @@ -39,7 +39,7 @@ MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeParams *emerge) c_node = CONTENT_AIR; MapNode n_node(c_node); - set_light = (ndef->get(n_node).sunlight_propagates) ? LIGHT_SUN : 0x00; + set_light = (ndef->getLightingFlags(n_node).sunlight_propagates) ? LIGHT_SUN : 0x00; } |
