mock_renderer.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // mock_renderer.h
  3. // engine
  4. //
  5. // Created by Sam Jaffe on 6/2/19.
  6. // Copyright © 2019 Sam Jaffe. All rights reserved.
  7. //
  8. #pragma once
  9. #include "game/graphics/manager.hpp"
  10. #include "game/graphics/renderer.hpp"
  11. #include "game/graphics/shader.hpp"
  12. #include "game/graphics/shader_program.hpp"
  13. #include "game/graphics/texture.hpp"
  14. #include "game/util/identity.hpp"
  15. template <typename T> inline identity<T> cast(unsigned int id) {
  16. return *reinterpret_cast<identity<T> *>(&id);
  17. }
  18. struct stub_manager_impl : graphics::manager {
  19. using shader = graphics::shader;
  20. using shader_program = graphics::shader_program;
  21. using texture = graphics::texture;
  22. shader compile(graphics::shaders::type t,
  23. std::string const & s) const override {
  24. return {0, t, s};
  25. }
  26. shader_program compile(identity<shader> f,
  27. identity<shader> v) const override {
  28. return {0, f, v};
  29. }
  30. texture compile(graphics::textures::format, math::vec2i dims,
  31. void const *) const override {
  32. return {0, dims};
  33. }
  34. };