Sky API: Rename *_tint to fog_*_tint for consistency
authorSmallJoker <mk939@ymail.com>
Mon, 4 May 2020 18:19:12 +0000 (20:19 +0200)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Tue, 5 May 2020 06:37:04 +0000 (08:37 +0200)
src/client/game.cpp
src/client/sky.cpp
src/network/clientpackethandler.cpp
src/network/networkprotocol.h
src/remoteplayer.cpp
src/script/lua_api/l_object.cpp
src/server.cpp
src/skyparams.h

index 3bdac786c02aea26d8ab05cf185110a8f02c0f42..d1eb3bba2a5079aa209cede439e84839fc18147b 100644 (file)
@@ -2799,9 +2799,9 @@ void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
                // Update mesh based skybox colours if applicable.
                sky->setSkyColors(*event->set_sky);
                sky->setHorizonTint(
-                       event->set_sky->sun_tint,
-                       event->set_sky->moon_tint,
-                       event->set_sky->tint_type
+                       event->set_sky->fog_sun_tint,
+                       event->set_sky->fog_moon_tint,
+                       event->set_sky->fog_tint_type
                );
        } else if (event->set_sky->type == "skybox" &&
                        event->set_sky->textures.size() == 6) {
@@ -2811,9 +2811,9 @@ void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
                sky->setFallbackBgColor(event->set_sky->bgcolor);
                // Set sunrise and sunset fog tinting:
                sky->setHorizonTint(
-                       event->set_sky->sun_tint,
-                       event->set_sky->moon_tint,
-                       event->set_sky->tint_type
+                       event->set_sky->fog_sun_tint,
+                       event->set_sky->fog_moon_tint,
+                       event->set_sky->fog_tint_type
                );
                // Add textures to skybox.
                for (int i = 0; i < 6; i++)
index 7a7b188ce15788ceb73b3e46a34983598a508f32..ce33b96aea6fa2b55b46d5ed360f50af131514ca 100644 (file)
@@ -529,7 +529,7 @@ void Sky::update(float time_of_day, float time_brightness,
                                pointcolor_sun_f.g = pointcolor_light *
                                        (float)m_materials[3].EmissiveColor.getGreen() / 255;
                        } else if (!m_default_tint) {
-                               pointcolor_sun_f = m_sky_params.sun_tint;
+                               pointcolor_sun_f = m_sky_params.fog_sun_tint;
                        } else {
                                pointcolor_sun_f.r = pointcolor_light * 1;
                                pointcolor_sun_f.b = pointcolor_light *
@@ -548,9 +548,9 @@ void Sky::update(float time_of_day, float time_brightness,
                                );
                        } else {
                                pointcolor_moon_f = video::SColorf(
-                                       (m_sky_params.moon_tint.getRed() / 255) * pointcolor_light,
-                                       (m_sky_params.moon_tint.getGreen() / 255) * pointcolor_light,
-                                       (m_sky_params.moon_tint.getBlue() / 255) * pointcolor_light,
+                                       (m_sky_params.fog_moon_tint.getRed() / 255) * pointcolor_light,
+                                       (m_sky_params.fog_moon_tint.getGreen() / 255) * pointcolor_light,
+                                       (m_sky_params.fog_moon_tint.getBlue() / 255) * pointcolor_light,
                                        1
                                );
                        }
@@ -941,8 +941,8 @@ void Sky::setHorizonTint(video::SColor sun_tint, video::SColor moon_tint,
                std::string use_sun_tint)
 {
        // Change sun and moon tinting:
-       m_sky_params.sun_tint = sun_tint;
-       m_sky_params.moon_tint = moon_tint;
+       m_sky_params.fog_sun_tint = sun_tint;
+       m_sky_params.fog_moon_tint = moon_tint;
        // Faster than comparing strings every rendering frame
        if (use_sun_tint == "default")
                m_default_tint = true;
index 6428ed752541f9a7ab07ffadf211be582b95409b..8d0225a3dce73c50ec8fe8e4e923187217ce9505 100644 (file)
@@ -1276,9 +1276,9 @@ void Client::handleCommand_HudSetSky(NetworkPacket* pkt)
                // Fix for "regular" skies, as color isn't kept:
                if (skybox.type == "regular") {
                        skybox.sky_color = sky_defaults.getSkyColorDefaults();
-                       skybox.tint_type = "default";
-                       skybox.moon_tint = video::SColor(255, 255, 255, 255);
-                       skybox.sun_tint = video::SColor(255, 255, 255, 255);
+                       skybox.fog_tint_type = "default";
+                       skybox.fog_moon_tint = video::SColor(255, 255, 255, 255);
+                       skybox.fog_sun_tint = video::SColor(255, 255, 255, 255);
                }
                else {
                        sun.visible = false;
@@ -1313,7 +1313,7 @@ void Client::handleCommand_HudSetSky(NetworkPacket* pkt)
                std::string texture;
 
                *pkt >> skybox.bgcolor >> skybox.type >> skybox.clouds >>
-                       skybox.sun_tint >> skybox.moon_tint >> skybox.tint_type;
+                       skybox.fog_sun_tint >> skybox.fog_moon_tint >> skybox.fog_tint_type;
 
                if (skybox.type == "skybox") {
                        *pkt >> texture_count;
index 73523ea4230fe5d8dc3b8e62afd5250e23472b69..527ebba7cd729d7f95dd9c0b5561f0dd03882e55 100644 (file)
@@ -634,9 +634,9 @@ enum ToClientCommand
                u8[4] night_sky (ARGB)
                u8[4] night_horizon (ARGB)
                u8[4] indoors (ARGB)
-               u8[4] sun_tint (ARGB)
-               u8[4] moon_tint (ARGB)
-               std::string tint_type
+               u8[4] fog_sun_tint (ARGB)
+               u8[4] fog_moon_tint (ARGB)
+               std::string fog_tint_type
        */
 
        TOCLIENT_OVERRIDE_DAY_NIGHT_RATIO = 0x50,
index 7a603d53eed7369b94773ebb17b0fced4b360f5d..bef60c79231fe86bbc0e94d48c32d0fb74d6b672 100644 (file)
@@ -74,9 +74,9 @@ RemotePlayer::RemotePlayer(const char *name, IItemDefManager *idef):
        m_skybox_params.sky_color = sky_defaults.getSkyColorDefaults();
        m_skybox_params.type = "regular";
        m_skybox_params.clouds = true;
-       m_skybox_params.sun_tint = video::SColor(255, 244, 125, 29);
-       m_skybox_params.moon_tint = video::SColorf(0.5, 0.6, 0.8, 1).toSColor();
-       m_skybox_params.tint_type = "default";
+       m_skybox_params.fog_sun_tint = video::SColor(255, 244, 125, 29);
+       m_skybox_params.fog_moon_tint = video::SColorf(0.5, 0.6, 0.8, 1).toSColor();
+       m_skybox_params.fog_tint_type = "default";
 
        m_sun_params = sky_defaults.getSunDefaults();
        m_moon_params = sky_defaults.getMoonDefaults();
index dcaee10b22832f2085d1aa907b936acab03c7e05..f711303789e5ac8c95512c7d88319a0b2797ed65 100644 (file)
@@ -1782,19 +1782,19 @@ int ObjectRef::l_set_sky(lua_State *L)
                        lua_pop(L, 1);
 
                        // Prevent flickering clouds at dawn/dusk:
-                       skybox_params.sun_tint = video::SColor(255, 255, 255, 255);
+                       skybox_params.fog_sun_tint = video::SColor(255, 255, 255, 255);
                        lua_getfield(L, -1, "fog_sun_tint");
-                       read_color(L, -1, &skybox_params.sun_tint);
+                       read_color(L, -1, &skybox_params.fog_sun_tint);
                        lua_pop(L, 1);
 
-                       skybox_params.moon_tint = video::SColor(255, 255, 255, 255);
+                       skybox_params.fog_moon_tint = video::SColor(255, 255, 255, 255);
                        lua_getfield(L, -1, "fog_moon_tint");
-                       read_color(L, -1, &skybox_params.moon_tint);
+                       read_color(L, -1, &skybox_params.fog_moon_tint);
                        lua_pop(L, 1);
 
                        lua_getfield(L, -1, "fog_tint_type");
                        if (!lua_isnil(L, -1))
-                               skybox_params.tint_type = luaL_checkstring(L, -1);
+                               skybox_params.fog_tint_type = luaL_checkstring(L, -1);
                        lua_pop(L, 1);
 
                        // Because we need to leave the "sky_color" table.
@@ -1912,12 +1912,12 @@ int ObjectRef::l_get_sky_color(lua_State *L)
                push_ARGB8(L, skybox_params.sky_color.indoors);
                lua_setfield(L, -2, "indoors");
        }
-       push_ARGB8(L, skybox_params.sun_tint);
-       lua_setfield(L, -2, "sun_tint");
-       push_ARGB8(L, skybox_params.moon_tint);
-       lua_setfield(L, -2, "moon_tint");
-       lua_pushstring(L, skybox_params.tint_type.c_str());
-       lua_setfield(L, -2, "tint_type");
+       push_ARGB8(L, skybox_params.fog_sun_tint);
+       lua_setfield(L, -2, "fog_sun_tint");
+       push_ARGB8(L, skybox_params.fog_moon_tint);
+       lua_setfield(L, -2, "fog_moon_tint");
+       lua_pushstring(L, skybox_params.fog_tint_type.c_str());
+       lua_setfield(L, -2, "fog_tint_type");
        return 1;
 }
 
index 0346d197d7d3c6843b26cb66ec94d4e72f5ca83b..05584be2d4114bb3bf2de9ae98770514f3db1f44 100644 (file)
@@ -1770,8 +1770,8 @@ void Server::SendSetSky(session_t peer_id, const SkyboxParams &params)
                pkt << params.clouds;
        } else { // Handle current clients and future clients
                pkt << params.bgcolor << params.type
-               << params.clouds << params.sun_tint
-               << params.moon_tint << params.tint_type;
+               << params.clouds << params.fog_sun_tint
+               << params.fog_moon_tint << params.fog_tint_type;
 
                if (params.type == "skybox") {
                        pkt << (u16) params.textures.size();
index 9fdfd89dab16012d582f6b3a676df85bba38d78f..c362ef8f327590ff39dbd8999bd05550cbe57e44 100644 (file)
@@ -37,9 +37,9 @@ struct SkyboxParams
        std::vector<std::string> textures;
        bool clouds;
        SkyColor sky_color;
-       video::SColor sun_tint;
-       video::SColor moon_tint;
-       std::string tint_type;
+       video::SColor fog_sun_tint;
+       video::SColor fog_moon_tint;
+       std::string fog_tint_type;
 };
 
 struct SunParams