Mercurial > hg > Game > Kinect
comparison main.cc @ 1:2afd5c6cc8d2
Class definition export to KinectTrack.h
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 31 Jan 2011 03:49:24 +0900 |
parents | 1478aad947a6 |
children | 3b5465899da9 |
comparison
equal
deleted
inserted
replaced
0:1478aad947a6 | 1:2afd5c6cc8d2 |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include <XnOpenNI.h> | 2 #include <XnOpenNI.h> |
3 #include <XnCppWrapper.h> | 3 #include <XnCppWrapper.h> |
4 #include <XnVNite.h> | 4 #include <XnVNite.h> |
5 | 5 |
6 #include "KinectTrack.h" | |
7 | |
6 #define INIT_XML_PATH "./kinect.xml" | 8 #define INIT_XML_PATH "./kinect.xml" |
7 | |
8 typedef enum { | |
9 IN_SESSION, | |
10 NOT_IN_SESSION, | |
11 QUICK_REFOCUS | |
12 } SessionState; | |
13 | 9 |
14 void checkRC(const XnStatus &rc, const char *what) { | 10 void checkRC(const XnStatus &rc, const char *what) { |
15 if (rc != XN_STATUS_OK) { | 11 if (rc != XN_STATUS_OK) { |
16 printf("%s faild: %s\n", what, xnGetStatusString(rc)); | 12 printf("%s faild: %s\n", what, xnGetStatusString(rc)); |
17 } | 13 } |
23 errors.ToString(strError, 1024); | 19 errors.ToString(strError, 1024); |
24 printf("%s\n", strError); | 20 printf("%s\n", strError); |
25 } | 21 } |
26 } | 22 } |
27 | 23 |
28 class NIState { | |
29 public: | |
30 static SessionState gSessionState; | |
31 static void XN_CALLBACK_TYPE sessionStarting(const XnPoint3D &ptPosition, void *userCxt); | |
32 static void XN_CALLBACK_TYPE sessionEnding(void *userCxt); | |
33 static void XN_CALLBACK_TYPE focusProgress(const XnChar *strFocus, const XnPoint3D &ptPosition, | |
34 XnFloat fProgress, void *userCxt); | |
35 }; | |
36 SessionState NIState::gSessionState = NOT_IN_SESSION; | 24 SessionState NIState::gSessionState = NOT_IN_SESSION; |
37 void NIState::XN_CALLBACK_TYPE sessionStarting(const XnPoint3D &ptPosition, void *userCxt) { | 25 void NIState::XN_CALLBACK_TYPE sessionStarting(const XnPoint3D &ptPosition, void *userCxt) { |
38 printf("Session start: (%f, %f, %f)\n)", ptPosition.X, ptPosition.Y, ptPosition.Z); | 26 printf("Session start: (%f, %f, %f)\n)", ptPosition.X, ptPosition.Y, ptPosition.Z); |
39 gSessionState = IN_SESSION; | 27 gSessionState = IN_SESSION; |
40 } | 28 } |