<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<!-- 
	@Name: DirtShader
	@Info: Shader for washable vehicle
	@Author: Manuel Leithner
	@Team:	SFM-Modding
	@Date:	25/12/2009
-->
<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>
