
///////////////////////////////////////////////////////////////////////////////
//
// File   : Asura_FacialAnimation_MuscleGroup.h
// Author : Andy Tate
// Date   : 8-May-2008
//
// Copyright (C) 2008 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif   // ifdef ASURA_USE_PRAGMA_ONCE

#ifndef __ASURA_FACIALANIMATION_MUSCLEGROUP_H__
#define __ASURA_FACIALANIMATION_MUSCLEGROUP_H__

#if defined(ASURA_USE_FACIAL_ANIMATION_SYSTEM)

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////////
// Forward class declarations...
////////////////////////////////////////////////////////////////////////////////

class Asura_Animation;
class Asura_AnimationController_Group;
class Asura_Chunk_Stream;


////////////////////////////////////////////////////////////////////////////////
// Class declaration...
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Class        : Asura_FacialAnimation_MuscleGroup
// Author       : Andy Tate
// Date         : 8-May-2008
//
// Description  : Class used to store the data for a particular muscle-group
//				  for a specific face in the facial-animation system.
////////////////////////////////////////////////////////////////////////////////

class Asura_FacialAnimation_MuscleGroup
{
public:
	// Public enumerated types...
	enum ControlType
	{
		CT_SINGLE,
		CT_SINGLE_PAIR,
		CT_BALANCE,
		CT_BALANCE_PAIR,

		MAX_CONTROL_TYPES
	};

	enum
	{
		MAX_ANIMATIONS	= 2,
	};

	// Public functions...
	Asura_FacialAnimation_MuscleGroup(void);
	Asura_FacialAnimation_MuscleGroup(Asura_Chunk_Stream& xStream);
	Asura_FacialAnimation_MuscleGroup(const Asura_Hash_ID uHash, Asura_Chunk_Stream& xStream);
//	~Asura_FacialAnimation_MuscleGroup();

	// Animation functions...
	u_int	UpdateAnimation(const float fWeight, const float fBalance, Asura_Animation& xAnimation, Asura_AnimationController_Group& xGroup) const;

	// Chunk-stream functions...
	void	ReadFromChunkStream(Asura_Chunk_Stream& xStream);
	void	WriteToChunkStream(Asura_Chunk_Stream& xStream) const;

	// Accessor functions...
	void	SetNumAnimations(const u_int uNumAnimations)	{ m_uNumAnimations = uNumAnimations; }
	u_int	GetNumAnimations(void) const					{ return(m_uNumAnimations); }

	void			SetAnimationHash(const u_int uIndex, const Asura_Hash_ID uHash)	{ m_auAnimationHashes[uIndex] = uHash; }
	Asura_Hash_ID	GetAnimationHash(const u_int uIndex) const						{ return(m_auAnimationHashes[uIndex]); }

	void			SetControlType(const ControlType eType)	{ m_eControlType = eType; }
	ControlType		GetControlType(void) const				{ return(m_eControlType); }

#if defined(ASURA_TOOLS)
	static const char**	Tools_GetControlTypeNames(void)						{ return(s_aszControlTypeNames); }
	static const char*	Tools_GetControlTypeName(const ControlType eType)	{ return(s_aszControlTypeNames[eType]); }
#endif	//defined(ASURA_TOOLS)


protected:
	// Protected variables...

	// Protected functions...


private:
	// Private variables...
	ControlType			m_eControlType;							// The type of control required over this animation.
	u_int				m_uNumAnimations;						// The number of animations this muscle-group actually uses.
	Asura_Hash_ID		m_auAnimationHashes[MAX_ANIMATIONS];	// Each muscle-group has a (potential) pair of  associated "Asura_Hierarchy_Anim"s.

#if defined(ASURA_TOOLS)
	static const char*	s_aszControlTypeNames[MAX_CONTROL_TYPES];
#endif	//defined(ASURA_TOOLS)

	static const u_int	s_uChunkVersion;						// The version used when reading/writing.

	// Private functions...
	Asura_FacialAnimation_MuscleGroup(const Asura_FacialAnimation_MuscleGroup& xOther);

	Asura_FacialAnimation_MuscleGroup&	operator=(const Asura_FacialAnimation_MuscleGroup& xOther);

};   // End of class 'Asura_FacialAnimation_MuscleGroup'.

#endif	//defined(ASURA_USE_FACIAL_ANIMATION_SYSTEM)

#endif   // ifndef __ASURA_FACIALANIMATION_MUSCLEGROUP_H__


/// End of file. ///
