From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- engine/initmathlib.cpp | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 engine/initmathlib.cpp (limited to 'engine/initmathlib.cpp') diff --git a/engine/initmathlib.cpp b/engine/initmathlib.cpp new file mode 100644 index 0000000..9628305 --- /dev/null +++ b/engine/initmathlib.cpp @@ -0,0 +1,67 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + + +#include "mathlib/mathlib.h" +#include "convar.h" // ConVar define +#include "view.h" +#include "gl_cvars.h" // mat_overbright +#include "cmd.h" // Cmd_* +#include "console.h" // ConMsg + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +static bool s_bAllow3DNow = true; +static bool s_bAllowSSE2 = true; + +void InitMathlib( void ) +{ + MathLib_Init( 2.2f, // v_gamma.GetFloat() + 2.2f, // v_texgamma.GetFloat() + 0.0f /*v_brightness.GetFloat() */, + 2.0f /*mat_overbright.GetInt() */, s_bAllow3DNow, true, s_bAllowSSE2, true ); +} + +/* +=============== +R_SSE2 +=============== +*/ +CON_COMMAND( r_sse2, "Enable/disable SSE2 code" ) +{ + if (args.ArgC() == 1) + { + s_bAllowSSE2 = true; + } + else + { + s_bAllowSSE2 = atoi( args[1] ) ? true : false; + } + + InitMathlib(); + ConMsg( "SSE2 code is %s\n", MathLib_SSE2Enabled() ? "enabled" : "disabled" ); +} + +/* +=============== +R_3DNow +=============== +*/ +CON_COMMAND( r_3dnow, "Enable/disable 3DNow code" ) +{ + if (args.ArgC() == 1) + { + s_bAllow3DNow = true; + } + else + { + s_bAllow3DNow = atoi( args[1] ) ? true : false; + } + + InitMathlib(); + ConMsg( "3DNow code is %s\n", MathLib_3DNowEnabled() ? "enabled" : "disabled" ); +} \ No newline at end of file -- cgit v1.2.3