]> git.tdb.fi Git - libs/game.git/blobdiff - source/gameview/meshrenderer.h
Add components for giving entities a visual appearance
[libs/game.git] / source / gameview / meshrenderer.h
diff --git a/source/gameview/meshrenderer.h b/source/gameview/meshrenderer.h
new file mode 100644 (file)
index 0000000..96fe612
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef MSP_GAMEVIEW_MESHRENDERER_H_
+#define MSP_GAMEVIEW_MESHRENDERER_H_
+
+#include <msp/game/component.h>
+#include <msp/game/meshsource.h>
+#include <msp/gl/objectinstance.h>
+
+namespace Msp::GameView {
+
+class MeshRenderer: public Game::Component
+{
+private:
+       Game::Handle<Game::MeshSource> source;
+       const GL::Object &object;
+       GL::ObjectInstance instance;
+
+public:
+       MeshRenderer(Game::Handle<Game::Entity>, Game::Handle<Game::MeshSource>);
+
+       GL::ObjectInstance &get_instance() { return instance; }
+
+       void update_matrix();
+};
+
+} // namespace Msp::GameView
+
+#endif