1 #pragma once 2 3 #include <vector> 4 #include <string> 5 6 #include <glm/glm.hpp> 7 8 #include "vbo.h" 9 10 class Mesh { 11 public: 12 13 Mesh(); 14 Mesh(const Mesh &_mother); 15 virtual ~Mesh(); 16 17 void setDrawMode(GLenum _drawMode = GL_TRIANGLES); 18 19 void setColor(const glm::vec4 &_color); 20 void addColor(const glm::vec4 &_color); 21 void addColors(const std::vector<glm::vec4> &_colors); 22 23 void addVertex(const glm::vec3 &_point); 24 void addVertices(const std::vector<glm::vec3>& _verts); 25 void addVertices(const glm::vec3* _verts, int _amt); 26 27 void addNormal(const glm::vec3 &_normal); 28 void addNormals(const std::vector<glm::vec3> &_normals ); 29 30 void addTexCoord(const glm::vec2 &_uv); 31 void addTexCoords(const std::vector<glm::vec2> &_uvs); 32 33 void addIndex(uint16_t _i); 34 void addIndices(const std::vector<uint16_t>& _inds); 35 void addIndices(const uint16_t* _inds, int _amt); 36 37 void addTriangle(uint16_t index1, uint16_t index2, uint16_t index3); 38 39 void add(const Mesh &_mesh); 40 41 GLenum getDrawMode() const; 42 std::vector<glm::ivec3> getTriangles() const ; 43 44 const std::vector<glm::vec4> & getColors() const; 45 const std::vector<glm::vec3> & getVertices() const; 46 const std::vector<glm::vec3> & getNormals() const; 47 const std::vector<glm::vec2> & getTexCoords() const; 48 const std::vector<uint16_t> & getIndices() const; 49 50 Vbo* getVbo(); 51 52 void computeNormals(); 53 void clear(); 54 55 private: 56 std::vector<glm::vec4> m_colors; 57 std::vector<glm::vec3> m_vertices; 58 std::vector<glm::vec3> m_normals; 59 std::vector<glm::vec2> m_texCoords; 60 std::vector<uint16_t> m_indices; 61 62 GLenum m_drawMode; 63 }; 64