
local _Material		= Material( "pp/sharpen" )
local tex_MotionBlur	= render.GetMoBlurTex0()

/*---------------------------------------------------------
   Register the convars that will control this effect
---------------------------------------------------------*/   
CreateClientConVar( "pp_sharpen_contrast", "1", false, false )
CreateClientConVar( "pp_sharpen_distance", "1", false, false )
CreateClientConVar( "pp_sharpen", "0", false, false )


function DrawSharpen( contrast, distance )

	render.UpdateScreenEffectTexture()

	_Material:SetMaterialFloat( "$contrast", contrast )
	_Material:SetMaterialFloat( "$distance", distance / ScrW() )
	
	render.SetMaterial( _Material )
	render.DrawScreenQuad()
	
end

local function DrawInternal()

	if ( GetConVarNumber( "pp_sharpen" ) == 0 ) then return end
	if ( !GAMEMODE:PostProcessPermitted( "sharpen" ) ) then return end

	DrawSharpen( GetConVarNumber( "pp_sharpen_contrast" ), GetConVarNumber( "pp_sharpen_distance" ) );

end

hook.Add( "RenderScreenspaceEffects", "RenderSharpen", DrawInternal )