skyparams.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. Minetest
  3. Copyright (C) 2019 Jordach, Jordan Snelling <jordach.snelling@gmail.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #pragma once
  17. struct SkyColor
  18. {
  19. video::SColor day_sky;
  20. video::SColor day_horizon;
  21. video::SColor dawn_sky;
  22. video::SColor dawn_horizon;
  23. video::SColor night_sky;
  24. video::SColor night_horizon;
  25. video::SColor indoors;
  26. };
  27. struct SkyboxParams
  28. {
  29. video::SColor bgcolor;
  30. std::string type;
  31. std::vector<std::string> textures;
  32. bool clouds;
  33. SkyColor sky_color;
  34. video::SColor fog_sun_tint;
  35. video::SColor fog_moon_tint;
  36. std::string fog_tint_type;
  37. };
  38. struct SunParams
  39. {
  40. bool visible;
  41. std::string texture;
  42. std::string tonemap;
  43. std::string sunrise;
  44. bool sunrise_visible;
  45. f32 scale;
  46. };
  47. struct MoonParams
  48. {
  49. bool visible;
  50. std::string texture;
  51. std::string tonemap;
  52. f32 scale;
  53. };
  54. struct StarParams
  55. {
  56. bool visible;
  57. u32 count;
  58. video::SColor starcolor;
  59. f32 scale;
  60. };
  61. // Utility class for setting default sky, sun, moon, stars values:
  62. class SkyboxDefaults
  63. {
  64. public:
  65. const SkyColor getSkyColorDefaults()
  66. {
  67. SkyColor sky;
  68. // Horizon colors
  69. sky.day_horizon = video::SColor(255, 144, 211, 246);
  70. sky.indoors = video::SColor(255, 100, 100, 100);
  71. sky.dawn_horizon = video::SColor(255, 186, 193, 240);
  72. sky.night_horizon = video::SColor(255, 64, 144, 255);
  73. // Sky colors
  74. sky.day_sky = video::SColor(255, 97, 181, 245);
  75. sky.dawn_sky = video::SColor(255, 180, 186, 250);
  76. sky.night_sky = video::SColor(255, 0, 107, 255);
  77. return sky;
  78. }
  79. const SunParams getSunDefaults()
  80. {
  81. SunParams sun;
  82. sun.visible = true;
  83. sun.sunrise_visible = true;
  84. sun.texture = "sun.png";
  85. sun.tonemap = "sun_tonemap.png";
  86. sun.sunrise = "sunrisebg.png";
  87. sun.scale = 1;
  88. return sun;
  89. }
  90. const MoonParams getMoonDefaults()
  91. {
  92. MoonParams moon;
  93. moon.visible = true;
  94. moon.texture = "moon.png";
  95. moon.tonemap = "moon_tonemap.png";
  96. moon.scale = 1;
  97. return moon;
  98. }
  99. const StarParams getStarDefaults()
  100. {
  101. StarParams stars;
  102. stars.visible = true;
  103. stars.count = 1000;
  104. stars.starcolor = video::SColor(105, 235, 235, 255);
  105. stars.scale = 1;
  106. return stars;
  107. }
  108. };