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

	COMChecker.h

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

	Author: Jerome Bignon

	Date: 04/29/99

	Revision history

	when		who			what & why
	=========== =========== =====================================================================
	04/29/99	Jerome		Finishing and comment
	04/28/99	Jerome		Creation

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

#ifndef __CHECKER__
#define __CHECKER__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "CheckerDef.h"
#include "BasicShader.h"
#include "I3DShShader.h"
#include "MCPtrArray.h"
#include "IShComponent.h"

// Define the Checker CLSID ( see the CheckerDef.h file to get R_CLSID_Checker value )

extern const MCGUID CLSID_Checker;

class Checker : public TBasicShader
{
public :

	Checker();

	STANDARD_RELEASE;
  
// We don't have to take care of the none implemented methods because the TBasicShader
// does this for us

	virtual void*			MCCOMAPI    GetExtensionDataBuffer	()			{ return &fPMap; }
	virtual int32			MCCOMAPI	GetParamsBufferSize		() const	{ return sizeof(fPMap);}
	virtual MCCOMErr		MCCOMAPI	ExtensionDataChanged	();
	virtual boolean			MCCOMAPI    IsEqualTo				(I3DExShader* aShader);  
	virtual MCCOMErr		MCCOMAPI	GetShadingFlags			(ShadingFlags& theFlags);
	virtual EShaderOutput	MCCOMAPI	GetImplementedOutput	();
	
	virtual real			MCCOMAPI	GetValue				(real& result,boolean& fullArea,ShadingIn& shadingIn);

protected:
	struct TPMap
	{	
		TPMap();
		int32		fNb[2];		// Contains the Horizontal (fNb[0]) and Vertical (fNb[1]) values
		TMCCountedPtr<IShParameterComponent> fShader[2];
	};

	TPMap						fPMap;

	TMCCountedPtr<I3DShShader> fShaders[2];
	TVector2    fMul;		// Preprocessing factor 
							// to convert UV Coordinate to "Checker" Coordinate
};
                           
#endif // __CHECKER__

