// // mock_renderer.h // engine // // Created by Sam Jaffe on 6/2/19. // Copyright © 2019 Sam Jaffe. All rights reserved. // #pragma once #include #include #include #include #include #include template inline identity cast(unsigned int id) { return *reinterpret_cast *>(&id); } struct stub_manager_impl : graphics::manager { using shader = graphics::shader; using shader_program = graphics::shader_program; using texture = graphics::texture; shader compile(graphics::shaders::type t, std::string const & s) const override { return {0, t, s}; } shader_program compile(identity f, identity v) const override { return {0, f, v}; } texture compile(graphics::textures::format, math::vec2i dims, void const *) const override { return {0, dims}; } }; class stub_renderer : public graphics::renderer { public: std::shared_ptr manager() const override { return manager_; } void draw(graphics::object const &) override {} void draw(identity, math::matr4 const &, std::vector const &) override{}; void clear() override {} void flush() override {} private: std::shared_ptr manager_{new stub_manager_impl}; };