//
// Water_FP.h
//
// Created by Catalin Arsenescu - 26 August 2007
//
// Copyright (C) 2006 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __ASURA_PS3_WATER_FP_H__
#define __ASURA_PS3_WATER_FP_H__

extern u_int _binary_PS3_Water_FP_bin_start;
extern u_int _binary_PS3_Water_FP_bin_end;

enum FRAGMENT_SHADER_UNIFORM_WATER
{
	FPW_UVScroll,
	FPW_UVScroll2,
	FPW_WaterFogColour,
	FPW_WaterReflectionColour,
	FPW_WaterRefractionColour,
	FPW_OneOverScreenWidthHeight,
	FPW_CameraPosition,
	FPW_WaterProperties,
	FPW_FogColour,
	FPW_FogProperties,
	FPW_DepthAdjustment,
	FPW_ELEMENTS
};

enum TEXTURE_UNITS_WATER
{
	FPW_DepthTextureSampler,
	FPW_BackBufferTextureSampler,
	FPW_ReflectionTextureSampler,
	FPW_NormalMapSampler,
	FPW_NormalMap2Sampler,
	FPW_TransparencyMapSampler,
	FPW_FogTexture,
	FPW_TU_ELEMENTS
};

class Asura_PS3_Water_Handles : public Asura_PS3_FP_Handles
{
public:
	Asura_PS3_Water_Handles() : Asura_PS3_FP_Handles( FPW_ELEMENTS, FPW_TU_ELEMENTS )
	{}

	void InitialiseFromShader( Asura_PS3_FragmentShaderBase* pxShader )
	{
		pxShader->InitUniformElement( FPW_UVScroll,					"g_xUVScroll",					1 );
		pxShader->InitUniformElement( FPW_UVScroll2,				"g_xUVScroll2",					1 );
		pxShader->InitUniformElement( FPW_WaterFogColour,			"g_xWaterFogColour",			1 );
		pxShader->InitUniformElement( FPW_WaterReflectionColour,	"g_xWaterReflectionColour",		1 );
		pxShader->InitUniformElement( FPW_WaterRefractionColour,	"g_xWaterRefractionColour",		1 );
		pxShader->InitUniformElement( FPW_OneOverScreenWidthHeight,	"g_fOneOverScreenWidthHeight",	1 );
		pxShader->InitUniformElement( FPW_CameraPosition,			"g_xCameraPosition",			1 );
		pxShader->InitUniformElement( FPW_WaterProperties,			"g_xWaterProperties",			1 );
		pxShader->InitUniformElement( FPW_DepthAdjustment,			"g_xDepthAdjustment",			1 );

		pxShader->InitUniformElement( FPW_FogColour,				"g_xFogColour",					1 );
		pxShader->InitUniformElement( FPW_FogProperties,			"g_xFogProperties",				1 );

		pxShader->InitTextureUnit( FPW_DepthTextureSampler,			"g_xDepthTextureSampler",		CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_NEAREST, CELL_GCM_TEXTURE_NEAREST );
		pxShader->InitTextureUnit( FPW_BackBufferTextureSampler,	"g_xBackBufferTextureSampler",	CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_NEAREST, CELL_GCM_TEXTURE_NEAREST );
		pxShader->InitTextureUnit( FPW_ReflectionTextureSampler,	"g_xReflectionTextureSampler",	CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_LINEAR_LINEAR, CELL_GCM_TEXTURE_LINEAR );
		pxShader->InitTextureUnit( FPW_NormalMapSampler,			"g_xNormalMapSampler",			CELL_GCM_TEXTURE_WRAP, CELL_GCM_TEXTURE_WRAP, CELL_GCM_TEXTURE_LINEAR_LINEAR, CELL_GCM_TEXTURE_LINEAR );
		pxShader->InitTextureUnit( FPW_NormalMap2Sampler,			"g_xNormalMap2Sampler",			CELL_GCM_TEXTURE_WRAP, CELL_GCM_TEXTURE_WRAP, CELL_GCM_TEXTURE_LINEAR_LINEAR, CELL_GCM_TEXTURE_LINEAR );
		pxShader->InitTextureUnit( FPW_TransparencyMapSampler,		"g_xTransparencyMapSampler",	CELL_GCM_TEXTURE_WRAP, CELL_GCM_TEXTURE_WRAP, CELL_GCM_TEXTURE_LINEAR_LINEAR, CELL_GCM_TEXTURE_LINEAR );
		pxShader->InitTextureUnit( FPW_FogTexture,					"g_xFogSampler",				CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_CLAMP, CELL_GCM_TEXTURE_NEAREST, CELL_GCM_TEXTURE_NEAREST );
	}
};

#endif //#ifndef __ASURA_PS3_WATER_FP_H__
