diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-01-25 01:11:09 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-01-25 01:11:09 +0000 |
commit | 535be42da6a32cae03fd0422b44862fdf9638c5b (patch) | |
tree | 00802162bfd3c6aa7aa9286035af3d9a1a1e0bbe /game/terrain.h | |
parent | Simplify vertex interface (diff) | |
download | ilt-535be42da6a32cae03fd0422b44862fdf9638c5b.tar.bz2 ilt-535be42da6a32cae03fd0422b44862fdf9638c5b.tar.xz ilt-535be42da6a32cae03fd0422b44862fdf9638c5b.zip |
Generate some basic flat terrain
Diffstat (limited to 'game/terrain.h')
-rw-r--r-- | game/terrain.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/game/terrain.h b/game/terrain.h new file mode 100644 index 0000000..4db99c5 --- /dev/null +++ b/game/terrain.h @@ -0,0 +1,37 @@ +#ifndef TERRAIN_H +#define TERRAIN_H + +#include "worldobject.h" +#include <GL/glew.h> +#include <array> +#include <gfx/models/vertex.hpp> +#include <gfx/renderable.h> +#include <memory> +#include <special_members.hpp> +#include <vector> + +class Shader; +class Texture; + +class Terrain : public WorldObject, public Renderable { +public: + Terrain(); + ~Terrain() override; + NO_COPY(Terrain); + NO_MOVE(Terrain); + + void render(const Shader & shader) const override; + + void tick(TickDuration) override { } + +private: + static constexpr unsigned int NUM_BUFFERS {4}; + + GLuint m_vertexArrayObject; + std::array<GLuint, NUM_BUFFERS> m_vertexArrayBuffers; + std::vector<Vertex> vertices; + std::vector<unsigned int> indices; + std::shared_ptr<Texture> texture; +}; + +#endif |