-
Notifications
You must be signed in to change notification settings - Fork 1
/
SkeletalViewer.h
116 lines (94 loc) · 4.33 KB
/
SkeletalViewer.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
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
108
109
110
111
112
113
114
115
116
/************************************************************************
* *
* SkeletalViewer.h -- Declares of CSkeletalViewerApp class *
* *
* Copyright (c) Microsoft Corp. All rights reserved. *
* *
* This code is licensed under the terms of the *
* Microsoft Kinect for Windows SDK (Beta) *
* License Agreement: http://kinectforwindows.org/KinectSDK-ToU *
* *
************************************************************************/
#pragma once
#include "resource.h"
#include "MSR_NuiApi.h"
#include "DrawDevice.h"
#include "AviFile.h"
#include <btkAcquisitionFileWriter.h>
#include "OpenGLDevice.h" //same as above
#define SZ_APPDLG_WINDOW_CLASS _T("SkeletalViewerAppDlgWndClass")
#define WM_USER_UPDATE_FPS WM_USER
#define WM_USER_UPDATE_COMBO WM_USER+1
typedef Vector4 POINT3D;
typedef struct {
INT index1;
INT index2;
INT index3;
} SKELETON_ANGLE;
class CSkeletalViewerApp
{
public:
CSkeletalViewerApp();
~CSkeletalViewerApp();
HRESULT Nui_Init();
HRESULT Nui_Init(int index);
HRESULT Nui_Init(OLECHAR *instanceName);
void Nui_UnInit( );
void Nui_GotDepthAlert( );
void Nui_GotVideoAlert( );
void Nui_GotSkeletonAlert( );
void Nui_Zero();
void Nui_BlankSkeletonScreen( HWND hWnd );
void Nui_DoDoubleBuffer(HWND hWnd,HDC hDC);
void Nui_DrawSkeleton(HDC dc, bool bBlank, NUI_SKELETON_DATA * pSkel, HWND hWnd, int WhichSkeletonColor );
void Nui_Draw3DSkeleton(HDC dc, bool bBlank, NUI_SKELETON_DATA * pSkel, HWND hWnd, int WhichSkeletonColor );
void Nui_DrawSkeletonSegment( HDC dc, NUI_SKELETON_DATA * pSkel, int numJoints, ... );
RGBQUAD Nui_ShortToQuad_Depth( USHORT s );
static LRESULT CALLBACK MessageRouter(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static void CALLBACK Nui_StatusProcThunk(const NuiStatusData *pStatusData);
void CALLBACK Nui_StatusProc(const NuiStatusData *pStatusData);
HWND m_hWnd;
private:
bool m_fUpdatingUi;
void UpdateComboBox();
void StartRecording();
void StopRecording();
void DrawSweepingArc(HDC dc, Vector4 *skeletonPositions, INT jointIndex) ;
void Nui_WriteToFile(NUI_SKELETON_DATA * pSkel);
CRITICAL_SECTION m_critSecUi; // Gate UI operations on the background thread.
static DWORD WINAPI Nui_ProcessThread(LPVOID pParam);
DWORD WINAPI Nui_ProcessThread();
INuiInstance* m_pNuiInstance;
BSTR m_instanceId;
CAviFile* m_pAviFile;
// NUI and draw stuff
DrawDevice m_DrawDepth;
//DrawDevice m_DrawVideo;
// thread handling
HANDLE m_hThNuiProcess;
HANDLE m_hEvNuiProcessStop;
HANDLE m_hNextDepthFrameEvent;
HANDLE m_hNextVideoFrameEvent;
HANDLE m_hNextSkeletonEvent;
HANDLE m_pDepthStreamHandle;
HANDLE m_pVideoStreamHandle;
HFONT m_hFontFPS;
HPEN m_Pen[6];
HDC m_SkeletonDC, m_VideoDC;
HBITMAP m_VideoBMP;
HGDIOBJ m_SkeletonOldObj, m_VideoOldObj;
int m_PensTotal;
POINT3D m_Points[NUI_SKELETON_POSITION_COUNT];
RGBQUAD m_rgbWk[640*480];
int m_LastSkeletonFoundTime;
bool m_bScreenBlanked;
int m_FramesTotal;
int m_LastFPStime;
int m_LastFramesTotal;
int m_RecordedFrames;
BOOL m_bRecording;
btk::AcquisitionFileWriter::Pointer m_pWriter;
btk::Acquisition::Pointer m_pAcquisition;
};
int MessageBoxResource(HWND hwnd,UINT nID,UINT nType);