<?xml version="1.0" encoding="utf-8"?>
<!--
	FruitShader
	Shader to animate a dynamic fruit
	
	Author: Manuel Leithner - SFM-Modding
	Date:	27.09.2011
	
	Copyright 2011 - SFM-Modding
	free for noncommerical-usage
-->
<CustomShader version="1.0" classRequirement="">
    <LodLevel startDistance="0">
        <Parameters>
            <Parameter name="FruitSettings" target="In.mat.fruitSettings" type="float4"/>
        </Parameters>
        <CodeInjections>
			<CodeInjection position="MATERIALINFO">
				<![CDATA[
				uniform float4 fruitSettings;
				]]>
			</CodeInjection>
			<CodeInjection position="POST_SET_TEXCOORDS_VS">
				<![CDATA[
				#if defined(ALBEDO_MAP)
					float2 uv = getTexCoords(In, ALBEDOMAP_TEXCOORD);
                    uv.y += 0.5 - (In.mat.fruitSettings.x * 0.5);
                    setTexCoords(Out.texCoords[ALBEDOMAP_TEXCOORD/2], ALBEDOMAP_TEXCOORD, uv);
				#endif
				]]>
        	</CodeInjection>
            <CodeInjection position="POST_ALBEDO_FS">
				<![CDATA[
				#if defined(ALBEDO_MAP)
					albedo.w *= In.mat.fruitSettings.w;
				#endif
				]]>
	        </CodeInjection>			
     	  </CodeInjections>
    </LodLevel>
</CustomShader>