-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShadowMapClass.hpp
91 lines (66 loc) · 1.6 KB
/
ShadowMapClass.hpp
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
89
90
91
#ifndef SHADOWMAPCLASS_HPP
#define SHADOWMAPCLASS_HPP
//#include <d3d11.h>
//#include <d3dcompiler.h>
//#include <DirectXMath.h>
#include "ConstantBufferClass.hpp"
struct ShadowMapConstantBuffer
{
DirectX::XMFLOAT4X4 ShadowViewMatrix;
DirectX::XMFLOAT4X4 ShadowProjectionMatrix;
};
class ShadowMapClass
{
private:
ID3D11InputLayout* VertexLayout;
ID3D11VertexShader* VertexShader;
ID3D11PixelShader* PixelShader;
ID3D11Texture2D* DepthStencilBuffer;
ID3D11DepthStencilView* DepthStencilView;
ID3D11ShaderResourceView* DepthShaderResourceView;
ID3D11SamplerState* SamplerStateCLAMP;
ID3D11Buffer* ConstantBuffer;
ShadowMapConstantBuffer ConstantBufferData;
// PRIVATE FUNCTIONS
void InitializeShaders(
ID3D11Device* *Device
);
void InitializeSampler(
ID3D11Device* *Device
);
void InitializeBuffers(
ID3D11Device* *Device,
UINT ScreenWidth,
UINT ScreenHeight
);
void InitializeConstantBuffer(
ID3D11Device* *Device,
ID3D11DeviceContext* *DeviceContext,
DirectX::XMFLOAT4 LightPositionArray
);
public:
ShadowMapClass();
~ShadowMapClass();
void InitializeAll(
ID3D11Device* *Device,
ID3D11DeviceContext* *DeviceContext,
UINT ScreenWidth,
UINT ScreenHeight,
DirectX::XMFLOAT4 LightPosition
);
void SetDepthRenderTarget(
ID3D11DeviceContext* *DeviceContext
);
void SetShaderResourceView(
ID3D11DeviceContext* *Device
);
void SetShadingContext(
ID3D11DeviceContext* *DeviceContext
);
void RenderObjectShadowMap(
ID3D11DeviceContext* *DeviceContext,
ID3D11Buffer* *VertexBuffer,
int VerticeCount
);
};
#endif