-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModel.h
46 lines (35 loc) · 910 Bytes
/
Model.h
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
43
44
45
#pragma once
#include <GL/glew.h>
#include <glm/glm.hpp>
#include <memory>
#include <vector>
#include "Material.h"
struct VertexData
{
glm::vec3 position{ 0 };
glm::vec3 normal{ 0 };
glm::vec3 tangent{ 0 };
glm::vec2 texCoord{ 0 };
};
class Model
{
public:
Model();
~Model();
Model(std::vector<VertexData> const& vertices,
std::vector<GLuint> const& indices,
std::shared_ptr<Material> pMaterial);
void Draw();
void SetTransform(glm::mat4 const& trans) { m_transform = trans; }
void SetMaterial(std::shared_ptr<Material> pMat) { m_pMaterial = pMat; }
Material* GetMaterial() { return m_pMaterial.get(); }
glm::mat4 const& GetTransform() { return m_transform; }
private:
GLuint m_indexBuffer;
GLuint m_normalBuffer;
GLuint m_vertexBuffer;
GLuint m_texCoordBuffer;
int m_indexCount;
std::shared_ptr<Material> m_pMaterial;
glm::mat4 m_transform;
};