diff --git a/src/Mesh.cpp b/src/Mesh.cpp new file mode 100644 index 0000000..3cdbd6d --- /dev/null +++ b/src/Mesh.cpp @@ -0,0 +1,10 @@ +#include "Mesh.h" + +Mesh::Mesh(std::vector vertices, std::vector indices, + std::vector textures) { + this->vertices = vertices; + this->indices = indices; + this->textures = textures; + + setupMesh(); +} diff --git a/src/Mesh.h b/src/Mesh.h new file mode 100644 index 0000000..57d8d2c --- /dev/null +++ b/src/Mesh.h @@ -0,0 +1,34 @@ +#pragma once +#include "Error.h" +#include "ShaderLoader.h" +#include +#include +#include + +// Define some useful structures to be used in the mesh object +struct Vertex { + glm::vec3 Position; + glm::vec3 Normal; + glm::vec2 TexCoords; +}; +struct Texture { + unsigned int id; + std::string type; +}; + +class Mesh { +private: + Error error = Error("Mesh"); + + unsigned int VAO, VBO, EBO; + void setupMesh(); + +public: + std::vector vertices; + std::vector indices; + std::vector textures; + + void Draw(ShaderLoader &shader); + Mesh(std::vector vertices, std::vector indices, + std::vector textures); +};