-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSceneBoard.h
61 lines (49 loc) · 1.34 KB
/
SceneBoard.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
#pragma once
#include "MyWinHeader.h"
#include "Point.h"
#include "Vertex.h"
#include "AbstractShape.h"
#include "Camera.h"
#include "SmartPointer.h"
#include <d3d11.h>
#include <d3d10.h>
#include <d3dcompiler.h>
#include <vector>
#include "AbstractAnimation.h"
#pragma comment (lib,"d3d11.lib")
#pragma comment (lib,"d3d10.lib")
#pragma comment (lib,"D3DCompiler.lib")
class SceneBoard
{
std::vector<sp<AbstractShape>> m_shapes;
std::vector<sp<AbstractAnimation>> m_animations;
IDXGISwapChain* m_swapChain;
ID3D11Device* m_device;
ID3D11DeviceContext* m_context;
ID3D11RenderTargetView* m_renderTargetView;
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D10Blob* m_vertexShaderData;
ID3D10Blob* m_pixelShaderData;
HWND m_handle;
Point m_pos;
float m_height;
float m_width;
private:
void InitD3d();
void SetViewport();
void SetRenderTarget();
void CreateBase3dObjects();
void InitShaders();
void ClearRenderTarget();
void SetViewProjectionMatrix(sp<Camera> camera);
void SetVertexShaderConstantBuffer(int slot, DirectX::XMMATRIX matrix);
void RenderShape(sp<AbstractShape> shape);
public:
SceneBoard(HWND windowHandle);
void Tick();
void Render(sp<Camera> camera);
void AddShape(sp<AbstractShape> shape);
void RemoveShape(sp<AbstractShape> shape);
void AddAnimation(sp<AbstractAnimation> animation);
};