<?xml version="1.0" encoding="utf-8"?>
<!-- 
	@Name: 		DirtShader
	@Info: 		Shader for washable vehicle
	@Author: 	Manuel Leithner
	@Team:		SFM-Modding
	@Version:	v2.0
	@Date:		04/08/2010
	@History:	v1.0 - Inital version
				v2.0 - Converted to UTF-8
-->
<CustomShader version="1.0" classRequirement="">
    <LodLevel startDistance="0">
        <Parameters>
            <Parameter name="dirtScale" target="In.mat.dirtScale" type="float4"/>
        </Parameters>
        <Textures>
			<Texture name="dirtTexture" />
        </Textures>
        <CodeInjections>
            <CodeInjection position="SAMPLERS">
<![CDATA[
uniform sampler2D dirtTexture : TEXUNITN;
]]>
            </CodeInjection>
            <CodeInjection position="MATERIALINFO">
<![CDATA[
uniform float4 dirtScale;
]]>
            </CodeInjection>
            <CodeInjection position="POST_ALBEDO_FS">
<![CDATA[
	float3 albedoDirt = tex2D(In.samplers.dirtTexture, getTexCoords(In, globals, ALBEDOMAP_TEXCOORD).xy).xyz;
	albedo.xyz = albedo.xyz*(1-In.mat.dirtScale.x) + albedoDirt.xyz*In.mat.dirtScale.x;
]]>
            </CodeInjection>
        </CodeInjections>
    </LodLevel>
</CustomShader>
