diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/shared/apparent_velocity_helper.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/shared/apparent_velocity_helper.h')
| -rw-r--r-- | mp/src/game/shared/apparent_velocity_helper.h | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/mp/src/game/shared/apparent_velocity_helper.h b/mp/src/game/shared/apparent_velocity_helper.h index ac785c13..765a419d 100644 --- a/mp/src/game/shared/apparent_velocity_helper.h +++ b/mp/src/game/shared/apparent_velocity_helper.h @@ -1,74 +1,74 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================//
-
-#ifndef APPARENT_VELOCITY_HELPER_H
-#define APPARENT_VELOCITY_HELPER_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-
-inline float CalcDistance( float x, float y )
-{
- return x - y;
-}
-
-inline float CalcDistance( const Vector &a, const Vector &b )
-{
- return a.DistTo( b );
-}
-
-
-template<class T>
-class CDefaultCalcDistance
-{
-public:
- static inline float CalcDistance( const T &a, const T &b )
- {
- return ::CalcDistance( a, b );
- }
-};
-
-class CCalcDistance2D
-{
-public:
- static inline float CalcDistance( const Vector &a, const Vector &b )
- {
- return (a-b).Length2D();
- }
-};
-
-
-template< class T, class Functor=CDefaultCalcDistance<T> >
-class CApparentVelocity
-{
-public:
- CApparentVelocity()
- {
- m_LastTime = -1;
- }
-
- float AddSample( float time, T value )
- {
- float flRet = 0;
- if ( m_LastTime != -1 )
- {
- flRet = Functor::CalcDistance(value, m_LastValue) / (time - m_LastTime);
- }
-
- m_LastTime = time;
- m_LastValue = value;
-
- return flRet;
- }
-
-private:
- T m_LastValue;
- float m_LastTime;
-};
-
-
-#endif // APPARENT_VELOCITY_HELPER_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#ifndef APPARENT_VELOCITY_HELPER_H +#define APPARENT_VELOCITY_HELPER_H +#ifdef _WIN32 +#pragma once +#endif + + +inline float CalcDistance( float x, float y ) +{ + return x - y; +} + +inline float CalcDistance( const Vector &a, const Vector &b ) +{ + return a.DistTo( b ); +} + + +template<class T> +class CDefaultCalcDistance +{ +public: + static inline float CalcDistance( const T &a, const T &b ) + { + return ::CalcDistance( a, b ); + } +}; + +class CCalcDistance2D +{ +public: + static inline float CalcDistance( const Vector &a, const Vector &b ) + { + return (a-b).Length2D(); + } +}; + + +template< class T, class Functor=CDefaultCalcDistance<T> > +class CApparentVelocity +{ +public: + CApparentVelocity() + { + m_LastTime = -1; + } + + float AddSample( float time, T value ) + { + float flRet = 0; + if ( m_LastTime != -1 ) + { + flRet = Functor::CalcDistance(value, m_LastValue) / (time - m_LastTime); + } + + m_LastTime = time; + m_LastValue = value; + + return flRet; + } + +private: + T m_LastValue; + float m_LastTime; +}; + + +#endif // APPARENT_VELOCITY_HELPER_H |