From 7ba59731085858ca7af9a9ad5acad73e15d980af Mon Sep 17 00:00:00 2001 From: Desour Date: Tue, 7 Jan 2025 15:08:22 +0100 Subject: [PATCH] Get rid of MapblockMeshGenerator::cur_node.light --- src/client/content_mapblock.cpp | 19 ++++++++++--------- src/client/content_mapblock.h | 1 - 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp index a33ad93c7..db172e097 100644 --- a/src/client/content_mapblock.cpp +++ b/src/client/content_mapblock.cpp @@ -542,19 +542,20 @@ void MapblockMeshGenerator::prepareLiquidNodeDrawing() if (data->m_smooth_lighting) return; // don't need to pre-compute anything in this case + auto light = LightPair(getInteriorLight(cur_node.n, 0, nodedef)); if (cur_node.f->light_source != 0) { // If this liquid emits light and doesn't contain light, draw // it at what it emits, for an increased effect u8 e = decode_light(cur_node.f->light_source); - cur_node.light = LightPair(std::max(e, cur_node.light.lightDay), - std::max(e, cur_node.light.lightNight)); + light = LightPair(std::max(e, light.lightDay), + std::max(e, light.lightNight)); } else if (nodedef->getLightingFlags(ntop).has_light) { // Otherwise, use the light of the node on top if possible - cur_node.light = LightPair(getInteriorLight(ntop, 0, nodedef)); + light = LightPair(getInteriorLight(ntop, 0, nodedef)); } - cur_liquid.color_top = encode_light(cur_node.light, cur_node.f->light_source); - cur_node.color = encode_light(cur_node.light, cur_node.f->light_source); + cur_liquid.color_top = encode_light(light, cur_node.f->light_source); + cur_node.color = encode_light(light, cur_node.f->light_source); } void MapblockMeshGenerator::getLiquidNeighborhood() @@ -1267,8 +1268,8 @@ void MapblockMeshGenerator::drawPlantlikeRootedNode() getSmoothLightFrame(); } else { MapNode ntop = data->m_vmanip.getNodeNoEx(blockpos_nodes + cur_node.p); - cur_node.light = LightPair(getInteriorLight(ntop, 0, nodedef)); - cur_node.color = encode_light(cur_node.light, cur_node.f->light_source); + auto light = LightPair(getInteriorLight(ntop, 0, nodedef)); + cur_node.color = encode_light(light, cur_node.f->light_source); } drawPlantlike(tile, true); cur_node.p.Y--; @@ -1748,8 +1749,8 @@ void MapblockMeshGenerator::drawNode() if (data->m_smooth_lighting) { getSmoothLightFrame(); } else { - cur_node.light = LightPair(getInteriorLight(cur_node.n, 0, nodedef)); - cur_node.color = encode_light(cur_node.light, cur_node.f->light_source); + auto light = LightPair(getInteriorLight(cur_node.n, 0, nodedef)); + cur_node.color = encode_light(light, cur_node.f->light_source); } switch (cur_node.f->drawtype) { case NDT_FLOWINGLIQUID: drawLiquidNode(); break; diff --git a/src/client/content_mapblock.h b/src/client/content_mapblock.h index 400577a08..bc9e86e8a 100644 --- a/src/client/content_mapblock.h +++ b/src/client/content_mapblock.h @@ -63,7 +63,6 @@ private: v3f origin; MapNode n; const ContentFeatures *f; - LightPair light; LightFrame frame; video::SColor color; } cur_node;