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