#ifndef _RUSHADER_D3D_STANDARD_H_
#define _RUSHADER_D3D_STANDARD_H_

// Rune system core
#include "../../Direct3D/Shader/RuShader_D3D_Base.h"

#pragma unmanaged

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

class CRuShader_NULL : public CRuShader_Static_Base
{
public:
											CRuShader_NULL(CRuEngineD3D *engine);
	virtual									~CRuShader_NULL();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);
	virtual void							EndPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;
};

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

class CRuShader_Gizmo : public CRuShader_Base
{
public:
											CRuShader_Gizmo(CRuEngineD3D *engine);
	virtual									~CRuShader_Gizmo();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);
	virtual void							EndPass(INT32 passNumber);

	// Multi-Pass
	virtual INT32							GetNumPasses() const;

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;
};

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

class CRuShader_Static_Flat : public CRuShader_Static_Base
{
public:
											CRuShader_Static_Flat(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_Flat();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

class CRuShader_Static_SH9 : public CRuShader_Static_Base
{
public:
											CRuShader_Static_SH9(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_SH9();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

class CRuShader_Static_SH9_Gloss : public CRuShader_Static_Base
{
public:
											CRuShader_Static_SH9_Gloss(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_SH9_Gloss();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

class CRuShader_Static_SH9_Translucent : public CRuShader_Static_Base
{
public:
											CRuShader_Static_SH9_Translucent(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_SH9_Translucent();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

class CRuShader_Static_SH9_Colored : public CRuShader_Static_Colored_Base
{
public:
											CRuShader_Static_SH9_Colored(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_SH9_Colored();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

class CRuShader_Static_SH9_Colored_Gloss : public CRuShader_Static_Colored_Base
{
public:
											CRuShader_Static_SH9_Colored_Gloss(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_SH9_Colored_Gloss();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

class CRuShader_Static_SH9_Colored_Gloss_Distort : public CRuShader_Static_Colored_Base
{
public:
											CRuShader_Static_SH9_Colored_Gloss_Distort(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_SH9_Colored_Gloss_Distort();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

/*
	[ 27 -  30] Texture transform 0
*/
class CRuShader_Static_Prelit : public CRuShader_Base
{
protected:
	CRuMatrix4x4							m_identityMatrix;

public:
											CRuShader_Static_Prelit(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_Prelit();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual INT32							GetNumPasses() const;
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetDefaultParameters();
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

/*
	[ 27 -  30] Texture transform 0
*/
class CRuShader_Static_Prelit_Translucent : public CRuShader_Base
{
protected:
	CRuMatrix4x4							m_identityMatrix;

public:
											CRuShader_Static_Prelit_Translucent(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_Prelit_Translucent();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual INT32							GetNumPasses() const;
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;

	// Shader parameter setup
	virtual void							SetDefaultParameters();
	virtual void							SetParameters(const CRuParameterCache *paramCache);
};

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

class CRuShader_Static_FX : public CRuShader_Static_Prelit
{
public:
											CRuShader_Static_FX(CRuEngineD3D *engine);
	virtual									~CRuShader_Static_FX();

	// Shader capabilities query
	virtual const char*						GetShaderName() const;
	virtual INT32							GetShaderPriority() const;
	virtual DWORD							GetCaps() const;

	// Rendering setup
	virtual INT32							GetNumPasses() const;
	virtual void							BeginPass(INT32 passNumber);

	// Shader texture placement query
	virtual INT32							GetNumSamplers(INT32 passNumber) const;
	virtual RuTextureChannel				GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const;
};

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

inline const char *CRuShader_NULL::GetShaderName() const
{
	return "ruSHADER_NULL";
}

inline INT32 CRuShader_NULL::GetShaderPriority() const
{
	return 1001;
}

inline DWORD CRuShader_NULL::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_NULL::GetNumSamplers(INT32 passNumber) const
{
	return 0;
}

inline RuTextureChannel CRuShader_NULL::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Gizmo::GetShaderName() const
{
	return "ruSHADER_GIZMO";
}

inline INT32 CRuShader_Gizmo::GetShaderPriority() const
{
	return 2000;
}

inline DWORD CRuShader_Gizmo::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Gizmo::GetNumPasses() const
{
	return 1;
}

inline INT32 CRuShader_Gizmo::GetNumSamplers(INT32 passNumber) const
{
	return 0;
}

inline RuTextureChannel CRuShader_Gizmo::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_Flat::GetShaderName() const
{
	return "ruSHADER_STATIC_FLAT";
}

inline INT32 CRuShader_Static_Flat::GetShaderPriority() const
{
	return 1000;
}

inline DWORD CRuShader_Static_Flat::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_Flat::GetNumSamplers(INT32 passNumber) const
{
	return 1;
}

inline RuTextureChannel CRuShader_Static_Flat::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	if(passNumber == 0 && samplerNumber == 0)
		return ruTEXCHANNEL_DIFFUSEMAP;

	if(passNumber == 0 && samplerNumber == 1)
		return ruTEXCHANNEL_GLOSSMAP;

	if(samplerNumber == 1)
		return ruTEXCHANNEL_SHADOWDEPTHMAP;

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_SH9::GetShaderName() const
{
	return "ruSHADER_STATIC_SH9";
}

inline INT32 CRuShader_Static_SH9::GetShaderPriority() const
{
	return 1000;
}

inline DWORD CRuShader_Static_SH9::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_SH9::GetNumSamplers(INT32 passNumber) const
{
	return 1;
}

inline RuTextureChannel CRuShader_Static_SH9::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
					case 1:	return ruTEXCHANNEL_SHADOWDEPTHMAP;
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_SH9_Gloss::GetShaderName() const
{
	return "ruSHADER_STATIC_SH9_GLOSS";
}

inline INT32 CRuShader_Static_SH9_Gloss::GetShaderPriority() const
{
	return 1000;
}

inline DWORD CRuShader_Static_SH9_Gloss::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_SH9_Gloss::GetNumSamplers(INT32 passNumber) const
{
	return 2;
}

inline RuTextureChannel CRuShader_Static_SH9_Gloss::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
					case 1:	return ruTEXCHANNEL_GLOSSMAP;					
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_SH9_Translucent::GetShaderName() const
{
	return "ruSHADER_STATIC_SH9_TRANSLUCENT";
}

inline INT32 CRuShader_Static_SH9_Translucent::GetShaderPriority() const
{
	return 3000;
}

inline DWORD CRuShader_Static_SH9_Translucent::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_SH9_Translucent::GetNumSamplers(INT32 passNumber) const
{
	return 1;
}

inline RuTextureChannel CRuShader_Static_SH9_Translucent::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_SH9_Colored::GetShaderName() const
{
	return "ruSHADER_STATIC_SH9_COLORED";
}

inline INT32 CRuShader_Static_SH9_Colored::GetShaderPriority() const
{
	return 1000;
}

inline DWORD CRuShader_Static_SH9_Colored::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_SH9_Colored::GetNumSamplers(INT32 passNumber) const
{
	return 1;
}

inline RuTextureChannel CRuShader_Static_SH9_Colored::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
					case 1:	return ruTEXCHANNEL_SHADOWDEPTHMAP;
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_SH9_Colored_Gloss::GetShaderName() const
{
	return "ruSHADER_STATIC_SH9_COLORED_GLOSS";
}

inline INT32 CRuShader_Static_SH9_Colored_Gloss::GetShaderPriority() const
{
	return 1000;
}

inline DWORD CRuShader_Static_SH9_Colored_Gloss::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_SH9_Colored_Gloss::GetNumSamplers(INT32 passNumber) const
{
	return 2;
}

inline RuTextureChannel CRuShader_Static_SH9_Colored_Gloss::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
					case 1:	return ruTEXCHANNEL_GLOSSMAP;					
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_SH9_Colored_Gloss_Distort::GetShaderName() const
{
	return "ruSHADER_STATIC_SH9_COLORED_GLOSS_DISTORT";
}

inline INT32 CRuShader_Static_SH9_Colored_Gloss_Distort::GetShaderPriority() const
{
	return 1000;
}

inline DWORD CRuShader_Static_SH9_Colored_Gloss_Distort::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_SH9_Colored_Gloss_Distort::GetNumSamplers(INT32 passNumber) const
{
	return 4;
}

inline RuTextureChannel CRuShader_Static_SH9_Colored_Gloss_Distort::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
					case 1:	return ruTEXCHANNEL_GLOSSMAP;
					case 2:	return ruTEXCHANNEL_DISTORTMAP;
					case 3:	return ruTEXCHANNEL_BACKBUFFER;
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_Prelit::GetShaderName() const
{
	return "ruSHADER_STATIC_PRELIT";
}

inline INT32 CRuShader_Static_Prelit::GetShaderPriority() const
{
	return 1000;
}

inline DWORD CRuShader_Static_Prelit::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_Prelit::GetNumPasses() const
{
	return 1;
}

inline INT32 CRuShader_Static_Prelit::GetNumSamplers(INT32 passNumber) const
{
	return 1;
}

inline RuTextureChannel CRuShader_Static_Prelit::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_Prelit_Translucent::GetShaderName() const
{
	return "ruSHADER_STATIC_PRELIT_TRANSLUCENT";
}

inline INT32 CRuShader_Static_Prelit_Translucent::GetShaderPriority() const
{
	return 3000;
}

inline DWORD CRuShader_Static_Prelit_Translucent::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_Prelit_Translucent::GetNumPasses() const
{
	return 1;
}

inline INT32 CRuShader_Static_Prelit_Translucent::GetNumSamplers(INT32 passNumber) const
{
	return 1;
}

inline RuTextureChannel CRuShader_Static_Prelit_Translucent::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

inline const char *CRuShader_Static_FX::GetShaderName() const
{
	return "ruSHADER_STATIC_FX";
}

inline INT32 CRuShader_Static_FX::GetShaderPriority() const
{
	return 2000;
}

inline DWORD CRuShader_Static_FX::GetCaps() const
{
	return 0x00000000;
}

inline INT32 CRuShader_Static_FX::GetNumPasses() const
{
	return 1;
}

inline INT32 CRuShader_Static_FX::GetNumSamplers(INT32 passNumber) const
{
	return 1;
}

inline RuTextureChannel CRuShader_Static_FX::GetTextureChannel(INT32 passNumber, INT32 samplerNumber) const
{
	switch(passNumber)
	{
		case 0:
			{
				switch(samplerNumber)
				{
					case 0:	return ruTEXCHANNEL_DIFFUSEMAP;
				}
			}

			break;
	}

	return ruTEXCHANNEL_INVALID;
}

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

#pragma managed

#endif
