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

		Sphere.h

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

		Definitions shared by the C++ files and the resource definition files (.r)


		Author:	Jerome Bignon

		Date:	04/30/99

		Revision History

		when		who			what & why
		==========	==========	======================================================
		05/07/99	Jerome		Added a getUVSpaceRDS5 method
		04/30/99	Jerome		Creation

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

#ifndef __Sphere__
#define __Sphere__  

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "SphereDef.h"
#include "BasicPrimitive.h"

// Define the Sphere CLSID ( see the SphereDef.h file to get R_CLSID_Sphere value )

extern const MCGUID CLSID_Sphere;

// Sphere Object definition : 
// Sphere Object :

class Sphere : public TBasicPrimitive, public IRaytracablePrimitive
{
	public :  
		Sphere();
		
		virtual MCCOMErr 	MCCOMAPI QueryInterface			(const MCIID &riid, void** ppvObj);
 		virtual uint32 		MCCOMAPI AddRef 				();
		STANDARD_RELEASE;

		virtual int32		MCCOMAPI GetParamsBufferSize	() const	{ return 0;}

		// Geometric Calls
		virtual void	 MCCOMAPI GetBoundingBox			(TBBox3D& bbox);
		virtual MCCOMErr MCCOMAPI EnumPatches				(EnumPatchesCallback callback, void* privData, boolean& closed);

		// Add a button in the modeling room
		virtual boolean	 MCCOMAPI CanConvertToOtherModeler() { return true; }

		// 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
		virtual MCCOMErr MCCOMAPI UV2XYZ					(TVector2* uv,uint32 uvSpaceID, TVector3* resultPosition, boolean* inUVSpace);

		// Raytracing calls
		virtual boolean  MCCOMAPI RayHit					(RayHitParameters& params);
		virtual MCCOMErr MCCOMAPI GetRayHitDetails			(RayHit3D* hit); 		
		virtual MCCOMErr MCCOMAPI IsInfiniteBB				(boolean& isInfinite);
		
	private :
		static void GetDetails(RayHit3D& hit);
};

#endif // __SPHERE__