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

/*---------------------------------------------------------
   Register the convars that will control this effect
---------------------------------------------------------*/   
local pp_sharpen_contrast 	= CreateClientConVar( "pp_sharpen_contrast", "1", false, false )
local pp_sharpen_distance	= CreateClientConVar( "pp_sharpen_distance", "1", false, false )
local pp_sharpen			= 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 ( !pp_sharpen:GetBool() ) then return end
	if ( !GAMEMODE:PostProcessPermitted( "sharpen" ) ) then return end

	DrawSharpen( pp_sharpen_contrast:GetFloat(), pp_sharpen_distance:GetFloat() );

end

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