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

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

		Author:	Lionel
		Date:	10/5/2004

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

#ifndef __SimpleLightingModel__
#define __SimpleLightingModel__


#include "SimpleLightingModelDef.h"

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

#include "COMUtilities.h"
#include "BasicShader.h"
#include "I3DShShader.h"
#include "MCColorRGBA.h"

#include "ShaderTypes.h"
#include "I3DShShader.h"
#include "I3DExRenderFeature.h"

#include "MCPtrArray.h"
#include "IShComponent.h"

#include "RenderTypes.h"

//----------------------
// TSimpleLightingModel
//----------------------

class TSimpleLightingModel : public TBasicShader
{
public:
	TSimpleLightingModel();
	~TSimpleLightingModel();
	STANDARD_RELEASE;

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

			I3DShShader*			 GetIndShader			(int32 index)	{ return (I3DShShader*)(*fShaderList)[index];}
	virtual void					 SetIndShader			(uint32 index,I3DShShader*& theShader,boolean withAnim);

	virtual boolean			MCCOMAPI HasExplicitLightingModel(const LightingContext& lightingContext) { return true; }
	virtual boolean			MCCOMAPI WantsTransform			() { return false; };
	virtual EShaderOutput	MCCOMAPI GetImplementedOutput				(); 
	virtual MCCOMErr		MCCOMAPI GetShadingFlags		(ShadingFlags& theFlags);
	virtual MCCOMErr 		MCCOMAPI DoShade				(ShadingOut &result, ShadingIn& theShadingIn);

	// ****************************************************************************
	//								CalculateDirectLighting
	// 
	// -Description:
	//
	//		Should calculate the direct lighting and fill result.fAmbientLight, result.fDiffuseLight
	//		and result.fSpecularLight.
	//
	// -Parameters:
	//
	//		lightingContext: gives information about the lighting settings that have been chosen
	//
	virtual void MCCOMAPI CalculateDirectLighting(LightingDetail& result,const LightingContext&	lightingContext);

	static	const MCGUID	sClassId;

	struct PMap
	{
		TMCCountedPtr<IShParameterComponent>	fShader;		// pointer to the sublevel shader
		int32									fClusterValue;	// ID of the lines configuration
		real32									fUVAngle;		// customizable orientation of the lines
	};

protected:
	PMap						fPMap;
	TMCPtrArray<I3DShShader>*	fShaderList;

};



#endif


