/**
* Model Blur Effect
* @version: 03-04-2005
* @author Joseph 'Pcjoe' Florencio
*/

#ifndef MDLBLUR_H
#define MDLBLUR_H

#include "bonerec.h"

/*
* Model Blur
*/
class CModelBlur
{
public:
	// Constructors
	CModelBlur() { setIndex(0); setEmitRate(0); setStayTime(0);
					setFadeRate(0); setLastEmit(0); setBoneAccessor(NULL); }

	// Check
	bool Check( int idx );

	// Think (create blurs at emit rate)
	void Think( float flTime );

	// Create Blur
	void createBlur( void );

	/*
	* Accessors
	*/
	// Emit Rate
	void setEmitRate( float flEmit ) { m_flEmitRate = flEmit; }
	float getEmitRate( void ) { return m_flEmitRate; }

	// Stay Time ( time before entity starts fading )
	void setStayTime( float flTime ) { m_flStayTime = flTime; }
	float getStayTime( void ) { return m_flStayTime; }

	// Fade Rate ( how long entity will fade, dissapear, and be removed, after stay time )
	void setFadeRate( float flRate ) { m_flFadeRate = flRate; }
	float getFadeRate( void ) { return m_flFadeRate; }

	// Last Emit Time
	void setLastEmit( float flTime ) { m_flLastEmit = flTime; }
	float getLastEmit( void ) { return m_flLastEmit; }

	// Index
	void setIndex( int idx ) { m_iIndex = idx; }
	int getIndex( void ) { return m_iIndex; }

	// Bone Acessor
	void setBoneAccessor( CBoneAccessor *pAccessor ) { m_pBoneAccessor = pAccessor; }
	CBoneAccessor *getBoneAccessor( void ) { return m_pBoneAccessor; }
private:
	CBoneAccessor *m_pBoneAccessor;
	float	m_flEmitRate;
	float	m_flStayTime;
	float	m_flFadeRate;
	float	m_flLastEmit;
	int		m_iIndex;
};


/*
* Model Blur Manager
*/
class CModelBlurManager
{
public:
	CModelBlurManager() {}

	// Add Blur
	CModelBlur *addBlur( int idx, float flEmitRate, float flStayTime, float flFadeRate );

	// Remove Blur
	void removeBlur( int idx );

	// Check for idx, and if matching create blur
	void Think( int idx, float flTime );

	/*
	* Accessors
	*/
	// Model Blur list
	std::list<CModelBlur> *getModelBlurList() { return &m_ModelBlur; }
private:
	std::list<CModelBlur>	m_ModelBlur;
};
#endif