#pragma once
#define MLR_GOSIMAGEPOOL_HPP

#include "MLR.hpp"

namespace MidLevelRenderer {

	class GOSImage;
	class MLRTexture;

	class GOSImagePool
		#if defined(_ARMOR)
			: public Stuff::Signature
		#endif
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Constructors/Destructors
	//
	public:
		GOSImagePool();
		~GOSImagePool();

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Image handling
	//
	public:
		GOSImage*
			GetImage(const char* imageName);
		GOSImage*
			GetImage(const char* imageName, gos_TextureFormat format, int size, gos_TextureHints hints);
		virtual bool
			LoadImageGOS(GOSImage *image, int=0)=0;
		void
			RemoveImage(GOSImage *image);


		void
			GetTexturePath(Stuff::MString* pName) const
				{ Check_Object(this); *pName = texturePath; }

		static DWORD
			SkinThis(
				const char* name,
				gos_TextureFormat format,
				DWORD skin,
				DWORD detail
			);
		static void
			SkinThis(
				TEXTUREPTR texture_ptr,
				TEXTUREPTR skin_ptr,
				TEXTUREPTR detail_ptr
			);

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Testing
	//
	public:
		void
			TestInstance() const
				{}

	protected:
		Stuff::HashOf<GOSImage*, Stuff::MString>
			imageHash;
		Stuff::MString
			texturePath;

		static int
			ReadHint(Stuff::Page *page);
	};

	class TGAFilePool:
		public GOSImagePool
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Constructors/Destructors
	//
	public:
		TGAFilePool(
			const char* path,
			const char* hint_file=NULL
		);
		~TGAFilePool();

	protected:
		Stuff::NotationFile
			*hintFile;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Image handling
	//
	public:
		bool
			LoadImageGOS(GOSImage *image, int=0);

	};
}
