1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Allow resetting celestial vault elements by leaving its arguments empty (#11922)

This commit is contained in:
Zughy 2022-01-22 12:42:49 +01:00 committed by GitHub
parent f66ed2c27f
commit 37d80784dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 124 additions and 120 deletions

View file

@ -68,11 +68,34 @@ struct StarParams
f32 scale;
};
struct CloudParams
{
float density;
video::SColor color_bright;
video::SColor color_ambient;
float thickness;
float height;
v2f speed;
};
// Utility class for setting default sky, sun, moon, stars values:
class SkyboxDefaults
{
public:
const SkyColor getSkyColorDefaults()
static const SkyboxParams getSkyDefaults()
{
SkyboxParams sky;
sky.bgcolor = video::SColor(255, 255, 255, 255);
sky.type = "regular";
sky.clouds = true;
sky.sky_color = getSkyColorDefaults();
sky.fog_sun_tint = video::SColor(255, 244, 125, 29);
sky.fog_moon_tint = video::SColorf(0.5, 0.6, 0.8, 1).toSColor();
sky.fog_tint_type = "default";
return sky;
}
static const SkyColor getSkyColorDefaults()
{
SkyColor sky;
// Horizon colors
@ -87,7 +110,7 @@ public:
return sky;
}
const SunParams getSunDefaults()
static const SunParams getSunDefaults()
{
SunParams sun;
sun.visible = true;
@ -99,7 +122,7 @@ public:
return sun;
}
const MoonParams getMoonDefaults()
static const MoonParams getMoonDefaults()
{
MoonParams moon;
moon.visible = true;
@ -109,7 +132,7 @@ public:
return moon;
}
const StarParams getStarDefaults()
static const StarParams getStarDefaults()
{
StarParams stars;
stars.visible = true;
@ -118,4 +141,16 @@ public:
stars.scale = 1;
return stars;
}
static const CloudParams getCloudDefaults()
{
CloudParams clouds;
clouds.density = 0.4f;
clouds.color_bright = video::SColor(229, 240, 240, 255);
clouds.color_ambient = video::SColor(255, 0, 0, 0);
clouds.thickness = 16.0f;
clouds.height = 120;
clouds.speed = v2f(0.0f, -2.0f);
return clouds;
}
};