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

		Flat.h

		Copyright (c)1990 - 1999 MetaCreations. All rights reserved.


		Author:	Jerome Bignon

		Date:	05/05/99

		Revision History

		when		who			what & why
		==========	==========	======================================================
		05/07/99	Jerome		Solved problem with getUVSpaceRDS5
		05/05/99	Jerome		Creation

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

#ifndef __Flat__
#define __Flat__  

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "FlatDef.h"
#include "BasicPrimitive.h"

// Define the Flat CLSID ( see the FlatDef.h file to get R_CLSID_Flat value )

extern const MCGUID CLSID_Flat;


// Flat Object definition : 
// Flat Object :

class Flat : public TBasicPrimitive
{
	struct TPMap
	{
		TPMap() : fScalingFactor(1) {}

		real32		fScalingFactor;
	};

	public :  
		Flat();
		
		STANDARD_RELEASE;

		virtual void*	 MCCOMAPI GetExtensionDataBuffer	() { return &fPMap; }
		virtual int32	 MCCOMAPI GetParamsBufferSize		() const	{ return sizeof(fPMap); }

		// Geometric Calls
		virtual void	 MCCOMAPI GetBoundingBox	(TBBox3D& bbox);
		virtual MCCOMErr MCCOMAPI GetNbrLOD			(int16& nbrLod);
		virtual MCCOMErr MCCOMAPI GetFacetMesh		(uint32 lodIndex, FacetMesh** outMesh);	// lod = level of detail. See theory text in .cpp


		// Shading Calls
		virtual uint32	 MCCOMAPI GetUVSpaceCount	();
		virtual MCCOMErr MCCOMAPI GetUVSpace		(uint32 uvSpaceID, UVSpaceInfo* uvSpaceInfo);
		virtual MCCOMErr MCCOMAPI GetUVSpaceRDS5	(uint32 uvSpaceID, UVSpaceInfoRDS5* uvSpaceInfo); // To be implemented only if your primitive existed in RDS 5 or earlier, so that UV spaces can be mapped properly to the new 0..1 boundaries

		// Handle scene magnitude
		virtual boolean		MCCOMAPI IsScalable() const			{ return true; }
		virtual real32		MCCOMAPI GetScalingFactor()	const	{ return fPMap.fScalingFactor; }
		virtual void		MCCOMAPI SetScalingFactor(real32 inValue) { fPMap.fScalingFactor = inValue; }

	protected:
		TPMap		fPMap;		
};

#endif // __Flat__