/*! * \file include/Mesh.h * \brief OpenGL Mesh * * \author xythobuz */ #ifndef _MESH_H_ #define _MESH_H_ #include #include "system/Shader.h" struct IndexedRectangle { unsigned int v1, v2, v3, v4; // Vertex list indices unsigned int texture; // Index into object-texture list IndexedRectangle(unsigned int t, unsigned int _v1, unsigned int _v2, unsigned int _v3, unsigned int _v4 = 0) : v1(_v1), v2(_v2), v3(_v3), v4(_v4), texture(t) { } }; struct IndexedColoredRectangle { unsigned int v1, v2, v3, v4; unsigned char r, g, b; IndexedColoredRectangle(unsigned char _r, unsigned char _g, unsigned char _b, unsigned int _v1, unsigned int _v2, unsigned int _v3, unsigned int _v4 = 0) : v1(_v1), v2(_v2), v3(_v3), v4(_v4), r(_r), g(_g), b(_b) { } }; // -------------------------------------- class Mesh { public: Mesh(const std::vector& vertices, const std::vector& rectangles, const std::vector& triangles, const std::vector& coloredRectangles, const std::vector& coloredTriangles); void prepare(); void display(glm::mat4 MVP); private: std::vector indicesBuff; std::vector verticesBuff; std::vector texturesBuff; std::vector indicesColorBuff; std::vector verticesColorBuff; std::vector colorsBuff; ShaderBuffer indices, vertices, uvs; ShaderBuffer indicesColor, verticesColor, colors; }; #endif