#ifndef _RURESOURCEMANAGERBASE_H_
#define _RURESOURCEMANAGERBASE_H_

// Rune system core
#include "../../Engine/Base/RuCore.h"

#pragma unmanaged

// ************************************************************************************************************************************************************

class IRuShader;
class CRuAnimation;
class CRuEntity;

// ************************************************************************************************************************************************************

class IRuResourceManager
{
public:
	virtual								~IRuResourceManager() { }

	// Manager setup
	virtual void						SetRootDirectory(const char *rootDirectory) = 0;

	// Texture management
	virtual BOOL						AddTexture(IRuBaseTexture *texture) = 0;			// Adds texture to the manager's dictionary
	virtual BOOL						RemoveTexture(IRuBaseTexture *texture) = 0;			// Removes texture from the manager's dictionary
	virtual BOOL						RemoveTexture(const char *textureName) = 0;			// Removes texture from the manager's dictionary
	virtual	IRuTexture*					LoadTexture(const char *textureName) = 0;			// Loads a texture using default settings
	virtual	IRuTexture*					LoadTexture(const char *textureName, RuSurfaceFormat surfaceFormat) = 0;
	virtual IRuTexture*					CreateTexture(const char *textureName, UINT32 width, UINT32 height, RuSurfaceFormat surfaceFormat) = 0;	// Creates a new texture
	virtual IRuTexture*					CreateTexture(const char *textureName, UINT32 width, UINT32 height, UINT32 levels, RuSurfaceFormat surfaceFormat) = 0;	// Creates a new texture
	virtual IRuVolumeTexture*			CreateVolumeTexture(const char *textureName, UINT32 width, UINT32 height, UINT32 depth, UINT32 levels, RuSurfaceFormat surfaceFormat) = 0;

	// Render target pool management
	virtual BOOL						CreateRenderTargetPool(INT32 poolSize, INT32 rtSize, RuSurfaceFormat rtFormat) = 0;
	virtual BOOL						ResetRenderTargetPools() = 0;
	virtual IRuTexture*					GetPooledRenderTarget(INT32 rtSize, RuSurfaceFormat rtFormat) = 0;
	virtual BOOL						FreePooledRenderTarget(IRuTexture *renderTarget) = 0;

	// Shader management
	virtual BOOL						AddShader(IRuShader *shader) = 0;
	virtual BOOL						RemoveShader(IRuShader *shader) = 0;
	virtual BOOL						RemoveShader(const char *shaderName) = 0;
	virtual IRuShader*					GetShader(const char *shaderName) = 0;
	virtual BOOL						GetShaderList(CRuArrayList<const char *> &shaderListOut) = 0;

	// Animation management
	virtual CRuAnimation*				LoadAnimation(const char *animationName) = 0;

	// Entity management
	virtual CRuEntity*					LoadEntity(const char *entityName) = 0;

	// Dictionary management
	virtual BOOL						ClearTextureDictionary() = 0;						// Clears the texture dictionary
	virtual BOOL						ClearShaderDictionary() = 0;						// Clears the shader dictionary
	virtual BOOL						ClearAnimationDictionary() = 0;						// Clears the animation dictionary
	virtual BOOL						ClearEntityDictionary() = 0;						// Clears the Entity dictionary

	// Garbage collection
	virtual BOOL						GarbageCollect() = 0;								//!< Collects and frees unused resources
};

// ************************************************************************************************************************************************************

extern RUAPI IRuResourceManager*		g_ruResourceManager;

// ************************************************************************************************************************************************************

#pragma managed

#endif
