
// full screen quad with camera-to-pixel ray calculations

vertex_program ssao_vs unified
{
	delegate ssao_vs_pCg
	delegate ssao_vs_pGLSL
	delegate ssao_vs_pGLSLES
}
vertex_program ssao_vs_pCg hlsl
{
    source ssao.cg
    target vs_2_0
    entry_point ssao_vs
    default_params
    {
        param_named_auto wvp worldviewproj_matrix
    }
}
vertex_program ssao_vs_pGLSL glsl
{
    source ssao_vs.glsl
    syntax glsl150
    default_params
    {
        param_named_auto worldViewProj worldviewproj_matrix
    }
}
vertex_program ssao_vs_pGLSLES glsles
{
    source ssao_vs.glsl
    syntax glsles
    default_params
    {
        param_named_auto worldViewProj worldviewproj_matrix
    }
}
fragment_program ssao_ps unified
{
	delegate ssao_ps_pCg
	delegate ssao_ps_pGLSL
	delegate ssao_ps_pGLSLES
}
fragment_program ssao_ps_pCg hlsl
{
    source ssao.cg
    entry_point ssao_ps
    // will run on anything with pixel shader 2.b and up
    target ps_3_0
    default_params
    {
    }
}
fragment_program ssao_ps_pGLSL glsl
{
    source ssao_ps.glsl
    // will run on anything with GLSL 1.50 and up
    syntax glsl150
	default_params
	{
        param_named geomMap int 0
        param_named randMap int 1
    }
}
fragment_program ssao_ps_pGLSLES glsles
{
    source ssao_ps.glsl
    // will run on anything with GLSL 1.50 and up
    syntax glsl300es
	default_params
	{
        param_named geomMap int 0
        param_named randMap int 1
    }
}
fragment_program ssaoBlurX_ps unified
{
	delegate ssaoBlurX_ps_pCg
	delegate ssaoBlurX_ps_pGLSL
	delegate ssaoBlurX_ps_pGLSLES
}
fragment_program ssaoBlurX_ps_pCg hlsl
{
    source ssao.cg
    entry_point ssaoBlurX_ps
    target ps_3_0
    default_params
    {
        param_named_auto invTexSize inverse_texture_size 0
    }
}
fragment_program ssaoBlurX_ps_pGLSL glsl
{
    source ssao_blurx_ps.glsl
    syntax glsl150
    default_params
    {
        param_named_auto invTexSize inverse_texture_size 0
        param_named map int 0
        param_named geomMap int 1
    }
}
fragment_program ssaoBlurX_ps_pGLSLES glsles
{
    source ssao_blurx_ps.glsl
    syntax glsl300es
    default_params
    {
        param_named_auto invTexSize inverse_texture_size 0
        param_named map int 0
        param_named geomMap int 1
    }
}

fragment_program ssaoBlurY_ps unified
{
	delegate ssaoBlurY_ps_pCg
	delegate ssaoBlurY_ps_pGLSL
	delegate ssaoBlurY_ps_pGLSLES
}
fragment_program ssaoBlurY_ps_pCg hlsl
{
    source ssao.cg
    entry_point ssaoBlurY_ps
    target ps_3_0
    default_params
    {
        param_named_auto invTexSize inverse_texture_size 0
    }
}
fragment_program ssaoBlurY_ps_pGLSL glsl
{
    source ssao_blury_ps.glsl
    syntax glsl150
    default_params
    {
        param_named_auto invTexSize inverse_texture_size 0
        param_named map int 0
        param_named geomMap int 1
    }
}
fragment_program ssaoBlurY_ps_pGLSLES glsles
{
    source ssao_blury_ps.glsl
    syntax glsl300es
    default_params
    {
        param_named_auto invTexSize inverse_texture_size 0
        param_named map int 0
        param_named geomMap int 1
    }
}

material ssao
{
    technique
    {
        pass
        {
            vertex_program_ref ssao_vs
            {
            }

            fragment_program_ref ssao_ps
            {
                param_named_auto far far_clip_distance
            }

            texture_unit geomMap
            {
                tex_address_mode clamp
                filtering bilinear
            }

            texture_unit randMap
            {
                texture random.png
                filtering none
            }
        }
    }
}

material ssaoBlurX
{
    technique
    {
        pass
        {

            vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureWithUV
            {
            }
        
            fragment_program_ref ssaoBlurX_ps
            {
            }

            texture_unit map
            {
                tex_address_mode clamp
                filtering bilinear
            }

            texture_unit geomMap
            {
                tex_address_mode clamp
                filtering bilinear
            }
        }
    }
}

material ssaoBlurY
{
    technique
    {
        pass
        {
            vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureWithUV
            {
            }

            fragment_program_ref ssaoBlurY_ps
            {
            }

            texture_unit map
            {
                tex_address_mode clamp
                filtering bilinear
            }

            texture_unit geomMap
            {
                tex_address_mode clamp
                filtering bilinear
            }
        }
    }
}

material modulate
{
    technique
    {
        pass
        {
            lighting off

            texture_unit
            {
                filtering none
            }

            texture_unit
            {
                filtering none
            }
        }
    }
}
