fragment_program SSAO/Post/NoFilter_fp_hlsl hlsl
{
    source SSAOPost.hlsl
    entry_point noFilter_fp
    target ps_4_0
}

fragment_program SSAO/Post/BoxFilter_fp_hlsl hlsl
{
    source SSAOPost.hlsl
    entry_point boxFilter_fp
    target ps_4_0
}

fragment_program SSAO/Post/SmartBoxFilter_fp_hlsl hlsl
{
    source SSAOPost.hlsl
    entry_point smartBoxFilter_fp
    target ps_4_0
}

fragment_program SSAO/HorizonBased/CrossBilateralFilter/X_fp_hlsl hlsl
{
    source SSAOPost.hlsl
    entry_point crossBilateralFilterX_fp
    target ps_4_0
}

fragment_program SSAO/HorizonBased/CrossBilateralFilter/Y_fp_hlsl hlsl
{
    source SSAOPost.hlsl
    entry_point crossBilateralFilterY_fp
    target ps_4_0
}

fragment_program SSAO/Post/NoFilter_fp_cg cg
{
    source SSAOPost.cg
    entry_point noFilter_fp
    profiles ps_3_0 arbfp1
}

fragment_program SSAO/Post/BoxFilter_fp_cg cg
{
    source SSAOPost.cg
    entry_point boxFilter_fp
    profiles ps_3_0 arbfp1
}

fragment_program SSAO/Post/SmartBoxFilter_fp_cg cg
{
    source SSAOPost.cg
    entry_point smartBoxFilter_fp
    profiles ps_3_0 arbfp1
}

fragment_program SSAO/HorizonBased/CrossBilateralFilter/X_fp_cg cg
{
    source SSAOPost.cg
    entry_point crossBilateralFilterX_fp
    profiles ps_3_0 arbfp1
}

fragment_program SSAO/HorizonBased/CrossBilateralFilter/Y_fp_cg cg
{
    source SSAOPost.cg
    entry_point crossBilateralFilterY_fp
    profiles ps_3_0 arbfp1
}

fragment_program SSAO/Post/NoFilter_fp_glsl glsl
{
    source NoFilterFP.glsl
    	
	default_params
	{
		param_named sOcclusion int 0
	}
}

fragment_program SSAO/Post/BoxFilter_fp_glsl glsl
{
    source BoxFilterFP.glsl
    	
	default_params
	{
		param_named sOcclusion int 0
	}
}

fragment_program SSAO/Post/SmartBoxFilter_fp_glsl glsl
{
    source SmartBoxFilterFP.glsl
    	
	default_params
	{
		param_named sMrt1 int 0
		param_named sOcclusion int 1
	}
}

fragment_program SSAO/HorizonBased/CrossBilateralFilter/X_fp_glsl glsl
{
    source CrossBilateralFilterXFP.glsl
    	
	default_params
	{
		param_named sAccessibility int 0
		param_named sMRT2 int 1
	}
}

fragment_program SSAO/HorizonBased/CrossBilateralFilter/Y_fp_glsl glsl
{
    source CrossBilateralFilterYFP.glsl
    	
	default_params
	{
		param_named sAccessibility int 0
		param_named sMRT2 int 1
	}
}

fragment_program SSAO/Post/NoFilter_fp unified
{
	delegate SSAO/Post/NoFilter_fp_glsl
	delegate SSAO/Post/NoFilter_fp_hlsl
	delegate SSAO/Post/NoFilter_fp_cg 
}

fragment_program SSAO/Post/BoxFilter_fp unified
{
	delegate SSAO/Post/BoxFilter_fp_glsl
	delegate SSAO/Post/BoxFilter_fp_hlsl
	delegate SSAO/Post/BoxFilter_fp_cg 
}

fragment_program SSAO/Post/SmartBoxFilter_fp unified
{
	delegate SSAO/Post/SmartBoxFilter_fp_glsl
	delegate SSAO/Post/SmartBoxFilter_fp_hlsl
	delegate SSAO/Post/SmartBoxFilter_fp_cg 
}

