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

		ShadowUtils.h

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

		Author:	Ray Dream (MTIMEB.H)
		Date:	3/2/98

		Revision History

		when		who			what & why
		==========	==========	======================================================
		09/13/99	Charles		Created
		
*****************************************************************************************/

#ifndef __ShadowUtils__
#define __ShadowUtils__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCBasicTypes.h"
#include "TransformsFwd.h"

struct IShChannel;
struct I3DShScene;
struct I3DShCamera;
struct I3DShLightsource;

class TBBox2D;

// *******************************************************************************
//						ComputeShadowBuffer
//
// desc : instantiante a zBuffer renderer and computes the shadowBuffer
//
// zBuffer			result zBuffer pointer
// globalToCamera   is the transform from Global coordinates to Camera coordinates
// camera			is the camera corresponding to the light
// light            is the light to compute inclusion/exclusion (null if no exclusion)
// uvBox			is the screen uvBox
// scene			is the current scene
// resolution		is the resolution of the buffer
// blur				is the blur radius ( the buffer size is (resolution+2*blur)^2
// useAverageZ		is true if we want to use average z buffer ( average of first two z values)
// *******************************************************************************

void CreateShadowBuffer( IShChannel **	zBuffer,
						 TTransform3D	globalToCamera,
						 I3DShCamera*	camera,
						 const I3DShLightsource*	light,
						 TBBox2D&		uvBox,
						 I3DShScene*	scene,
						 uint32			resolution,
						 uint32			blur=0,
						 boolean		useAverageZ=false);


// **********************************************************************************
//					CreateCameraFromLight
//
// return a camera and uvbox that correspond the light with a given transform and
// halfangle
// **********************************************************************************

void CreateCameraFromLight(I3DShCamera **camera,
						   TBBox2D &uvBox,
						   TTransform3D &transform,
						   real halfAngle);

#endif