lighting.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. Minetest
  3. Copyright (C) 2021 x2048, Dmitry Kostenko <codeforsmile@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. /**
  18. * Parameters for automatic exposure compensation
  19. *
  20. * Automatic exposure compensation uses the following equation:
  21. *
  22. * wanted_exposure = 2^exposure_correction / clamp(observed_luminance, 2^luminance_min, 2^luminance_max)
  23. *
  24. */
  25. struct AutoExposure
  26. {
  27. /// @brief Minimum boundary for computed luminance
  28. float luminance_min;
  29. /// @brief Maximum boundary for computed luminance
  30. float luminance_max;
  31. /// @brief Luminance bias. Higher values make the scene darker, can be negative.
  32. float exposure_correction;
  33. /// @brief Speed of transition from dark to bright scenes
  34. float speed_dark_bright;
  35. /// @brief Speed of transition from bright to dark scenes
  36. float speed_bright_dark;
  37. /// @brief Power value for center-weighted metering. Value of 1.0 measures entire screen uniformly
  38. float center_weight_power;
  39. AutoExposure();
  40. };
  41. /** Describes ambient light settings for a player
  42. */
  43. struct Lighting
  44. {
  45. AutoExposure exposure;
  46. float shadow_intensity {0.0f};
  47. float saturation {1.0f};
  48. float volumetric_light_strength {0.0f};
  49. };