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

    <technique>
        <require context="MODE_SHADOWCAST || MODE_SILHOUETTEOCCLUDER"/>
        <require shaders="arb"/>
        <pass shader="arb/model_solid_tex">
            <define name="REQUIRE_ALPHA_GEQUAL" value="0.4"/>
        </pass>
    </technique>

    <technique>
        <require context="MODE_SHADOWCAST || MODE_SILHOUETTEOCCLUDER"/>
        <require shaders="glsl"/>
        <pass shader="glsl/model_solid_tex">
            <define name="REQUIRE_ALPHA_GEQUAL" value="0.4"/>
        </pass>
    </technique>

    <technique>
        <require context="MODE_SHADOWCAST || MODE_SILHOUETTEOCCLUDER"/>
        <require shaders="fixed"/>
        <define name="USE_PLAYERCOLOR" value="0"/>
        <define name="USE_OBJECTCOLOR" value="0"/>
        <pass shader="fixed:model_solid_tex">
            <alpha func="gequal" ref="0.4"/>
        </pass>
    </technique>



    <!--
        CRenderer::RenderSilhouettes skips alpha-blended models for
        MODE_SILHOUETTEDISPLAY, so do a dummy non-blended behaviour here to
        make it obviously buggy if CRenderer is changed to render these models.
    -->
    <technique>
        <require context="MODE_SILHOUETTEDISPLAY || MODE_WIREFRAME"/>
        <require shaders="arb"/>
        <pass shader="arb/model_solid_player"/>
    </technique>

    <technique>
        <require context="MODE_SILHOUETTEDISPLAY || MODE_WIREFRAME"/>
        <require shaders="glsl"/>
        <pass shader="glsl/model_solid_player"/>
    </technique>

    <technique>
        <require context="MODE_SILHOUETTEDISPLAY || MODE_WIREFRAME"/>
        <require shaders="fixed"/>
        <define name="USE_PLAYERCOLOR" value="1"/>
        <define name="USE_OBJECTCOLOR" value="0"/>
        <pass shader="fixed:model_solid"/>
    </technique>



    <technique>
        <require context="USE_ALPHATEST"/>
        <require shaders="arb"/>
        <pass shader="arb/model_common">
            <define name="USE_TRANSPARENT" value="1"/>
            <define name="REQUIRE_ALPHA_GEQUAL" value="0.4"/>
        </pass>
    </technique>

    <technique>
        <require context="USE_ALPHATEST"/>
        <require shaders="glsl"/>
        <pass shader="glsl/model_common">
            <define name="USE_TRANSPARENT" value="1"/>
            <define name="REQUIRE_ALPHA_GEQUAL" value="0.4"/>
        </pass>
    </technique>

    <technique>
        <require context="USE_ALPHATEST"/>
        <require shaders="fixed"/>
        <pass shader="fixed:model">
            <alpha func="gequal" ref="0.4"/>
        </pass>
    </technique>



    <technique>
        <require context="ALPHABLEND_PASS_OPAQUE"/>
        <require shaders="arb"/>
        <pass shader="arb/model_common">
            <define name="USE_TRANSPARENT" value="1"/>
            <define name="REQUIRE_ALPHA_GEQUAL" value="0.6375"/>
        </pass>
    </technique>

    <technique>
        <require context="ALPHABLEND_PASS_OPAQUE"/>
        <require shaders="glsl"/>
        <pass shader="glsl/model_common">
            <define name="USE_TRANSPARENT" value="1"/>
            <define name="REQUIRE_ALPHA_GEQUAL" value="0.6375"/>
        </pass>
    </technique>

    <technique>
        <require context="ALPHABLEND_PASS_OPAQUE"/>
        <require shaders="fixed"/>
        <pass shader="fixed:model">
            <alpha func="gequal" ref="0.6375"/>
        </pass>
    </technique>


    
    <technique>
        <require context="ALPHABLEND_PASS_BLEND"/>
        <require shaders="arb"/>
        <sort_by_distance/>
        <pass shader="arb/model_common">
            <define name="USE_TRANSPARENT" value="1"/>
            <define name="REQUIRE_ALPHA_GEQUAL" value="0.05"/>
            <blend src="src_alpha" dst="one_minus_src_alpha"/>
            <depth func="less" mask="false"/>
        </pass>
    </technique>

    <technique>
        <require context="ALPHABLEND_PASS_BLEND"/>
        <require shaders="glsl"/>
        <sort_by_distance/>
        <pass shader="glsl/model_common">
            <define name="USE_TRANSPARENT" value="1"/>
            <define name="REQUIRE_ALPHA_GEQUAL" value="0.05"/>
            <blend src="src_alpha" dst="one_minus_src_alpha"/>
            <depth func="less" mask="false"/>
        </pass>
    </technique>

    <technique>
        <require context="ALPHABLEND_PASS_BLEND"/>
        <require shaders="fixed"/>
        <sort_by_distance/>
        <pass shader="fixed:model">
            <define name="USE_TRANSPARENT" value="1"/>
            <alpha func="gequal" ref="0.05"/>
            <blend src="src_alpha" dst="one_minus_src_alpha"/>
            <depth func="less" mask="false"/>
        </pass>
    </technique>

</effect>
