#pragma once

#include "d3d9.h"
#include "..\Utilities\List.h"

enum FORMAT;
class DeviceStateManager;
class ViewPortRenderTexture;

class DXFUNCTIONS_API DXViewPort
{
	D3DVIEWPORT9 m_VPDesc;

	DeviceStateManager* m_pDevice;
	LList<ViewPortRenderTexture> m_lRenderTargets;

protected:
	friend ViewPortRenderTexture;

	void ReleaseRTRef(ViewPortRenderTexture* const rt);

public:
	DXViewPort(DeviceStateManager* const device);
	~DXViewPort(void);

	ViewPortRenderTexture* CreateViewPortRenderTexture(const float scale, const FORMAT fmt);

	void SetRegion(const unsigned x, const unsigned y, const unsigned width, const unsigned height, const float minz, const float maxz);

	unsigned GetWidth(void) const { return m_VPDesc.Width; }
	unsigned GetHeight(void) const { return m_VPDesc.Height; }

	const D3DVIEWPORT9* GetDesc(void) const { return &m_VPDesc; }
};
