material.cpp 567 B

1234567891011121314151617181920212223242526
  1. //
  2. // material.cpp
  3. // graphics
  4. //
  5. // Created by Sam Jaffe on 7/5/16.
  6. //
  7. #include "game/graphics/material.hpp"
  8. #include "game/graphics/texture.hpp"
  9. #include "game/util/hash.hpp"
  10. #include "helper.hpp"
  11. using namespace graphics;
  12. static math::vec2i ZERO{{0, 0}};
  13. static unsigned int next_id() {
  14. static unsigned int id{0};
  15. return ++id;
  16. }
  17. material::material(identity<shader_program> const & sp, math::vec2i size,
  18. std::vector<uniform> const & uniforms)
  19. : identity<material>(next_id()), program(sp), size(size),
  20. uniforms(uniforms) {}