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

		I3dWireFrame.h

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

		I3DShWireFrame definition
		I3DExWireFrame definition

		Author:	Ray Dream
		Date:	3/2/98

		Revision History

		when		who			what & why
		==========	==========	======================================================
		10/22/99	Brice		Added ExcludeFromProjection (use it when the wireframe should not appears on workingbox planes).
		08/10/99	Arnaud		FacetMesh is now counted.
		5/5/99		Alec		Added SetSelectedState
		4/12/99		Joshua		WireFrame activation
		3/19/99		Joshua		Fixed wireframe projection pipeline
		1/6/99		Joshua		Added back hit test API
		11/24/98	Joshua		Removed I3DShWireFrameDraw
		11/18/98	Joshua		Initial KWAK wireframe support
		10/14/98	Alec		I3DExWireFrame now has all params visible

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

#ifndef __ISHWIREFRAME__
#define __ISHWIREFRAME__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "APITypes.h"
#include "MCCompObj.h"


#include "I3DShRenderable.h"
#include "MCPtrArray.h"
#include "MCColorRGB.h"
#include "I3DWireFrameSet.h"

struct FacetMesh;
struct I3DFacetCache;
struct I3DShTreeElement;
struct I3DShCamera;
struct I3DShConicalTransform;
struct I3DLineDrawer;
struct IMCGraphicContext;


//****** Globally Unique Ids *************************************************
MCDEFINE_GUID(IID_I3DShWireFrame, 0x5daccff0, 0x7edc, 0x11d0, 0xbf, 0x67, 0x0, 0xa0, 0xc9, 0xa, 0x7c, 0xb);
MCDEFINE_GUID(IID_I3DExWireFrame, 0x5daccff1, 0x7edc, 0x11d0, 0xbf, 0x67, 0x0, 0xa0, 0xc9, 0xa, 0x7c, 0xb);
//****************************************************************************

/// Deprecated, do NOT use
///
struct WFPoint
{
	int16		fType;	//EWFHandleType
	TVector3	fLoc;
	TVector3	fProjectedLoc;
	TVector3	fScreenLoc;
};

/// Deprecated, do NOT use
///
struct WFConnection
{
	int32 fFromPoint;
	int32 fToPoint;
};

/// Deprecated, do NOT use
///
struct WFData
{
	int16			fNumPoints;
	int16			fNumConnections;
	WFPoint*		fPoints;
	WFConnection*	fConnections;
};



/// \addtogroup ShellInterface
///
/// \{

/// \deprecated Note: this interface has been depreacted. 
/// DO NOT create new code with it, use I3DExWireFrameSet instead
/// and update the old code whenever you can
struct I3DShWireFrame: public IMCUnknown
{
	virtual MCCOMErr	MCCOMAPI AllocateFMesh		(int32 numFacets, int32 numVertices, int32 facetStreamSize) = 0;
	virtual MCCOMErr	MCCOMAPI GetFMesh			(FacetMesh** aMesh) = 0;
	virtual MCCOMErr	MCCOMAPI AllocateWireFrame	(int16 numPoints, int16 numConnections) = 0;
	virtual MCCOMErr	MCCOMAPI GetWireFrame		(WFData& aWireFrame) = 0;
	virtual MCCOMErr	MCCOMAPI Connect			(int16 point, int16 from, int16 to) = 0;
	virtual MCCOMErr	MCCOMAPI SetPoint			(int16 point, EWFHandleType type, const TVector3& loc) = 0;

	virtual void		MCCOMAPI Transform			(const TTreeProjectionTransform& trans) = 0;
	virtual short		MCCOMAPI TestHit			(const TVector2& point,boolean selectBehindCamera, real error) = 0;

	virtual void		MCCOMAPI AddRenderables		(TMCPtrArray<I3DShRenderable>& renderables) = 0;

	virtual TMCColorRGB	MCCOMAPI GetColor			() = 0;
	virtual void		MCCOMAPI SetColor			(const TMCColorRGB& color) = 0;

	virtual MCCOMErr	MCCOMAPI ExcludeFromZBuffer	(boolean excludeLines, boolean excludePoints)=0;
	virtual void		MCCOMAPI SetSelectedState	(const boolean selected) = 0;
	virtual MCCOMErr	MCCOMAPI ExcludeFromProjection	(boolean exclude) = 0;

	//returns true if lines AND points are excluded from the Z buffer
	virtual boolean		MCCOMAPI IsExcludedFromZBuffer	()=0;

};

/// \}


/// \addtogroup ExternalInterface
///
/// \{

/// \deprecated: This interface has been depreacted. 
/// <B>DO NOT</B> create new code with it, use I3DExWireFrameSet instead
/// and update the old code whenever you can
///
struct I3DExWireFrame: public IMCUnknown
{
	virtual MCCOMErr MCCOMAPI TrackWireFrame	(I3DShWireFrame* wireFrame, int16 proj, I3DShTreeElement* tree, 
												 int16 handle, const TRACKINFO&	startinfo, const TRACKINFO& previnfo, 
												 const TRACKINFO& nextinfo, I3DShCamera* camera) = 0;
	virtual MCCOMErr MCCOMAPI DataToWireFrame	(I3DShWireFrame* wireFrame, int16 proj, I3DShTreeElement* tree,
												 I3DShCamera* camera) = 0;
	virtual MCCOMErr MCCOMAPI WireFrameToData	(I3DShWireFrame* wireFrame, int16 proj, I3DShTreeElement* tree,
												 I3DShCamera* camera) = 0;
	virtual MCCOMErr MCCOMAPI GetWireFrameBBox	(TBBox3D* outBBox, int16	proj, I3DShTreeElement*	tree) = 0;
	
	virtual void	 MCCOMAPI ShowWFTools		(boolean show) = 0;
	virtual boolean	 MCCOMAPI HandlesTool		(int16 inTool) = 0;
	virtual boolean  MCCOMAPI IsViewDependent	() const = 0;

	virtual real32	 MCCOMAPI GetScalingFactor()	const = 0;
	virtual void	 MCCOMAPI SetScalingFactor(real32 inValue) = 0;
};

/// \}

#endif