//
// FSFX_DisplacementMap_FP.h
//
// Created by Andrew Southgate - 31 March 2009
//
// Copyright (C) 2009 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __ASURA_PS3_DISPLACEMENTMAP_FSFX_FP_H__
#define __ASURA_PS3_DISPLACEMENTMAP_FSFX_FP_H__

#include "Rendering/ShadersDefinition/AVP_PS3_ProjectShaders.h"

extern uint32_t _binary_PS3_FSFX_DisplacementMap_FP_bin_start;
extern uint32_t _binary_PS3_FSFX_DisplacementMap_FP_bin_end;

class AVP_PS3_FSFX_DisplacementMap_PS : public AVP_PS3_PixelShader
{
	class Handles : public Asura_PS3_FP_Handles
	{
	public:
		Handles() : Asura_PS3_FP_Handles( FP_ELEMENTS, FP_TU_ELEMENTS )
		{}

		void InitialiseFromShader( Asura_PS3_FragmentShaderBase* pxShader )
		{
			pxShader->InitUniformElement( FP_Intensity,		"g_fIntensity",		1 );

			pxShader->InitTextureUnit( FP_SceneTextureSampler,	"g_xSceneTextureSampler",	CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_LINEAR, CELL_GCM_TEXTURE_LINEAR );
			pxShader->InitTextureUnit( FP_DisplacementMapSampler,	"g_xDisplacementMapSampler",	CELL_GCM_TEXTURE_WRAP, CELL_GCM_TEXTURE_WRAP, CELL_GCM_TEXTURE_LINEAR, CELL_GCM_TEXTURE_LINEAR );

		}
	};

public:
	enum FRAGMENT_SHADER_UNIFORM
	{
		FP_Intensity,
		FP_ELEMENTS
	};

	enum TEXTURE_UNITS
	{
		FP_SceneTextureSampler,
		FP_DisplacementMapSampler,
		FP_TU_ELEMENTS
	};

	AVP_PS3_FSFX_DisplacementMap_PS() : 
		AVP_PS3_PixelShader(ASURA_PS3_FSFX_DISPLACEMENTMAP_SHADER, new Handles(), 
			&_binary_PS3_FSFX_DisplacementMap_FP_bin_start, &_binary_PS3_FSFX_DisplacementMap_FP_bin_end)
		{

		}
#if defined(ASURA_PS3_ALLOW_SHADER_RELOAD)
		void ReloadFromDisc()
		{
			AVP_PS3_PixelShader::ReloadFromDisc("~/Project/AVP/Game/PS3/Shaders/FSFX_displacementMap_FP.fpx", new Handles());

		}
#endif


		void SetFloats( FRAGMENT_SHADER_UNIFORM iElementID, const unsigned char ucElements, const float* pfData)
		{
			AVP_PS3_PixelShader::SetFloats(iElementID, ucElements, pfData);
		}

		void SetTexture( TEXTURE_UNITS iTextureID, int iTextureIndex)
		{
			AVP_PS3_PixelShader::SetTexture(iTextureID, iTextureIndex);
		}
		void SetTexture( TEXTURE_UNITS iTextureID, Asura_PS3_Texture* pxTexture, bool bNormalizedTextureCoordinates = true )
		{
			AVP_PS3_PixelShader::SetTexture(iTextureID, pxTexture, bNormalizedTextureCoordinates);
		}

};

#endif //#ifndef __ASURA_PS3_LASER_FSFX_FP_H__