fragment_program SSAO/HorizonBased/CrossBilateralFilter/X_fp unified
{
	delegate SSAO/HorizonBased/CrossBilateralFilter/X_fp_glsl
	delegate SSAO/HorizonBased/CrossBilateralFilter/X_fp_hlsl
	delegate SSAO/HorizonBased/CrossBilateralFilter/X_fp_cg
}

fragment_program SSAO/HorizonBased/CrossBilateralFilter/Y_fp unified
{
	delegate SSAO/HorizonBased/CrossBilateralFilter/Y_fp_glsl
	delegate SSAO/HorizonBased/CrossBilateralFilter/Y_fp_hlsl
	delegate SSAO/HorizonBased/CrossBilateralFilter/Y_fp_cg
}

material SSAO/Post/NoFilter
{
    technique
    {
        pass
        {
            cull_hardware none
			cull_software none
			depth_check off
			
			vertex_program_ref Ogre/Compositor/StdQuad_vp {}
            fragment_program_ref SSAO/Post/NoFilter_fp {}

            texture_unit
            {
                content_type compositor SSAO/GBuffer occlusion
                tex_address_mode clamp
                filtering none
            }
        }
    }
}

material SSAO/Post/BoxFilter
{
    technique
    {
        pass
        {
            depth_check off

			vertex_program_ref Ogre/Compositor/StdQuad_vp {}
            fragment_program_ref SSAO/Post/BoxFilter_fp
            {
                param_named_auto screenSize viewport_size
            }

            texture_unit
            {
                content_type compositor SSAO/GBuffer occlusion
                tex_address_mode clamp
                filtering none
            }
        }
    }
}

material SSAO/Post/SmartBoxFilter
{
    technique
    {
        pass
        {
            depth_check off

			vertex_program_ref Ogre/Compositor/StdQuad_vp {}
            fragment_program_ref SSAO/Post/SmartBoxFilter_fp
            {
                param_named_auto screenSize viewport_size
                param_named_auto farClipDistance far_clip_distance
            }

            texture_unit
            {
                content_type compositor SSAO/GBuffer mrt 0
                tex_address_mode clamp
                filtering none
            }

            texture_unit
            {
                content_type compositor SSAO/GBuffer occlusion
                tex_address_mode clamp
                filtering none
            }
        }
    }
}

material SSAO/HorizonBased/CrossBilateralFilter/X
{
    technique
    {
        pass // two pass in x and y direction
        {
            depth_check off
            
			vertex_program_ref Ogre/Compositor/StdQuad_vp {}
            fragment_program_ref SSAO/HorizonBased/CrossBilateralFilter/X_fp
            {
                param_named_auto stepX inverse_viewport_width
                param_named cPhotometricExponent float 10
            }
            
            texture_unit // the accessability texture
            {
                content_type compositor SSAO/GBuffer occlusion
                tex_address_mode clamp
                filtering none
            }
            
            texture_unit
            {
                content_type compositor SSAO/GBuffer mrt 1
                tex_address_mode clamp
                filtering none
            }
        }
    }
}

material SSAO/HorizonBased/CrossBilateralFilter/Y
{
    technique
    {
        pass // two pass in x and y direction
        {
            depth_check off
            
			vertex_program_ref Ogre/Compositor/StdQuad_vp {}
            fragment_program_ref SSAO/HorizonBased/CrossBilateralFilter/Y_fp
            {
                param_named_auto stepY inverse_viewport_height
                param_named cPhotometricExponent float 10
            }
            
            texture_unit // the accessability texture, injected by the compositor
            {
                tex_address_mode clamp
                filtering none
            }
            
            texture_unit
            {
                content_type compositor SSAO/GBuffer mrt 1
                tex_address_mode clamp
                filtering none
            }
        }
    }
}
