Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NPClient.h
Go to the documentation of this file.
1 // *******************************************************************************
2 // *
3 // * Module Name:
4 // * NPClient.h
5 // *
6 // * Doyle Nickless -- 13 Jan, 2003 -- for Eye Control Technology.
7 // *
8 // * Abstract:
9 // * Header for NaturalPoint Game Client API.
10 // *
11 // * Environment:
12 // * Microsoft Windows -- User mode
13 // *
14 // *******************************************************************************
15 
16 #ifndef _NPCLIENT_H_DEFINED_
17 #define _NPCLIENT_H_DEFINED_
18 
19 #pragma pack( push, npclient_h ) // Save current pack value
20 #pragma pack(1)
21 
25 #define VERSION_MAJOR 1
26 #define VERSION_MINOR 0
27 #define VERSION_BUILD 1
28 
29 // magic to get the preprocessor to do what we want
30 #define lita(arg) #arg
31 #define xlita(arg) lita(arg)
32 #define cat3(w,x,z) w##.##x##.##z##\000
33 #define xcat3(w,x,z) cat3(w,x,z)
34 #define VERSION_STRING xlita(xcat3(VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD))
35 //
36 // Versioning hasn't been worked out yet...
37 //
38 // The following is the previous spec definition of versioning info -- I can probably do
39 // something very similar to this -- will keep you posted.
40 //
41 // request version information using 2 messages, they cannot be expected to arrive in a specific order - so always parse using the High byte
42 // the messages have a NPCONTROL byte in the first parameter, and the second parameter has packed bytes.
43 // Message 1) (first parameter)NPCONTROL : (second parameter) (High Byte)NPVERSIONMAJOR (Low Byte) major version number data
44 // Message 2) (first parameter)NPCONTROL : (second parameter) (High Byte)NPVERSIONMINOR (Low Byte) minor version number data
45 
46 #define NPQUERYVERSION 1040
47 
48 #define NPSTATUS_REMOTEACTIVE 0
49 #define NPSTATUS_REMOTEDISABLED 1
50 
51 // CONTROL DATA SUBFIELDS
52 #define NPVERSIONMAJOR 1
53 #define NPVERSIONMINOR 2
54 
55 // DATA FIELDS
56 #define NPControl 8 // indicates a control data field
57 // the second parameter of a message bearing control data information contains a packed data format.
58 // The High byte indicates what the data is, and the Low byte contains the actual data
59 // roll, pitch, yaw
60 #define NPRoll 1 // +/- 16383 (representing +/- 180) [data = input - 16383]
61 #define NPPitch 2 // +/- 16383 (representing +/- 180) [data = input - 16383]
62 #define NPYaw 4 // +/- 16383 (representing +/- 180) [data = input - 16383]
63 
64 // x, y, z - remaining 6dof coordinates
65 #define NPX 16 // +/- 16383 [data = input - 16383]
66 #define NPY 32 // +/- 16383 [data = input - 16383]
67 #define NPZ 64 // +/- 16383 [data = input - 16383]
68 
69 // raw object position from imager
70 #define NPRawX 128 // 0..25600 (actual value is multiplied x 100 to pass two decimal places of precision) [data = input / 100]
71 #define NPRawY 256 // 0..25600 (actual value is multiplied x 100 to pass two decimal places of precision) [data = input / 100]
72 #define NPRawZ 512 // 0..25600 (actual value is multiplied x 100 to pass two decimal places of precision) [data = input / 100]
73 
74 // x, y, z deltas from raw imager position
75 #define NPDeltaX 1024 // +/- 2560 (actual value is multiplied x 10 to pass two decimal places of precision) [data = (input / 10) - 256]
76 #define NPDeltaY 2048 // +/- 2560 (actual value is multiplied x 10 to pass two decimal places of precision) [data = (input / 10) - 256]
77 #define NPDeltaZ 4096 // +/- 2560 (actual value is multiplied x 10 to pass two decimal places of precision) [data = (input / 10) - 256]
78 
79 // raw object position from imager
80 #define NPSmoothX 8192 // 0..32766 (actual value is multiplied x 10 to pass one decimal place of precision) [data = input / 10]
81 #define NPSmoothY 16384 // 0..32766 (actual value is multiplied x 10 to pass one decimal place of precision) [data = input / 10]
82 #define NPSmoothZ 32768 // 0..32766 (actual value is multiplied x 10 to pass one decimal place of precision) [data = input / 10]
83 
84 
88 
89 // NPESULT values are returned from the Game Client API functions.
90 //
91 typedef enum tagNPResult
92 {
93  NP_OK = 0,
100 
101 } NPRESULT;
102 
103 typedef struct tagTrackIRSignature
104 {
105  char DllSignature[200];
106  char AppSignature[200];
107 
109 
110 typedef struct tagTrackIRData
111 {
112  unsigned short wNPStatus;
113  unsigned short wPFrameSignature;
114  unsigned long dwNPIOData;
115 
116  float fNPRoll;
117  float fNPPitch;
118  float fNPYaw;
119  float fNPX;
120  float fNPY;
121  float fNPZ;
122  float fNPRawX;
123  float fNPRawY;
124  float fNPRawZ;
125  float fNPDeltaX;
126  float fNPDeltaY;
127  float fNPDeltaZ;
128  float fNPSmoothX;
129  float fNPSmoothY;
130  float fNPSmoothZ;
131 
133 
134 
135 //
136 // Typedef for pointer to the notify callback function that is implemented within
137 // the client -- this function receives head tracker reports from the game client API
138 //
139 typedef NPRESULT (__stdcall *PF_NOTIFYCALLBACK)( unsigned short, unsigned short );
140 
141 // Typedefs for game client API functions (useful for declaring pointers to these
142 // functions within the client for use during GetProcAddress() ops)
143 //
144 typedef NPRESULT (__stdcall *PF_NP_REGISTERWINDOWHANDLE)( HWND );
145 typedef NPRESULT (__stdcall *PF_NP_UNREGISTERWINDOWHANDLE)( void );
146 typedef NPRESULT (__stdcall *PF_NP_REGISTERPROGRAMPROFILEID)( unsigned short );
147 typedef NPRESULT (__stdcall *PF_NP_QUERYVERSION)( unsigned short* );
148 typedef NPRESULT (__stdcall *PF_NP_REQUESTDATA)( unsigned short );
150 typedef NPRESULT (__stdcall *PF_NP_GETDATA)( LPTRACKIRDATA );
152 typedef NPRESULT (__stdcall *PF_NP_UNREGISTERNOTIFY)( void );
153 typedef NPRESULT (__stdcall *PF_NP_STARTCURSOR)( void );
154 typedef NPRESULT (__stdcall *PF_NP_STOPCURSOR)( void );
155 typedef NPRESULT (__stdcall *PF_NP_RECENTER)( void );
156 typedef NPRESULT (__stdcall *PF_NP_STARTDATATRANSMISSION)( void );
157 typedef NPRESULT (__stdcall *PF_NP_STOPDATATRANSMISSION)( void );
158 
160 //
161 // Functions exported from game client API DLL ( note __stdcall calling convention
162 // is used for ease of interface to clients of differing implementations including
163 // C, C++, Pascal (Delphi) and VB. )
164 //
165 NPRESULT __stdcall NP_RegisterWindowHandle( HWND hWnd );
166 NPRESULT __stdcall NP_UnregisterWindowHandle( void );
167 NPRESULT __stdcall NP_RegisterProgramProfileID( unsigned short wPPID );
168 NPRESULT __stdcall NP_QueryVersion( unsigned short* pwVersion );
169 NPRESULT __stdcall NP_RequestData( unsigned short wDataReq );
170 NPRESULT __stdcall NP_GetSignature( LPTRACKIRSIGNATURE pSignature );
171 NPRESULT __stdcall NP_GetData( LPTRACKIRDATA pTID );
172 NPRESULT __stdcall NP_RegisterNotify( PF_NOTIFYCALLBACK pfNotify );
173 NPRESULT __stdcall NP_UnregisterNotify( void );
174 NPRESULT __stdcall NP_StartCursor( void );
175 NPRESULT __stdcall NP_StopCursor( void );
176 NPRESULT __stdcall NP_ReCenter( void );
177 NPRESULT __stdcall NP_StartDataTransmission( void );
178 NPRESULT __stdcall NP_StopDataTransmission( void );
179 
181 
182 #pragma pack( pop, npclient_h ) // Ensure previous pack value is restored
183 
184 #endif // #ifdef NPCLIENT_H_DEFINED_
185 
186 //
187 // *** End of file: NPClient.h ***
188 //
189 
190