/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///																																  ///
///		FICHIER :	ZooBone.h 																									  ///
///																																  ///
///		NATURE	:	Definition of the class to manage the bones object           												  ///
///																																  ///
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __ZOOBone_H__
#define __ZOOBone_H__



#include	"..\Basic\ZooStd.h"
#include	"..\Scene Graph\ZooNodeGraph.h"
#include	"..\Basic\ZooNode.h"
#include	"..\Datas\ZooMesh.h"
#include	"..\Scene Graph\ZooCamera.h"
#include	"..\Scene Graph\ZooAnim.h"


class ZBone : public ZNodeGraph
{
protected:


public:

	// Vertex associé au bones
	ZVert boneVert1 ;
	ZVert boneVert2 ;
	ZVert boneVert3 ;

	// Informations concernant les coordonnées du bones dans le repère global

	float globalPosX,globalPosY,globalPosZ,globalRotX,globalRotY,globalRotZ ;

	// Noeud associé au bone
	ZNode	*boneNode ;

	// Objet associé au bones
	ZObject *BoneObject ;

	// Mesh associé au bones
	ZMesh		*topoBone ;

	ZMatrix		iniMat ;

	// Material

	ZMaterial *BoneMaterial ;
	// Flags
	bool		visible;									// flag de visibilite pour le test de culling avec le view frustrum

	bool		clickable;

	bool	    isAnimed ;
		bool isAnimated ;

	//	Information du père

	string		parentName;
	int			parentID ;

	// Valeur propre au bones

	int			ID ;

	// Nombre d'enfants

	int			numberOfChild ;

	ZArray<ZBone*> bones ;
	ZArray<ZBone*> initBones ;
	ZArray<ZAnim*> animBones ;

	/// Constructor	1				 					
	ZBone(int s3d);

	// Animation associé au bone courant

	/// Constructeur2
	ZBone(int s3d,ZMesh *_mesh);
	// Destructeur
	~ZBone();

////////////////////////////////////////////////////////////////////////////////
////////////////////  Set Mesh  ////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
inline void ZBone::SetMesh(ZMesh *newMesh)
{
	if(newMesh!=topoBone)
	{
		if(topoBone!=NULL)			topoBone->DecRef();

		topoBone = newMesh;
		if(topoBone!=NULL)			topoBone->IncRef();
	}
}
///////////////////////////////////////////////////////////////////////////
/// Get the mesh														///
///////////////////////////////////////////////////////////////////////////
inline ZMesh* ZBone::GetMesh()
{
	return topoBone;
}

};


#endif