| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- //
- // 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/graphics/graphics_fwd.h"
- #include "game/math/math_fwd.hpp"
- namespace graphics {
- 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(identity<shader> const & fragmentShader,
- identity<shader> const & vertexShader);
- void activate(identity<shader_program> id);
- int uniform_location(identity<shader_program> id,
- std::string const & uniform);
- }
- namespace materials {
- enum class uniform : unsigned int { NORMAL, DIFFUSE, SPECULAR };
- void activate(identity<shader_program> program,
- std::vector<graphics::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));
- }
- };
- template <> struct hash<graphics::materials::uniform> {
- std::size_t operator()(graphics::materials::uniform uf) const {
- return std::hash<unsigned int>()(static_cast<unsigned int>(uf));
- }
- };
- }
|