blob: 0edf4bd2546d23013caec45e63f216a6a93a1953 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#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};
void finish(unsigned int width, unsigned int height, unsigned int resolution);
Vertex & v(unsigned int width, unsigned int x, unsigned int z);
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
|