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

		BasicModifiers.h

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

		Author:	Ray Dream
		Date:	9/29/98

		Revision History

		when		who			what & why
		==========	==========	======================================================
		09/28/99	Mathieu		GetMaxTimeWithoutComputation()
		08/10/99	Arnaud		FacetMesh is now counted.

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

#ifndef __BasicModifiers__
#define __BasicModifiers__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "BasicCOMImplementations.h"
#include "MCBasicTypes.h"

#include "I3DShFacetMesh.h"
#include "I3DExModifier.h"



/// \addtogroup BaseClass
/// \{
/***************************************************************************\
*                                                                           *
*     TBasicModifier                                                        *
*                                                                           *
\***************************************************************************/
/// Basic Modifier class.  Derive from this for a default implementation of an I3DExModifier.
/// \see I3DExModifier
class TBasicModifier : public I3DExModifier, public TBasicDataExchanger
{
	public:
		
		TBasicModifier  ();
		~TBasicModifier	();


	
		virtual MCCOMErr 		MCCOMAPI QueryInterface					(const MCIID& riid, void** ppvObj);
		virtual uint32 			MCCOMAPI AddRef							() { return TBasicDataExchanger::AddRef(); }

		virtual void*			MCCOMAPI GetExtensionDataBuffer			();

		virtual TModifierFlags	MCCOMAPI GetModifierFlags				()	{ return fFlags; }

		//Tree Modifiers
		virtual MCCOMErr		MCCOMAPI Apply							(I3DShTreeElement* tree);
		virtual MicroTick		MCCOMAPI GetMaxTimeWithoutComputation	(I3DShTreeElement* tree) ;
		virtual boolean			MCCOMAPI IsIKTerminator					(boolean& outExcludeFromChain)	const { return false; }

		//Deform Modifiers		
		virtual MCCOMErr		MCCOMAPI DeformPoint					(const TVector3 & point,  TVector3 & result);
		virtual MCCOMErr		MCCOMAPI DeformVertex3D					(const TVertex3D& vertex, TVertex3D& result);
		virtual MCCOMErr		MCCOMAPI DeformFacetMesh				(real lod,FacetMesh* in, FacetMesh** outMesh);
		virtual MCCOMErr		MCCOMAPI DeformBBox						(const TBBox3D& in,TBBox3D& out);
		virtual MCCOMErr		MCCOMAPI GetNeededLOD					(const real outputLOD, real& neededLod);
		virtual MCCOMErr		MCCOMAPI GetDeformerInfo				(real lod, TDeformInfo& deformInfo);

		virtual boolean			MCCOMAPI ModifierChanged				() { return false; }

	protected:

		TModifierFlags	fFlags;
};



/***************************************************************************\
*                                                                           *
*     TBasicDeformModifier                                                  *
*                                                                           *
\***************************************************************************/
/// Basic Deform Modifier class.  Derive from this for a default implementation of I3DExModifier for deformations.
/// \see I3DExModifier
class TBasicDeformModifier : public TBasicModifier
{
	public:

	  TBasicDeformModifier()	{ fFlags.SetMasked(TModifierFlags::kDeformModifier); }
};




/***************************************************************************\
*                                                                           *
*     TBasicTreeModifier                                                    *
*                                                                           *
\***************************************************************************/
/// Basic Tree Modifier class.  Derive from this for a default implementation of I3DExModifier for trees.
/// \see I3DExModifier
class TBasicTreeModifier : public TBasicModifier
{
	public:
		TBasicTreeModifier	()	{ fFlags.SetMasked(TModifierFlags::kTreeModifier); }


		virtual void MCCOMAPI SetBoundingBox (const TBBox3D& bbox) {}
};

/// \}

#endif