summaryrefslogtreecommitdiff
path: root/gfx/models/mesh.h
blob: a2205a1a08998d57e586ff5cac9cb8fec7060fcf (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
#pragma once

#include <GL/glew.h>
#include <glArrays.h>
#include <memory>
#include <span>
#include <stdTypeDefs.hpp>

class Vertex;
class VertexArrayObject;

class Mesh : public ConstTypeDefs<Mesh> {
public:
	Mesh(const std::span<const Vertex> vertices, const std::span<const unsigned int> indices, GLenum = GL_TRIANGLES);

	void Draw() const;
	void DrawInstanced(GLuint vao, GLsizei count) const;
	VertexArrayObject & configureVAO(VertexArrayObject &&) const;
	GLsizei count() const;
	GLenum type() const;

private:
	glVertexArray m_vertexArrayObject;
	glBuffers<2> m_vertexArrayBuffers;
	GLsizei m_numIndices;
	GLenum mode;
};