

/**
*
* \file Asura_Carpet_StyleManager.cpp
*
* Created by Dave Reed - 23/11/2005
*
* Copyright (C) 2005 Rebellion (Derby), All Rights Reserved.
*
**/

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifdef ASURA_USE_CARPET

#ifndef __ASURA_CARPET_STYLESMANAGER_H__
#define __ASURA_CARPET_STYLESMANAGER_H__

#ifdef ASURA_TOOLS

#define ASURA_CARPET_BILLBOARDS_PER_STYLE			8
// JAT 13/02/06 this needs to be a power of 2
#define ASURA_CARPET_BILLBOARD_SEQUENCE_LENGTH		16

#include "Core/Asura_String.h"


struct Asura_Carpet_Billboard
{	
	float					fU[2];
	float					fV[2];
	float					fWidth;
	float					fHeight;
	float					fMinScale;	
};



struct Asura_Carpet_Style
{
	Asura_String	  		xName;
	Asura_String			xTextureName;
	int						iTextureID;
	int						iUID;
	float					fDensity;
	float					fLodFadeNear;
	float					fLodFadeFar;
	float					fMovementScale;
	int						aiSequence[ASURA_CARPET_BILLBOARD_SEQUENCE_LENGTH];
	Asura_Carpet_Billboard	axBillboards[ASURA_CARPET_BILLBOARDS_PER_STYLE];
};

class Asura_Carpet_StyleManager
{
public:
	static void					Initialise();			// Load styles from carptsty.asr
	static void					Shutdown();
	static void					Reset(); 		
	static bool				    Save(char* szFileName);	// Save styles to carptsty.asr
	static void					LoadResources();		// Load the textures referenced by the style


	static int					GetNumStyles();	
	static Asura_Carpet_Style  *GetStyle(int iStyle);
	static char				   *GetStyleName(int iStyle);
	static int					FindStyleFromUID(int iUID);
	
	static int					GetNextUID()		 {return s_iNextUID;}
	static void					SetNextUID(int iUID) {s_iNextUID=iUID;}	

	// Tools functions
	static int					CreateStyle();
	static void					RemoveStyle(int iStyle);

private:

	static int					s_iNumStyles;
	static int					s_iNextUID;
	static Asura_Carpet_Style*  s_pxStyles;
};

#endif // #ifdef ASURA_TOOLS

#endif //__ASURA_CARPET_STYLESMANAGER_H__

#endif // ASURA_USE_CARPET
