-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmesh.h
More file actions
42 lines (33 loc) · 1000 Bytes
/
mesh.h
File metadata and controls
42 lines (33 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include <iostream>
#include <vector>
#include "glad/glad.h"
#include <glm/glm.hpp>
#include "shader.h"
struct Vertex {
glm::vec3 Position;
glm::vec3 Normal;
glm::vec2 TexCoords;
};
struct Texture {
unsigned int id;
std::string type;
std::string path; // store the path of the texture to compare with other textures
};
class Mesh {
public:
// mesh data
std::vector<Vertex> vertices;
std::vector<unsigned int> indices;
std::vector<Texture> textures;
Mesh();
Mesh(std::vector<Vertex> vertices, std::vector<unsigned int> indices, std::vector<Texture> textures);
void Draw(Shader &shader);
// Getters for instanced rendering
unsigned int getVAO() const { return VAO; }
unsigned int getIndexCount() const { return static_cast<unsigned int>(indices.size()); }
private:
// render data
unsigned int VAO, VBO, EBO;
void setupMesh();
};