-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphicsSystem.h
More file actions
56 lines (50 loc) · 1.7 KB
/
GraphicsSystem.h
File metadata and controls
56 lines (50 loc) · 1.7 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
#pragma once
#include <d3d11.h>
#include <vector>
class GraphicsSystem
{
public:
struct Viewport
{
unsigned x;
unsigned y;
unsigned width;
unsigned height;
};
public:
enum class RasterizerState { SOLID, WIREFRAME, }; // render states are created at initialization and stored into dynamic arrays in same order as enumerators
enum class BlendState { DISABLED, ADDITIVE, };
enum class DepthStencilState { ENABLED, DISABLED, };
static GraphicsSystem &GetInstance();
~GraphicsSystem() = default;
void Initialize(HWND window);
unsigned GetDisplayWidth() const { return mDisplayWidth; }
unsigned GetDisplayHeight() const { return mDisplayHeight; }
Viewport GetViewport() const { return mViewport; }
void SetRasterizerState(RasterizerState state);
void SetBlendState(BlendState state);
void SetDepthStencilState(DepthStencilState state);
void ClearScreen(const float color[]);
void Present();
ID3D11Device *GetDevice() { return mDevice; }
ID3D11DeviceContext *GetDeviceContext() { return mDeviceContext; }
bool IsMSAAEnabled() const { return mMSAAEnabled; }
int GetSampleCount() const { return mSampleCount; }
int GetSampleQuality() const { return mSampleQuality; }
private:
GraphicsSystem() = default;
ID3D11Device *mDevice;
ID3D11DeviceContext *mDeviceContext;
IDXGISwapChain *mSwapChain;
int mSampleCount;
int mSampleQuality;
ID3D11RenderTargetView *mRenderTargetView;
ID3D11DepthStencilView *mDepthStencilView;
unsigned int mDisplayWidth;
unsigned int mDisplayHeight;
Viewport mViewport;
bool mMSAAEnabled = true;
std::vector<ID3D11RasterizerState*> mRasterizerStateGroup;
std::vector<ID3D11BlendState*> mBlendStateGroup;
std::vector<ID3D11DepthStencilState*> mDepthStencilStateGroup;
};