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

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

		Author:	Arnaud
		Date:	12/2/2004

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

#ifndef __Renderable__
#define __Renderable__

#if CP_PRAGMA_ONCE
#pragma once
#endif


#include "CountedRenderable.h"
#include "I3DShFacetMesh.h"
#include "MCPtr.h"


class TModeler;


// Common class for the various meshes (facet/segments/points) used by the modeler
// (each renderable is only allowed one kind of data)
// Delegates calls to the modeler

class TRenderable : public TCountedRenderable
{
public:
	static void Create(	TRenderable**			renderable, 
						TModeler*				modeler,
						I3DShRenderable::EType	geomType);

protected:
	TRenderable(TModeler* modeler, I3DShRenderable::EType geomType);
	virtual ~TRenderable();

public:	
	void SetGeometryType			(I3DShRenderable::EType geomType)			{ fGeometryType	= geomType; }
	
	I3DShRenderable::EType	MCCOMAPI GetGeometryType			() const						{ return fGeometryType; }		
	TRenderableFlags		MCCOMAPI GetRenderableFlags			( void ) const					{ return fRenderFlags; }
	MCCOMErr				MCCOMAPI GetFMesh					(real lod, FacetMesh** outMesh);
	const TSegmentMesh*		MCCOMAPI GetSegmentMesh				() const;	
	const TPointMesh*		MCCOMAPI GetPointMesh				()	const;
	void					MCCOMAPI GetBoundingBox				(TBBox3D& bb);
	MCCOMErr				MCCOMAPI SetRenderableFlags			(const TRenderableFlags renderFlags)	{ fRenderFlags	= renderFlags; return MC_S_OK; }
	uint32					MCCOMAPI GetUVSpaceCount();

protected:
	I3DShRenderable::EType		fGeometryType;
	TRenderableFlags			fRenderFlags;
	TMCPtr<TModeler>			fModeler;
};



#endif