/**
* OpenGL Texture Manager
* @version: 3-20-2005
* @author Joseph 'Pcjoe' Florencio
*/

#ifndef FXTEXTUREMANAGER_H
#define FXTEXTUREMANAGER_H

class CGLTextureManager;
extern CGLTextureManager gGLTextureManager;

// GL Texture
class CGLTexture
{
public:
	// Constructor
	CGLTexture() { setTextureNum(0); setTexturePath(""); setBMPTextureData(NULL); }
	// Destrutor
	~CGLTexture() { }

	// Load Texture
	GLuint loadTexture( std::string strPath, bool bWrap );

	// Setup Mipmaps
	void setupMipmaps( bool bWrap );

	// Invert Texture Colors
	void invertTextureColors( void );

	/*
	* Accessors
	*/
	// GL Texture Number
	void setTextureNum( GLuint iTexture ) { m_iTextureNum = iTexture; }
	GLuint getTextureNum( void ) { return m_iTextureNum; }

	// Path to texture
	void setTexturePath( std::string strPath ) { m_strPath = strPath; }
	std::string getTexturePath( void ) { return m_strPath; }

	// BMP Texture Data
	void setBMPTextureData( AUX_RGBImageRec *pTexture ) { m_pBMPTextureData = pTexture; }
	AUX_RGBImageRec *getBMPTextureData( void ) { return m_pBMPTextureData; }
private:
	std::string		m_strPath;
	GLuint			m_iTextureNum;
	AUX_RGBImageRec	*m_pBMPTextureData;
};

// GL Texture Manager
class CGLTextureManager
{
public:
	// Constructor
	CGLTextureManager() { }
	// Destructor
	~CGLTextureManager() { }

	// Load BMP
	CGLTexture *loadBMP( std::string strPath, bool bWrap, GLuint &iTexture );
	CGLTexture *loadBMP( std::string strPath, bool bWrap );

	// Load Empty Texture
	GLuint createBlankTexture( int iWidth, int iHeight, GLenum target );

	// Find Texture
	CGLTexture *findTexture( std::string strPath );

	// Add to list
	CGLTexture *addToList( CGLTexture texture );
	
	/*
	* Accessors
	*/
	std::list<CGLTexture> *getTextureList( void ) { return (&m_Textures); }
private:
	// Texture list
	std::list<CGLTexture>	m_Textures;
};

#endif