-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCubeScene.h
47 lines (40 loc) · 1.41 KB
/
CubeScene.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
#pragma once
#include "Scene.h"
#include <DirectXMath.h>
typedef struct _vertexPositionColor
{
DirectX::XMFLOAT3 pos;
DirectX::XMFLOAT3 normal;
} VertexPositionNormal;
class CubeScene: public Scene
{
public:
CubeScene();
virtual ~CubeScene();
bool Initialize(Renderer* renderer) override;
bool Update(Renderer* renderer, float elapsed) override;
bool Render(Renderer* renderer) override;
private:
typedef struct _constantBufferStruct {
DirectX::XMMATRIX world;
DirectX::XMMATRIX view;
DirectX::XMMATRIX projection;
DirectX::XMFLOAT4 vLightDir[2];
DirectX::XMFLOAT4 vLightColor[2];
DirectX::XMFLOAT4 vOutputColor;
} ConstantBufferStruct;
// Assert that the constant buffer remains 16-byte aligned.
static_assert((sizeof(ConstantBufferStruct) % 16) == 0, "Constant Buffer size must be 16-byte aligned");
ConstantBufferStruct m_constantBufferData{};
unsigned int m_indexCount;
DirectX::XMFLOAT4 m_lightDirs[2]{};
DirectX::XMFLOAT4 m_lightColors[2]
= { DirectX::XMFLOAT4(0.5f, 0.5f, 0.5f, 1.0f),
DirectX::XMFLOAT4(0.5f, 0.0f, 0.0f, 1.0f),
};
ID3D11Buffer* vertex_buffer_ = nullptr;
ID3D11Buffer* index_buffer_ = nullptr;
ID3D11InputLayout* input_layout_ = nullptr;
ID3D11InputLayout* input_layout_extended_ = nullptr;
ID3D11Buffer* constant_buffer_ = nullptr;
};