summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR/TrackIR.h
blob: 81df17c746b3d311451dcfbc1a7ba16200c9559a (plain)
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
// Retro 26/09/03

//#define DEBUG_TRACKIR_STUFF

class TrackIR {
public:
	TrackIR()
			{	FrameSignature = missedFrameCount = Pit_2d_Yaw = Pit_2d_Yaw = 0;
				panningAllowed = isActive = true;
				yaw = pitch = roll = x = y = z = 0;
			};
	~TrackIR() {};

	void InitTrackIR(HWND);
	void ExitTrackIR();

	void Allow_2D_Panning()		{ panningAllowed = true; }
	bool Get_Panning_Allowed()	{ return panningAllowed; }

	void GetTrackIR_ViewValues(float*, float*);	// for 3d cockpit panning, gets yaw/pitch values in radians
	int TrackIR_2D_Map();						// for 2d cockpit panning, returns POV_N, POV_S, POV_E, POV_W values, -1 for neutral

	float getYaw() { return yaw; }
	float getPitch() { return pitch; }
	float getRoll() { return roll; }
	float getX() { return x; }
	float getY() { return y; }
	float getZ() { return z;}

	void Poll();

private:
	unsigned long FrameSignature;
	unsigned long missedFrameCount;

	bool panningAllowed;

	bool isActive;	// flag indicating if the TIR receives updates.. eg when the user hits F9 (stop TIR) then this one gets false after
					// a set time of frames (100 for now). This is used to give control back to keyboard/mouse in case tir is switched off
					// ONLY FOR THE 3d PIT THOUGHT - 2D pit just returns -1 ("don´t pan")

	int Pit_2d_Yaw;
	int Pit_2d_Pitch;

	float yaw, pitch, roll, x, y, z;
};