]> git.lizzy.rs Git - dragonfireclient.git/blob - src/skyparams.h
Don't ignore server disconnects in client code
[dragonfireclient.git] / src / skyparams.h
1 /*
2 Minetest
3 Copyright (C) 2019 Jordach, Jordan Snelling <jordach.snelling@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 struct SkyColor
23 {
24         video::SColor day_sky;
25         video::SColor day_horizon;
26         video::SColor dawn_sky;
27         video::SColor dawn_horizon;
28         video::SColor night_sky;
29         video::SColor night_horizon;
30         video::SColor indoors;
31 };
32
33 struct SkyboxParams
34 {
35         video::SColor bgcolor;
36         std::string type;
37         std::vector<std::string> textures;
38         bool clouds;
39         SkyColor sky_color;
40         video::SColor fog_sun_tint;
41         video::SColor fog_moon_tint;
42         std::string fog_tint_type;
43 };
44
45 struct SunParams
46 {
47         bool visible;
48         std::string texture;
49         std::string tonemap;
50         std::string sunrise;
51         bool sunrise_visible;
52         f32 scale;
53 };
54
55 struct MoonParams
56 {
57         bool visible;
58         std::string texture;
59         std::string tonemap;
60         f32 scale;
61 };
62
63 struct StarParams
64 {
65         bool visible;
66         u32 count;
67         video::SColor starcolor;
68         f32 scale;
69 };
70
71 struct CloudParams
72 {
73         float density;
74         video::SColor color_bright;
75         video::SColor color_ambient;
76         float thickness;
77         float height;
78         v2f speed;
79 };
80
81 // Utility class for setting default sky, sun, moon, stars values:
82 class SkyboxDefaults
83 {
84 public:
85         SkyboxDefaults() = delete;
86
87         static const SkyboxParams getSkyDefaults()
88         {
89                 SkyboxParams sky;
90                 sky.bgcolor = video::SColor(255, 255, 255, 255);
91                 sky.type = "regular";
92                 sky.clouds = true;
93                 sky.sky_color = getSkyColorDefaults();
94                 sky.fog_sun_tint = video::SColor(255, 244, 125, 29);
95                 sky.fog_moon_tint = video::SColorf(0.5, 0.6, 0.8, 1).toSColor();
96                 sky.fog_tint_type = "default";
97                 return sky;
98         }
99
100         static const SkyColor getSkyColorDefaults()
101         {
102                 SkyColor sky;
103                 // Horizon colors
104                 sky.day_horizon = video::SColor(255, 144, 211, 246);
105                 sky.indoors = video::SColor(255, 100, 100, 100);
106                 sky.dawn_horizon = video::SColor(255, 186, 193, 240);
107                 sky.night_horizon = video::SColor(255, 64, 144, 255);
108                 // Sky colors
109                 sky.day_sky = video::SColor(255, 97, 181, 245);
110                 sky.dawn_sky = video::SColor(255, 180, 186, 250);
111                 sky.night_sky = video::SColor(255, 0, 107, 255);
112                 return sky;
113         }
114
115         static const SunParams getSunDefaults()
116         {
117                 SunParams sun;
118                 sun.visible = true;
119                 sun.sunrise_visible = true;
120                 sun.texture = "sun.png";
121                 sun.tonemap = "sun_tonemap.png";
122                 sun.sunrise = "sunrisebg.png";
123                 sun.scale = 1;
124                 return sun;
125         }
126
127         static const MoonParams getMoonDefaults()
128         {
129                 MoonParams moon;
130                 moon.visible = true;
131                 moon.texture = "moon.png";
132                 moon.tonemap = "moon_tonemap.png";
133                 moon.scale = 1;
134                 return moon;
135         }
136
137         static const StarParams getStarDefaults()
138         {
139                 StarParams stars;
140                 stars.visible = true;
141                 stars.count = 1000;
142                 stars.starcolor = video::SColor(105, 235, 235, 255);
143                 stars.scale = 1;
144                 return stars;
145         }
146
147         static const CloudParams getCloudDefaults()
148         {
149                 CloudParams clouds;
150                 clouds.density = 0.4f;
151                 clouds.color_bright = video::SColor(229, 240, 240, 255);
152                 clouds.color_ambient = video::SColor(255, 0, 0, 0);
153                 clouds.thickness = 16.0f;
154                 clouds.height = 120;
155                 clouds.speed = v2f(0.0f, -2.0f);
156                 return clouds;
157         }
158 };