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

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

		Author:	Arnaud
		Date:	11/23/2004

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

#ifndef __PanePart__
#define __PanePart__

#if CP_PRAGMA_ONCE
#pragma once
#endif


#include "BasicMCFCOMImplementations.h"
#include "IEx3DEditorHostPart.h"
#include "MCPtr.h"
#include "MCSmartPtr.h"


class TModeler;


class TPanePart :	public TBasicPart, public IEx3DEditorHostPanePart
{
public:
	static const MCGUID sClassID;
	TPanePart();
	~TPanePart();
	
	// IMCUnknown
	MCErr				MCCOMAPI QueryInterface	( const MCIID& riid, void** ppvObj );
	uint32				MCCOMAPI AddRef			()										{return TBasicPart::AddRef();}
	STANDARD_RELEASE;

	
	// IMFExPart
	virtual void		MCCOMAPI SelfPrepareToDestroy	();
	virtual void		MCCOMAPI SelfDraw				(IMCGraphicContext* graphicContext, const TMCRect& inZone);
	TMFEventResult		MCCOMAPI SelfMouseDown			(const TMCPoint& inWhere, const TMCPlatformEvent& inEvent);


	//	IEx3DEditorHostPanePart
	virtual void		MCCOMAPI Set3DEditorHostPanePart		(I3DEditorHostPanePart* editorHostPanePart);
	virtual MCCOMErr	MCCOMAPI SelfRenderDraw					(TRenderable2DArray& renderables2D);
	virtual MCCOMErr	MCCOMAPI InvalidateRender				(boolean invalidate = true, boolean cameraChanged=false);
	virtual MCCOMErr	MCCOMAPI SelfRenderPickDraw				(I3DExPickRenderer* pickRenderer);
	virtual MCCOMErr	MCCOMAPI GetLocationOfSelectionInGlobal	(TVector3& outGlobalLocation)									{return MC_S_OK;}
	virtual boolean		MCCOMAPI GetHitLocationInGlobal			(const TMCPoint& inWindowPoint, TVector3& outGlobalLocation)	{return false;}
	virtual void		MCCOMAPI GetCurrentScene				(I3DShScene **scene, boolean createIfNone);
	virtual void		MCCOMAPI GetCameraToolsStatus			(TCameraToolsStatus& outStatus, boolean& outAllowSavePos);		
	virtual I3DEditorHostPanePart* MCCOMAPI  Get3DEditorHostPanePart()	const { return f3DEditorHostPanePart;}
	virtual	void		MCCOMAPI SelfActivatePane				()		{}
	virtual void		MCCOMAPI BeginAreaRender()   {}
	virtual void		MCCOMAPI EndAreaRender()     {}
	virtual void		MCCOMAPI CameraMoved()       {}
	

	void		SetModeler			(TModeler* inModeler);
	void		InternalSelfDraw	(IMCGraphicContext* graphicContext, TMCRect* inZone);

protected:
	boolean		IsPerspective		();
	void		CreateLightSource	();

protected:
	TMCPtr<I3DEditorHostPanePart>	f3DEditorHostPanePart;
	TMCPtr<TModeler>				fModeler;

	TMCCountedPtr<I3DShLightsource> fLightSource;
	TMCSmartPtr<TRenderableAndTfm>	fLightSourceRenderable;
};


#endif

