💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.0 KiB

  1. /*
  2. * Copyright (C) 2023 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ANTKEEPER_GL_CUBE_MAP_HPP
  20. #define ANTKEEPER_GL_CUBE_MAP_HPP
  21. #include <cstdint>
  22. namespace gl {
  23. /// Cube map layouts.
  24. enum class cube_map_layout: std::uint8_t
  25. {
  26. /// Unknown layout.
  27. unknown,
  28. /// Faces are stored consecutively in a single column.
  29. column,
  30. /// Faces are stored consecutively in a single row.
  31. row,
  32. /// Faces are stored in a vertical cross.
  33. vertical_cross,
  34. /// Faces are stored in a horizontal cross.
  35. horizontal_cross,
  36. /// Faces are stored in an equirectangular projection.
  37. equirectangular,
  38. /// Faces are stored in a spherical projection.
  39. spherical
  40. };
  41. /**
  42. * Infers the layout of a cube map from its dimensions.
  43. *
  44. * @param width Cube map width.
  45. * @param height Cube map height.
  46. *
  47. * @return Inferred cube map layout.
  48. */
  49. [[nodiscard]] cube_map_layout infer_cube_map_layout(std::uint32_t width, std::uint32_t height) noexcept;
  50. /**
  51. * Infers the width of a cube map face from its dimensons and layout.
  52. *
  53. * @param width Cube map width.
  54. * @param height Cube map height.
  55. * @param layout Cube map layout.
  56. *
  57. * @return Inferred cube map face width.
  58. */
  59. [[nodiscard]] std::uint32_t infer_cube_map_face_width(std::uint32_t width, std::uint32_t height, cube_map_layout layout) noexcept;
  60. } // namespace gl
  61. #endif // ANTKEEPER_GL_CUBE_MAP_HPP