-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd3d11mesh.h
57 lines (44 loc) · 1.3 KB
/
d3d11mesh.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
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef D3D11MESH_H
#define D3D11MESH_H
/*
* This is for Direct3D 11 implementation (Windows only) of the 3D mode.
*
*/
#include <vector>
#include "vertex.h"
#include "d3d11texture.h"
#include "camera.h"
#include <glm/glm.hpp>
class D3D11Mesh
{
public:
#ifdef Q_OS_WIN
std::vector <Vertex> vertices;
std::vector <unsigned int> indices;
std::vector <D3D11Texture> textures;
// Store VAO in public so it can be used in the Draw function
ID3D11Buffer* m_transbuf = 0;
ID3D11Buffer* m_rotbuf = 0;
ID3D11Buffer* m_scabuf = 0;
ID3D11Buffer* m_modelbuf = 0;
ID3D11Buffer* m_vbuf = 0; //vertex
ID3D11Buffer* m_indbuf = 0; //index
ID3D11InputLayout *m_inputLayout = 0;
// Initializes the mesh
D3D11Mesh(D3D11Shader* shader, std::vector <Vertex>& vertices, std::vector <unsigned int>& indices, std::vector <D3D11Texture>& textures);
~D3D11Mesh(){}
void Delete();
// Draws the mesh
void Draw
(
D3D11Shader* shader,
Camera& camera,
glm::mat4 matrix = glm::mat4(1.0f),
glm::vec3 translation = glm::vec3(0.0f, 0.0f, 0.0f),
glm::quat rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f),
glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f)
);
//void Draw(Shader& shader, Camera& camera);
#endif
};
#endif // D3D11MESH_H