Shadows go brrr

This commit is contained in:
2025-01-16 14:03:28 +01:00
parent 8a3bf57d7e
commit 071caf51b6
22 changed files with 4140 additions and 3269 deletions

View File

@@ -7,13 +7,15 @@ SamplerState::SamplerState(ID3D11Device *device)
SamplerState::~SamplerState() {
if (m_samplerState) m_samplerState->Release();
}
bool SamplerState::Initialize() {
D3D11_SAMPLER_DESC samplerDesc = {};
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
// samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
// samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
// samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

View File

@@ -9,9 +9,9 @@ public:
SamplerState(ID3D11Device* device);
~SamplerState();
bool Initialize();
ID3D11SamplerState* GetSamplerState() const { return m_samplerState; }
private:
ID3D11Device* m_device;
ID3D11SamplerState* m_samplerState;

View File

@@ -40,6 +40,7 @@ void ShadowMapBuffer::SetRenderTarget(ID3D11DeviceContext *deviceContext) {
deviceContext->OMSetRenderTargets(0, nullptr, m_depthBuffer.GetDepthStencilView());
}
void ShadowMapBuffer::ResetRenderTarget(ID3D11DeviceContext *deviceContext) {
ID3D11RenderTargetView *nullRTV = nullptr;
deviceContext->OMSetRenderTargets(1, &nullRTV, nullptr);

View File

@@ -27,9 +27,7 @@ public:
ID3D11SamplerState *GetSamplerState() const { return m_samplerState.GetSamplerState(); }
ID3D11DepthStencilView *GetDepthStencilView();
private:
ID3D11Device *m_device;
UINT m_width;