//*******************************************************************
//
// File: Asura_PS2_Botanicals_Store.h
//
// Created: 22 March 2006 by Jake Turner
//
// Description: 
// PS2 specific botanicalsmesh storage class
// Manager class for PS2 botanicals data
//
//*******************************************************************

#ifdef ASURA_USE_BOTANICALS

#ifndef __ASURA_PS2_BOTANICALS_STORE_H__
#define __ASURA_PS2_BOTANICALS_STORE_H__

#include "Core/Asura_Handle.h"
#include "Botanicals/Asura_PS2_Botanicals_Shared.h"

// Forward declaration
struct Asura_PS2_Botanicals_Instance_Runtime_Data;
class Asura_SphericalHarmonics_Order2_RGB;

// For avoiding #define spaghetti in SetLights declaration
#ifdef ASURA_PS2_BOTANICAL_BILLBOARDS_IGNORE_NORMAL_FOR_LIGHTING
#define IGNORE_NORMAL_PARAM , bool bIgnoreNormal = false
#else 
#define IGNORE_NORMAL_PARAM
#endif

#ifdef ASURA_PS2_SUPPORT_BOTANICAL_LIGHTING
#define DYNAMIC_LIGHT_PARAM , const Asura_SphericalHarmonics_Order2_RGB* pxDynamicSH = NULL
#else
#define DYNAMIC_LIGHT_PARAM
#endif

class Asura_PS2_Botanicals_Store
{
public:
	static void Initialize( void );
	static void Shutdown( void );
	static void Reset( void ); 		
	static void Render( const float fDefaultHorizFoV, const float fGlobalFade );

	static bool Load( Asura_Handle xFile );

private:
	static void Begin( void );
	static void End( void );
	static void SendPendingData( const bool bWillMSCNTForNextStrip );
	static void SetCamFlags( const u_int uVisFlags, const u_int uClipFlags );
	static void SetObjectToWorldMat( const Asura_Matrix_3x3& xOri, const Asura_Vector_3& xPos, const float fObjectScale );
	static void SetLights( const u_int uSH0, const u_int uSH1, const u_int uSH2, const u_int uSH3 DYNAMIC_LIGHT_PARAM IGNORE_NORMAL_PARAM );
	static void SetTexture( const int iTexID, const int iMMAG, const int iMMIN, const u_int uBfr );
	static void SetRenderState( const u_int uInputMaterialFlags );

	static Asura_PS2_Botanicals_Header s_xHeader;
	static const Asura_PS2_Botanicals_Type_Header** s_ppxTypeHeaders;
	static const Asura_PS2_Botanicals_Type_Info** s_ppxTypeInfos;
	static const Asura_PS2_Botanicals_Instance** s_ppxInstancePtrs;
	static struct Asura_PS2_Botanicals_Component_Data** s_ppxComponentDatas;
	static Asura_PS2_QW* s_pxDataPool;
    static Asura_RenderChainNode** s_pxTails;
	static Asura_PS2_Botanicals_Instance_Runtime_Data *s_pxInstanceRuntimeData;
	static u_short *s_pusComponentTriCounts;
};

#endif // #ifndef __ASURA_PS2_BOTANICALS_STORE_H__

#endif // #ifdef ASURA_USE_BOTANICALS