// All content © 2010-2011 DigiPen (USA) Corporation, all rights reserved.

//Fragment shader to render heat haze effect

#version 150

// ---------------------------------------------------------------------------
//uniforms

uniform sampler2D		uSceneTex; //texture before post processing
uniform sampler2D		uDistortTex; //distortion map
uniform vec2			uOffset; //texture offset, for animation

// ---------------------------------------------------------------------------
// varyings

//distort tex constants
uniform vec2			INV_TEX_SIZE = vec2( 1.0/600.0, 1.0/600.0 );

// ---------------------------------------------------------------------------

out vec4				out_Color;

void main()
{
	//out_Color = vec4( texture( uDistortTex, gl_FragCoord.xy*INV_TEX_SIZE + uOffset ).rg, 0.0, 1.0 );
	out_Color = texelFetch( uSceneTex, 
							ivec2( gl_FragCoord.xy + texture( uDistortTex, gl_FragCoord.xy*INV_TEX_SIZE + uOffset ).rg ),
							0 );
}




