-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodelclass.h
68 lines (54 loc) · 1.77 KB
/
modelclass.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
58
59
60
61
62
63
64
65
66
67
68
////////////////////////////////////////////////////////////////////////////////
// Filename: modelclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _MODELCLASS_H_
#define _MODELCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "pch.h"
//#include <d3dx10math.h>
//#include <fstream>
//using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: ModelClass
////////////////////////////////////////////////////////////////////////////////
using namespace DirectX;
class ModelClass
{
private:
struct VertexType
{
DirectX::SimpleMath::Vector3 position;
DirectX::SimpleMath::Vector2 texture;
DirectX::SimpleMath::Vector3 normal;
};
public:
ModelClass();
~ModelClass();
bool InitializeModel(ID3D11Device *device, char* filename);
bool InitializeTeapot(ID3D11Device*);
bool InitializeSphere(ID3D11Device*);
bool InitializeBox(ID3D11Device*, float xwidth, float yheight, float zdepth);
void Shutdown();
void Render(ID3D11DeviceContext*);
void SetCentre(DirectX::SimpleMath::Vector3 centre);
DirectX::SimpleMath::Vector3 GetCentre();
DirectX::SimpleMath::Vector3 GetDimensions();
int GetIndexCount();
private:
bool InitializeBuffers(ID3D11Device*);
void ShutdownBuffers();
void RenderBuffers(ID3D11DeviceContext*);
bool LoadModel(char*);
void ReleaseModel();
private:
ID3D11Buffer *m_vertexBuffer, *m_indexBuffer;
int m_vertexCount, m_indexCount;
//arrays for our generated objects Made by directX
std::vector<VertexPositionNormalTexture> preFabVertices;
std::vector<uint16_t> preFabIndices;
DirectX::SimpleMath::Vector3 m_ObjCentre;
DirectX::SimpleMath::Vector3 m_ObjDimensions;
};
#endif