Skip to content

Commit cad5b98

Browse files
SmallJokernerzhul
authored andcommittedMay 5, 2020
Sky API: Rename *_tint to fog_*_tint for consistency
1 parent 1b6f40c commit cad5b98

File tree

8 files changed

+38
-38
lines changed

8 files changed

+38
-38
lines changed
 

Diff for: ‎src/client/game.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -2799,9 +2799,9 @@ void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
27992799
// Update mesh based skybox colours if applicable.
28002800
sky->setSkyColors(*event->set_sky);
28012801
sky->setHorizonTint(
2802-
event->set_sky->sun_tint,
2803-
event->set_sky->moon_tint,
2804-
event->set_sky->tint_type
2802+
event->set_sky->fog_sun_tint,
2803+
event->set_sky->fog_moon_tint,
2804+
event->set_sky->fog_tint_type
28052805
);
28062806
} else if (event->set_sky->type == "skybox" &&
28072807
event->set_sky->textures.size() == 6) {
@@ -2811,9 +2811,9 @@ void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
28112811
sky->setFallbackBgColor(event->set_sky->bgcolor);
28122812
// Set sunrise and sunset fog tinting:
28132813
sky->setHorizonTint(
2814-
event->set_sky->sun_tint,
2815-
event->set_sky->moon_tint,
2816-
event->set_sky->tint_type
2814+
event->set_sky->fog_sun_tint,
2815+
event->set_sky->fog_moon_tint,
2816+
event->set_sky->fog_tint_type
28172817
);
28182818
// Add textures to skybox.
28192819
for (int i = 0; i < 6; i++)

Diff for: ‎src/client/sky.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ void Sky::update(float time_of_day, float time_brightness,
529529
pointcolor_sun_f.g = pointcolor_light *
530530
(float)m_materials[3].EmissiveColor.getGreen() / 255;
531531
} else if (!m_default_tint) {
532-
pointcolor_sun_f = m_sky_params.sun_tint;
532+
pointcolor_sun_f = m_sky_params.fog_sun_tint;
533533
} else {
534534
pointcolor_sun_f.r = pointcolor_light * 1;
535535
pointcolor_sun_f.b = pointcolor_light *
@@ -548,9 +548,9 @@ void Sky::update(float time_of_day, float time_brightness,
548548
);
549549
} else {
550550
pointcolor_moon_f = video::SColorf(
551-
(m_sky_params.moon_tint.getRed() / 255) * pointcolor_light,
552-
(m_sky_params.moon_tint.getGreen() / 255) * pointcolor_light,
553-
(m_sky_params.moon_tint.getBlue() / 255) * pointcolor_light,
551+
(m_sky_params.fog_moon_tint.getRed() / 255) * pointcolor_light,
552+
(m_sky_params.fog_moon_tint.getGreen() / 255) * pointcolor_light,
553+
(m_sky_params.fog_moon_tint.getBlue() / 255) * pointcolor_light,
554554
1
555555
);
556556
}
@@ -941,8 +941,8 @@ void Sky::setHorizonTint(video::SColor sun_tint, video::SColor moon_tint,
941941
std::string use_sun_tint)
942942
{
943943
// Change sun and moon tinting:
944-
m_sky_params.sun_tint = sun_tint;
945-
m_sky_params.moon_tint = moon_tint;
944+
m_sky_params.fog_sun_tint = sun_tint;
945+
m_sky_params.fog_moon_tint = moon_tint;
946946
// Faster than comparing strings every rendering frame
947947
if (use_sun_tint == "default")
948948
m_default_tint = true;

Diff for: ‎src/network/clientpackethandler.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1276,9 +1276,9 @@ void Client::handleCommand_HudSetSky(NetworkPacket* pkt)
12761276
// Fix for "regular" skies, as color isn't kept:
12771277
if (skybox.type == "regular") {
12781278
skybox.sky_color = sky_defaults.getSkyColorDefaults();
1279-
skybox.tint_type = "default";
1280-
skybox.moon_tint = video::SColor(255, 255, 255, 255);
1281-
skybox.sun_tint = video::SColor(255, 255, 255, 255);
1279+
skybox.fog_tint_type = "default";
1280+
skybox.fog_moon_tint = video::SColor(255, 255, 255, 255);
1281+
skybox.fog_sun_tint = video::SColor(255, 255, 255, 255);
12821282
}
12831283
else {
12841284
sun.visible = false;
@@ -1313,7 +1313,7 @@ void Client::handleCommand_HudSetSky(NetworkPacket* pkt)
13131313
std::string texture;
13141314

13151315
*pkt >> skybox.bgcolor >> skybox.type >> skybox.clouds >>
1316-
skybox.sun_tint >> skybox.moon_tint >> skybox.tint_type;
1316+
skybox.fog_sun_tint >> skybox.fog_moon_tint >> skybox.fog_tint_type;
13171317

13181318
if (skybox.type == "skybox") {
13191319
*pkt >> texture_count;

Diff for: ‎src/network/networkprotocol.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,9 @@ enum ToClientCommand
634634
u8[4] night_sky (ARGB)
635635
u8[4] night_horizon (ARGB)
636636
u8[4] indoors (ARGB)
637-
u8[4] sun_tint (ARGB)
638-
u8[4] moon_tint (ARGB)
639-
std::string tint_type
637+
u8[4] fog_sun_tint (ARGB)
638+
u8[4] fog_moon_tint (ARGB)
639+
std::string fog_tint_type
640640
*/
641641

642642
TOCLIENT_OVERRIDE_DAY_NIGHT_RATIO = 0x50,

Diff for: ‎src/remoteplayer.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ RemotePlayer::RemotePlayer(const char *name, IItemDefManager *idef):
7474
m_skybox_params.sky_color = sky_defaults.getSkyColorDefaults();
7575
m_skybox_params.type = "regular";
7676
m_skybox_params.clouds = true;
77-
m_skybox_params.sun_tint = video::SColor(255, 244, 125, 29);
78-
m_skybox_params.moon_tint = video::SColorf(0.5, 0.6, 0.8, 1).toSColor();
79-
m_skybox_params.tint_type = "default";
77+
m_skybox_params.fog_sun_tint = video::SColor(255, 244, 125, 29);
78+
m_skybox_params.fog_moon_tint = video::SColorf(0.5, 0.6, 0.8, 1).toSColor();
79+
m_skybox_params.fog_tint_type = "default";
8080

8181
m_sun_params = sky_defaults.getSunDefaults();
8282
m_moon_params = sky_defaults.getMoonDefaults();

Diff for: ‎src/script/lua_api/l_object.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -1782,19 +1782,19 @@ int ObjectRef::l_set_sky(lua_State *L)
17821782
lua_pop(L, 1);
17831783

17841784
// Prevent flickering clouds at dawn/dusk:
1785-
skybox_params.sun_tint = video::SColor(255, 255, 255, 255);
1785+
skybox_params.fog_sun_tint = video::SColor(255, 255, 255, 255);
17861786
lua_getfield(L, -1, "fog_sun_tint");
1787-
read_color(L, -1, &skybox_params.sun_tint);
1787+
read_color(L, -1, &skybox_params.fog_sun_tint);
17881788
lua_pop(L, 1);
17891789

1790-
skybox_params.moon_tint = video::SColor(255, 255, 255, 255);
1790+
skybox_params.fog_moon_tint = video::SColor(255, 255, 255, 255);
17911791
lua_getfield(L, -1, "fog_moon_tint");
1792-
read_color(L, -1, &skybox_params.moon_tint);
1792+
read_color(L, -1, &skybox_params.fog_moon_tint);
17931793
lua_pop(L, 1);
17941794

17951795
lua_getfield(L, -1, "fog_tint_type");
17961796
if (!lua_isnil(L, -1))
1797-
skybox_params.tint_type = luaL_checkstring(L, -1);
1797+
skybox_params.fog_tint_type = luaL_checkstring(L, -1);
17981798
lua_pop(L, 1);
17991799

18001800
// Because we need to leave the "sky_color" table.
@@ -1912,12 +1912,12 @@ int ObjectRef::l_get_sky_color(lua_State *L)
19121912
push_ARGB8(L, skybox_params.sky_color.indoors);
19131913
lua_setfield(L, -2, "indoors");
19141914
}
1915-
push_ARGB8(L, skybox_params.sun_tint);
1916-
lua_setfield(L, -2, "sun_tint");
1917-
push_ARGB8(L, skybox_params.moon_tint);
1918-
lua_setfield(L, -2, "moon_tint");
1919-
lua_pushstring(L, skybox_params.tint_type.c_str());
1920-
lua_setfield(L, -2, "tint_type");
1915+
push_ARGB8(L, skybox_params.fog_sun_tint);
1916+
lua_setfield(L, -2, "fog_sun_tint");
1917+
push_ARGB8(L, skybox_params.fog_moon_tint);
1918+
lua_setfield(L, -2, "fog_moon_tint");
1919+
lua_pushstring(L, skybox_params.fog_tint_type.c_str());
1920+
lua_setfield(L, -2, "fog_tint_type");
19211921
return 1;
19221922
}
19231923

Diff for: ‎src/server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1770,8 +1770,8 @@ void Server::SendSetSky(session_t peer_id, const SkyboxParams &params)
17701770
pkt << params.clouds;
17711771
} else { // Handle current clients and future clients
17721772
pkt << params.bgcolor << params.type
1773-
<< params.clouds << params.sun_tint
1774-
<< params.moon_tint << params.tint_type;
1773+
<< params.clouds << params.fog_sun_tint
1774+
<< params.fog_moon_tint << params.fog_tint_type;
17751775

17761776
if (params.type == "skybox") {
17771777
pkt << (u16) params.textures.size();

Diff for: ‎src/skyparams.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ struct SkyboxParams
3737
std::vector<std::string> textures;
3838
bool clouds;
3939
SkyColor sky_color;
40-
video::SColor sun_tint;
41-
video::SColor moon_tint;
42-
std::string tint_type;
40+
video::SColor fog_sun_tint;
41+
video::SColor fog_moon_tint;
42+
std::string fog_tint_type;
4343
};
4444

4545
struct SunParams

0 commit comments

Comments
 (0)
Please sign in to comment.