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

<CustomShader version="2" classRequirement="">
    <LodLevel startDistance="0">
        <Parameters>
        </Parameters>
        <CodeInjections>
            <CodeInjection position="GET_REFLECTION_COLOR_FS">
<![CDATA[
#if GPU_PROFILE >= GPU_PROFILE_MEDIUM
    #if defined(REFLECTION_MAP_2D) || defined(REFLECTION_MAP_CUBE)
        float fresnel2 = max(min(getFresnel(facing, reflectionRefractionCoeffScale[0], 3.0)*0.2, 0.12), 0.08);
    #if defined(GLOSS_MAP) && defined(USE_ENVMAP_GLOSS_MODULATION)
        fresnel2 *= tex2D(glossMap, getTexCoords(In, globals, GLOSSMAP_TEXCOORD)).a;
    #endif
        res = lerp(oColor.xyz, getReflectionColorTex(In, globals, normal, viewDir), fresnel2);
    #endif
#endif
]]>
            </CodeInjection>
            <CodeInjection position="NUM_TEXCOORDS">
<![CDATA[
#if GPU_PROFILE < GPU_PROFILE_MEDIUM
    #if defined(REFLECTION_MAP_CUBE)
    #undef REFLECTION_MAP_CUBE
    #endif
#endif
]]>
            </CodeInjection>
        </CodeInjections>
    </LodLevel>
    <LodLevel startDistance="30">
        <Parameters>
        </Parameters>
        <CodeInjections>
            <CodeInjection position="NUM_TEXCOORDS">
<![CDATA[
#if defined(REFLECTION_MAP_CUBE)
#undef REFLECTION_MAP_CUBE
#endif
]]>
            </CodeInjection>
        </CodeInjections>
    </LodLevel>
</CustomShader>