-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCube.cpp
More file actions
69 lines (60 loc) · 1.75 KB
/
Cube.cpp
File metadata and controls
69 lines (60 loc) · 1.75 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
60
61
62
63
64
65
66
67
68
69
#include "Cube.h"
#include "ImGUI/imgui.h"
#include "BaseMaterial.h"
Cube::Cube(GraphicsD11& gfx)
{
BaseMaterial::VertexInput vi[] = {
{ {-0.5f, 0.5f, 0.5f}, {255,000,000,255}, {0.0f, 0.25f}}, //0
{ {-0.5f, -0.5f, 0.5f}, {255,255,000,255}, {0.0f, 0.5f}}, //1
{ {-0.5f, 0.5f, 0.5f}, {255,255,000,255}, {0.25f, 0.0f}}, //2
{ {-0.5f, 0.5f, -0.5f}, {255,000,000,255}, {0.25f, 0.25f}}, //3
{ {-0.5f, -0.5f, -0.5f}, {255,255,000,255}, {0.25f, 0.5f}}, //4
{ {-0.5f, -0.5f, 0.5f}, {255,255,000,255}, {0.25f, 0.75f}}, //5
{ { 0.5f, 0.5f, 0.5f}, {255,000,000,255}, {0.5f, 0.0f}}, //6
{ { 0.5f, 0.5f, -0.5f}, {255,255,000,255}, {0.5f, 0.25f}}, //7
{ { 0.5f, -0.5f, -0.5f}, {255,255,000,255}, {0.5f, 0.5f}}, //8
{ { 0.5f, -0.5f, 0.5f}, {255,255,000,255}, {0.5f, 0.75f}}, //9
{ { 0.5f, 0.5f, 0.5f}, {255,255,000,255}, {0.75f, 0.25f}}, //10
{ { 0.5f, -0.5f, 0.5f}, {255,255,000,255}, {0.75f, 0.5f}}, //11
{ {-0.5f, 0.5f, 0.5f}, {255,255,000,255}, {1.0f, 0.25f}}, //12
{ {-0.5f, -0.5f, 0.5f}, {255,255,000,255}, {1.0f, 0.5f}}, //13
};
UINT16 ind[] = {
0, 3, 1,
3, 4, 1,
2, 6, 3,
6, 7, 3,
3, 7, 4,
7, 8, 4,
3, 7, 4,
7, 8, 4,
4, 8, 5,
8, 9, 5,
7, 10, 8,
10, 11, 8,
10, 12, 11,
12, 13, 11
};
mVertBuf = new VertexBuffer(
gfx,
sizeof(BaseMaterial::VertexInput) * std::size(vi),
sizeof(BaseMaterial::VertexInput),
&vi
);
mIndBuf = new IndexBuffer(
gfx,
std::size(ind),
&ind
);
mTopo = new Topology(gfx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
mTextureDiff = new Texture(gfx, "cube.png");
mIndCount = std::size(ind);
mTransform->SetPosition({ 1.0f, 0.0f, 0.0f, 0.0f });
}
void Cube::Bind(GraphicsD11& gfx)
{
mVertBuf->Bind(gfx);
mIndBuf->Bind(gfx);
mTopo->Bind(gfx);
mTextureDiff->Bind(gfx);
}