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

		IEx3DEditorPart.h

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

		Author:	Joshua
		Date:	8/24/98
		

		Revision History

		when		who			what & why
		==========	==========	======================================================
		11/18/98	Alec		updated DrawInstances call to use TRenderableAndTfmArray
		
*****************************************************************************************/

#ifndef __IEX3DEDITORHOSTPART__
#define __IEX3DEDITORHOSTPART__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCCompObj.h"
#include "I3DShRenderable.h"
#include "I3DExInteractiveRenderer.h"

struct I3DShCamera;
//struct I3DExInteractiveRenderer;
struct I3DEditorHostPanePart;

//****** Globally Unique Ids *************************************************

MCDEFINE_GUID(IID_IEx3DEditorHostPanePart, 0x8e168022, 0x1837, 0x11d2, 0xa0, 0xe0, 0x0, 0xaa, 0x0, 0xd3, 0x7, 0xeb);

enum TCameraToolsStatus
{
	kAllDisabled	= 0,
	kAllEnabled		= 1,
	k3DToolsEnabled	= 2,	//rotate/track
	k2DToolsEnabled	= 3,	//zoom, pan
	kInvalidStatus= 0xFFFFFFFF
};


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

/// \addtogroup ExternalInterface
/// \{

/// Derive your own part from this class to implement your own 3D Editor host panes.
///
struct IEx3DEditorHostPanePart : public IMCUnknown
{
	// ****************************************************************************
	//								Set3DEditorHostPanePart
	// 
	/// This function is called when the 3DEditorHostPanePart extension is attached
	/// 
	/// \param editorHostPanePart  
	/// 
	virtual void		MCCOMAPI Set3DEditorHostPanePart (I3DEditorHostPanePart* editorHostPanePart)=0;


	// ****************************************************************************
	//								InvalidateRender
	// 
	/// Called by 3DEditorHostPart when something like a camera change
	/// causes need for a re-render.  If you are using 3DEditorHostPanePart::RenderDraw
	/// just call 3DEditorHostPanePart::InvalidateRender
	/// 
	/// \param invalidate     
	/// \param cameraChanged  
	/// 
	virtual MCCOMErr	MCCOMAPI InvalidateRender (boolean invalidate, boolean cameraChanged)=0;
		
	// ****************************************************************************
	//								SelfRenderDraw
	// 
	/// This function is called by 3DEditorHostPanePart::RenderDraw to
	///  allow the extension to create a renderable array and call DrawInstances
	///  on the interactive renderer
	/// 
	virtual MCCOMErr	MCCOMAPI SelfRenderDraw	(TRenderable2DArray& renderables2D)=0;
	
	// ****************************************************************************
	//								SelfRenderPickDraw
	// 
	/// This function is called by 3DEditorHostPanePart::Pick to allow the extension
	/// to create a renderable array for picking and call PickInstances on the
	/// pickRenderer
	/// 
	/// \param pickRenderer  
	/// 
	virtual MCCOMErr	MCCOMAPI SelfRenderPickDraw	(I3DExPickRenderer* pickRenderer)=0;
		
	// ****************************************************************************
	//								GetLocationOfSelectionInGlobal
	// 
	///
	virtual MCCOMErr	MCCOMAPI GetLocationOfSelectionInGlobal (TVector3& outGlobalLocation)=0;
	
	// ****************************************************************************
	//								GetHitLocationInGlobal
	// 
	/// Return the location of the hit in global coordinates.
	/// 
	/// \param inWindowPoint      The position in window coordinates
	/// \param outGlobalLocation  The position in global coordinates
	/// 
	virtual boolean		MCCOMAPI GetHitLocationInGlobal (const TMCPoint& inWindowPoint, TVector3& outGlobalLocation)=0;

	// ****************************************************************************
	//								GetCurrentScene
	// 
	/// Return the scene that should be renderered in this view ( in case of a modeler, 
	//	it is a scene containing the object)
	/// 
	/// \param scene          The scene that is returned.
	/// \param createIfNone   Set this to true to ask a modeler to create its scene ( otherwise 
	///						  the scene returned by a modeler is NULL )
	/// 
	virtual void	    MCCOMAPI GetCurrentScene(I3DShScene** scene, boolean createIfNone )=0;
		
	// ****************************************************************************
	//								GetCameraToolsStatus
	// 
	/// Returns the enable status that the 3deditor host should give to the camera tools
	/// 
	/// \param outStatus        Status to give to the camera tools
	/// \param outAllowSavePos  True if camera's position should be saved (false for canonical views)
	/// 
	virtual void		MCCOMAPI GetCameraToolsStatus(TCameraToolsStatus& outStatus, boolean& outAllowSavePos)= 0;

	// ****************************************************************************
	//								Get3DEditorHostPanePart
	// 
	/// Returns a pointer to the associated pane part.
	/// 
	virtual I3DEditorHostPanePart* MCCOMAPI  Get3DEditorHostPanePart() const = 0;

	// ****************************************************************************
	//								BeginAreaRender
	// 
	/// Called before starting an area render.
	/// 
	/// 
	virtual void		MCCOMAPI BeginAreaRender() = 0;

	// ****************************************************************************
	//								EndAreaRender
	// 
	/// Called at the end of an area render.
	/// 
	/// 
	virtual void		MCCOMAPI EndAreaRender() = 0;

	// ****************************************************************************
	//								CameraMoved
	//
	/// Alerts the pane part that the camera has moved
	///
	virtual void			MCCOMAPI	CameraMoved() = 0;
};

/// \}

#endif