1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-30 19:22:14 +00:00

More fixes suggested by sfan5

This commit is contained in:
MirceaKitsune 2025-07-02 00:09:39 +03:00
parent b3317fbe66
commit d599380f1d
4 changed files with 10 additions and 8 deletions

View file

@ -8843,9 +8843,9 @@ child will follow movement and rotation of that bone.
bottom texture and the bottom edge of the top texture touch the east face).
Some top and bottom textures expect to be aligned with the north face and will need to be rotated
by -90 and 90 degrees, respectively, to fit the eastward orientation.
For `"skybox_back"` and `"skybox_front"` types, the textures should have an alpha channel.
* `clouds`: Boolean for whether clouds appear. (default: `true`)
* `sky_color`: A table used in `"regular"`, `"skybox_back"`, `"skybox_front"` types only. For a skybox
the `textures` should have an alpha channel. Contains the following values (alpha is ignored):
* `sky_color`: A table used in `"regular"` `"skybox_back"` `"skybox_front"` types, containing the following values:
* `day_sky`: ColorSpec, for the top half of the sky during the day.
(default: `#61b5f5`)
* `day_horizon`: ColorSpec, for the bottom half of the sky during the day.

View file

@ -2858,7 +2858,6 @@ void Game::handleClientEvent_HudChange(ClientEvent *event, CameraOrientation *ca
void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
{
// Handle invalid sky type.
if (!event->set_sky->isTextured() && !event->set_sky->hasAlpha() && event->set_sky->type != "plain")
infostream << "Unknown sky type: " << (event->set_sky->type) << std::endl;
@ -2875,18 +2874,19 @@ void Game::handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam)
sky->setFallbackBgColor(event->set_sky->bgcolor);
// Use horizon tint for regular or skybox skies.
if (event->set_sky->isTextured() || event->set_sky->hasAlpha())
if (event->set_sky->isTextured() || event->set_sky->hasAlpha()) {
sky->setHorizonTint(
event->set_sky->fog_sun_tint,
event->set_sky->fog_moon_tint,
event->set_sky->fog_tint_type
);
else
} else {
sky->setHorizonTint(
event->set_sky->bgcolor,
event->set_sky->bgcolor,
"custom"
);
}
// Clear the old textures out in case we switch rendering type.
sky->clearSkyboxTextures();

View file

@ -82,7 +82,7 @@ public:
const video::SColorf &getCloudColor() const { return m_cloudcolor_f; }
void setVisible(bool visible) { m_visible = visible; }
void setType(std::string type) { m_sky_params.type = type; }
void setType(const std::string &type) { m_sky_params.type = type; }
// Set only from set_sky API
void setCloudsEnabled(bool clouds_enabled) { m_clouds_enabled = clouds_enabled; }
@ -125,7 +125,7 @@ public:
private:
aabb3f m_box{{0.0f, 0.0f, 0.0f}};
video::SMaterial m_materials[SKY_MATERIAL_COUNT];
virtual void renderTextures(video::IVideoDriver *driver);
void renderTextures(video::IVideoDriver *driver);
// How much sun & moon transition should affect horizon color
float m_horizon_blend()

View file

@ -39,11 +39,13 @@ struct SkyboxParams
float fog_start { -1.0f };
video::SColor fog_color { 0 }; // override, only used if alpha > 0
// Check if this is a textured skybox and whether transparency is used
// Check if this is a textured skybox
bool isTextured() const
{
return type == "skybox" || type == "skybox_back" || type == "skybox_front";
}
// Check whether transparency is used
bool hasAlpha() const
{
return type == "regular" || type == "skybox_back" || type == "skybox_front";