diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/c_func_lod.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/c_func_lod.cpp')
| -rw-r--r-- | game/client/c_func_lod.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/game/client/c_func_lod.cpp b/game/client/c_func_lod.cpp new file mode 100644 index 0000000..766cced --- /dev/null +++ b/game/client/c_func_lod.cpp @@ -0,0 +1,67 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#include "cbase.h" +#include "view.h" +#include "iviewrender.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class C_Func_LOD : public C_BaseEntity +{ +public: + DECLARE_CLASS( C_Func_LOD, C_BaseEntity ); + DECLARE_CLIENTCLASS(); + + C_Func_LOD(); + +// C_BaseEntity overrides. +public: + + unsigned char GetClientSideFade(); + +public: +// Replicated vars from the server. +// These are documented in the server-side entity. +public: + float m_fDisappearDist; +}; + + +ConVar lod_TransitionDist("lod_TransitionDist", "800"); + + +// ------------------------------------------------------------------------- // +// Tables. +// ------------------------------------------------------------------------- // + +// Datatable.. +IMPLEMENT_CLIENTCLASS_DT(C_Func_LOD, DT_Func_LOD, CFunc_LOD) + RecvPropFloat(RECVINFO(m_fDisappearDist)), +END_RECV_TABLE() + + + +// ------------------------------------------------------------------------- // +// C_Func_LOD implementation. +// ------------------------------------------------------------------------- // + +C_Func_LOD::C_Func_LOD() +{ + m_fDisappearDist = 5000.0f; +} + +//----------------------------------------------------------------------------- +// Purpose: Calculate a fade. +//----------------------------------------------------------------------------- +unsigned char C_Func_LOD::GetClientSideFade() +{ + return UTIL_ComputeEntityFade( this, m_fDisappearDist, m_fDisappearDist + lod_TransitionDist.GetFloat(), 1.0f ); +} + + |