Minetest  5.4.0
skyparams.h
Go to the documentation of this file.
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 
34 {
35  video::SColor bgcolor;
36  std::string type;
37  std::vector<std::string> textures;
38  bool clouds;
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;
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 // Utility class for setting default sky, sun, moon, stars values:
73 {
74 public:
76  {
77  SkyColor sky;
78  // Horizon colors
79  sky.day_horizon = video::SColor(255, 144, 211, 246);
80  sky.indoors = video::SColor(255, 100, 100, 100);
81  sky.dawn_horizon = video::SColor(255, 186, 193, 240);
82  sky.night_horizon = video::SColor(255, 64, 144, 255);
83  // Sky colors
84  sky.day_sky = video::SColor(255, 97, 181, 245);
85  sky.dawn_sky = video::SColor(255, 180, 186, 250);
86  sky.night_sky = video::SColor(255, 0, 107, 255);
87  return sky;
88  }
89 
91  {
92  SunParams sun;
93  sun.visible = true;
94  sun.sunrise_visible = true;
95  sun.texture = "sun.png";
96  sun.tonemap = "sun_tonemap.png";
97  sun.sunrise = "sunrisebg.png";
98  sun.scale = 1;
99  return sun;
100  }
101 
103  {
104  MoonParams moon;
105  moon.visible = true;
106  moon.texture = "moon.png";
107  moon.tonemap = "moon_tonemap.png";
108  moon.scale = 1;
109  return moon;
110  }
111 
113  {
114  StarParams stars;
115  stars.visible = true;
116  stars.count = 1000;
117  stars.starcolor = video::SColor(105, 235, 235, 255);
118  stars.scale = 1;
119  return stars;
120  }
121 };
Definition: skyparams.h:73
const MoonParams getMoonDefaults()
Definition: skyparams.h:102
const StarParams getStarDefaults()
Definition: skyparams.h:112
const SkyColor getSkyColorDefaults()
Definition: skyparams.h:75
const SunParams getSunDefaults()
Definition: skyparams.h:90
Definition: skyparams.h:56
std::string tonemap
Definition: skyparams.h:59
f32 scale
Definition: skyparams.h:60
std::string texture
Definition: skyparams.h:58
bool visible
Definition: skyparams.h:57
Definition: skyparams.h:23
video::SColor indoors
Definition: skyparams.h:30
video::SColor dawn_sky
Definition: skyparams.h:26
video::SColor night_horizon
Definition: skyparams.h:29
video::SColor dawn_horizon
Definition: skyparams.h:27
video::SColor day_horizon
Definition: skyparams.h:25
video::SColor day_sky
Definition: skyparams.h:24
video::SColor night_sky
Definition: skyparams.h:28
Definition: skyparams.h:34
std::vector< std::string > textures
Definition: skyparams.h:37
std::string fog_tint_type
Definition: skyparams.h:42
video::SColor bgcolor
Definition: skyparams.h:35
video::SColor fog_sun_tint
Definition: skyparams.h:40
std::string type
Definition: skyparams.h:36
bool clouds
Definition: skyparams.h:38
SkyColor sky_color
Definition: skyparams.h:39
video::SColor fog_moon_tint
Definition: skyparams.h:41
Definition: skyparams.h:64
u32 count
Definition: skyparams.h:66
video::SColor starcolor
Definition: skyparams.h:67
f32 scale
Definition: skyparams.h:68
bool visible
Definition: skyparams.h:65
Definition: skyparams.h:46
std::string tonemap
Definition: skyparams.h:49
std::string texture
Definition: skyparams.h:48
std::string sunrise
Definition: skyparams.h:50
bool visible
Definition: skyparams.h:47
f32 scale
Definition: skyparams.h:52
bool sunrise_visible
Definition: skyparams.h:51