Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
skyparams.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2019 Jordach, Jordan Snelling <jordach.snelling@gmail.com>
4
5#pragma once
6
7
8struct SkyColor
9{
10 video::SColor day_sky;
11 video::SColor day_horizon;
12 video::SColor dawn_sky;
13 video::SColor dawn_horizon;
14 video::SColor night_sky;
15 video::SColor night_horizon;
16 video::SColor indoors;
17};
18
20{
21 static constexpr float INVALID_SKYBOX_TILT = -1024.f;
22
23 video::SColor bgcolor;
24 std::string type;
25 std::vector<std::string> textures;
26 bool clouds;
28 video::SColor fog_sun_tint;
29 video::SColor fog_moon_tint;
30 std::string fog_tint_type;
32 s16 fog_distance { -1 };
33 float fog_start { -1.0f };
34 video::SColor fog_color { 0 }; // override, only used if alpha > 0
35};
36
38{
39 bool visible;
40 std::string texture;
41 std::string tonemap;
42 std::string sunrise;
44 f32 scale;
45};
46
48{
49 bool visible;
50 std::string texture;
51 std::string tonemap;
52 f32 scale;
53};
54
56{
57 bool visible;
58 u32 count;
59 video::SColor starcolor;
60 f32 scale;
62};
63
65{
66 float density;
67 video::SColor color_bright;
68 video::SColor color_ambient;
69 video::SColor color_shadow;
70 float thickness;
71 float height;
73};
74
75// Utility class for setting default sky, sun, moon, stars values:
77{
78public:
79 SkyboxDefaults() = delete;
80
82 {
83 SkyboxParams sky;
84 sky.bgcolor = video::SColor(255, 255, 255, 255);
85 sky.type = "regular";
86 sky.clouds = true;
88 sky.fog_sun_tint = video::SColor(255, 244, 125, 29);
89 sky.fog_moon_tint = video::SColorf(0.5, 0.6, 0.8, 1).toSColor();
90 sky.fog_tint_type = "default";
91 sky.fog_color = video::SColor(0);
92 return sky;
93 }
94
96 {
97 SkyColor sky;
98 // Horizon colors
99 sky.day_horizon = video::SColor(255, 144, 211, 246);
100 sky.indoors = video::SColor(255, 100, 100, 100);
101 sky.dawn_horizon = video::SColor(255, 186, 193, 240);
102 sky.night_horizon = video::SColor(255, 64, 144, 255);
103 // Sky colors
104 sky.day_sky = video::SColor(255, 97, 181, 245);
105 sky.dawn_sky = video::SColor(255, 180, 186, 250);
106 sky.night_sky = video::SColor(255, 0, 107, 255);
107 return sky;
108 }
109
111 {
112 SunParams sun;
113 sun.visible = true;
114 sun.sunrise_visible = true;
115 sun.texture = "sun.png";
116 sun.tonemap = "sun_tonemap.png";
117 sun.sunrise = "sunrisebg.png";
118 sun.scale = 1;
119 return sun;
120 }
121
123 {
124 MoonParams moon;
125 moon.visible = true;
126 moon.texture = "moon.png";
127 moon.tonemap = "moon_tonemap.png";
128 moon.scale = 1;
129 return moon;
130 }
131
133 {
134 StarParams stars;
135 stars.visible = true;
136 stars.count = 1000;
137 stars.starcolor = video::SColor(105, 235, 235, 255);
138 stars.scale = 1;
139 stars.day_opacity = 0;
140 return stars;
141 }
142
144 {
145 CloudParams clouds;
146 clouds.density = 0.4f;
147 clouds.color_bright = video::SColor(229, 240, 240, 255);
148 clouds.color_ambient = video::SColor(255, 0, 0, 0);
149 clouds.color_shadow = video::SColor(255, 204, 204, 204);
150 clouds.thickness = 16.0f;
151 clouds.height = 120;
152 clouds.speed = v2f(0.0f, -2.0f);
153 return clouds;
154 }
155};
Definition skyparams.h:77
static const SkyboxParams getSkyDefaults()
Definition skyparams.h:81
static const CloudParams getCloudDefaults()
Definition skyparams.h:143
SkyboxDefaults()=delete
static const SunParams getSunDefaults()
Definition skyparams.h:110
static const MoonParams getMoonDefaults()
Definition skyparams.h:122
static const SkyColor getSkyColorDefaults()
Definition skyparams.h:95
static const StarParams getStarDefaults()
Definition skyparams.h:132
core::vector2d< f32 > v2f
Definition irr_v2d.h:11
Definition skyparams.h:65
video::SColor color_shadow
Definition skyparams.h:69
video::SColor color_bright
Definition skyparams.h:67
float thickness
Definition skyparams.h:70
video::SColor color_ambient
Definition skyparams.h:68
v2f speed
Definition skyparams.h:72
float height
Definition skyparams.h:71
float density
Definition skyparams.h:66
Definition skyparams.h:48
std::string tonemap
Definition skyparams.h:51
f32 scale
Definition skyparams.h:52
std::string texture
Definition skyparams.h:50
bool visible
Definition skyparams.h:49
Definition skyparams.h:9
video::SColor indoors
Definition skyparams.h:16
video::SColor dawn_sky
Definition skyparams.h:12
video::SColor night_horizon
Definition skyparams.h:15
video::SColor dawn_horizon
Definition skyparams.h:13
video::SColor day_horizon
Definition skyparams.h:11
video::SColor day_sky
Definition skyparams.h:10
video::SColor night_sky
Definition skyparams.h:14
Definition skyparams.h:20
std::vector< std::string > textures
Definition skyparams.h:25
std::string fog_tint_type
Definition skyparams.h:30
s16 fog_distance
Definition skyparams.h:32
video::SColor bgcolor
Definition skyparams.h:23
video::SColor fog_sun_tint
Definition skyparams.h:28
video::SColor fog_color
Definition skyparams.h:34
std::string type
Definition skyparams.h:24
static constexpr float INVALID_SKYBOX_TILT
Definition skyparams.h:21
float fog_start
Definition skyparams.h:33
float body_orbit_tilt
Definition skyparams.h:31
bool clouds
Definition skyparams.h:26
SkyColor sky_color
Definition skyparams.h:27
video::SColor fog_moon_tint
Definition skyparams.h:29
Definition skyparams.h:56
u32 count
Definition skyparams.h:58
video::SColor starcolor
Definition skyparams.h:59
f32 scale
Definition skyparams.h:60
bool visible
Definition skyparams.h:57
f32 day_opacity
Definition skyparams.h:61
Definition skyparams.h:38
std::string tonemap
Definition skyparams.h:41
std::string texture
Definition skyparams.h:40
std::string sunrise
Definition skyparams.h:42
bool visible
Definition skyparams.h:39
f32 scale
Definition skyparams.h:44
bool sunrise_visible
Definition skyparams.h:43