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

		BasicEnvironment.h

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

		Author:	Ray Dream
		Date:	9/29/98

		Revision History

		when		who					what & why
		==========	=================	======================================================
		09/10/99	Guillaume			Changed parameters of SegmentFilter and DirectionFilter
											from pointers to references
		08/11/99	Guillaume&Christy	Added inheritance to all the Basic* classes
		07/06/99	Pierre-E			modification of the identifier in the methods SegmentFilter
										and DirectionFilter: filterOut --> inOutFilter
		06/29/99	cph					Added include for MCBasicDefines.h

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

#ifndef __BasicEnvironment__
#define __BasicEnvironment__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "BasicCOMImplementations.h"
#include "MCBasicTypes.h"
#include "MCBasicDefines.h"

#include "I3DExEnvironment.h"


/****************************************************************************\
*                                                                            *
*       TBasicAmbient                                                        *
*                                                                            *
\****************************************************************************/
/// \addtogroup BaseClass
/// \{

/// Basic Ambient light class.  Derive from this for a default implementation of an I3DExAmbientLight
/// \see I3DExAmbientLight
class TBasicAmbient : public I3DExAmbientLight, public TBasicDataExchanger 
{
	public:
		virtual MCCOMErr MCCOMAPI QueryInterface	(const MCIID& riid, void** ppvObj);
		virtual uint32 	 MCCOMAPI AddRef			()	{ return TBasicDataExchanger::AddRef(); }

		virtual MCCOMErr MCCOMAPI GetColor			(TMCColorRGB* resultColor);
};




/****************************************************************************\
*                                                                            *
*       TBasicAtmosphere                                                     *
*                                                                            *
\****************************************************************************/
/// Basic Atmosphere class.  Derive from this for a default implementation of I3DExAtmosphericShader
/// \see I3DExAtmosphericShader
class TBasicAtmosphere : public I3DExAtmosphericShader, public TBasicDataExchanger 
{
	public:
		virtual MCCOMErr MCCOMAPI QueryInterface		(const MCIID& riid, void** ppvObj);
		virtual uint32 	 MCCOMAPI AddRef				() { return TBasicDataExchanger::AddRef(); }

		// I3DExAtmosphericShader
		virtual MCCOMErr MCCOMAPI SegmentTraceRay		(const Ray3D&		ray,
														 real64				tmin,
														 real64				tmax,
														 TMCColorRGBA&		inOutFilter,
														 I3DExRaytracer*	raytracer,
														 boolean			isShadowRay,
														 boolean			indirectLight,
														 boolean			isSunLightShadowCasting);

		virtual MCCOMErr MCCOMAPI DirectionTraceRay		(const Ray3D&		ray,
														 TMCColorRGBA&		inOutFilter,
														 I3DExRaytracer*	raytracer,
														 boolean			indirectLight);
		virtual MCCOMErr MCCOMAPI PrepareRender			() { return MC_S_OK; };
		virtual MCCOMErr MCCOMAPI EndRender				() { return MC_S_OK; };

		// Old I3DExAtmosphericShader, just to keep compatibility
		virtual MCCOMErr MCCOMAPI SegmentFilter			(TVector3& beg, TVector3& end, TMCColorRGB& inOutFilter, boolean indirectLight, boolean isShadowCasting, boolean isSunLightShadowCasting);
		virtual MCCOMErr MCCOMAPI DirectionFilter		(TVector3& origin,TVector3& direction, TMCColorRGB& inOutFilter, boolean indirectLight);

		virtual void	MCCOMAPI GetLightInfo(TAtmosphericLightInfo& info,EAtmosphericLightType lightType);
		virtual void	MCCOMAPI SetLightInfo(TAtmosphericLightInfo& info,EAtmosphericLightType lightType);

};



/****************************************************************************\
*                                                                            *
*       TBasicBackdrop                                                       *
*                                                                            *
\****************************************************************************/
/// Basic Backdrop class.  Derive from this for a default implementation of I3DExBackdrop
/// \see I3DExBackdrop
class TBasicBackdrop :  public I3DExBackdrop, public TBasicDataExchanger 
{
	public:
		virtual MCCOMErr MCCOMAPI QueryInterface	(const MCIID& riid, void** ppvObj);
		virtual uint32 	 MCCOMAPI AddRef			() { return TBasicDataExchanger::AddRef(); }
		
		virtual MCCOMErr MCCOMAPI GetBackdropColor	(TMCColorRGB& color,boolean& fullAreaDone,const TBBox2D& screenMinMax,const TVector2& uv)=0;
};



/****************************************************************************\
*                                                                            *
*       TBasicBackground                                                     *
*                                                                            *
\****************************************************************************/
/// Basic Background class.  Derive from this for a default implementation of I3DExBackground.
/// \see I3DExBackground
class TBasicBackground : public I3DExBackground, public TBasicDataExchanger
{
	public:
		virtual MCCOMErr MCCOMAPI QueryInterface		(const MCIID& riid, void** ppvObj);
		virtual uint32 	 MCCOMAPI AddRef				() { return TBasicDataExchanger::AddRef(); }

		virtual MCCOMErr MCCOMAPI GetBackgroundColor	(TMCColorRGB& resultColor,boolean& fullAreaDone,const TVector3& direction);
};

/// \}

#endif