1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Sky: Get custom sun and moon tinting to work again

This fixes a regression introduced by commit 58ccf0b.
This commit is contained in:
sfan5 2025-07-29 20:35:59 +02:00 committed by SmallJoker
parent d679261488
commit 9ff38bdf7f

View file

@ -711,6 +711,7 @@ static void getTextureAsImage(video::IImage *&dst, const std::string &name, ITex
dst = nullptr; dst = nullptr;
} }
if (tsrc->isKnownSourceImage(name)) { if (tsrc->isKnownSourceImage(name)) {
infostream << "Sky: loading image " << name << std::endl;
auto *texture = tsrc->getTexture(name); auto *texture = tsrc->getTexture(name);
assert(texture); assert(texture);
auto *driver = RenderingEngine::get_video_driver(); auto *driver = RenderingEngine::get_video_driver();
@ -726,7 +727,7 @@ void Sky::setSunTexture(const std::string &sun_texture,
{ {
// Ignore matching textures (with modifiers) entirely, // Ignore matching textures (with modifiers) entirely,
// but lets at least update the tonemap before hand. // but lets at least update the tonemap before hand.
if (m_sun_params.tonemap != sun_tonemap) { if (m_sun_params.tonemap != sun_tonemap || m_first_update) {
m_sun_params.tonemap = sun_tonemap; m_sun_params.tonemap = sun_tonemap;
getTextureAsImage(m_sun_tonemap, sun_tonemap, tsrc); getTextureAsImage(m_sun_tonemap, sun_tonemap, tsrc);
} }
@ -756,7 +757,7 @@ void Sky::setSunriseTexture(const std::string &sunglow_texture,
ITextureSource* tsrc) ITextureSource* tsrc)
{ {
// Ignore matching textures (with modifiers) entirely. // Ignore matching textures (with modifiers) entirely.
if (m_sun_params.sunrise == sunglow_texture) if (m_sun_params.sunrise == sunglow_texture && !m_first_update)
return; return;
m_sun_params.sunrise = sunglow_texture; m_sun_params.sunrise = sunglow_texture;
m_materials[2].setTexture(0, tsrc->getTextureForMesh( m_materials[2].setTexture(0, tsrc->getTextureForMesh(
@ -769,7 +770,7 @@ void Sky::setMoonTexture(const std::string &moon_texture,
{ {
// Ignore matching textures (with modifiers) entirely, // Ignore matching textures (with modifiers) entirely,
// but lets at least update the tonemap before hand. // but lets at least update the tonemap before hand.
if (m_moon_params.tonemap != moon_tonemap) { if (m_moon_params.tonemap != moon_tonemap || m_first_update) {
m_moon_params.tonemap = moon_tonemap; m_moon_params.tonemap = moon_tonemap;
getTextureAsImage(m_moon_tonemap, moon_tonemap, tsrc); getTextureAsImage(m_moon_tonemap, moon_tonemap, tsrc);
} }