-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModel.h
More file actions
59 lines (45 loc) · 1.4 KB
/
Copy pathModel.h
File metadata and controls
59 lines (45 loc) · 1.4 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 "Mesh.h"
class Model
{
friend class QuadTree;
private:
//Mesh mesh;
XMMATRIX worldMatrix; //world matrix is unique for each object in the world. It's responsible for transforming vertices of objects from its
//local space to world space
std::string name;
// Struct for storing data of models
struct Transform
{
XMVECTOR translation;
XMVECTOR rotation;
XMVECTOR scale;
Transform(XMVECTOR translation, XMVECTOR rotation, XMVECTOR scale)
: translation(translation), rotation(rotation), scale(scale) {}
}transform;
public:
Model() = default;
Model(ID3D11Device* device, std::string name, XMVECTOR position = { 0.0f,0.0f,0.0f },
XMVECTOR rotation = { 0.0f,0.0f,0.0f }, XMVECTOR scale = { 1.0f, 1.0f, 1.0f });
~Model();
XMFLOAT3 posForQuads;
bool hasCubeMap;
// Buffers
ID3D11Buffer* vBuffer;
ID3D11Buffer* posBuffer;
Mesh mesh;
void Update();//updates data of models
int GetVertexCount();
XMMATRIX GetWorldMatrix();
ID3D11Buffer** GetMTLBuffer();
ID3D11Buffer** GetPositionsBuffer();
ID3D11Buffer** GetBuffer();
XMVECTOR GetPosition();
const Material::Data& GetMaterial();
void BindTextures(ID3D11DeviceContext* context, int startSlot = 0);
void SetTranslation(XMVECTOR translation);
void SetRotation(XMVECTOR rotation);
void SetScale(XMVECTOR scale);
XMVECTOR GetRotation();
void Shutdown();
};