summaryrefslogtreecommitdiff
path: root/mesh.h
blob: 69f41b9e9d950791a4005491edd9ccc733d2834f (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
#ifndef MESH_INCLUDED_H
#define MESH_INCLUDED_H

#include <GL/glew.h>
#include <array>
#include <cstddef>
#include <string>

class IndexedModel;
class Vertex;

enum MeshBufferPositions { POSITION_VB, TEXCOORD_VB, NORMAL_VB, INDEX_VB };

class Mesh {
public:
	explicit Mesh(const std::string & fileName);
	explicit Mesh(const IndexedModel & model);
	Mesh(Vertex * vertices, unsigned int numVertices, unsigned int * indices, unsigned int numIndices);
	Mesh(const Mesh &) = delete;
	void operator=(const Mesh &) = delete;

	virtual ~Mesh();

	void Draw();

private:
	static constexpr unsigned int NUM_BUFFERS {4};

	GLuint m_vertexArrayObject;
	std::array<GLuint, NUM_BUFFERS> m_vertexArrayBuffers;
	size_t m_numIndices;
};

#endif