Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1019 B

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef SIMPLE_KEYS_H
  7. #define SIMPLE_KEYS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. enum simplekeyinterp_t
  12. {
  13. KEY_LINEAR = 0,
  14. KEY_SPLINE,
  15. KEY_ACCELERATE,
  16. KEY_DECELERATE,
  17. };
  18. class CSimpleKeyInterp : public Vector
  19. {
  20. public:
  21. CSimpleKeyInterp( float t, simplekeyinterp_t interp, float x, float y = 0, float z = 0 ) : Vector( x, y, z )
  22. {
  23. m_interp = interp;
  24. m_keyTime = t;
  25. }
  26. float GetTime() const { return m_keyTime; }
  27. // out = t*start + (1-t) * end (may be splinear or linear)
  28. static void Interp( Vector &out, float t, const CSimpleKeyInterp &start, const CSimpleKeyInterp &end );
  29. float m_keyTime;
  30. simplekeyinterp_t m_interp;
  31. };
  32. class CSimpleKeyList
  33. {
  34. public:
  35. int Insert( const CSimpleKeyInterp &key );
  36. bool Interp( Vector &out, float t );
  37. CUtlVector<CSimpleKeyInterp> m_list;
  38. };
  39. #endif // SIMPLE_KEYS_H