-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderSystem.h
More file actions
89 lines (74 loc) · 2.64 KB
/
RenderSystem.h
File metadata and controls
89 lines (74 loc) · 2.64 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#pragma once
#include "Prerequisites.h"
#include "SwapChain.h"
#include "DeviceContext.h"
#include "VertexBuffer.h"
#include "VertexShader.h"
#include "PixelShader.h"
#include "ConstantBuffer.h"
#include "IndexBuffer.h"
class RenderSystem
{
public:
// Init the Render System and DirectX 11 Device
RenderSystem();
// Release all the resources loaded
~RenderSystem();
public:
SwapChainPtr createSwapChain(HWND hwnd, UINT width, UINT height);
VertexBufferPtr createVertexBuffer(
void* list_vertices,
UINT size_vertex,
UINT size_list,
void* shader_byte_code,
size_t size_byte_shader
);
VertexShaderPtr createVertexShader(const void* shader_byte_code, size_t byte_code_size);
PixelShaderPtr createPixelShader(const void* shader_byte_code, size_t byte_code_size);
ConstantBufferPtr createConstantBuffer(void* buffer, UINT size_buffer);
IndexBufferPtr createIndexBuffer(void* list_indices, UINT size_list);
public:
DeviceContextPtr getImmediateDeviceContext();
// Methods used to compile a shader file (.hlsl file)
bool compileVertexShader(
const wchar_t* file_name,
const char* entry_point_name,
void** shader_byte_code,
size_t* byte_code_size
);
bool compilePixelShader(
const wchar_t* file_name,
const char* entry_point_name,
void** shader_byte_code,
size_t* byte_code_size
);
void releaseCompiledShader();
void setRasterizerState(bool cull_front);
private:
void initRasterizerState();
private:
// DirectX Graphics Infrastructure (DXGI)
// Members that start with I (Ex: ID3D11Device) are COM (Component Object Model) objects
ID3D11Device* mD3DDevice = nullptr;
D3D_FEATURE_LEVEL mFeatureLevel = D3D_FEATURE_LEVEL_11_0;
IDXGIDevice* mDxgiDevice = nullptr;
// This is a value that indicates what graphics adapter Direct3D should use.
// A graphics adapter typically refers to a GPU and its video memory, digital-to-analog converter, etc.
IDXGIAdapter* mDxgiAdapter = nullptr;
// An IDXGIFactory interface implements methods for generating DXGI objects (which handle full screen transitions).
IDXGIFactory* mDxgiFactory = nullptr;
ID3D11DeviceContext* mImmContext = nullptr;
ID3DBlob* mBlob = nullptr;
ID3D11RasterizerState* mCullFrontState = nullptr;
ID3D11RasterizerState* mCullBackState = nullptr;
private:
DeviceContextPtr mImmDeviceContext;
private:
friend class SwapChain;
friend class VertexBuffer;
friend class VertexShader;
friend class PixelShader;
friend class ConstantBuffer;
friend class IndexBuffer;
friend class Texture;
};