
    // "Depth of Field" demo for Ogre
    // Copyright (C) 2006  Christian Lindequist Larsen
    //
    // This code is in the public domain. You may do whatever you want with it.



    vertex_program DoF_DepthVP_cg cg         
    {
        source DoF.cg
        entry_point DoF_DepthVP_cg
        profiles vs_3_0               
       
        default_params               
        {
            param_named_auto worldViewProj worldviewproj_matrix      
        }
    }


    fragment_program DoF_DepthFP_cg cg
    {
       source DoF.cg
       entry_point DoF_DepthFP_cg
       profiles ps_3_0
    }


vertex_program DoF_DepthVP_GLSL glsl
{
  source DoF_Depth_GLSL.vert
}

fragment_program DoF_DepthFP_GLSL glsl
{
  source DoF_Depth_GLSL.frag
}

fragment_program DoF_Gaussian3x3FP_GLSL glsl
{
  source DoF_Gaussian3x3_GLSL.frag

  default_params
  {
    param_named source int 0
  }
}

fragment_program DoF_DepthOfFieldFP_GLSL glsl
{
  source DoF_DepthOfField_GLSL.frag
  
  default_params
  {
    param_named scene int 0
    param_named depth int 1
    param_named blur int 2
  }
}

    /////////////////////////////////////////////////////////////////////

    vertex_program DoF_Gaussian3x3VP_cg cg         
    {
        source DoF.cg
        entry_point DoF_Gaussian3x3VP_cg
        profiles vs_3_0               
       
        default_params               
        {
            param_named_auto worldViewProj worldviewproj_matrix      
        }
    }

    fragment_program DoF_Gaussian3x3FP_cg cg
    {
       source DoF.cg
       entry_point DoF_Gaussian3x3FP_cg
       profiles ps_3_0
    }

    /////////////////////////////////////////////////////////////////////


    vertex_program DoF_DepthOfFieldVP_cg cg         
    {
        source DoF.cg
        entry_point DoF_DepthOfFieldVP_cg
        profiles vs_3_0               
       
        default_params               
        {
            param_named_auto worldViewProj worldviewproj_matrix      
        }
    }

    fragment_program DoF_DepthOfFieldFP_cg cg
    {
       source DoF.cg
       entry_point DoF_DepthOfFieldFP_cg
       profiles ps_3_0
    }



    /*********************************************************************************/


    material DoF_Depth
    {
      technique cg
      {
        pass
        {
          vertex_program_ref DoF_DepthVP_cg
          {
          }

          fragment_program_ref DoF_DepthFP_cg
          {
            //trouver de bonnes valeurs // dofParams coefficients: x = near blur depth; y = focal plane depth; z = far blur depth,  w = blurriness cutoff constant for objects behind the focal plane
            param_named dofParams float4 0.3 0.3 0.3 0.3
          }
        }
      }
     
      technique GLSL
      {
        pass
        {
          vertex_program_ref DoF_DepthVP_GLSL
          {
          }

          fragment_program_ref DoF_DepthFP_GLSL
          {
          }
        }
      }
    }


    /////////////////////////////////////////////////////////////////////


    material DoF_Gaussian3x3
    {
      technique cg
      {
        pass
        {
          vertex_program_ref DoF_Gaussian3x3VP_cg
          {
          }
         
          fragment_program_ref DoF_Gaussian3x3FP_cg
          {
            param_named pixelSize float3 0.03 0.03 0.03
          }

          texture_unit source
          {
            tex_address_mode clamp
          }
        }
      }
     
     
      technique GLSL
      {
        pass
        {
          fragment_program_ref DoF_Gaussian3x3FP_GLSL
          {
          }

          texture_unit source
          {
            tex_address_mode clamp
          }
        }
      }
    }



    /////////////////////////////////////////////////////////////////////



    material DoF_DepthOfField
    {
      technique cg
      {
        pass
        {
          vertex_program_ref DoF_DepthOfFieldVP_cg
          {
          }
         
          fragment_program_ref DoF_DepthOfFieldFP_cg
          {
            param_named pixelSizeScene float3 0.03 0.03 0.03
            param_named pixelSizeBlur float3 0.03 0.03 0.03
          }

          texture_unit scene
          {
            tex_address_mode clamp
          }

          texture_unit depth
          {
            tex_address_mode clamp
            texture DoF_Depth
          }

          texture_unit blur
          {
            tex_address_mode clamp
          }
        }
      }
     
     
     
      technique GLSL
      {
        pass
        {
          fragment_program_ref DoF_DepthOfFieldFP_GLSL
          {
          }

          texture_unit scene
          {
            tex_address_mode clamp
          }

          texture_unit depth
          {
            tex_address_mode clamp
            texture DoF_Depth
          }

          texture_unit blur
          {
            tex_address_mode clamp
          }
        }
      }
    }

    material DoF_FocusArea
    {
      technique
      {
        pass
        {
          scene_blend alpha_blend
         
          texture_unit
          {
            texture focus.png
            alpha_op_ex modulate src_texture src_manual 0.2
          }
        }
      }
    }

	material DoF_DepthDebug
	{
      technique
      {
        pass
        {
			texture_unit
			{
			}
        }
      }
	}