helper.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. namespace graphics {
  14. struct uniform;
  15. namespace textures {
  16. enum class format { RGB, RGBA };
  17. unsigned int init(format, math::vec2i, void const *);
  18. }
  19. namespace shaders {
  20. enum class type : unsigned int { FRAGMENT, VERTEX };
  21. unsigned int init(type, std::string const &);
  22. unsigned int init(identity<shader> const & fragmentShader,
  23. identity<shader> const & vertexShader);
  24. void activate(identity<shader_program> id);
  25. int uniform_location(identity<shader_program> id,
  26. std::string const & uniform);
  27. }
  28. namespace materials {
  29. void activate(identity<shader_program> program,
  30. std::vector<uniform> const & uniforms);
  31. }
  32. }
  33. namespace std {
  34. template <> struct hash<graphics::shaders::type> {
  35. std::size_t operator()(graphics::shaders::type tp) const {
  36. return std::hash<unsigned int>()(static_cast<unsigned int>(tp));
  37. }
  38. };
  39. }