mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Allow resetting celestial vault elements by leaving its arguments empty (#11922)
This commit is contained in:
parent
f66ed2c27f
commit
37d80784dd
@ -6794,12 +6794,15 @@ object you are working with still exists.
|
|||||||
* `set_sky(sky_parameters)`
|
* `set_sky(sky_parameters)`
|
||||||
* The presence of the function `set_sun`, `set_moon` or `set_stars` indicates
|
* The presence of the function `set_sun`, `set_moon` or `set_stars` indicates
|
||||||
whether `set_sky` accepts this format. Check the legacy format otherwise.
|
whether `set_sky` accepts this format. Check the legacy format otherwise.
|
||||||
|
* Passing no arguments resets the sky to its default values.
|
||||||
* `sky_parameters` is a table with the following optional fields:
|
* `sky_parameters` is a table with the following optional fields:
|
||||||
* `base_color`: ColorSpec, changes fog in "skybox" and "plain".
|
* `base_color`: ColorSpec, changes fog in "skybox" and "plain".
|
||||||
|
(default: `#ffffff`)
|
||||||
* `type`: Available types:
|
* `type`: Available types:
|
||||||
* `"regular"`: Uses 0 textures, `base_color` ignored
|
* `"regular"`: Uses 0 textures, `base_color` ignored
|
||||||
* `"skybox"`: Uses 6 textures, `base_color` used as fog.
|
* `"skybox"`: Uses 6 textures, `base_color` used as fog.
|
||||||
* `"plain"`: Uses 0 textures, `base_color` used as both fog and sky.
|
* `"plain"`: Uses 0 textures, `base_color` used as both fog and sky.
|
||||||
|
(default: `"regular"`)
|
||||||
* `textures`: A table containing up to six textures in the following
|
* `textures`: A table containing up to six textures in the following
|
||||||
order: Y+ (top), Y- (bottom), X- (west), X+ (east), Z+ (north), Z- (south).
|
order: Y+ (top), Y- (bottom), X- (west), X+ (east), Z+ (north), Z- (south).
|
||||||
* `clouds`: Boolean for whether clouds appear. (default: `true`)
|
* `clouds`: Boolean for whether clouds appear. (default: `true`)
|
||||||
@ -6828,9 +6831,9 @@ object you are working with still exists.
|
|||||||
* `indoors`: ColorSpec, for when you're either indoors or underground.
|
* `indoors`: ColorSpec, for when you're either indoors or underground.
|
||||||
(default: `#646464`)
|
(default: `#646464`)
|
||||||
* `fog_sun_tint`: ColorSpec, changes the fog tinting for the sun
|
* `fog_sun_tint`: ColorSpec, changes the fog tinting for the sun
|
||||||
at sunrise and sunset.
|
at sunrise and sunset. (default: `#f47d1d`)
|
||||||
* `fog_moon_tint`: ColorSpec, changes the fog tinting for the moon
|
* `fog_moon_tint`: ColorSpec, changes the fog tinting for the moon
|
||||||
at sunrise and sunset.
|
at sunrise and sunset. (default: `#7f99cc`)
|
||||||
* `fog_tint_type`: string, changes which mode the directional fog
|
* `fog_tint_type`: string, changes which mode the directional fog
|
||||||
abides by, `"custom"` uses `sun_tint` and `moon_tint`, while
|
abides by, `"custom"` uses `sun_tint` and `moon_tint`, while
|
||||||
`"default"` uses the classic Minetest sun and moon tinting.
|
`"default"` uses the classic Minetest sun and moon tinting.
|
||||||
@ -6848,6 +6851,7 @@ object you are working with still exists.
|
|||||||
* `get_sky_color()`: returns a table with the `sky_color` parameters as in
|
* `get_sky_color()`: returns a table with the `sky_color` parameters as in
|
||||||
`set_sky`.
|
`set_sky`.
|
||||||
* `set_sun(sun_parameters)`:
|
* `set_sun(sun_parameters)`:
|
||||||
|
* Passing no arguments resets the sun to its default values.
|
||||||
* `sun_parameters` is a table with the following optional fields:
|
* `sun_parameters` is a table with the following optional fields:
|
||||||
* `visible`: Boolean for whether the sun is visible.
|
* `visible`: Boolean for whether the sun is visible.
|
||||||
(default: `true`)
|
(default: `true`)
|
||||||
@ -6863,6 +6867,7 @@ object you are working with still exists.
|
|||||||
* `get_sun()`: returns a table with the current sun parameters as in
|
* `get_sun()`: returns a table with the current sun parameters as in
|
||||||
`set_sun`.
|
`set_sun`.
|
||||||
* `set_moon(moon_parameters)`:
|
* `set_moon(moon_parameters)`:
|
||||||
|
* Passing no arguments resets the moon to its default values.
|
||||||
* `moon_parameters` is a table with the following optional fields:
|
* `moon_parameters` is a table with the following optional fields:
|
||||||
* `visible`: Boolean for whether the moon is visible.
|
* `visible`: Boolean for whether the moon is visible.
|
||||||
(default: `true`)
|
(default: `true`)
|
||||||
@ -6874,6 +6879,7 @@ object you are working with still exists.
|
|||||||
* `get_moon()`: returns a table with the current moon parameters as in
|
* `get_moon()`: returns a table with the current moon parameters as in
|
||||||
`set_moon`.
|
`set_moon`.
|
||||||
* `set_stars(star_parameters)`:
|
* `set_stars(star_parameters)`:
|
||||||
|
* Passing no arguments resets stars to their default values.
|
||||||
* `star_parameters` is a table with the following optional fields:
|
* `star_parameters` is a table with the following optional fields:
|
||||||
* `visible`: Boolean for whether the stars are visible.
|
* `visible`: Boolean for whether the stars are visible.
|
||||||
(default: `true`)
|
(default: `true`)
|
||||||
@ -6887,6 +6893,7 @@ object you are working with still exists.
|
|||||||
* `get_stars()`: returns a table with the current stars parameters as in
|
* `get_stars()`: returns a table with the current stars parameters as in
|
||||||
`set_stars`.
|
`set_stars`.
|
||||||
* `set_clouds(cloud_parameters)`: set cloud parameters
|
* `set_clouds(cloud_parameters)`: set cloud parameters
|
||||||
|
* Passing no arguments resets clouds to their default values.
|
||||||
* `cloud_parameters` is a table with the following optional fields:
|
* `cloud_parameters` is a table with the following optional fields:
|
||||||
* `density`: from `0` (no clouds) to `1` (full clouds) (default `0.4`)
|
* `density`: from `0` (no clouds) to `1` (full clouds) (default `0.4`)
|
||||||
* `color`: basic cloud color with alpha channel, ColorSpec
|
* `color`: basic cloud color with alpha channel, ColorSpec
|
||||||
|
@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "irrlichttypes_extrabloated.h"
|
#include "irrlichttypes_extrabloated.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "cloudparams.h"
|
#include "skyparams.h"
|
||||||
|
|
||||||
// Menu clouds
|
// Menu clouds
|
||||||
class Clouds;
|
class Clouds;
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
Minetest
|
|
||||||
Copyright (C) 2017 bendeutsch, Ben Deutsch <ben@bendeutsch.de>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
struct CloudParams
|
|
||||||
{
|
|
||||||
float density;
|
|
||||||
video::SColor color_bright;
|
|
||||||
video::SColor color_ambient;
|
|
||||||
float thickness;
|
|
||||||
float height;
|
|
||||||
v2f speed;
|
|
||||||
};
|
|
@ -68,19 +68,10 @@ RemotePlayer::RemotePlayer(const char *name, IItemDefManager *idef):
|
|||||||
m_cloud_params.speed = v2f(0.0f, -2.0f);
|
m_cloud_params.speed = v2f(0.0f, -2.0f);
|
||||||
|
|
||||||
// Skybox defaults:
|
// Skybox defaults:
|
||||||
|
m_skybox_params = SkyboxDefaults::getSkyDefaults();
|
||||||
SkyboxDefaults sky_defaults;
|
m_sun_params = SkyboxDefaults::getSunDefaults();
|
||||||
|
m_moon_params = SkyboxDefaults::getMoonDefaults();
|
||||||
m_skybox_params.sky_color = sky_defaults.getSkyColorDefaults();
|
m_star_params = SkyboxDefaults::getStarDefaults();
|
||||||
m_skybox_params.type = "regular";
|
|
||||||
m_skybox_params.clouds = true;
|
|
||||||
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();
|
|
||||||
m_star_params = sky_defaults.getStarDefaults();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "cloudparams.h"
|
|
||||||
#include "skyparams.h"
|
#include "skyparams.h"
|
||||||
|
|
||||||
class PlayerSAO;
|
class PlayerSAO;
|
||||||
|
@ -1732,9 +1732,11 @@ int ObjectRef::l_set_sky(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
SkyboxParams sky_params = player->getSkyParams();
|
SkyboxParams sky_params = player->getSkyParams();
|
||||||
bool is_colorspec = is_color_table(L, 2);
|
|
||||||
|
|
||||||
if (lua_istable(L, 2) && !is_colorspec) {
|
// reset if empty
|
||||||
|
if (lua_isnoneornil(L, 2) && lua_isnone(L, 3)) {
|
||||||
|
sky_params = SkyboxDefaults::getSkyDefaults();
|
||||||
|
} else if (lua_istable(L, 2) && !is_color_table(L, 2)) {
|
||||||
lua_getfield(L, 2, "base_color");
|
lua_getfield(L, 2, "base_color");
|
||||||
if (!lua_isnil(L, -1))
|
if (!lua_isnil(L, -1))
|
||||||
read_color(L, -1, &sky_params.bgcolor);
|
read_color(L, -1, &sky_params.bgcolor);
|
||||||
@ -1758,17 +1760,11 @@ int ObjectRef::l_set_sky(lua_State *L)
|
|||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
/*
|
// Validate that we either have six or zero textures
|
||||||
We want to avoid crashes, so we're checking even if we're not using them.
|
if (sky_params.textures.size() != 6 && !sky_params.textures.empty())
|
||||||
However, we want to ensure that the skybox can be set to nil when
|
|
||||||
using "regular" or "plain" skybox modes as textures aren't needed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (sky_params.textures.size() != 6 && sky_params.textures.size() > 0)
|
|
||||||
throw LuaError("Skybox expects 6 textures!");
|
throw LuaError("Skybox expects 6 textures!");
|
||||||
|
|
||||||
sky_params.clouds = getboolfield_default(L, 2,
|
sky_params.clouds = getboolfield_default(L, 2, "clouds", sky_params.clouds);
|
||||||
"clouds", sky_params.clouds);
|
|
||||||
|
|
||||||
lua_getfield(L, 2, "sky_color");
|
lua_getfield(L, 2, "sky_color");
|
||||||
if (lua_istable(L, -1)) {
|
if (lua_istable(L, -1)) {
|
||||||
@ -1816,7 +1812,7 @@ int ObjectRef::l_set_sky(lua_State *L)
|
|||||||
sky_params.fog_tint_type = luaL_checkstring(L, -1);
|
sky_params.fog_tint_type = luaL_checkstring(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
// Because we need to leave the "sky_color" table.
|
// pop "sky_color" table
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1852,11 +1848,8 @@ int ObjectRef::l_set_sky(lua_State *L)
|
|||||||
if (lua_istable(L, 4)) {
|
if (lua_istable(L, 4)) {
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
while (lua_next(L, 4) != 0) {
|
while (lua_next(L, 4) != 0) {
|
||||||
// Key at index -2, and value at index -1
|
// Key at index -2, and value at index -1
|
||||||
if (lua_isstring(L, -1))
|
sky_params.textures.emplace_back(readParam<std::string>(L, -1));
|
||||||
sky_params.textures.emplace_back(readParam<std::string>(L, -1));
|
|
||||||
else
|
|
||||||
sky_params.textures.emplace_back("");
|
|
||||||
// Remove the value, keep the key for the next iteration
|
// Remove the value, keep the key for the next iteration
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
@ -1872,6 +1865,7 @@ int ObjectRef::l_set_sky(lua_State *L)
|
|||||||
getServer(L)->setMoon(player, moon_params);
|
getServer(L)->setMoon(player, moon_params);
|
||||||
getServer(L)->setStars(player, star_params);
|
getServer(L)->setStars(player, star_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
getServer(L)->setSky(player, sky_params);
|
getServer(L)->setSky(player, sky_params);
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1947,21 +1941,20 @@ int ObjectRef::l_set_sun(lua_State *L)
|
|||||||
if (player == nullptr)
|
if (player == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
luaL_checktype(L, 2, LUA_TTABLE);
|
|
||||||
SunParams sun_params = player->getSunParams();
|
SunParams sun_params = player->getSunParams();
|
||||||
|
|
||||||
sun_params.visible = getboolfield_default(L, 2,
|
// reset if empty
|
||||||
"visible", sun_params.visible);
|
if (lua_isnoneornil(L, 2)) {
|
||||||
sun_params.texture = getstringfield_default(L, 2,
|
sun_params = SkyboxDefaults::getSunDefaults();
|
||||||
"texture", sun_params.texture);
|
} else {
|
||||||
sun_params.tonemap = getstringfield_default(L, 2,
|
luaL_checktype(L, 2, LUA_TTABLE);
|
||||||
"tonemap", sun_params.tonemap);
|
sun_params.visible = getboolfield_default(L, 2, "visible", sun_params.visible);
|
||||||
sun_params.sunrise = getstringfield_default(L, 2,
|
sun_params.texture = getstringfield_default(L, 2, "texture", sun_params.texture);
|
||||||
"sunrise", sun_params.sunrise);
|
sun_params.tonemap = getstringfield_default(L, 2, "tonemap", sun_params.tonemap);
|
||||||
sun_params.sunrise_visible = getboolfield_default(L, 2,
|
sun_params.sunrise = getstringfield_default(L, 2, "sunrise", sun_params.sunrise);
|
||||||
"sunrise_visible", sun_params.sunrise_visible);
|
sun_params.sunrise_visible = getboolfield_default(L, 2, "sunrise_visible", sun_params.sunrise_visible);
|
||||||
sun_params.scale = getfloatfield_default(L, 2,
|
sun_params.scale = getfloatfield_default(L, 2, "scale", sun_params.scale);
|
||||||
"scale", sun_params.scale);
|
}
|
||||||
|
|
||||||
getServer(L)->setSun(player, sun_params);
|
getServer(L)->setSun(player, sun_params);
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
@ -2004,17 +1997,18 @@ int ObjectRef::l_set_moon(lua_State *L)
|
|||||||
if (player == nullptr)
|
if (player == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
luaL_checktype(L, 2, LUA_TTABLE);
|
|
||||||
MoonParams moon_params = player->getMoonParams();
|
MoonParams moon_params = player->getMoonParams();
|
||||||
|
|
||||||
moon_params.visible = getboolfield_default(L, 2,
|
// reset if empty
|
||||||
"visible", moon_params.visible);
|
if (lua_isnoneornil(L, 2)) {
|
||||||
moon_params.texture = getstringfield_default(L, 2,
|
moon_params = SkyboxDefaults::getMoonDefaults();
|
||||||
"texture", moon_params.texture);
|
} else {
|
||||||
moon_params.tonemap = getstringfield_default(L, 2,
|
luaL_checktype(L, 2, LUA_TTABLE);
|
||||||
"tonemap", moon_params.tonemap);
|
moon_params.visible = getboolfield_default(L, 2, "visible", moon_params.visible);
|
||||||
moon_params.scale = getfloatfield_default(L, 2,
|
moon_params.texture = getstringfield_default(L, 2, "texture", moon_params.texture);
|
||||||
"scale", moon_params.scale);
|
moon_params.tonemap = getstringfield_default(L, 2, "tonemap", moon_params.tonemap);
|
||||||
|
moon_params.scale = getfloatfield_default(L, 2, "scale", moon_params.scale);
|
||||||
|
}
|
||||||
|
|
||||||
getServer(L)->setMoon(player, moon_params);
|
getServer(L)->setMoon(player, moon_params);
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
@ -2053,21 +2047,24 @@ int ObjectRef::l_set_stars(lua_State *L)
|
|||||||
if (player == nullptr)
|
if (player == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
luaL_checktype(L, 2, LUA_TTABLE);
|
|
||||||
StarParams star_params = player->getStarParams();
|
StarParams star_params = player->getStarParams();
|
||||||
|
|
||||||
star_params.visible = getboolfield_default(L, 2,
|
// reset if empty
|
||||||
"visible", star_params.visible);
|
if (lua_isnoneornil(L, 2)) {
|
||||||
star_params.count = getintfield_default(L, 2,
|
star_params = SkyboxDefaults::getStarDefaults();
|
||||||
"count", star_params.count);
|
} else {
|
||||||
|
luaL_checktype(L, 2, LUA_TTABLE);
|
||||||
|
star_params.visible = getboolfield_default(L, 2, "visible", star_params.visible);
|
||||||
|
star_params.count = getintfield_default(L, 2, "count", star_params.count);
|
||||||
|
|
||||||
lua_getfield(L, 2, "star_color");
|
lua_getfield(L, 2, "star_color");
|
||||||
if (!lua_isnil(L, -1))
|
if (!lua_isnil(L, -1))
|
||||||
read_color(L, -1, &star_params.starcolor);
|
read_color(L, -1, &star_params.starcolor);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
star_params.scale = getfloatfield_default(L, 2,
|
star_params.scale = getfloatfield_default(L, 2,
|
||||||
"scale", star_params.scale);
|
"scale", star_params.scale);
|
||||||
|
}
|
||||||
|
|
||||||
getServer(L)->setStars(player, star_params);
|
getServer(L)->setStars(player, star_params);
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
@ -2106,31 +2103,36 @@ int ObjectRef::l_set_clouds(lua_State *L)
|
|||||||
if (player == nullptr)
|
if (player == nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
luaL_checktype(L, 2, LUA_TTABLE);
|
|
||||||
CloudParams cloud_params = player->getCloudParams();
|
CloudParams cloud_params = player->getCloudParams();
|
||||||
|
|
||||||
cloud_params.density = getfloatfield_default(L, 2, "density", cloud_params.density);
|
// reset if empty
|
||||||
|
if (lua_isnoneornil(L, 2)) {
|
||||||
|
cloud_params = SkyboxDefaults::getCloudDefaults();
|
||||||
|
} else {
|
||||||
|
luaL_checktype(L, 2, LUA_TTABLE);
|
||||||
|
cloud_params.density = getfloatfield_default(L, 2, "density", cloud_params.density);
|
||||||
|
|
||||||
lua_getfield(L, 2, "color");
|
lua_getfield(L, 2, "color");
|
||||||
if (!lua_isnil(L, -1))
|
if (!lua_isnil(L, -1))
|
||||||
read_color(L, -1, &cloud_params.color_bright);
|
read_color(L, -1, &cloud_params.color_bright);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_getfield(L, 2, "ambient");
|
lua_getfield(L, 2, "ambient");
|
||||||
if (!lua_isnil(L, -1))
|
if (!lua_isnil(L, -1))
|
||||||
read_color(L, -1, &cloud_params.color_ambient);
|
read_color(L, -1, &cloud_params.color_ambient);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
cloud_params.height = getfloatfield_default(L, 2, "height", cloud_params.height );
|
cloud_params.height = getfloatfield_default(L, 2, "height", cloud_params.height);
|
||||||
cloud_params.thickness = getfloatfield_default(L, 2, "thickness", cloud_params.thickness);
|
cloud_params.thickness = getfloatfield_default(L, 2, "thickness", cloud_params.thickness);
|
||||||
|
|
||||||
lua_getfield(L, 2, "speed");
|
lua_getfield(L, 2, "speed");
|
||||||
if (lua_istable(L, -1)) {
|
if (lua_istable(L, -1)) {
|
||||||
v2f new_speed;
|
v2f new_speed;
|
||||||
new_speed.X = getfloatfield_default(L, -1, "x", 0);
|
new_speed.X = getfloatfield_default(L, -1, "x", 0);
|
||||||
new_speed.Y = getfloatfield_default(L, -1, "z", 0);
|
new_speed.Y = getfloatfield_default(L, -1, "z", 0);
|
||||||
cloud_params.speed = new_speed;
|
cloud_params.speed = new_speed;
|
||||||
|
}
|
||||||
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
|
||||||
|
|
||||||
getServer(L)->setClouds(player, cloud_params);
|
getServer(L)->setClouds(player, cloud_params);
|
||||||
lua_pushboolean(L, true);
|
lua_pushboolean(L, true);
|
||||||
|
@ -68,11 +68,34 @@ struct StarParams
|
|||||||
f32 scale;
|
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:
|
// Utility class for setting default sky, sun, moon, stars values:
|
||||||
class SkyboxDefaults
|
class SkyboxDefaults
|
||||||
{
|
{
|
||||||
public:
|
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;
|
SkyColor sky;
|
||||||
// Horizon colors
|
// Horizon colors
|
||||||
@ -87,7 +110,7 @@ public:
|
|||||||
return sky;
|
return sky;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SunParams getSunDefaults()
|
static const SunParams getSunDefaults()
|
||||||
{
|
{
|
||||||
SunParams sun;
|
SunParams sun;
|
||||||
sun.visible = true;
|
sun.visible = true;
|
||||||
@ -99,7 +122,7 @@ public:
|
|||||||
return sun;
|
return sun;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MoonParams getMoonDefaults()
|
static const MoonParams getMoonDefaults()
|
||||||
{
|
{
|
||||||
MoonParams moon;
|
MoonParams moon;
|
||||||
moon.visible = true;
|
moon.visible = true;
|
||||||
@ -109,7 +132,7 @@ public:
|
|||||||
return moon;
|
return moon;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StarParams getStarDefaults()
|
static const StarParams getStarDefaults()
|
||||||
{
|
{
|
||||||
StarParams stars;
|
StarParams stars;
|
||||||
stars.visible = true;
|
stars.visible = true;
|
||||||
@ -118,4 +141,16 @@ public:
|
|||||||
stars.scale = 1;
|
stars.scale = 1;
|
||||||
return stars;
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user