<?xml version="1.0" encoding="utf-8"?>

<CustomShader version="1.0" classRequirement="">
    <LodLevel startDistance="0">
        <Parameters>
            <Parameter name="waterDirection" target="In.mat.waterDirection" type="float" />
            <Parameter name="waterOffset" target="In.mat.waterOffset" type="float" />
        </Parameters>
        <CodeInjections>
            
            <CodeInjection position="MATERIALINFO">
                <![CDATA[
                uniform float waterDirection;
                uniform float waterOffset;
                ]]>
            </CodeInjection>  
            
			<CodeInjection position="POST_SET_TEXCOORDS_VS">
				<![CDATA[
				#if defined(ALBEDO_MAP) || defined(EMISSIVE_MAP)
					float2 uv = getTexCoords(In, ALBEDOMAP_TEXCOORD);
					uv.x += In.mat.waterDirection * sin(In.time.y + In.mat.waterOffset) / 6;
					uv.y += In.mat.waterDirection * sin(In.time.y / 2 + In.mat.waterOffset) / 12;
					setTexCoords(Out.texCoords[ALBEDOMAP_TEXCOORD/2], ALBEDOMAP_TEXCOORD, uv);
				#endif
				]]>
        	</CodeInjection>
     	  </CodeInjections>
    </LodLevel>
</CustomShader>
