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.

51 lines
1.2 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef FX_INTERPVALUE_H
  7. #define FX_INTERPVALUE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. // Types of supported interpolation
  12. enum InterpType_t
  13. {
  14. INTERP_LINEAR = 0,
  15. INTERP_SPLINE,
  16. };
  17. class CInterpolatedValue
  18. {
  19. public:
  20. CInterpolatedValue( void );
  21. CInterpolatedValue( float startTime, float endTime, float startValue, float endValue, InterpType_t type );
  22. void SetTime( float start, float end );
  23. void SetRange( float start, float end );
  24. void SetType( InterpType_t type );
  25. // Set the value with no range
  26. void SetAbsolute( float value );
  27. // Set the value with range and time supplied
  28. void Init( float startValue, float endValue, float dt, InterpType_t type = INTERP_LINEAR );
  29. // Start from the current value and move towards the end value
  30. void InitFromCurrent( float endValue, float dt, InterpType_t type = INTERP_LINEAR );
  31. // Find our interpolated value at the given point in time
  32. float Interp( float curTime );
  33. private:
  34. float m_flStartTime;
  35. float m_flEndTime;
  36. float m_flStartValue;
  37. float m_flEndValue;
  38. int m_nInterpType;
  39. };
  40. #endif // FX_INTERPVALUE_H