// MariFX main handler

Class MariFXHandler : StaticEventHandler
{
	override void RenderOverlay( RenderEvent e )
	{
		PlayerInfo p = players[consoleplayer];
		// GLOBAL TOGGLE
		if ( !mfx_enabled )
		{
			Shader.SetEnabled(p,"mfx_lumasharp",false);
			Shader.SetEnabled(p,"mfx_grain",false);
			Shader.SetEnabled(p,"mfx_dirt",false);
			Shader.SetEnabled(p,"mfx_grading",false);
			Shader.SetEnabled(p,"mfx_lutgrading",false);
			Shader.SetEnabled(p,"mfx_technicolor",false);
			Shader.SetEnabled(p,"mfx_colormatrix",false);
			Shader.SetEnabled(p,"mfx_huesaturation",false);
			Shader.SetEnabled(p,"mfx_bss_blur",false);
			Shader.SetEnabled(p,"mfx_bss_sharp",false);
			Shader.SetEnabled(p,"mfx_bss_shift",false);
			Shader.SetEnabled(p,"mfx_borderblur",false);
			Shader.SetEnabled(p,"mfx_vignette",false);
			Shader.SetEnabled(p,"mfx_paint_pass1",false);
			Shader.SetEnabled(p,"mfx_paint_pass2",false);
			Shader.SetEnabled(p,"mfx_paint_pass3",false);
			Shader.SetEnabled(p,"mfx_retrofx",false);
			Shader.SetEnabled(p,"mfx_palette",false);
			Shader.SetEnabled(p,"mfx_palette_naive",false);
			return;
		}
		// LUMA SHARPEN
		Shader.SetEnabled(p,"mfx_lumasharp",mfx_lsharpenable);
		Shader.SetUniform1f(p,"mfx_lumasharp","sharpradius",mfx_lsharpradius);
		Shader.SetUniform1f(p,"mfx_lumasharp","sharpclamp",mfx_lsharpclamp);
		Shader.SetUniform1f(p,"mfx_lumasharp","sharpblend",mfx_lsharpblend);
		// FILM GRAIN
		Shader.SetEnabled(p,"mfx_grain",mfx_ne);
		Shader.SetUniform1f(p,"mfx_grain","nf",mfx_nf/10.);
		Shader.SetUniform1f(p,"mfx_grain","ni",mfx_ni);
		Shader.SetUniform1f(p,"mfx_grain","ns",mfx_ns);
		Shader.SetUniform3f(p,"mfx_grain","nm1",(mfx_nm1_r,mfx_nm1_g,mfx_nm1_b));
		Shader.SetUniform1f(p,"mfx_grain","nk",mfx_nk);
		Shader.SetUniform3f(p,"mfx_grain","nm2",(mfx_nm2_r,mfx_nm2_g,mfx_nm2_b));
		Shader.SetUniform1f(p,"mfx_grain","np",mfx_np);
		Shader.SetUniform1f(p,"mfx_grain","bnp",mfx_bnp);
		Shader.SetUniform1i(p,"mfx_grain","nb",mfx_nb);
		Shader.SetUniform1f(p,"mfx_grain","Timer",(gametic+e.fractic)/35.);
		// SCREEN DIRT
		Shader.SetEnabled(p,"mfx_dirt",mfx_dirtenable);
		Shader.SetUniform1f(p,"mfx_dirt","dirtmc",mfx_dirtmc);
		Shader.SetUniform1f(p,"mfx_dirt","dirtcfactor",mfx_dirtcfactor);
		// TONEMAP
		switch ( mfx_tenable )
		{
		case 1:
			Shader.SetEnabled(p,"mfx_tonemap_reinhard",true);
			Shader.SetEnabled(p,"mfx_tonemap_uc2",false);
			Shader.SetEnabled(p,"mfx_tonemap_hejldawson",false);
			Shader.SetUniform1f(p,"mfx_tonemap_reinhard","texposure",mfx_texposure);
			Shader.SetUniform1f(p,"mfx_tonemap_reinhard","tblend",mfx_tblend);
			break;
		case 2:
			Shader.SetEnabled(p,"mfx_tonemap_reinhard",false);
			Shader.SetEnabled(p,"mfx_tonemap_uc2",true);
			Shader.SetEnabled(p,"mfx_tonemap_hejldawson",false);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","texposure",mfx_texposure);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","tblend",mfx_tblend);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","unA",mfx_una);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","unB",mfx_unb);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","unC",mfx_unc);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","unD",mfx_und);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","unE",mfx_une);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","unF",mfx_unf);
			Shader.SetUniform1f(p,"mfx_tonemap_uc2","unW",mfx_unw);
			break;
		case 3:
			Shader.SetEnabled(p,"mfx_tonemap_reinhard",false);
			Shader.SetEnabled(p,"mfx_tonemap_uc2",false);
			Shader.SetEnabled(p,"mfx_tonemap_hejldawson",true);
			Shader.SetUniform1f(p,"mfx_tonemap_hejldawson","texposure",mfx_texposure);
			Shader.SetUniform1f(p,"mfx_tonemap_hejldawson","tblend",mfx_tblend);
			break;
		default:
			Shader.SetEnabled(p,"mfx_tonemap_reinhard",false);
			Shader.SetEnabled(p,"mfx_tonemap_uc2",false);
			Shader.SetEnabled(p,"mfx_tonemap_hejldawson",false);
			break;
		}
		// COLOR GRADING
		Shader.SetEnabled(p,"mfx_grading",mfx_gradeenable);
		Shader.SetUniform3f(p,"mfx_grading","grademul",(mfx_grademul_r,mfx_grademul_g,mfx_grademul_b));
		Shader.SetUniform3f(p,"mfx_grading","gradepow",(mfx_gradepow_r,mfx_gradepow_g,mfx_gradepow_b));
		Shader.SetUniform3f(p,"mfx_grading","gradecol",(mfx_gradecol_r,mfx_gradecol_g,mfx_gradecol_b));
		Shader.SetUniform1f(p,"mfx_grading","gradecolfact",mfx_gradecolfact);
		Shader.SetUniform1f(p,"mfx_grading","gradesatmul",mfx_gradesatmul);
		Shader.SetUniform1f(p,"mfx_grading","gradesatpow",mfx_gradesatpow);
		Shader.SetUniform1f(p,"mfx_grading","gradevalmul",mfx_gradevalmul);
		Shader.SetUniform1f(p,"mfx_grading","gradevalpow",mfx_gradevalpow);
		// LUT GRADING
		Shader.SetEnabled(p,"mfx_lutgrading",mfx_lutenable);
		Shader.SetUniform1i(p,"mfx_lutgrading","lutindex",mfx_lutindex);
		Shader.SetUniform1f(p,"mfx_lutgrading","lutblend",mfx_lutblend);
		// TECHNICOLOR
		Shader.SetEnabled(p,"mfx_technicolor",mfx_techenable);
		Shader.SetUniform1f(p,"mfx_technicolor","techblend",mfx_techblend);
		// COLOR MATRIX
		Shader.SetEnabled(p,"mfx_colormatrix",mfx_cmatenable);
		Shader.SetUniform3f(p,"mfx_colormatrix","redrow",(mfx_cmat_rr,mfx_cmat_rg,mfx_cmat_rb));
		Shader.SetUniform3f(p,"mfx_colormatrix","greenrow",(mfx_cmat_gr,mfx_cmat_gg,mfx_cmat_gb));
		Shader.SetUniform3f(p,"mfx_colormatrix","bluerow",(mfx_cmat_br,mfx_cmat_bg,mfx_cmat_bb));
		// HUE-SATURATION
		Shader.SetEnabled(p,"mfx_huesaturation",mfx_hsenable);
		Shader.SetUniform1f(p,"mfx_huesaturation","hsover",mfx_hsover);
		Shader.SetUniform1f(p,"mfx_huesaturation","hshue_a",mfx_hshue_a);
		Shader.SetUniform1f(p,"mfx_huesaturation","hssat_a",mfx_hssat_a);
		Shader.SetUniform1f(p,"mfx_huesaturation","hsval_a",mfx_hsval_a);
		Shader.SetUniform1f(p,"mfx_huesaturation","hshue_r",mfx_hshue_r);
		Shader.SetUniform1f(p,"mfx_huesaturation","hssat_r",mfx_hssat_r);
		Shader.SetUniform1f(p,"mfx_huesaturation","hsval_r",mfx_hsval_r);
		Shader.SetUniform1f(p,"mfx_huesaturation","hshue_y",mfx_hshue_y);
		Shader.SetUniform1f(p,"mfx_huesaturation","hssat_y",mfx_hssat_y);
		Shader.SetUniform1f(p,"mfx_huesaturation","hsval_y",mfx_hsval_y);
		Shader.SetUniform1f(p,"mfx_huesaturation","hshue_g",mfx_hshue_g);
		Shader.SetUniform1f(p,"mfx_huesaturation","hssat_g",mfx_hssat_g);
		Shader.SetUniform1f(p,"mfx_huesaturation","hsval_g",mfx_hsval_g);
		Shader.SetUniform1f(p,"mfx_huesaturation","hshue_c",mfx_hshue_c);
		Shader.SetUniform1f(p,"mfx_huesaturation","hssat_c",mfx_hssat_c);
		Shader.SetUniform1f(p,"mfx_huesaturation","hsval_c",mfx_hsval_c);
		Shader.SetUniform1f(p,"mfx_huesaturation","hshue_b",mfx_hshue_b);
		Shader.SetUniform1f(p,"mfx_huesaturation","hssat_b",mfx_hssat_b);
		Shader.SetUniform1f(p,"mfx_huesaturation","hsval_b",mfx_hsval_b);
		Shader.SetUniform1f(p,"mfx_huesaturation","hshue_m",mfx_hshue_m);
		Shader.SetUniform1f(p,"mfx_huesaturation","hssat_m",mfx_hssat_m);
		Shader.SetUniform1f(p,"mfx_huesaturation","hsval_m",mfx_hsval_m);
		// BLURSHARPSHIFT
		Shader.SetEnabled(p,"mfx_bss_blur",mfx_bssblurenable);
		Shader.SetUniform1f(p,"mfx_bss_blur","bssblurradius",mfx_bssblurradius);
		Shader.SetEnabled(p,"mfx_bss_sharp",mfx_bsssharpenable);
		Shader.SetUniform1f(p,"mfx_bss_sharp","bsssharpradius",mfx_bsssharpradius);
		Shader.SetUniform1f(p,"mfx_bss_sharp","bsssharpamount",mfx_bsssharpamount);
		Shader.SetEnabled(p,"mfx_bss_shift",mfx_bssshiftenable);
		Shader.SetUniform1f(p,"mfx_bss_shift","bssshiftradius",mfx_bssshiftradius);
		// VIGNETTE / BORDER BLUR
		Shader.SetEnabled(p,"mfx_borderblur",mfx_bblurenable);
		Shader.SetUniform1f(p,"mfx_borderblur","vigpow",mfx_vigpow);
		Shader.SetUniform1f(p,"mfx_borderblur","vigmul",mfx_vigmul);
		Shader.SetUniform1f(p,"mfx_borderblur","vigbump",mfx_vigbump);
		Shader.SetUniform1i(p,"mfx_borderblur","vigshape",mfx_vigshape);
		Shader.SetUniform1f(p,"mfx_borderblur","bblurpow",mfx_bblurpow);
		Shader.SetUniform1f(p,"mfx_borderblur","bblurmul",mfx_bblurmul);
		Shader.SetUniform1f(p,"mfx_borderblur","bblurbump",mfx_bblurbump);
		Shader.SetUniform1f(p,"mfx_borderblur","bblurradius",mfx_bblurradius);
		Shader.SetEnabled(p,"mfx_vignette",mfx_vigenable);
		Shader.SetUniform3f(p,"mfx_vignette","vigcolor",(mfx_vigcolor_r,mfx_vigcolor_g,mfx_vigcolor_b));
		Shader.SetUniform1f(p,"mfx_vignette","vigpow",mfx_vigpow);
		Shader.SetUniform1f(p,"mfx_vignette","vigmul",mfx_vigmul);
		Shader.SetUniform1f(p,"mfx_vignette","vigbump",mfx_vigbump);
		Shader.SetUniform1i(p,"mfx_vignette","vigshape",mfx_vigshape);
		Shader.SetUniform1i(p,"mfx_vignette","vigmode",mfx_vigmode);
		// PAINTING
		Shader.SetEnabled(p,"mfx_paint_pass1",mfx_paintenable);
		Shader.SetEnabled(p,"mfx_paint_pass2",mfx_paintenable);
		Shader.SetEnabled(p,"mfx_paint_pass3",mfx_paintenable);
		// RETRO FX
		Vector2 rresl = (Screen.GetWidth(),Screen.GetHeight());
		Vector2 bresl = rresl;
		switch ( mfx_retroscalemode )
		{
		case 0:
			bresl = (CleanWidth,CleanHeight);
			break;
		case 1:
			bresl = (CleanWidth_1,CleanHeight_1);
			break;
		case 2:
			bresl = (max(1,rresl.x*mfx_bscl_x),max(1,rresl.y*mfx_bscl_y));
			break;
		case 3:
			bresl = (clamp(mfx_bres_x,1,rresl.x),clamp(mfx_bres_y,1,rresl.y));
			break;
		}
		Shader.SetEnabled(p,"mfx_retrofx",mfx_retroenable);
		Shader.SetUniform2f(p,"mfx_retrofx","bresl",bresl);
		if ( mfx_palnaive )
		{
			Shader.SetEnabled(p,"mfx_palette",false);
			Shader.SetEnabled(p,"mfx_palette_naive",mfx_palenable);
			Shader.SetUniform2f(p,"mfx_palette_naive","sfact",mfx_retroenable?bresl:rresl);
			Shader.SetUniform1f(p,"mfx_palette_naive","palsat",mfx_palsat);
			Shader.SetUniform1f(p,"mfx_palette_naive","palpow",mfx_palpow);
			bool dospread = true;
			switch ( mfx_paldither )
			{
			case 0:
				Shader.SetUniform1i(p,"mfx_palette_naive","dsize",2);
				Shader.SetUniform1i(p,"mfx_palette_naive","doffset",0);
				break;
			case 1:
				Shader.SetUniform1i(p,"mfx_palette_naive","dsize",2);
				Shader.SetUniform1i(p,"mfx_palette_naive","doffset",2);
				break;
			case 2:
				Shader.SetUniform1i(p,"mfx_palette_naive","dsize",4);
				Shader.SetUniform1i(p,"mfx_palette_naive","doffset",4);
				break;
			case 3:
				Shader.SetUniform1i(p,"mfx_palette_naive","dsize",8);
				Shader.SetUniform1i(p,"mfx_palette_naive","doffset",8);
				break;
			case 4:
				Shader.SetUniform1i(p,"mfx_palette_naive","dsize",16);
				Shader.SetUniform1i(p,"mfx_palette_naive","doffset",16);
				break;
			default:
				Shader.SetUniform1i(p,"mfx_palette_naive","dsize",1);
				Shader.SetUniform1i(p,"mfx_palette_naive","doffset",0);
				dospread = false;
				break;
			}
			Shader.SetUniform1f(p,"mfx_palette_naive","paldither",dospread?mfx_palspread:0.);
			Shader.SetUniform1i(p,"mfx_palette_naive","palnum",mfx_palnum);
		}
		else
		{
			Shader.SetEnabled(p,"mfx_palette_naive",false);
			Shader.SetEnabled(p,"mfx_palette",mfx_palenable);
			Shader.SetUniform2f(p,"mfx_palette","sfact",mfx_retroenable?bresl:rresl);
			Shader.SetUniform1f(p,"mfx_palette","palsat",mfx_palsat);
			Shader.SetUniform1f(p,"mfx_palette","palpow",mfx_palpow);
			Shader.SetUniform1i(p,"mfx_palette","paldepth",int(2.**mfx_paldepth)-1);
			switch ( mfx_paldither )
			{
			case 0:
				Shader.SetUniform1i(p,"mfx_palette","dsize",2);
				Shader.SetUniform1i(p,"mfx_palette","doffset",0);
				break;
			case 1:
				Shader.SetUniform1i(p,"mfx_palette","dsize",2);
				Shader.SetUniform1i(p,"mfx_palette","doffset",2);
				break;
			case 2:
				Shader.SetUniform1i(p,"mfx_palette","dsize",4);
				Shader.SetUniform1i(p,"mfx_palette","doffset",4);
				break;
			case 3:
				Shader.SetUniform1i(p,"mfx_palette","dsize",8);
				Shader.SetUniform1i(p,"mfx_palette","doffset",8);
				break;
			case 4:
				Shader.SetUniform1i(p,"mfx_palette","dsize",16);
				Shader.SetUniform1i(p,"mfx_palette","doffset",16);
				break;
			default:
				Shader.SetUniform1i(p,"mfx_palette","dsize",1);
				Shader.SetUniform1i(p,"mfx_palette","doffset",0);
				break;
			}
			Shader.SetUniform1i(p,"mfx_palette","palnum",mfx_palnum);
		}
	}
	override void ConsoleProcess( ConsoleEvent e )
	{
		PlayerInfo p = players[consoleplayer];
		if ( e.Name ~== "loadmfxpreset" )
		{
			int slot = clamp(mfx_presetslot,0,MFX_NUMPRESETS-1);
			MFXPresetUtility.LoadPreset(slot);
		}
		else if ( e.Name ~== "savemfxpreset" )
		{
			int slot = clamp(mfx_presetslot,0,MFX_NUMPRESETS-1);
			MFXPresetUtility.SavePreset(slot);
		}
		else if ( e.Name ~== "resetmfxvars" )
		{
			switch( e.args[0] )
			{
			case 0:
				CVar.FindCVar('mfx_ne').ResetToDefault();
				CVar.FindCVar('mfx_ni').ResetToDefault();
				CVar.FindCVar('mfx_nf').ResetToDefault();
				CVar.FindCVar('mfx_ns').ResetToDefault();
				CVar.FindCVar('mfx_np').ResetToDefault();
				CVar.FindCVar('mfx_nm1_r').ResetToDefault();
				CVar.FindCVar('mfx_nm1_g').ResetToDefault();
				CVar.FindCVar('mfx_nm1_b').ResetToDefault();
				CVar.FindCVar('mfx_nk').ResetToDefault();
				CVar.FindCVar('mfx_nm2_r').ResetToDefault();
				CVar.FindCVar('mfx_nm2_g').ResetToDefault();
				CVar.FindCVar('mfx_nm2_b').ResetToDefault();
				CVar.FindCVar('mfx_bnp').ResetToDefault();
				CVar.FindCVar('mfx_nb').ResetToDefault();
				break;
			case 1:
				CVar.FindCVar('mfx_dirtenable').ResetToDefault();
				CVar.FindCVar('mfx_dirtmc').ResetToDefault();
				CVar.FindCVar('mfx_dirtcfactor').ResetToDefault();
				break;
			case 2:
				CVar.FindCVar('mfx_gradeenable').ResetToDefault();
				CVar.FindCVar('mfx_grademul_r').ResetToDefault();
				CVar.FindCVar('mfx_grademul_g').ResetToDefault();
				CVar.FindCVar('mfx_grademul_b').ResetToDefault();
				CVar.FindCVar('mfx_gradepow_r').ResetToDefault();
				CVar.FindCVar('mfx_gradepow_g').ResetToDefault();
				CVar.FindCVar('mfx_gradepow_b').ResetToDefault();
				CVar.FindCVar('mfx_gradecol_r').ResetToDefault();
				CVar.FindCVar('mfx_gradecol_g').ResetToDefault();
				CVar.FindCVar('mfx_gradecol_b').ResetToDefault();
				CVar.FindCVar('mfx_gradecolfact').ResetToDefault();
				CVar.FindCVar('mfx_gradesatmul').ResetToDefault();
				CVar.FindCVar('mfx_gradesatpow').ResetToDefault();
				CVar.FindCVar('mfx_gradevalmul').ResetToDefault();
				CVar.FindCVar('mfx_gradevalpow').ResetToDefault();
				break;
			case 3:
				CVar.FindCVar('mfx_cmatenable').ResetToDefault();
				CVar.FindCVar('mfx_cmat_rr').ResetToDefault();
				CVar.FindCVar('mfx_cmat_rg').ResetToDefault();
				CVar.FindCVar('mfx_cmat_rb').ResetToDefault();
				CVar.FindCVar('mfx_cmat_gr').ResetToDefault();
				CVar.FindCVar('mfx_cmat_gg').ResetToDefault();
				CVar.FindCVar('mfx_cmat_gb').ResetToDefault();
				CVar.FindCVar('mfx_cmat_br').ResetToDefault();
				CVar.FindCVar('mfx_cmat_bg').ResetToDefault();
				CVar.FindCVar('mfx_cmat_bb').ResetToDefault();
				break;
			case 4:
				CVar.FindCVar('mfx_hsenable').ResetToDefault();
				CVar.FindCVar('mfx_hsover').ResetToDefault();
				CVar.FindCVar('mfx_hshue_a').ResetToDefault();
				CVar.FindCVar('mfx_hssat_a').ResetToDefault();
				CVar.FindCVar('mfx_hsval_a').ResetToDefault();
				CVar.FindCVar('mfx_hshue_r').ResetToDefault();
				CVar.FindCVar('mfx_hssat_r').ResetToDefault();
				CVar.FindCVar('mfx_hsval_r').ResetToDefault();
				CVar.FindCVar('mfx_hshue_y').ResetToDefault();
				CVar.FindCVar('mfx_hssat_y').ResetToDefault();
				CVar.FindCVar('mfx_hsval_y').ResetToDefault();
				CVar.FindCVar('mfx_hshue_g').ResetToDefault();
				CVar.FindCVar('mfx_hssat_g').ResetToDefault();
				CVar.FindCVar('mfx_hsval_g').ResetToDefault();
				CVar.FindCVar('mfx_hshue_c').ResetToDefault();
				CVar.FindCVar('mfx_hssat_c').ResetToDefault();
				CVar.FindCVar('mfx_hsval_c').ResetToDefault();
				CVar.FindCVar('mfx_hshue_b').ResetToDefault();
				CVar.FindCVar('mfx_hssat_b').ResetToDefault();
				CVar.FindCVar('mfx_hsval_b').ResetToDefault();
				CVar.FindCVar('mfx_hshue_m').ResetToDefault();
				CVar.FindCVar('mfx_hssat_m').ResetToDefault();
				CVar.FindCVar('mfx_hsval_m').ResetToDefault();
				break;
			case 5:
				CVar.FindCVar('mfx_bssblurenable').ResetToDefault();
				CVar.FindCVar('mfx_bssblurradius').ResetToDefault();
				CVar.FindCVar('mfx_bsssharpenable').ResetToDefault();
				CVar.FindCVar('mfx_bsssharpradius').ResetToDefault();
				CVar.FindCVar('mfx_bsssharpamount').ResetToDefault();
				CVar.FindCVar('mfx_bssshiftenable').ResetToDefault();
				CVar.FindCVar('mfx_bssshiftradius').ResetToDefault();
				break;
			case 6:
				CVar.FindCVar('mfx_bblurenable').ResetToDefault();
				CVar.FindCVar('mfx_bblurpow').ResetToDefault();
				CVar.FindCVar('mfx_bblurmul').ResetToDefault();
				CVar.FindCVar('mfx_bblurbump').ResetToDefault();
				CVar.FindCVar('mfx_bblurradius').ResetToDefault();
				CVar.FindCVar('mfx_vigenable').ResetToDefault();
				CVar.FindCVar('mfx_vigcolor_r').ResetToDefault();
				CVar.FindCVar('mfx_vigcolor_g').ResetToDefault();
				CVar.FindCVar('mfx_vigcolor_b').ResetToDefault();
				CVar.FindCVar('mfx_vigpow').ResetToDefault();
				CVar.FindCVar('mfx_vigmul').ResetToDefault();
				CVar.FindCVar('mfx_vigbump').ResetToDefault();
				CVar.FindCVar('mfx_vigshape').ResetToDefault();
				CVar.FindCVar('mfx_vigmode').ResetToDefault();
				break;
			case 7:
				CVar.FindCVar('mfx_retroenable').ResetToDefault();
				CVar.FindCVar('mfx_retroscalemode').ResetToDefault();
				CVar.FindCVar('mfx_bres_x').ResetToDefault();
				CVar.FindCVar('mfx_bres_y').ResetToDefault();
				CVar.FindCVar('mfx_bscl_x').ResetToDefault();
				CVar.FindCVar('mfx_bscl_y').ResetToDefault();
				CVar.FindCVar('mfx_palenable').ResetToDefault();
				CVar.FindCVar('mfx_palnum').ResetToDefault();
				CVar.FindCVar('mfx_palsat').ResetToDefault();
				CVar.FindCVar('mfx_palpow').ResetToDefault();
				CVar.FindCVar('mfx_palnaive').ResetToDefault();
				CVar.FindCVar('mfx_paldither').ResetToDefault();
				CVar.FindCVar('mfx_paldepth').ResetToDefault();
				CVar.FindCVar('mfx_palspread').ResetToDefault();
				break;
			case 8:
				CVar.FindCVar('mfx_lsharpenable').ResetToDefault();
				CVar.FindCVar('mfx_lsharpradius').ResetToDefault();
				CVar.FindCVar('mfx_lsharpclamp').ResetToDefault();
				CVar.FindCVar('mfx_lsharpblend').ResetToDefault();
				break;
			case 9:
				CVar.FindCVar('mfx_lutenable').ResetToDefault();
				CVar.FindCVar('mfx_lutindex').ResetToDefault();
				CVar.FindCVar('mfx_lutblend').ResetToDefault();
				break;
			case 10:
				CVar.FindCVar('mfx_techenable').ResetToDefault();
				CVar.FindCVar('mfx_techblend').ResetToDefault();
				break;
			case 11:
				CVar.FindCVar('mfx_paintenable').ResetToDefault();
				break;
			case 12:
				CVar.FindCVar('mfx_tenable').ResetToDefault();
				CVar.FindCVar('mfx_texposure').ResetToDefault();
				CVar.FindCVar('mfx_tblend').ResetToDefault();
				CVar.FindCVar('mfx_una').ResetToDefault();
				CVar.FindCVar('mfx_unb').ResetToDefault();
				CVar.FindCVar('mfx_unc').ResetToDefault();
				CVar.FindCVar('mfx_und').ResetToDefault();
				CVar.FindCVar('mfx_une').ResetToDefault();
				CVar.FindCVar('mfx_unf').ResetToDefault();
				CVar.FindCVar('mfx_unw').ResetToDefault();
				break;
			}
		}
	}
}
