Sky API: Rename *_tint to fog_*_tint for consistency

This commit is contained in:
SmallJoker 2020-05-04 20:19:12 +02:00 committed by Loïc Blot
parent 1b6f40c356
commit cad5b987ad
8 changed files with 38 additions and 38 deletions

@ -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++)

@ -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;

@ -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;

@ -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,

@ -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();

@ -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;
}

@ -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();

@ -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