static const UINT ShadowMapCount = 6;

enum ShadowMapShaderType
{
    ShadowMapShaderCreate,
    ShadowMapShaderRender,
};

class ShadowMap
{
public:
    ShadowMap();
    ~ShadowMap();
    void FreeMemory();

    void SetAsRenderTarget(UINT ShadowMapIndex, IDirect3DDevice9 *Device);
    void SetAsTextures(IDirect3DDevice9 *Device);

    void SetLightMatrices(UINT LightIndex, const Camera &LightCamera, const Matrix4 &Perspective);
    void SetCameraMatrices(const MatrixController &MC, ShadowMapShaderType Shader);

    //void SetRenderMatrices(const MatrixController &CameraMC, const MatrixController &LightMC, const Vec3f &LightPos);

    void Init(D3D9GraphicsDevice &GD, UINT Resolution);

    void BlurAllShadowMaps(IDirect3DDevice9 *Device);

    void SaveDebugBitmap(const String &Filename);
    void SaveTextureToFile(D3D9Texture &T, const String &Filename);

//private:
    D3D9VertexShader _VShaderCreate;
    D3D9PixelShader _PShaderCreate;

    D3D9VertexShader _VShaderRender;
    D3D9PixelShader _PShaderRender;

    D3D9VertexShader _VShaderGaussian;
    D3D9PixelShader _PShaderGaussianX;
    D3D9PixelShader _PShaderGaussianY;

    D3D9Mesh _SimpleQuadMesh;

    D3D9Texture _DepthMapTextures[ShadowMapCount];
    D3D9Texture _DepthMapBlurTexture;
    IDirect3DSurface9 *_DepthStencil;

    String _StringLightView, _StringLightViewProj, _StringLightDir;
};