mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +00:00
add option for consistent stars in the sky
This commit is contained in:
parent
274d8a7c65
commit
3c5df72148
6 changed files with 9 additions and 2 deletions
|
@ -2850,7 +2850,7 @@ void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
|
||||||
);
|
);
|
||||||
} else if (event->set_sky->type == "skybox" &&
|
} else if (event->set_sky->type == "skybox" &&
|
||||||
event->set_sky->textures.size() == 6) {
|
event->set_sky->textures.size() == 6) {
|
||||||
// Disable the dyanmic mesh skybox:
|
// Disable the dynamic mesh skybox:
|
||||||
sky->setVisible(false);
|
sky->setVisible(false);
|
||||||
// Set fog colors:
|
// Set fog colors:
|
||||||
sky->setFallbackBgColor(event->set_sky->bgcolor);
|
sky->setFallbackBgColor(event->set_sky->bgcolor);
|
||||||
|
@ -2926,6 +2926,8 @@ void Game::handleClientEvent_SetStars(ClientEvent *event, CameraOrientation *cam
|
||||||
sky->setStarColor(event->star_params->starcolor);
|
sky->setStarColor(event->star_params->starcolor);
|
||||||
sky->setStarScale(event->star_params->scale);
|
sky->setStarScale(event->star_params->scale);
|
||||||
sky->setStarDayOpacity(event->star_params->day_opacity);
|
sky->setStarDayOpacity(event->star_params->day_opacity);
|
||||||
|
if (event->star_params->star_seed != 0)
|
||||||
|
sky->setStarSeed(event->star_params->star_seed);
|
||||||
delete event->star_params;
|
delete event->star_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ public:
|
||||||
|
|
||||||
// Set only from set_sky API
|
// Set only from set_sky API
|
||||||
void setCloudsEnabled(bool clouds_enabled) { m_clouds_enabled = clouds_enabled; }
|
void setCloudsEnabled(bool clouds_enabled) { m_clouds_enabled = clouds_enabled; }
|
||||||
|
void setStarSeed(u64 star_seed) { m_seed = star_seed; }
|
||||||
void setFallbackBgColor(video::SColor fallback_bg_color)
|
void setFallbackBgColor(video::SColor fallback_bg_color)
|
||||||
{
|
{
|
||||||
m_fallback_bg_color = fallback_bg_color;
|
m_fallback_bg_color = fallback_bg_color;
|
||||||
|
|
|
@ -1445,6 +1445,7 @@ void Client::handleCommand_HudSetStars(NetworkPacket *pkt)
|
||||||
try {
|
try {
|
||||||
*pkt >> stars.day_opacity;
|
*pkt >> stars.day_opacity;
|
||||||
} catch (PacketError &e) {};
|
} catch (PacketError &e) {};
|
||||||
|
*pkt >> stars.star_seed;
|
||||||
|
|
||||||
ClientEvent *event = new ClientEvent();
|
ClientEvent *event = new ClientEvent();
|
||||||
event->type = CE_SET_STARS;
|
event->type = CE_SET_STARS;
|
||||||
|
|
|
@ -2452,6 +2452,7 @@ int ObjectRef::l_set_stars(lua_State *L)
|
||||||
"scale", star_params.scale);
|
"scale", star_params.scale);
|
||||||
star_params.day_opacity = getfloatfield_default(L, 2,
|
star_params.day_opacity = getfloatfield_default(L, 2,
|
||||||
"day_opacity", star_params.day_opacity);
|
"day_opacity", star_params.day_opacity);
|
||||||
|
star_params.star_seed = getintfield_default(L, 2, "star_seed", star_params.star_seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
getServer(L)->setStars(player, star_params);
|
getServer(L)->setStars(player, star_params);
|
||||||
|
|
|
@ -1953,7 +1953,7 @@ void Server::SendSetStars(session_t peer_id, const StarParams ¶ms)
|
||||||
|
|
||||||
pkt << params.visible << params.count
|
pkt << params.visible << params.count
|
||||||
<< params.starcolor << params.scale
|
<< params.starcolor << params.scale
|
||||||
<< params.day_opacity;
|
<< params.day_opacity << params.star_seed;
|
||||||
|
|
||||||
Send(&pkt);
|
Send(&pkt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ struct StarParams
|
||||||
video::SColor starcolor;
|
video::SColor starcolor;
|
||||||
f32 scale;
|
f32 scale;
|
||||||
f32 day_opacity;
|
f32 day_opacity;
|
||||||
|
u64 star_seed;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CloudParams
|
struct CloudParams
|
||||||
|
@ -142,6 +143,7 @@ public:
|
||||||
stars.starcolor = video::SColor(105, 235, 235, 255);
|
stars.starcolor = video::SColor(105, 235, 235, 255);
|
||||||
stars.scale = 1;
|
stars.scale = 1;
|
||||||
stars.day_opacity = 0;
|
stars.day_opacity = 0;
|
||||||
|
stars.star_seed = 0;
|
||||||
return stars;
|
return stars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue