summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR/FTNoIR_cxx_protocolserver.h
blob: 6548a82fd27e231b496491e4c72210fdb69dcf38 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/********************************************************************************
* FTNoIR_cxx_protocolserver is the base Class for Game-protocol-servers.		*
*						    Using this, the tracker only needs to create one	*
*						    server and can use the same functions to			*
*							communicate with it.								*
*																				*
* Copyright (C) 2010	Wim Vriend (Developing)									*
*						Ron Hendriks (Testing and Research)						*
*																				*
* This program is free software; you can redistribute it and/or modify it		*
* under the terms of the GNU General Public License as published by the			*
* Free Software Foundation; either version 3 of the License, or (at your		*
* option) any later version.													*
*																				*
* This program is distributed in the hope that it will be useful, but			*
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY	*
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for	*
* more details.																	*
*																				*
* You should have received a copy of the GNU General Public License along		*
* with this program; if not, see <http://www.gnu.org/licenses/>.				*
*																				*
********************************************************************************/
#ifndef FTNOIR_CXX_PROTOCOLSERVER_H
#define FTNOIR_CXX_PROTOCOLSERVER_H

#include "Windows.h" 
//#include <QThread>
#include <QObject>

namespace v4friend
{
    namespace ftnoir
    {
		class ProtocolServerBase : public QObject // : public QThread
        {
		Q_OBJECT
        public:

			virtual ~ProtocolServerBase() {}

			//! @return true if the engine will produce data.
            /*! @see smEngineIsLicensed() */
			virtual bool isLicensed() const { return true; };
			virtual	QString GetProgramName() { return QString("Test"); };

			virtual bool checkServerInstallationOK ( HANDLE handle ) { return true; }
			virtual void sendHeadposeToGame() {}
			virtual void setVirtRotX(float rot) { virtRotX = rot; }
			virtual void setVirtRotY(float rot) { virtRotY = rot; }
			virtual void setVirtRotZ(float rot) { virtRotZ = rot; }
			virtual void setVirtPosX(float pos) { virtPosX = pos / 100.0f; }
			virtual void setVirtPosY(float pos) { virtPosY = pos / 100.0f; }
			virtual void setVirtPosZ(float pos) { virtPosZ = pos / 100.0f; }

			virtual void setHeadRotX(float x) { headRotX = x; }
			virtual void setHeadRotY(float y) { headRotY = y; }
			virtual void setHeadRotZ(float z) { headRotZ = z; }
			virtual void setHeadPosX(float x) { headPosX = x; }
			virtual void setHeadPosY(float y) { headPosY = y; }
			virtual void setHeadPosZ(float z) { headPosZ = z; }

        protected:
			ProtocolServerBase() {};

		public:
			/** member variables for saving the head pose **/
			float virtPosX;
			float virtPosY;
			float virtPosZ;
	
			float virtRotX;
			float virtRotY;
			float virtRotZ;

			float headPosX;
			float headPosY;
			float headPosZ;
	
			float headRotX;
			float headRotY;
			float headRotZ;

			float prevPosX;
			float prevPosY;
			float prevPosZ;
			float prevRotX;
			float prevRotY;
			float prevRotZ;

			//
			// Values for analysis of tracking...
			//
			float confidence;
			float smoothvalue;
			float prev_value;
			bool newSample;
			float dT;

		private:
            ProtocolServerBase(const ProtocolServerBase &);
            ProtocolServerBase &operator=(const ProtocolServerBase &);
            bool operator==(const ProtocolServerBase &) const;
        };
    }
}
#endif