RenderEngine
Loading...
Searching...
No Matches
Mesh.hpp
Go to the documentation of this file.
1/*
2 * Mesh.hpp
3 *
4 * Mesh class can have vertices, texture coordinates, normals, and later on face indices
5 * can be used for creating simple geometries but also more complex ones from model loader
6 * by Stefanie Zollmann
7 *
8 */
9
10#ifndef MESH_HPP
11#define MESH_HPP
12
13#include "Object.hpp"
14// Include GLM
15#include <glm/glm.hpp>
16#include <glm/gtc/matrix_transform.hpp>
17#include <glm/gtc/quaternion.hpp>
18#include <glm/gtx/quaternion.hpp>
19#include <glm/gtx/euler_angles.hpp>
20#include <glm/gtx/norm.hpp>
21
22#include <vector>
23
25
28class Mesh: public Object{
29
30 public:
32
33 Mesh(){};
35
36 ~Mesh();
38
39 void setVertices(std::vector<float> verts);
41
42 void setVertices(std::vector<glm::vec3> verts);
44
45 void setUVs(std::vector<glm::vec2> uvs);
47
48 void setUVs(std::vector<float> uvs);
50
51 void setNormals(std::vector<glm::vec3> normals);
53
54 void setIndices(std::vector<unsigned short> indices);
56
57 void render(Camera* camera);
59
60 void setMatIndex(int index){matIndex = index;};
62
63 int getMatIndex(){return matIndex;}
64
65 private:
66 std::vector<glm::vec3> m_vertices;
67 std::vector<glm::vec2> m_uvs;
68 std::vector<glm::vec3> m_normals;
69 std::vector<unsigned short> m_indices;
70
71 GLuint m_vertexBufferID;
72 GLuint m_uvBufferID;
73 GLuint m_normalBufferID;
74 GLuint m_indexBufferID;
75 int matIndex;
76
77};
78
79#endif
Camera.
Definition Camera.hpp:22
Mesh.
Definition Mesh.hpp:28
int getMatIndex()
getMatIndex
Definition Mesh.hpp:63
void render(Camera *camera)
render
Definition Mesh.cpp:85
Mesh()
Default constructor.
Definition Mesh.hpp:33
void setMatIndex(int index)
setMatIndex
Definition Mesh.hpp:60
void setVertices(std::vector< float > verts)
setVertices
Definition Mesh.cpp:11
~Mesh()
Destructor.
Definition Mesh.cpp:5
void setUVs(std::vector< glm::vec2 > uvs)
setUVs
Definition Mesh.cpp:35
void setNormals(std::vector< glm::vec3 > normals)
setNormals
Definition Mesh.cpp:59
void setIndices(std::vector< unsigned short > indices)
setIndices
Definition Mesh.cpp:70
Object.
Definition Object.hpp:28