#ifndef RENDER_SHADOW_MAP_H
#define RENDER_SHADOW_MAP_H

#include <cstdint>
#include <d3d11.h>
#include <wrl/client.h>

class ShadowMap final {
public:
    void Initialize(ID3D11Device *device, std::uint32_t resolution);

    [[nodiscard]] ID3D11DepthStencilView *DSV() const noexcept {
        return m_dsv.Get();
    }

    [[nodiscard]] ID3D11ShaderResourceView *SRV() const noexcept {
        return m_srv.Get();
    }

    [[nodiscard]] ID3D11SamplerState *Sampler() const noexcept {
        return m_comparisonSampler.Get();
    }

    [[nodiscard]] const D3D11_VIEWPORT &Viewport() const noexcept {
        return m_viewport;
    }

    [[nodiscard]] std::uint32_t Resolution() const noexcept {
        return m_resolution;
    }

private:
    std::uint32_t m_resolution = 0;

    D3D11_VIEWPORT m_viewport{};

    Microsoft::WRL::ComPtr<ID3D11Texture2D> m_texture;
    Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_dsv;
    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_srv;
    Microsoft::WRL::ComPtr<ID3D11SamplerState> m_comparisonSampler;
};


#endif //RENDER_SHADOW_MAP_H
