
// Shadow Caster __________________________________________________


vertex_program VarianceShadowMapping/ShadowCasterVP cg
{
    source varianceshadowcastervp.cg
    entry_point main
    profiles arbvp1 vs_2_x

    default_params
    {
        param_named_auto uModelViewProjection worldviewproj_matrix
    }
}

fragment_program VarianceShadowMapping/ShadowCasterFP cg
{
    source varianceshadowcasterfp.cg
    entry_point main
    profiles arbfp1 ps_2_x

    default_params
    {
        param_named      uDepthOffset float       1.0
        param_named_auto uProjection              projection_matrix
    }
}

material VarianceShadowMapping/ShadowCaster
{
    technique default
    {
        // Z-write only pass
        pass Z-write
        {
            //Instead of using depth_bias, we'll be implementing it manually

            vertex_program_ref VarianceShadowMapping/ShadowCasterVP
            {
            }
            fragment_program_ref VarianceShadowMapping/ShadowCasterFP
            {
            }
        }
    }
}



// Shadow Receiver ________________________________________________

vertex_program VarianceShadowMapping/ShadowReceiverVP cg
{
    source varianceshadowreceivervp.cg
    entry_point main
    profiles arbvp1 vs_2_x

    default_params
    {
        param_named_auto uModelViewProjection   worldviewproj_matrix
        param_named_auto uLightPosition         light_position_object_space 0
        param_named_auto uModel                 world_matrix
        param_named_auto uTextureViewProjection texture_viewproj_matrix
    }
}

fragment_program VarianceShadowMapping/ShadowReceiverFP cg
{
    source varianceshadowreceiverfp.cg
    entry_point main
    profiles arbfp1 ps_2_x

    default_params
    {
        param_named uSTexWidth  float 512.0
        param_named uSTexHeight float 512.0
    }
}

material VarianceShadowMapping/ShadowReceiver
{
    technique default
    {
        pass lighting
        {
            vertex_program_ref VarianceShadowMapping/ShadowReceiverVP
            {
            }

            fragment_program_ref VarianceShadowMapping/ShadowReceiverFP
            {
            }

            // we won't rely on hardware specific filtering of z-tests
            texture_unit ShadowMap
            {
                tex_address_mode clamp
                filtering none
            }
        }
    }
}
