#ifndef __SKYBOX__
#define __SKYBOX__

// Forward declarations
class TransformMatrixesManager;


class SkyBox 
{
	private:

		// Skybox mesh data
		LPD3DXMESH m_pSkyBoxMesh;						// The D3DX Mesh loaded from X
		D3DMATERIAL9 * m_pMeshMaterials;				// Materials for our mesh
		DWORD m_dwNumMaterials;							// Number of mesh materials
		LPDIRECT3DCUBETEXTURE9 m_pSkyBoxCubeTexture;	// A cube texture for the skybox

		// Skybox effect data
		LPD3DXEFFECT m_pEffect;							// The effect interface
		D3DXHANDLE m_hSkyBoxTechnique;					// Handle on skybox technique

		D3DXHANDLE m_hMatCurrentWV;						// Handle on the WorldView matrix
		D3DXHANDLE m_hMatPreviousWV;					// Handle on the WorldView matrix
		D3DXHANDLE m_hMatProj;							// Handle on the Projection matrix

		D3DXHANDLE m_hSkyBoxCubeTexture;				// Handle on the skybox texture (a cube map)

		TransformMatrixesManager * m_pTransMatMgr;		// A pointer to the matrix manager


	public:

		// Construction / destruction
		SkyBox();
		~SkyBox();
		
		// Rendering
		HRESULT RenderSkyBox();

		// Effect settings
		HRESULT CompileEffect(LPCWSTR filePath);
		void SetupHandles();
		void SetupEffectMatrixes();

		// The usual f---ing DirectX events
		HRESULT OnResetDevice();
		HRESULT OnLostDevice();
};

#endif