Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
Mesh.h
Go to the documentation of this file.
1#pragma once
2#include <GL/glew.h>
3#include "graphics/VertexLayout.h"
4
5#include <glm//vec3.hpp>
6
7#include <memory>
8#include <string>
9
10namespace eng
11{
12 class Mesh
13 {
14 public:
15 Mesh(const VertexLayout& layout, const std::vector<float>& vertices, const std::vector<uint32_t>& indices);
16 Mesh(const VertexLayout& layout, const std::vector<float>& vertices);
17 Mesh(const Mesh&) = delete;
18 Mesh& operator=(const Mesh&) = delete;
19
20 void Bind();
21 void Unbind();
22 void Draw();
23
24 static std::shared_ptr<Mesh> CreateBox(const glm::vec3& extents = glm::vec3(1.0f));
25 static std::shared_ptr<Mesh> CreateSphere(float radius, int sectors, int stacks);
26 static std::shared_ptr<Mesh> CreatePlane();
27
28 private:
29 VertexLayout m_vertexLayout;
30 GLuint m_VBO = 0;
31 GLuint m_EBO = 0;
32 GLuint m_VAO = 0;
33
34 size_t m_vertexCout = 0;
35 size_t m_indexCount = 0;
36 };
37}
unsigned int GLuint
Definition GLForward.h:11
void Unbind()
Definition Mesh.cpp:69
Mesh(const Mesh &)=delete
Mesh & operator=(const Mesh &)=delete
void Draw()
Definition Mesh.cpp:74
static std::shared_ptr< Mesh > CreatePlane()
Definition Mesh.cpp:277
static std::shared_ptr< Mesh > CreateBox(const glm::vec3 &extents=glm::vec3(1.0f))
Definition Mesh.cpp:86
static std::shared_ptr< Mesh > CreateSphere(float radius, int sectors, int stacks)
Definition Mesh.cpp:187
void Bind()
Definition Mesh.cpp:64