Added mesh class (unfinished)
This commit is contained in:
parent
f42740d8cc
commit
65e7447fe3
2 changed files with 44 additions and 0 deletions
10
src/Mesh.cpp
Normal file
10
src/Mesh.cpp
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "Mesh.h"
|
||||||
|
|
||||||
|
Mesh::Mesh(std::vector<Vertex> vertices, std::vector<unsigned int> indices,
|
||||||
|
std::vector<Texture> textures) {
|
||||||
|
this->vertices = vertices;
|
||||||
|
this->indices = indices;
|
||||||
|
this->textures = textures;
|
||||||
|
|
||||||
|
setupMesh();
|
||||||
|
}
|
||||||
34
src/Mesh.h
Normal file
34
src/Mesh.h
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#pragma once
|
||||||
|
#include "Error.h"
|
||||||
|
#include "ShaderLoader.h"
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// 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<Vertex> vertices;
|
||||||
|
std::vector<unsigned int> indices;
|
||||||
|
std::vector<Texture> textures;
|
||||||
|
|
||||||
|
void Draw(ShaderLoader &shader);
|
||||||
|
Mesh(std::vector<Vertex> vertices, std::vector<unsigned int> indices,
|
||||||
|
std::vector<Texture> textures);
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue