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

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

		Author:	pascalc
		Date:	12/6/2005

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

#ifndef __SpatialForce__
#define __SpatialForce__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "Basic3DCOMImplementations.h"
#include "BasicDataComponent.h"
#include "MCBasicTypes.h"

#include "BasicWireFrameSet.h"
#include "MCPtr.h"

extern const MCGUID CLSID_SpatialForce;

struct SpatialForcePMAP
{
	real32 fStrength;
	real32 fSoftness;
};

class SpatialForce : public TBasicWireframeSet, public TBasicForce, public TBasicDataComponent
{
public:
	SpatialForce();
	virtual ~SpatialForce() {}

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

	// IExDataExchanger functions
	void*		MCCOMAPI GetExtensionDataBuffer();
	int32		MCCOMAPI GetParamsBufferSize		() const	{ return sizeof(fData);}
	MCCOMErr	MCCOMAPI ExtensionDataChanged();

	// I3DExForce functions
	virtual MCCOMErr	MCCOMAPI GetForceAndTorque	(const TPhysicalState& inPhysicalState, TVector3& outForce, TVector3& outTorque);
	virtual boolean		MCCOMAPI WillApplyForce		() { return true; }
	virtual boolean		MCCOMAPI WillApplyTorque	() { return false; }

	// I3DExWireFrameSet functions
	virtual MCCOMErr MCCOMAPI TrackWireFrame (I3DShWireFrameSet* wireFrame,int16 proj,I3DShTreeElement* tree,const TWFHitInfo& handle,const TRACKINFO& startinfo,const TRACKINFO& previnfo,const TRACKINFO& nextinfo);
	virtual MCCOMErr MCCOMAPI DataToWireFrame	(I3DShWireFrameSet* wireFrame, int16 proj, I3DShTreeElement* tree);
	virtual MCCOMErr MCCOMAPI WireFrameToData	(I3DShWireFrameSet* wireFrame, int16 proj, I3DShTreeElement* tree);
	virtual MCCOMErr MCCOMAPI GetWireFrameBBox	(TBBox3D* outBBox, int16	proj, I3DShTreeElement*	tree);

protected:
	SpatialForcePMAP		 fData;
};

#endif
