| 1 | #include "Mesh.h" |
| 2 | |
| 3 | Mesh::Mesh(std::vector <Vertex>& vertices, std::vector <GLuint>& indices, std::vector <Texture>& textures) |
| 4 | { |
| 5 | Mesh::vertices = vertices; |
| 6 | Mesh::indices = indices; |
| 7 | Mesh::textures = textures; |
| 8 | |
| 9 | VAO.Bind(); |
| 10 | // Generates Vertex Buffer Object and links it to vertices |
| 11 | VBO VBO(vertices); |
| 12 | // Generates Element Buffer Object and links it to indices |
| 13 | EBO EBO(indices); |
| 14 | // Links VBO attributes such as coordinates and colors to VAO |
| 15 | VAO.LinkAttrib(VBO, 0, 3, GL_FLOAT, sizeof(Vertex), (void*)0); |
| 16 | VAO.LinkAttrib(VBO, 1, 3, GL_FLOAT, sizeof(Vertex), (void*)(3 * sizeof(float))); |
| 17 | VAO.LinkAttrib(VBO, 2, 3, GL_FLOAT, sizeof(Vertex), (void*)(6 * sizeof(float))); |
| 18 | VAO.LinkAttrib(VBO, 3, 2, GL_FLOAT, sizeof(Vertex), (void*)(9 * sizeof(float))); |
| 19 | // Unbind all to prevent accidentally modifying them |
| 20 | VAO.Unbind(); |
| 21 | VBO.Unbind(); |
| 22 | EBO.Unbind(); |
| 23 | } |
| 24 | |
| 25 | |
| 26 | void Mesh::Draw |
nothing calls this directly
no test coverage detected