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

<CustomShader version="3">
    <Parameters>
        <Parameter name = "colorScale"    target = "colorScale"    type = "float3"  defaultValue = "0.0 1.0 0.0 1.0"  minValue = "0.0 0.0 0.0 0.0"          maxValue = "1.0 1.0 1.0 1.0"/>
    </Parameters>
    <Variations>
        <Variation name = "colorScale">
<![CDATA[
    #define COLOR_SCALE
]]>
        </Variation>
    </Variations>
    <LodLevel startDistance="0">
        <CodeInjections>
            <CodeInjection position = "MATERIALINFO">
<![CDATA[
#if defined( COLOR_SCALE )
    uniform float3 colorScale;
#endif
]]>
            </CodeInjection>             
            <CodeInjection position="EMISSIVE_FS">
<![CDATA[
#if defined( COLOR_SCALE )
    emissiveColor.rgb *= colorScale.rgb;
#endif
]]>
            </CodeInjection>   
            <CodeInjection position="POST_GLOSS_COLOR_FS">
<![CDATA[
// Disable specular color for alphablended billboards
#if defined(SPECULAR) && defined(ALPHA_BLENDED)
    #undef SPECULAR
#endif
]]>
            </CodeInjection>
            <CodeInjection position="GET_FOG_COLOR_FS">
<![CDATA[
#if defined(ALPHA_BLENDED) && FOG_MODE != 0
    return oColor.xyz*In.vs.fogFactor; // In additive blending mode, we need to use a black fog color
#endif
]]>
            </CodeInjection>
            <CodeInjection position="FINAL_POS_FS">
<![CDATA[
#if defined(ALPHA_BLENDED)
    oColor.a = 0.0; // additive blending
#endif
]]>
            </CodeInjection>
        </CodeInjections>
    </LodLevel>
</CustomShader>
