/*!
	@file
	@author		Albert Semenov
	@date		12/2009
*/

#ifndef MYGUI_DIRECTX_RTTEXTURE_H_
#define MYGUI_DIRECTX_RTTEXTURE_H_

#include "MyGUI_Prerequest.h"
#include "MyGUI_ITexture.h"
#include "MyGUI_RenderFormat.h"
#include "MyGUI_IRenderTarget.h"

struct IDirect3DDevice9;
struct IDirect3DTexture9;
struct IDirect3DSurface9;

namespace MyGUI
{

	class DirectXRTTexture :
		public IRenderTarget
	{
	public:
		DirectXRTTexture(IDirect3DDevice9* _device, IDirect3DTexture9* _texture);
		virtual ~DirectXRTTexture();

		virtual void begin();
		virtual void end();

		virtual void doRender(IVertexBuffer* _buffer, ITexture* _texture, size_t _count);

		virtual const RenderTargetInfo& getInfo() const override
		{
			return mRenderTargetInfo;
		}

	private:
		IDirect3DDevice9* mpD3DDevice;
		IDirect3DTexture9* mpTexture;
		IDirect3DSurface9* mpRenderSurface;
		IDirect3DSurface9* mpBackBuffer;
		RenderTargetInfo mRenderTargetInfo;
	};

} // namespace MyGUI

#endif // MYGUI_DIRECTX_RTTEXTURE_H_
