forked from vixorien/D3D11Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMesh.h
More file actions
60 lines (51 loc) · 1.19 KB
/
Mesh.h
File metadata and controls
60 lines (51 loc) · 1.19 KB
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
58
59
#pragma once
#include <d3d11.h>
#include <wrl/client.h>
#include "Vertex.h"
#include <string>
#include <fstream>
#include <vector>
class Mesh
{
public:
Mesh(
Vertex* vertices,
int numVertices,
unsigned int* indices,
int numIndices,
Microsoft::WRL::ComPtr<ID3D11Device> device,
Microsoft::WRL::ComPtr<ID3D11DeviceContext> context
);
Mesh(
const std::wstring& objFile,
Microsoft::WRL::ComPtr<ID3D11Device> device,
Microsoft::WRL::ComPtr<ID3D11DeviceContext> context
);
~Mesh();
Microsoft::WRL::ComPtr<ID3D11Buffer> GetVertexBuffer();
Microsoft::WRL::ComPtr<ID3D11Buffer> GetIndexBuffer();
int GetIndexCount();
// Callable methods
void Draw();
private:
// Core data
Microsoft::WRL::ComPtr<ID3D11Buffer> vertexBuffer;
Microsoft::WRL::ComPtr<ID3D11Buffer> indexBuffer;
Microsoft::WRL::ComPtr<ID3D11DeviceContext> deviceContext;
int indexCount;
// Helper methods
void CreateBuffers(
Vertex* vertices,
int numVertices,
unsigned int* indices,
int numIndices,
Microsoft::WRL::ComPtr<ID3D11Device> device,
Microsoft::WRL::ComPtr<ID3D11DeviceContext> context
);
void CalculateTangents(
Vertex* verts,
int numVerts,
unsigned int* indices,
int numIndices
);
};