aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/client/fx_interpvalue.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /sp/src/game/client/fx_interpvalue.h
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/game/client/fx_interpvalue.h')
-rw-r--r--sp/src/game/client/fx_interpvalue.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/sp/src/game/client/fx_interpvalue.h b/sp/src/game/client/fx_interpvalue.h
new file mode 100644
index 00000000..ea32c5ab
--- /dev/null
+++ b/sp/src/game/client/fx_interpvalue.h
@@ -0,0 +1,52 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#ifndef FX_INTERPVALUE_H
+#define FX_INTERPVALUE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+// Types of supported interpolation
+enum InterpType_t
+{
+ INTERP_LINEAR = 0,
+ INTERP_SPLINE,
+};
+
+class CInterpolatedValue
+{
+public:
+ CInterpolatedValue( void );
+ CInterpolatedValue( float startTime, float endTime, float startValue, float endValue, InterpType_t type );
+
+ void SetTime( float start, float end );
+ void SetRange( float start, float end );
+ void SetType( InterpType_t type );
+
+ // Set the value with no range
+ void SetAbsolute( float value );
+
+ // Set the value with range and time supplied
+ void Init( float startValue, float endValue, float dt, InterpType_t type = INTERP_LINEAR );
+
+ // Start from the current value and move towards the end value
+ void InitFromCurrent( float endValue, float dt, InterpType_t type = INTERP_LINEAR );
+
+ // Find our interpolated value at the given point in time
+ float Interp( float curTime );
+
+private:
+
+ float m_flStartTime;
+ float m_flEndTime;
+ float m_flStartValue;
+ float m_flEndValue;
+
+ int m_nInterpType;
+};
+
+#endif // FX_INTERPVALUE_H \ No newline at end of file