#ifndef __TARGETABLETEXTURE__
#define __TARGETABLETEXTURE__


class TargetableTexture
{
	private:
		
		LPDIRECT3DTEXTURE9 m_pRTTexture;	// The texture
		LPDIRECT3DSURFACE9 m_pRTSurface;	// if multisamped a multisampled RT, else the surface from m_pRTTexture

		bool m_bMultisampled;				// Do we use multisampling?


	public:

		// Construction / Destruction
		TargetableTexture();
		~TargetableTexture();

		// Content management
		HRESULT Init(const UINT Width, const UINT Height, const D3DFORMAT Format);
		void ReleaseAll();
		HRESULT CopyNonMultisampledSurfacetToTexture();	// Un-multisample the texture surface by copying it with stretchrect

		// Getters / Setters
		LPDIRECT3DTEXTURE9 GetTexture(){ if(FAILED(CopyNonMultisampledSurfacetToTexture())) return NULL; return m_pRTTexture; }
		LPDIRECT3DSURFACE9 GetSurface(){ return m_pRTSurface; }
};

#endif