#ifndef __D3DRenderTarget__
#define __D3DRenderTarget__

#include <windows.h>
#include <d3d10_1.h>
#include <d3dx10.h>
#include <dxgi.h>

#include "../Core/SceneGraph/RenderTarget.h"
#include "D3DDefs.h"

class D3DRenderTarget : public RenderTarget {
public:
    D3DRenderTarget(uint32 width, uint32 height, uint32 sampleCount, ID3D10Device1* device);
    virtual ~D3DRenderTarget();

    void resize(uint32 width, uint32 height);
    void resolve(RenderTarget* resolveTarget);
    void generateMipmaps();

    ID3D10ShaderResourceView* getShaderResourceView();
    ID3D10RenderTargetView*   getRenderTargetView();

protected:
    HRESULT createSurface(ID3D10Texture2D** ppTexture, ID3D10ShaderResourceView** ppTextureSRV, ID3D10RenderTargetView** ppTextureRTV, DXGI_FORMAT format, uint32& mipLevelCount, uint32 sampleCount, uint32 width, uint32 height);

    ID3D10Device1*              _device;

    ID3D10Texture2D*            _renderTarget;
    ID3D10ShaderResourceView*   _shaderResourceView;
    ID3D10RenderTargetView*     _renderTargetView;
};

#endif