diff options
-rw-r--r-- | application/main.cpp | 3 | ||||
-rw-r--r-- | game/physical.h | 5 | ||||
-rw-r--r-- | gfx/renderable.h | 11 |
3 files changed, 16 insertions, 3 deletions
diff --git a/application/main.cpp b/application/main.cpp index 2f9ae36..f510eca 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -9,6 +9,7 @@ #include <gfx/gl/camera.h> #include <gfx/gl/shader.h> #include <gfx/gl/transform.h> +#include <gfx/renderable.h> #include <glm/glm.hpp> #include <memory> #include <numbers> @@ -115,7 +116,7 @@ public: world.apply(&WorldObject::tick, t_passed); windows.apply(&Window::Clear, 0.0F, 0.0F, 0.0F, 1.0F); - world.apply<Physical>(&Physical::render, shader); + world.apply<Renderable>(&Renderable::render, shader); windows.apply(&Window::SwapBuffers); if (const auto snz = framelen - t_passed; snz.count() > 0) { diff --git a/game/physical.h b/game/physical.h index 5f624b0..44af5e6 100644 --- a/game/physical.h +++ b/game/physical.h @@ -2,6 +2,7 @@ #define PHYSICAL_H #include <gfx/gl/transform.h> +#include <gfx/renderable.h> #include <glm/glm.hpp> #include <memory> #include <string> @@ -11,11 +12,11 @@ class Mesh; class Texture; template<typename Obj> class Cache; -class Physical { +class Physical : public Renderable { public: Physical(glm::vec3 where, const std::string & m, const std::string & t); - void render(const Shader & shader) const; + void render(const Shader & shader) const override; [[nodiscard]] const auto & getPosition() const diff --git a/gfx/renderable.h b/gfx/renderable.h new file mode 100644 index 0000000..e3a34dd --- /dev/null +++ b/gfx/renderable.h @@ -0,0 +1,11 @@ +#ifndef RENDERABLE_H +#define RENDERABLE_H + +class Shader; + +class Renderable { +public: + virtual void render(const Shader & shader) const = 0; +}; + +#endif |