helper.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // helper.hpp
  3. // graphics
  4. //
  5. // Created by Sam Jaffe on 5/18/19.
  6. // Copyright © 2019 Sam Jaffe. All rights reserved.
  7. //
  8. #pragma once
  9. #include <string>
  10. #include <utility>
  11. #include "game/graphics/graphics_fwd.h"
  12. #include "game/math/math_fwd.hpp"
  13. #include "vector/vector.hpp"
  14. namespace graphics {
  15. namespace textures {
  16. enum class format : unsigned int { RGB, RGBA };
  17. struct external_data {
  18. external_data(std::string const & abs_path);
  19. ~external_data();
  20. format color;
  21. math::vec2i size;
  22. void * buffer;
  23. };
  24. }
  25. namespace shaders {
  26. enum class type : unsigned int { FRAGMENT, VERTEX };
  27. }
  28. namespace materials {
  29. enum class uniform : unsigned int { NORMAL, DIFFUSE, SPECULAR };
  30. }
  31. }
  32. namespace std {
  33. template <> struct hash<graphics::shaders::type> {
  34. std::size_t operator()(graphics::shaders::type tp) const {
  35. return std::hash<unsigned int>()(static_cast<unsigned int>(tp));
  36. }
  37. };
  38. template <> struct hash<graphics::materials::uniform> {
  39. std::size_t operator()(graphics::materials::uniform uf) const {
  40. return std::hash<unsigned int>()(static_cast<unsigned int>(uf));
  41. }
  42. };
  43. }