aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/client/simple_keys.h
blob: 1f3f0cd2936ed9ab8d69cd5bcf4f336195cda59f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#ifndef SIMPLE_KEYS_H
#define SIMPLE_KEYS_H
#ifdef _WIN32
#pragma once
#endif

enum simplekeyinterp_t
{
	KEY_LINEAR = 0,
	KEY_SPLINE,
	KEY_ACCELERATE,
	KEY_DECELERATE,
};

class CSimpleKeyInterp : public Vector
{
public:
	CSimpleKeyInterp( float t, simplekeyinterp_t interp, float x, float y = 0, float z = 0 ) : Vector( x, y, z ) 
	{
		m_interp = interp;
		m_keyTime = t;
	}
	
	float GetTime() const { return m_keyTime; }
	
	// out = t*start + (1-t) * end (may be splinear or linear)
	static void Interp( Vector &out, float t, const CSimpleKeyInterp &start, const CSimpleKeyInterp &end );

	float				m_keyTime;
	simplekeyinterp_t	m_interp;
};


class CSimpleKeyList
{
public:
	int		Insert( const CSimpleKeyInterp &key );
	bool	Interp( Vector &out, float t );

	CUtlVector<CSimpleKeyInterp>	m_list;
};

#endif // SIMPLE_KEYS_H