// full screen quad with camera-to-pixel ray calculations
vertex_program ssao_vs glsl
{
  source deferred_rendering/ssao_vp.glsl
  default_params
  {
    param_named_auto wvp worldviewproj_matrix
  }
}

fragment_program ssao_ps glsl
{
  source deferred_rendering/ssao_fp.glsl
  default_params
  {
  }
}

fragment_program ssaoBlurX_ps glsl
{
  source deferred_rendering/ssao_blurx.glsl
  default_params
  {
    param_named_auto invTexSize inverse_texture_size 0
  }
}

fragment_program ssaoBlurY_ps glsl
{
  source deferred_rendering/ssao_blury.glsl
  default_params
  {
    param_named_auto invTexSize inverse_texture_size 0
  }
}

material ssao
{
  technique
  {
    pass
    {
      vertex_program_ref ssao_vs
      {
      }

      fragment_program_ref ssao_ps
      {
      }

      texture_unit geomMap
      {
        tex_address_mode clamp
        filtering bilinear
      }

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

material ssaoBlurX
{
  technique
  {
    pass
    {
      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
    {
      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
        {
          texture white.bmp
          filtering bilinear
        }

      texture_unit
      {
        texture white.bmp
        filtering bilinear
      }
    }
  }
}
