diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2012-03-17 16:15:51 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2012-03-17 16:15:51 +0000 |
commit | 9184ea73941814b95c2768d8bcca8bdb77655891 (patch) | |
tree | 9cf5977e95abb7e42a719730560c145c1b33c9ba /FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp | |
parent | 9ae8a2212d0c85cfa904ea3bf03c0631f6c1369a (diff) |
Changed Tracker code, so the DLL's are true plug-ins.
FaceTrackNoIR will scan the bin folder for FTNoIR_Tracker*.dll and put the names in the combobox.
All Trackers have 3 new member-functions (like the filters).
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@104 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp')
-rw-r--r-- | FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp | 75 |
1 files changed, 54 insertions, 21 deletions
diff --git a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp index 82857745..096b957a 100644 --- a/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp +++ b/FTNoIR_Protocol_FTIR/FTNoIR_Protocol_FTIR.cpp @@ -133,6 +133,8 @@ float virtRotX; float virtRotY;
float virtRotZ;
+TRACKIRDATA localdata;
+
//
// Copy the Raw measurements directly to the client.
//
@@ -148,8 +150,31 @@ float virtRotZ; // Check if the pointer is OK and wait for the Mutex.
// Use the setposition in the (special) DLL, to write the headpose-data.
//
+// qDebug() << "FTIRCreateMapping says: sendHeadpose";
if ( (pMemData != NULL) && (WaitForSingleObject(hFTIRMutex, 100) == WAIT_OBJECT_0) ) {
- setposition (virtPosX, virtPosY, virtPosZ, virtRotZ, virtRotX, virtRotY );
+// qDebug() << "FTIRCreateMapping says: Calling setposition" << setdata;
+
+ //localdata.fNPX = virtPosX;
+ //localdata.fNPY = virtPosY;
+ //localdata.fNPZ = virtPosZ;
+ //localdata.fNPRoll = virtRotZ;
+ //localdata.fNPPitch = virtRotX;
+ //localdata.fNPYaw = virtRotY;
+ //localdata.wPFrameSignature = localdata.wPFrameSignature + 1;
+
+ //setdata(&localdata);
+ //
+// setposition ( virtPosX, virtPosY, virtPosZ, virtRotZ, virtRotX, virtRotY );
+ pMemData->data.fNPX = virtPosX;
+ pMemData->data.fNPY = virtPosY;
+ pMemData->data.fNPZ = virtPosZ;
+ pMemData->data.fNPRoll = virtRotZ;
+ pMemData->data.fNPPitch = virtRotX;
+ pMemData->data.fNPYaw = virtRotY;
+ pMemData->data.wPFrameSignature +=1;
+ if ((pMemData->data.wPFrameSignature < 0) || (pMemData->data.wPFrameSignature > 1000)){
+ pMemData->data.wPFrameSignature = 0;
+ }
ReleaseMutex(hFTIRMutex);
}
}
@@ -185,6 +210,7 @@ bool FTNoIR_Protocol_FTIR::checkServerInstallationOK( HANDLE handle ) //
aFileName = aLocation;
aFileName.append(FTIR_CLIENT_FILENAME);
+// aFileName.append("TIR5.dll");
qDebug() << "FTCheckClientDLL says: Full path of DLL =" << aFileName;
if ( QFile::exists( aFileName ) ) {
@@ -240,16 +266,17 @@ bool FTNoIR_Protocol_FTIR::checkServerInstallationOK( HANDLE handle ) //
// Find the functions in the DLL's
//
- // Get the setposition function from the DLL and use it!
- //
- setposition = (importSetPosition) FTIRClientLib.resolve("SetPosition");
- if (setposition == NULL) {
- qDebug() << "FTIRServer::run() says: SetPosition function not found in DLL!";
- return false;
- }
- else {
- setposition (7.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f);
- }
+ //// Get the setposition function from the DLL and use it!
+ ////
+ ////setposition = (importSetPosition) FTIRClientLib.resolve("SetPosition");
+ ////if (setdata == NULL) {
+ //// qDebug() << "FTIRServer::run() says: SetPosition function not found in DLL!";
+ //// return false;
+ ////}
+ ////else {
+ //// qDebug() << "FTIRCreateMapping says: Calling setposition" << setposition;
+ //// setposition ( 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f );
+ ////}
//
// Load the Start function from TIRViews.dll and call it, to start compatibility with older games
@@ -291,26 +318,32 @@ bool FTNoIR_Protocol_FTIR::FTIRCreateMapping( HANDLE handle ) // If one already exists: close it.
//
hFTIRMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE , 00 , PAGE_READWRITE , 0 ,
- sizeof( TRACKIRDATA ) + sizeof( HANDLE ) + 100,
+ sizeof( FTIRMemMap ),
+// sizeof( TRACKIRDATA ) + sizeof( HANDLE ) + 100,
(LPCSTR) FTIR_MM_DATA );
if ( hFTIRMemMap != 0 ) {
- qDebug() << "FTIRCreateMapping says: FileMapping Created!" << hFTIRMemMap;
- }
-
- if ( ( hFTIRMemMap != 0 ) && ( (long) GetLastError == ERROR_ALREADY_EXISTS ) ) {
- CloseHandle( hFTIRMemMap );
- hFTIRMemMap = 0;
+ if ( (long) GetLastError == ERROR_ALREADY_EXISTS ) {
+ qDebug() << "FTIRCreateMapping says: FileMapping already exists!" << hFTIRMemMap;
+ CloseHandle( hFTIRMemMap );
+ hFTIRMemMap = 0;
+ }
+ else {
+ qDebug() << "FTIRCreateMapping says: FileMapping newly created!" << hFTIRMemMap;
+ }
}
//
- // Create a new FileMapping, Read/Write access
+ // Open the FileMapping, Read/Write access
//
+ pMemData = 0;
hFTIRMemMap = OpenFileMappingA( FILE_MAP_ALL_ACCESS , false , (LPCSTR) FTIR_MM_DATA );
if ( ( hFTIRMemMap != 0 ) ) {
- qDebug() << "FTIRCreateMapping says: FileMapping Created again:" << hFTIRMemMap;
- pMemData = (FTIRMemMap *) MapViewOfFile(hFTIRMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TRACKIRDATA) + sizeof(hFTIRMemMap) + 100);
+ qDebug() << "FTIRCreateMapping says: FileMapping opened: " << hFTIRMemMap;
+// pMemData = (FTIRMemMap *) MapViewOfFile(hFTIRMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(TRACKIRDATA) + sizeof(hFTIRMemMap) + 100);
+ pMemData = (FTIRMemMap *) MapViewOfFile(hFTIRMemMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(FTIRMemMap));
if (pMemData != NULL) {
+ qDebug() << "FTIRCreateMapping says: View of File mapped: " << pMemData;
pMemData->RegisteredHandle = handle; // The game uses the handle, to send a message that the Program-Name was set!
}
hFTIRMutex = CreateMutexA(NULL, false, FTIR_MUTEX);
|