| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // helper.hpp
- // graphics
- //
- // Created by Sam Jaffe on 5/18/19.
- // Copyright © 2019 Sam Jaffe. All rights reserved.
- //
- #pragma once
- #include <string>
- #include <utility>
- #include "game/math/math_fwd.hpp"
- template <typename> class flyweight;
- namespace graphics {
- class shader;
- class shader_program;
- struct uniform;
- namespace textures {
- enum class format { RGB, RGBA };
- unsigned int init(format, math::vec2i, void const *);
- }
- namespace shaders {
- enum class type : unsigned int { FRAGMENT, VERTEX };
- unsigned int init(type, std::string const &);
- unsigned int init(flyweight<shader> const & fragmentShader,
- flyweight<shader> const & vertexShader);
- void activate(unsigned int id);
- int uniform_location(unsigned int id, std::string const & uniform);
- }
- namespace materials {
- void activate(flyweight<shader_program> program,
- std::vector<uniform> const & uniforms);
- }
- }
- namespace std {
- template <> struct hash<graphics::shaders::type> {
- std::size_t operator()(graphics::shaders::type tp) const {
- return std::hash<unsigned int>()(static_cast<unsigned int>(tp));
- }
- };
- }
|