/****************************************************************************************************

		I3DShJoint.h
		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Arnaud
		Date:	10/11/2001

****************************************************************************************************/

#ifndef __I3DShJoint__
#define __I3DShJoint__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCCompObj.h"
#include "TransformsFwd.h"
#include "I3DShGlobalDeformerHelper.h"


struct I3DShTreeElement;
struct I3DShPrimitive;
class  TBBox3D;

MCDEFINE_GUID_SAFELIB(IID_I3DShJoint, 0xdd444577, 0x4905, 0x456d, 0x83, 0x95, 0xa4, 0x5, 0xfd, 0x2b, 0x9e, 0xab);

struct I3DShJoint;
template<class T> class TMCPtrArray;


/// \addtogroup ShellInterface
/// \{

// ****************************************************************************
//								I3DShJoint
// 
/// <P>The interface for the joint object that is used to build skeletons for
/// character animation.</P>
///
/// <P>A joint is basically a tree element (with a transform) with an extra datacomponent that
/// store informations relative to the skinning.</P>
///
/// <P>Look at the file BonesUtilities.h for usefull tools related to I3DShJoint.</P>
/// <P>Note: the attach methods only have an effect on this single joint/</P>
///
/// <P>Joints always implement I3DShTreeElement and I3DShGlobalDeformerHelper</P>
///
struct I3DShJoint: public IMCUnknown
{
	// ****************************************************************************
	//								GetTreeElement
	// 
	/// Returns a pointer to the I3DShTreeElement interface. This is equivalent to
	/// call QueryInterface with IID_I3DShTreeElement.
	/// 
	virtual	I3DShTreeElement*	MCCOMAPI GetTreeElement() = 0;

	// ****************************************************************************
	//								GetGlobalDeformerHelper
	// 
	/// Returns a pointer to the I3DExGlobalDeformerHelper interface. This is equivalent to
	/// call QueryInterface with IID_I3DExGlobalDeformerHelper.
	/// 
	virtual	I3DShGlobalDeformerHelper*	MCCOMAPI GetGlobalDeformerHelper() = 0;

	// ****************************************************************************
	//								IsSkeletonRoot
	// 
	/// Return true if the father of the joint is not a joint
	/// 
	/// 
	virtual	boolean				MCCOMAPI IsSkeletonRoot() = 0;

	// ****************************************************************************
	//								GetSkeletonRoot
	// 
	/// Returns: the topmost joint parent of this one
	/// 
	virtual	I3DShJoint*			MCCOMAPI GetSkeletonRoot() = 0;

	// ****************************************************************************
	//								GetFather
	// 
	/// Returns the father ot this joint (null if it is the root of the skeleton)
	/// 
	virtual	I3DShJoint*			MCCOMAPI GetFather() = 0;
	
	// ****************************************************************************
	//								GetSonJoints
	// 
	/// Returns the list of the (direct) sons of this joint
	/// 
	/// \param outSons  An array to store the list of the sons of this joint.
	/// 
	virtual void				MCCOMAPI GetSonJoints(TMCPtrArray<I3DShJoint>& outSons) = 0;

	// ****************************************************************************
	//								IsOneJointSelected
	// 
	/// Returns true if one joint of the skeleton this joint belongs to is selected
	/// 
	virtual boolean				MCCOMAPI IsOneJointSelected() = 0;

	// ****************************************************************************
	//								SetPrimitiveBoundingBox
	// 
	/// Set the bounding box of the given primitive for the joint. The primitive must
	/// be attached to this joint.
	///
	/// \param primitive	The calling primitive.
	/// \param bbox			The bounding box in joint local coordinates.
	/// 
	virtual void				MCCOMAPI SetPrimitiveBoundingBox(I3DShPrimitive* primitive, const TBBox3D& bbox) = 0;

	// ****************************************************************************
	//								GetJointBoundingBox
	// 
	/// Set the bounding box of the joint taking into account the geometry of the
	/// primitives attached to it.
	/// 
	virtual const TBBox3D&		MCCOMAPI GetJointBoundingBox() = 0;

	// ****************************************************************************
	//								InvalidatePrimitiveBoundingBox
	// 
	/// Invalidates the bounding box of the given primitive for the joint.
	///
	/// \param primitive	The calling primitive.
	/// 
	virtual void				MCCOMAPI InvalidatePrimitiveBoundingBox(I3DShPrimitive* primitive) = 0;
};

/// \}


#endif
