<?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="FINAL_POS_FS">
<![CDATA[
#if defined(ALPHA_BLENDED)
    // additive blending
    oColor.a = 0.0f;
#endif
]]>
            </CodeInjection>
        </CodeInjections>
    </LodLevel>
</CustomShader>
