-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathKinectV1Device.h
67 lines (53 loc) · 1.49 KB
/
KinectV1Device.h
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
#include "stdafx.h"
#include <NuiApi.h>
namespace KinectOsvr {
class KinectV1Device {
public:
KinectV1Device(OSVR_PluginRegContext ctx, INuiSensor* pNuiSensor);
~KinectV1Device();
OSVR_ReturnCode update();
static bool Detect(INuiSensor** ppNuiSensor);
enum BodyTrackingState {
CannotBeTracked,
CanBeTracked,
ShouldNotBeTracked,
ShouldBeTracked
};
void toggleSeatedMode();
BodyTrackingState *getBodyStates();
void setTrackedBody(int i);
void recenter();
struct ui_thread_data
{
std::mutex mutex;
KinectV1Device *kinect;
bool end = false;
};
static void ui_thread(ui_thread_data& data);
static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
void ProcessBody(NUI_SKELETON_FRAME* pSkeletons);
void IdentifyBodies(NUI_SKELETON_FRAME* pSkeletons);
osvr::pluginkit::DeviceToken m_dev;
OSVR_TrackerDeviceInterface m_tracker;
OSVR_AnalogDeviceInterface m_analog;
OSVR_ButtonDeviceInterface m_button;
INuiSensor* m_pNuiSensor;
HANDLE m_pSkeletonStreamHandle;
HANDLE m_hNextSkeletonEvent;
BodyTrackingState m_body_states[NUI_SKELETON_COUNT];
DWORD m_trackingId;
int m_trackedBody;
bool m_trackedBodyChanged;
Vector4 m_lastTrackedPosition;
LONGLONG m_lastTrackedTime;
bool m_firstUpdate;
OSVR_PoseState m_offset;
OSVR_PoseState m_kinectPose;
OSVR_TimeValue m_initializeTime;
LONGLONG m_initializeOffset;
std::thread *mThread;
ui_thread_data mThreadData;
bool m_seatedMode;
};
}