diff options
-rw-r--r-- | 3rdparty-notices/SM-FACEAPI-COPYING.txt | 9 | ||||
-rw-r--r-- | CMakeLists.txt | 1111 | ||||
-rw-r--r-- | faceapi/build_options.h | 8 | ||||
-rw-r--r-- | faceapi/ftnoir-faceapi-wrapper.exe.manifest | 15 | ||||
-rw-r--r-- | faceapi/ftnoir-faceapi-wrapper.rc | 2 | ||||
-rw-r--r-- | faceapi/lock.h | 35 | ||||
-rw-r--r-- | faceapi/lockfree.h | 65 | ||||
-rw-r--r-- | faceapi/main.cpp | 529 | ||||
-rw-r--r-- | faceapi/mutex.h | 46 | ||||
-rw-r--r-- | faceapi/stdafx.cpp | 8 | ||||
-rw-r--r-- | faceapi/stdafx.h | 36 | ||||
-rw-r--r-- | faceapi/utils.h | 349 | ||||
-rw-r--r-- | ftnoir_tracker_sm/ftnoir_sm_controls.ui | 223 | ||||
-rw-r--r-- | ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp | 220 | ||||
-rw-r--r-- | ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp | 188 | ||||
-rw-r--r-- | ftnoir_tracker_sm/ftnoir_tracker_faceapi_dll.cpp | 72 | ||||
-rw-r--r-- | ftnoir_tracker_sm/ftnoir_tracker_sm.h | 120 | ||||
-rw-r--r-- | ftnoir_tracker_sm/ftnoir_tracker_sm_types.h | 36 | ||||
-rw-r--r-- | ftnoir_tracker_sm/images/sm.png | bin | 1263 -> 0 bytes | |||
-rw-r--r-- | ftnoir_tracker_sm/sm-tracker.qrc | 5 |
20 files changed, 523 insertions, 2554 deletions
diff --git a/3rdparty-notices/SM-FACEAPI-COPYING.txt b/3rdparty-notices/SM-FACEAPI-COPYING.txt deleted file mode 100644 index b317bb76..00000000 --- a/3rdparty-notices/SM-FACEAPI-COPYING.txt +++ /dev/null @@ -1,9 +0,0 @@ --------------------------------------------------------------------------------- -FaceTrackingAPI Version 3.2.6 - August 2010 -Copyright (C) 2010 Seeing Machines Limited --------------------------------------------------------------------------------- - -The use of this API is strictly governed by the terms of a mandatory -prior license agreement between the user and Seeing Machines Ltd. - ---------------------------------------------------------------------------------
\ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index dd5c0317..46931cac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,14 +45,10 @@ if(UNIX) set(SDK_ENABLE_LIBEVDEV FALSE CACHE BOOL "libevdev virtual joystick protocol support (probably Linux only)") endif() if(WIN32) - SET(SDK_FACEAPI_ONLY FALSE CACHE BOOL "FaceAPI only (MSVC 2005)") -endif() -if(WIN32) SET(SDK_CONSOLE_DEBUG FALSE CACHE BOOL "Console build") endif() IF(WIN32) - SET(SDK_SM_FACEAPI_PATH "" CACHE PATH "SeeingMachines FaceAPI SDK path") SET(SDK_VJOY "" CACHE PATH "VJoy SDK path") ENDIF() SET(SDK_HYDRA "" CACHE PATH "libSixense path") @@ -60,10 +56,8 @@ SET(SDK_HYDRA_AMD64 FALSE CACHE BOOL "whether target is amd64 (else ia-32)") SET(SDK_RIFT "" CACHE PATH "libOVR path") -file(GLOB opentrack-faceapi-wrapper-c "faceapi/*.cpp") include_directories(${CMAKE_SOURCE_DIR}) -if(NOT SDK_FACEAPI_ONLY) find_package(OpenCV) find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui QUIET) cmake_policy(SET CMP0020 NEW) @@ -80,7 +74,6 @@ if(NOT SDK_FACEAPI_ONLY) SET(SDK_OPENCV_STATIC FALSE CACHE BOOL "Whether OpenCV is statically linked") if(WIN32) - SET(SDK_SM_FACEAPI_PATH "" CACHE PATH "SeeingMachines FaceAPI SDK path") set(SDK_SIMCONNECT "" CACHE PATH "Path to SimConnect SDK") set(SDK_DIRECTX "" CACHE PATH "Path to DirectX SDK") set(SDK_FSUIPC "" CACHE PATH "Path to FSUIPC") @@ -117,702 +110,644 @@ if(SDK_FSUIPC AND WIN32) link_directories("${SDK_FSUIPC}") endif() -if(NOT SDK_FACEAPI_ONLY) # Qxt bundled :: sorry for this, but gentoo ebuild is broken - if(APPLE) - set(qxt-mini-c qxt-mini/plat/qxtglobalshortcut_mac.cpp qxt-mini/qxtglobalshortcut.cpp) +if(APPLE) + set(qxt-mini-c qxt-mini/plat/qxtglobalshortcut_mac.cpp qxt-mini/qxtglobalshortcut.cpp) + include_directories("qxt-mini/") +else() + if(UNIX) + set(qxt-mini-c qxt-mini/plat/qxtglobalshortcut_x11.cpp qxt-mini/qxtglobalshortcut.cpp) include_directories("qxt-mini/") - else() - if(UNIX) - set(qxt-mini-c qxt-mini/plat/qxtglobalshortcut_x11.cpp qxt-mini/qxtglobalshortcut.cpp) - include_directories("qxt-mini/") - endif() endif() +endif() # main app - file(GLOB opentrack-bin-c "facetracknoir/*.cpp" "facetracknoir/*.rc") - file(GLOB opentrack-bin-h "facetracknoir/*.h") - file(GLOB opentrack-bin-ui "facetracknoir/*.ui") - file(GLOB opentrack-bin-rc "facetracknoir/*.qrc") - QT5_WRAP_UI(opentrack-bin-uih ${opentrack-bin-ui}) - QT5_ADD_RESOURCES(opentrack-bin-rcc ${opentrack-bin-rc}) +file(GLOB opentrack-bin-c "facetracknoir/*.cpp" "facetracknoir/*.rc") +file(GLOB opentrack-bin-h "facetracknoir/*.h") +file(GLOB opentrack-bin-ui "facetracknoir/*.ui") +file(GLOB opentrack-bin-rc "facetracknoir/*.qrc") +QT5_WRAP_UI(opentrack-bin-uih ${opentrack-bin-ui}) +QT5_ADD_RESOURCES(opentrack-bin-rcc ${opentrack-bin-rc}) - file(GLOB opentrack-pose-widget-c "ftnoir_posewidget/*.cpp") - file(GLOB opentrack-pose-widget-h "ftnoir_posewidget/*.h") - file(GLOB opentrack-pose-widget-rc "ftnoir_posewidget/*.qrc") - QT5_ADD_RESOURCES(opentrack-pose-widget-rcc ${opentrack-pose-widget-rc}) +file(GLOB opentrack-pose-widget-c "ftnoir_posewidget/*.cpp") +file(GLOB opentrack-pose-widget-h "ftnoir_posewidget/*.h") +file(GLOB opentrack-pose-widget-rc "ftnoir_posewidget/*.qrc") +QT5_ADD_RESOURCES(opentrack-pose-widget-rcc ${opentrack-pose-widget-rc}) - file(GLOB opentrack-spline-widget-c "qfunctionconfigurator/*.cpp") - file(GLOB opentrack-spline-widget-h "qfunctionconfigurator/*.h") +file(GLOB opentrack-spline-widget-c "qfunctionconfigurator/*.cpp") +file(GLOB opentrack-spline-widget-h "qfunctionconfigurator/*.h") # filters - file(GLOB opentrack-filter-accela-c "ftnoir_filter_accela/*.cpp") - file(GLOB opentrack-filter-accela-h "ftnoir_filter_accela/*.h") - file(GLOB opentrack-filter-accela-ui "ftnoir_filter_accela/*.ui") - file(GLOB opentrack-filter-accela-rc "ftnoir_filter_accela/*.qrc") - QT5_WRAP_UI(opentrack-filter-accela-uih ${opentrack-filter-accela-ui}) - QT5_ADD_RESOURCES(opentrack-filter-accela-rcc ${opentrack-filter-accela-rc}) +file(GLOB opentrack-filter-accela-c "ftnoir_filter_accela/*.cpp") +file(GLOB opentrack-filter-accela-h "ftnoir_filter_accela/*.h") +file(GLOB opentrack-filter-accela-ui "ftnoir_filter_accela/*.ui") +file(GLOB opentrack-filter-accela-rc "ftnoir_filter_accela/*.qrc") +QT5_WRAP_UI(opentrack-filter-accela-uih ${opentrack-filter-accela-ui}) +QT5_ADD_RESOURCES(opentrack-filter-accela-rcc ${opentrack-filter-accela-rc}) - file(GLOB opentrack-filter-ewma-c "ftnoir_filter_ewma2/*.cpp") - file(GLOB opentrack-filter-ewma-h "ftnoir_filter_ewma2/*.h") - file(GLOB opentrack-filter-ewma-ui "ftnoir_filter_ewma2/*.ui") - file(GLOB opentrack-filter-ewma-rc "ftnoir_filter_ewma2/*.qrc") - QT5_WRAP_UI(opentrack-filter-ewma-uih ${opentrack-filter-ewma-ui}) - QT5_ADD_RESOURCES(opentrack-filter-ewma-rcc ${opentrack-filter-ewma-rc}) +file(GLOB opentrack-filter-ewma-c "ftnoir_filter_ewma2/*.cpp") +file(GLOB opentrack-filter-ewma-h "ftnoir_filter_ewma2/*.h") +file(GLOB opentrack-filter-ewma-ui "ftnoir_filter_ewma2/*.ui") +file(GLOB opentrack-filter-ewma-rc "ftnoir_filter_ewma2/*.qrc") +QT5_WRAP_UI(opentrack-filter-ewma-uih ${opentrack-filter-ewma-ui}) +QT5_ADD_RESOURCES(opentrack-filter-ewma-rcc ${opentrack-filter-ewma-rc}) # protocols - file(GLOB opentrack-proto-fgfs-c "ftnoir_protocol_fg/*.cpp") - file(GLOB opentrack-proto-fgfs-h "ftnoir_protocol_fg/*.h") - file(GLOB opentrack-proto-fgfs-ui "ftnoir_protocol_fg/*.ui") - file(GLOB opentrack-proto-fgfs-rc "ftnoir_protocol_fg/*.qrc") - QT5_WRAP_UI(opentrack-proto-fgfs-uih ${opentrack-proto-fgfs-ui}) - QT5_ADD_RESOURCES(opentrack-proto-fgfs-rcc ${opentrack-proto-fgfs-rc}) - - file(GLOB opentrack-proto-fsuipc-c "ftnoir_protocol_fsuipc/*.cpp") - file(GLOB opentrack-proto-fsuipc-h "ftnoir_protocol_fsuipc/*.h") - file(GLOB opentrack-proto-fsuipc-ui "ftnoir_protocol_fsuipc/*.ui") - file(GLOB opentrack-proto-fsuipc-rc "ftnoir_protocol_fsuipc/*.qrc") - QT5_WRAP_UI(opentrack-proto-fsuipc-uih ${opentrack-proto-fsuipc-ui}) - QT5_ADD_RESOURCES(opentrack-proto-fsuipc-rcc ${opentrack-proto-fsuipc-rc}) - - file(GLOB opentrack-proto-freetrack-c "ftnoir_protocol_ft/*.cpp") - file(GLOB opentrack-proto-freetrack-h "ftnoir_protocol_ft/*.h") - file(GLOB opentrack-proto-freetrack-ui "ftnoir_protocol_ft/*.ui") - file(GLOB opentrack-proto-freetrack-rc "ftnoir_protocol_ft/*.qrc") - QT5_WRAP_UI(opentrack-proto-freetrack-uih ${opentrack-proto-freetrack-ui}) - QT5_ADD_RESOURCES(opentrack-proto-freetrack-rcc ${opentrack-proto-freetrack-rc}) - - file(GLOB opentrack-proto-udp-c "ftnoir_protocol_ftn/*.cpp") - file(GLOB opentrack-proto-udp-h "ftnoir_protocol_ftn/*.h") - file(GLOB opentrack-proto-udp-ui "ftnoir_protocol_ftn/*.ui") - file(GLOB opentrack-proto-udp-rc "ftnoir_protocol_ftn/*.qrc") - QT5_WRAP_UI(opentrack-proto-udp-uih ${opentrack-proto-udp-ui}) - QT5_ADD_RESOURCES(opentrack-proto-udp-rcc ${opentrack-proto-udp-rc}) - - file(GLOB opentrack-proto-wine-c "ftnoir_protocol_wine/*.cpp") - file(GLOB opentrack-proto-wine-h "ftnoir_protocol_wine/*.h") - file(GLOB opentrack-proto-wine-ui "ftnoir_protocol_wine/*.ui") - file(GLOB opentrack-proto-wine-rc "ftnoir_protocol_wine/*.qrc") - QT5_WRAP_UI(opentrack-proto-wine-uih ${opentrack-proto-wine-ui}) - QT5_ADD_RESOURCES(opentrack-proto-wine-rcc ${opentrack-proto-wine-rc}) - - file(GLOB opentrack-proto-win32-mouse-c "ftnoir_protocol_mouse/*.cpp") - file(GLOB opentrack-proto-win32-mouse-h "ftnoir_protocol_mouse/*.h") - file(GLOB opentrack-proto-win32-mouse-ui "ftnoir_protocol_mouse/*.ui") - file(GLOB opentrack-proto-win32-mouse-rc "ftnoir_protocol_mouse/*.qrc") - QT5_WRAP_UI(opentrack-proto-win32-mouse-uih ${opentrack-proto-win32-mouse-ui}) - QT5_ADD_RESOURCES(opentrack-proto-win32-mouse-rcc ${opentrack-proto-win32-mouse-rc}) - - file(GLOB opentrack-proto-simconnect-c "ftnoir_protocol_sc/*.cpp" "ftnoir_protocol_sc/ftnoir-protocol-sc.rc") - file(GLOB opentrack-proto-simconnect-h "ftnoir_protocol_sc/*.h") - file(GLOB opentrack-proto-simconnect-ui "ftnoir_protocol_sc/*.ui") - file(GLOB opentrack-proto-simconnect-rc "ftnoir_protocol_sc/*.qrc") - QT5_WRAP_UI(opentrack-proto-simconnect-uih ${opentrack-proto-simconnect-ui}) - QT5_ADD_RESOURCES(opentrack-proto-simconnect-rcc ${opentrack-proto-simconnect-rc}) - - file(GLOB opentrack-proto-vjoy-c "ftnoir_protocol_vjoy/*.cpp") - file(GLOB opentrack-proto-vjoy-h "ftnoir_protocol_vjoy/*.h") - file(GLOB opentrack-proto-vjoy-ui "ftnoir_protocol_vjoy/*.ui") - file(GLOB opentrack-proto-vjoy-rc "ftnoir_protocol_vjoy/*.qrc") - QT5_WRAP_UI(opentrack-proto-vjoy-uih ${opentrack-proto-vjoy-ui}) - QT5_ADD_RESOURCES(opentrack-proto-vjoy-rcc ${opentrack-proto-vjoy-rc}) - - file(GLOB opentrack-proto-libevdev-c "ftnoir_protocol_libevdev/*.cpp") - file(GLOB opentrack-proto-libevdev-h "ftnoir_protocol_libevdev/*.h") - file(GLOB opentrack-proto-libevdev-ui "ftnoir_protocol_libevdev/*.ui") - file(GLOB opentrack-proto-libevdev-rc "ftnoir_protocol_libevdev/*.qrc") - QT5_WRAP_UI(opentrack-proto-libevdev-uih ${opentrack-proto-libevdev-ui}) - QT5_ADD_RESOURCES(opentrack-proto-libevdev-rcc ${opentrack-proto-libevdev-rc}) +file(GLOB opentrack-proto-fgfs-c "ftnoir_protocol_fg/*.cpp") +file(GLOB opentrack-proto-fgfs-h "ftnoir_protocol_fg/*.h") +file(GLOB opentrack-proto-fgfs-ui "ftnoir_protocol_fg/*.ui") +file(GLOB opentrack-proto-fgfs-rc "ftnoir_protocol_fg/*.qrc") +QT5_WRAP_UI(opentrack-proto-fgfs-uih ${opentrack-proto-fgfs-ui}) +QT5_ADD_RESOURCES(opentrack-proto-fgfs-rcc ${opentrack-proto-fgfs-rc}) + +file(GLOB opentrack-proto-fsuipc-c "ftnoir_protocol_fsuipc/*.cpp") +file(GLOB opentrack-proto-fsuipc-h "ftnoir_protocol_fsuipc/*.h") +file(GLOB opentrack-proto-fsuipc-ui "ftnoir_protocol_fsuipc/*.ui") +file(GLOB opentrack-proto-fsuipc-rc "ftnoir_protocol_fsuipc/*.qrc") +QT5_WRAP_UI(opentrack-proto-fsuipc-uih ${opentrack-proto-fsuipc-ui}) +QT5_ADD_RESOURCES(opentrack-proto-fsuipc-rcc ${opentrack-proto-fsuipc-rc}) + +file(GLOB opentrack-proto-freetrack-c "ftnoir_protocol_ft/*.cpp") +file(GLOB opentrack-proto-freetrack-h "ftnoir_protocol_ft/*.h") +file(GLOB opentrack-proto-freetrack-ui "ftnoir_protocol_ft/*.ui") +file(GLOB opentrack-proto-freetrack-rc "ftnoir_protocol_ft/*.qrc") +QT5_WRAP_UI(opentrack-proto-freetrack-uih ${opentrack-proto-freetrack-ui}) +QT5_ADD_RESOURCES(opentrack-proto-freetrack-rcc ${opentrack-proto-freetrack-rc}) + +file(GLOB opentrack-proto-udp-c "ftnoir_protocol_ftn/*.cpp") +file(GLOB opentrack-proto-udp-h "ftnoir_protocol_ftn/*.h") +file(GLOB opentrack-proto-udp-ui "ftnoir_protocol_ftn/*.ui") +file(GLOB opentrack-proto-udp-rc "ftnoir_protocol_ftn/*.qrc") +QT5_WRAP_UI(opentrack-proto-udp-uih ${opentrack-proto-udp-ui}) +QT5_ADD_RESOURCES(opentrack-proto-udp-rcc ${opentrack-proto-udp-rc}) + +file(GLOB opentrack-proto-wine-c "ftnoir_protocol_wine/*.cpp") +file(GLOB opentrack-proto-wine-h "ftnoir_protocol_wine/*.h") +file(GLOB opentrack-proto-wine-ui "ftnoir_protocol_wine/*.ui") +file(GLOB opentrack-proto-wine-rc "ftnoir_protocol_wine/*.qrc") +QT5_WRAP_UI(opentrack-proto-wine-uih ${opentrack-proto-wine-ui}) +QT5_ADD_RESOURCES(opentrack-proto-wine-rcc ${opentrack-proto-wine-rc}) + +file(GLOB opentrack-proto-win32-mouse-c "ftnoir_protocol_mouse/*.cpp") +file(GLOB opentrack-proto-win32-mouse-h "ftnoir_protocol_mouse/*.h") +file(GLOB opentrack-proto-win32-mouse-ui "ftnoir_protocol_mouse/*.ui") +file(GLOB opentrack-proto-win32-mouse-rc "ftnoir_protocol_mouse/*.qrc") +QT5_WRAP_UI(opentrack-proto-win32-mouse-uih ${opentrack-proto-win32-mouse-ui}) +QT5_ADD_RESOURCES(opentrack-proto-win32-mouse-rcc ${opentrack-proto-win32-mouse-rc}) + +file(GLOB opentrack-proto-simconnect-c "ftnoir_protocol_sc/*.cpp" "ftnoir_protocol_sc/ftnoir-protocol-sc.rc") +file(GLOB opentrack-proto-simconnect-h "ftnoir_protocol_sc/*.h") +file(GLOB opentrack-proto-simconnect-ui "ftnoir_protocol_sc/*.ui") +file(GLOB opentrack-proto-simconnect-rc "ftnoir_protocol_sc/*.qrc") +QT5_WRAP_UI(opentrack-proto-simconnect-uih ${opentrack-proto-simconnect-ui}) +QT5_ADD_RESOURCES(opentrack-proto-simconnect-rcc ${opentrack-proto-simconnect-rc}) + +file(GLOB opentrack-proto-vjoy-c "ftnoir_protocol_vjoy/*.cpp") +file(GLOB opentrack-proto-vjoy-h "ftnoir_protocol_vjoy/*.h") +file(GLOB opentrack-proto-vjoy-ui "ftnoir_protocol_vjoy/*.ui") +file(GLOB opentrack-proto-vjoy-rc "ftnoir_protocol_vjoy/*.qrc") +QT5_WRAP_UI(opentrack-proto-vjoy-uih ${opentrack-proto-vjoy-ui}) +QT5_ADD_RESOURCES(opentrack-proto-vjoy-rcc ${opentrack-proto-vjoy-rc}) + +file(GLOB opentrack-proto-libevdev-c "ftnoir_protocol_libevdev/*.cpp") +file(GLOB opentrack-proto-libevdev-h "ftnoir_protocol_libevdev/*.h") +file(GLOB opentrack-proto-libevdev-ui "ftnoir_protocol_libevdev/*.ui") +file(GLOB opentrack-proto-libevdev-rc "ftnoir_protocol_libevdev/*.qrc") +QT5_WRAP_UI(opentrack-proto-libevdev-uih ${opentrack-proto-libevdev-ui}) +QT5_ADD_RESOURCES(opentrack-proto-libevdev-rcc ${opentrack-proto-libevdev-rc}) # trackers - file(GLOB opentrack-tracker-ht-c "ftnoir_tracker_ht/*.cpp") - file(GLOB opentrack-tracker-ht-h "ftnoir_tracker_ht/*.h") - file(GLOB opentrack-tracker-ht-ui "ftnoir_tracker_ht/*.ui") - file(GLOB opentrack-tracker-ht-rc "ftnoir_tracker_ht/*.qrc") - QT5_WRAP_UI(opentrack-tracker-ht-uih ${opentrack-tracker-ht-ui}) - QT5_ADD_RESOURCES(opentrack-tracker-ht-rcc ${opentrack-tracker-ht-rc}) - - file(GLOB opentrack-tracker-aruco-c "ftnoir_tracker_aruco/*.cpp") - file(GLOB opentrack-tracker-aruco-h "ftnoir_tracker_aruco/*.h") - file(GLOB opentrack-tracker-aruco-ui "ftnoir_tracker_aruco/*.ui") - file(GLOB opentrack-tracker-aruco-rc "ftnoir_tracker_aruco/*.qrc") - QT5_WRAP_UI(opentracktracker-aruco-uih ${opentrack-tracker-aruco-ui}) - QT5_ADD_RESOURCES(opentrack-tracker-aruco-rcc ${opentrack-tracker-aruco-rc}) - - file(GLOB opentrack-tracker-pt-c "FTNoIR_Tracker_PT/*.cpp") - file(GLOB opentrack-tracker-pt-h "FTNoIR_Tracker_PT/*.h") - file(GLOB opentrack-tracker-pt-ui "FTNoIR_Tracker_PT/*.ui") - file(GLOB opentrack-tracker-pt-rc "FTNoIR_Tracker_PT/*.qrc") - QT5_WRAP_UI(opentrack-tracker-pt-uih ${opentrack-tracker-pt-ui}) - QT5_ADD_RESOURCES(opentrack-tracker-pt-rcc ${opentrack-tracker-pt-rc}) - - file(GLOB opentrack-tracker-udp-c "ftnoir_tracker_udp/*.cpp") - file(GLOB opentrack-tracker-udp-h "ftnoir_tracker_udp/*.h") - file(GLOB opentrack-tracker-udp-ui "ftnoir_tracker_udp/*.ui") - file(GLOB opentrack-tracker-udp-rc "ftnoir_tracker_udp/*.qrc") - QT5_WRAP_UI(opentrack-tracker-udp-uih ${opentrack-tracker-udp-ui}) - QT5_ADD_RESOURCES(opentrack-tracker-udp-rcc ${opentrack-tracker-udp-rc}) - - file(GLOB opentrack-tracker-joystick-c "ftnoir_tracker_joystick/*.cpp") - file(GLOB opentrack-tracker-joystick-h "ftnoir_tracker_joystick/*.h") - file(GLOB opentrack-tracker-joystick-ui "ftnoir_tracker_joystick/*.ui") - file(GLOB opentrack-tracker-joystick-rc "ftnoir_tracker_joystick/*.qrc") - QT5_WRAP_UI(opentrack-tracker-joystick-uih ${opentrack-tracker-joystick-ui}) - QT5_ADD_RESOURCES(opentrack-tracker-joystick-rcc ${opentrack-tracker-joystick-rc}) - - file(GLOB opentrack-tracker-rift-c "ftnoir_tracker_rift/*.cpp") - file(GLOB opentrack-tracker-rift-h "ftnoir_tracker_rift/*.h") - file(GLOB opentrack-tracker-rift-ui "ftnoir_tracker_rift/*.ui") - file(GLOB opentrack-tracker-rift-rc "ftnoir_tracker_rift/*.qrc") - QT5_WRAP_UI(opentrack-tracker-rift-uih ${opentrack-tracker-rift-ui}) - QT5_ADD_RESOURCES(opentrack-tracker-rift-rcc ${opentrack-tracker-rift-rc}) - - file(GLOB opentrack-tracker-hydra-c "ftnoir_tracker_hydra/*.cpp") - file(GLOB opentrack-tracker-hydra-h "ftnoir_tracker_hydra/*.h") - file(GLOB opentrack-tracker-hydra-ui "ftnoir_tracker_hydra/*.ui") - file(GLOB opentrack-tracker-hydra-rc "ftnoir_tracker_hydra/*.qrc") - QT5_WRAP_UI(opentrack-tracker-hydra-uih ${opentrack-tracker-hydra-ui}) - QT5_ADD_RESOURCES(opentrack-tracker-hydra-rcc ${opentrack-tracker-hydra-rc}) - - file(GLOB opentrack-tracker-faceapi-c "ftnoir_tracker_sm/*.cpp") - file(GLOB opentrack-tracker-faceapi-h "ftnoir_tracker_sm/*.h") - file(GLOB opentrack-tracker-faceapi-ui "ftnoir_tracker_sm/*.ui") - file(GLOB opentrack-tracker-faceapi-rc "ftnoir_tracker_sm/*.qrc") - QT5_WRAP_UI(opentrack-tracker-faceapi-uih ${opentrack-tracker-faceapi-ui}) - QT5_ADD_RESOURCES(opentrack-tracker-faceapi-rcc ${opentrack-tracker-faceapi-rc}) - - file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp") +file(GLOB opentrack-tracker-ht-c "ftnoir_tracker_ht/*.cpp") +file(GLOB opentrack-tracker-ht-h "ftnoir_tracker_ht/*.h") +file(GLOB opentrack-tracker-ht-ui "ftnoir_tracker_ht/*.ui") +file(GLOB opentrack-tracker-ht-rc "ftnoir_tracker_ht/*.qrc") +QT5_WRAP_UI(opentrack-tracker-ht-uih ${opentrack-tracker-ht-ui}) +QT5_ADD_RESOURCES(opentrack-tracker-ht-rcc ${opentrack-tracker-ht-rc}) + +file(GLOB opentrack-tracker-aruco-c "ftnoir_tracker_aruco/*.cpp") +file(GLOB opentrack-tracker-aruco-h "ftnoir_tracker_aruco/*.h") +file(GLOB opentrack-tracker-aruco-ui "ftnoir_tracker_aruco/*.ui") +file(GLOB opentrack-tracker-aruco-rc "ftnoir_tracker_aruco/*.qrc") +QT5_WRAP_UI(opentracktracker-aruco-uih ${opentrack-tracker-aruco-ui}) +QT5_ADD_RESOURCES(opentrack-tracker-aruco-rcc ${opentrack-tracker-aruco-rc}) + +file(GLOB opentrack-tracker-pt-c "FTNoIR_Tracker_PT/*.cpp") +file(GLOB opentrack-tracker-pt-h "FTNoIR_Tracker_PT/*.h") +file(GLOB opentrack-tracker-pt-ui "FTNoIR_Tracker_PT/*.ui") +file(GLOB opentrack-tracker-pt-rc "FTNoIR_Tracker_PT/*.qrc") +QT5_WRAP_UI(opentrack-tracker-pt-uih ${opentrack-tracker-pt-ui}) +QT5_ADD_RESOURCES(opentrack-tracker-pt-rcc ${opentrack-tracker-pt-rc}) + +file(GLOB opentrack-tracker-udp-c "ftnoir_tracker_udp/*.cpp") +file(GLOB opentrack-tracker-udp-h "ftnoir_tracker_udp/*.h") +file(GLOB opentrack-tracker-udp-ui "ftnoir_tracker_udp/*.ui") +file(GLOB opentrack-tracker-udp-rc "ftnoir_tracker_udp/*.qrc") +QT5_WRAP_UI(opentrack-tracker-udp-uih ${opentrack-tracker-udp-ui}) +QT5_ADD_RESOURCES(opentrack-tracker-udp-rcc ${opentrack-tracker-udp-rc}) + +file(GLOB opentrack-tracker-joystick-c "ftnoir_tracker_joystick/*.cpp") +file(GLOB opentrack-tracker-joystick-h "ftnoir_tracker_joystick/*.h") +file(GLOB opentrack-tracker-joystick-ui "ftnoir_tracker_joystick/*.ui") +file(GLOB opentrack-tracker-joystick-rc "ftnoir_tracker_joystick/*.qrc") +QT5_WRAP_UI(opentrack-tracker-joystick-uih ${opentrack-tracker-joystick-ui}) +QT5_ADD_RESOURCES(opentrack-tracker-joystick-rcc ${opentrack-tracker-joystick-rc}) + +file(GLOB opentrack-tracker-rift-c "ftnoir_tracker_rift/*.cpp") +file(GLOB opentrack-tracker-rift-h "ftnoir_tracker_rift/*.h") +file(GLOB opentrack-tracker-rift-ui "ftnoir_tracker_rift/*.ui") +file(GLOB opentrack-tracker-rift-rc "ftnoir_tracker_rift/*.qrc") +QT5_WRAP_UI(opentrack-tracker-rift-uih ${opentrack-tracker-rift-ui}) +QT5_ADD_RESOURCES(opentrack-tracker-rift-rcc ${opentrack-tracker-rift-rc}) + +file(GLOB opentrack-tracker-hydra-c "ftnoir_tracker_hydra/*.cpp") +file(GLOB opentrack-tracker-hydra-h "ftnoir_tracker_hydra/*.h") +file(GLOB opentrack-tracker-hydra-ui "ftnoir_tracker_hydra/*.ui") +file(GLOB opentrack-tracker-hydra-rc "ftnoir_tracker_hydra/*.qrc") +QT5_WRAP_UI(opentrack-tracker-hydra-uih ${opentrack-tracker-hydra-ui}) +QT5_ADD_RESOURCES(opentrack-tracker-hydra-rcc ${opentrack-tracker-hydra-rc}) + +file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp") # compat lib for POSIX/win32 - file(GLOB opentrack-compat-c "compat/*.cpp") +file(GLOB opentrack-compat-c "compat/*.cpp") # x-plane plugin - file(GLOB opentrack-xplane-plugin-c "x-plane-plugin/*.c") - +file(GLOB opentrack-xplane-plugin-c "x-plane-plugin/*.c") + # freetrack - file(GLOB opentrack-freetrack-c "freetrackclient/*.cpp") +file(GLOB opentrack-freetrack-c "freetrackclient/*.cpp") - if(SDK_XPLANE) - # probably librt already included - add_library(opentrack-xplane-plugin SHARED ${opentrack-xplane-plugin-c}) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-xplane-plugin - PROPERTIES LINK_FLAGS - "-Wl,--version-script=${CMAKE_SOURCE_DIR}/x-plane-plugin/version-script.txt -shared -rdynamic -nodefaultlibs -undefined_warning -fPIC" - COMPILE_FLAGS "-Wall -O2 -pipe -fPIC -DLIN -DXPLM210" - LIBRARY_OUTPUT_NAME "facetracknoir.xpl" - PREFIX "" SUFFIX "") - endif() +if(SDK_XPLANE) + # probably librt already included + add_library(opentrack-xplane-plugin SHARED ${opentrack-xplane-plugin-c}) + if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-xplane-plugin + PROPERTIES LINK_FLAGS + "-Wl,--version-script=${CMAKE_SOURCE_DIR}/x-plane-plugin/version-script.txt -shared -rdynamic -nodefaultlibs -undefined_warning -fPIC" + COMPILE_FLAGS "-Wall -O2 -pipe -fPIC -DLIN -DXPLM210" + LIBRARY_OUTPUT_NAME "facetracknoir.xpl" + PREFIX "" SUFFIX "") endif() endif() # some boilerplate - if(QT_USE_FILE) - INCLUDE(${QT_USE_FILE}) - endif() +if(QT_USE_FILE) + INCLUDE(${QT_USE_FILE}) +endif() - if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of dll's.") - SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of modules.") - SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of modules.") - endif() +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + SET (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of dll's.") + SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of modules.") + SET (CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS_INIT} -rdynamic CACHE STRING "Flags used by the linker during the creation of modules.") +endif() - add_library(opentrack-compat SHARED ${opentrack-compat-c} ${opentrack-compat-h}) - if(NOT WIN32) - target_link_libraries(opentrack-compat rt) +add_library(opentrack-compat SHARED ${opentrack-compat-c} ${opentrack-compat-h}) +if(NOT WIN32) + target_link_libraries(opentrack-compat rt) +endif() + + # hack to avoid breakage on buildbot + set(my-qt-deps) + if(WIN32) + set(my-qt-deps ws2_32) endif() +SET(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps}) - # hack to avoid breakage on buildbot - set(my-qt-deps) - if(WIN32) - set(my-qt-deps ws2_32) - endif() - SET(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps}) +add_library(opentrack-csv SHARED ${opentrack-csv-c} ${opentrack-csv-h}) +target_link_libraries(opentrack-csv ${MY_QT_LIBS}) - add_library(opentrack-csv SHARED ${opentrack-csv-c} ${opentrack-csv-h}) - target_link_libraries(opentrack-csv ${MY_QT_LIBS}) +add_library(opentrack-pose-widget SHARED ${opentrack-pose-widget-c} ${opentrack-pose-widget-h} ${opentrack-pose-widget-moc} ${opentrack-pose-widget-rcc}) +target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS}) +add_library(opentrack-spline-widget SHARED ${opentrack-spline-widget-c} ${opentrack-spline-widget-h} ${opentrack-spline-widget-moc}) +target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS} ${QT_QTDESIGNER_LIBRARY_RELEASE}) - add_library(opentrack-pose-widget SHARED ${opentrack-pose-widget-c} ${opentrack-pose-widget-h} ${opentrack-pose-widget-moc} ${opentrack-pose-widget-rcc}) - target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS}) - add_library(opentrack-spline-widget SHARED ${opentrack-spline-widget-c} ${opentrack-spline-widget-h} ${opentrack-spline-widget-moc}) - target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS} ${QT_QTDESIGNER_LIBRARY_RELEASE}) +add_library(opentrack-filter-accela SHARED ${opentrack-filter-accela-c} ${opentrack-filter-accela-h} ${opentrack-filter-accela-moc} ${opentrack-filter-accela-uih} ${opentrack-filter-accela-rcc}) +target_link_libraries(opentrack-filter-accela ${MY_QT_LIBS}) - add_library(opentrack-filter-accela SHARED ${opentrack-filter-accela-c} ${opentrack-filter-accela-h} ${opentrack-filter-accela-moc} ${opentrack-filter-accela-uih} ${opentrack-filter-accela-rcc}) - target_link_libraries(opentrack-filter-accela ${MY_QT_LIBS}) +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-filter-accela + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") +endif() - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-filter-accela - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() +add_library(opentrack-filter-ewma SHARED ${opentrack-filter-ewma-uih} ${opentrack-filter-ewma-c} ${opentrack-filter-ewma-h} ${opentrack-filter-ewma-moc} ${opentrack-filter-ewma-rcc}) +target_link_libraries(opentrack-filter-ewma ${MY_QT_LIBS}) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-filter-ewma + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") +endif() - add_library(opentrack-filter-ewma SHARED ${opentrack-filter-ewma-uih} ${opentrack-filter-ewma-c} ${opentrack-filter-ewma-h} ${opentrack-filter-ewma-moc} ${opentrack-filter-ewma-rcc}) - target_link_libraries(opentrack-filter-ewma ${MY_QT_LIBS}) +add_library(opentrack-proto-fgfs SHARED ${opentrack-proto-fgfs-c} ${opentrack-proto-fgfs-h} ${opentrack-proto-fgfs-moc} ${opentrack-proto-fgfs-uih} ${opentrack-proto-fgfs-rcc}) +target_link_libraries(opentrack-proto-fgfs ${MY_QT_LIBS}) +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-proto-fgfs + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") +endif() +if(WIN32 AND SDK_VJOY) + include_directories(${SDK_VJOY}) + add_library(opentrack-proto-vjoy SHARED ${opentrack-proto-vjoy-c} ${opentrack-proto-vjoy-h} ${opentrack-proto-vjoy-moc} ${opentrack-proto-vjoy-uih} ${opentrack-proto-vjoy-rcc}) + if(MSVC) + target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.lib") + else() + target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.dll") + endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-filter-ewma - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") + SET_TARGET_PROPERTIES(opentrack-proto-vjoy + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt -Wl,--enable-stdcall-fixup") endif() +endif() - add_library(opentrack-proto-fgfs SHARED ${opentrack-proto-fgfs-c} ${opentrack-proto-fgfs-h} ${opentrack-proto-fgfs-moc} ${opentrack-proto-fgfs-uih} ${opentrack-proto-fgfs-rcc}) - target_link_libraries(opentrack-proto-fgfs ${MY_QT_LIBS}) +if(UNIX AND SDK_ENABLE_LIBEVDEV) + add_library(opentrack-proto-libevdev SHARED ${opentrack-proto-libevdev-c} ${opentrack-proto-libevdev-h} ${opentrack-proto-libevdev-moc} ${opentrack-proto-libevdev-uih} ${opentrack-proto-libevdev-rcc}) + target_link_libraries(opentrack-proto-libevdev ${MY_QT_LIBS} evdev) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-proto-fgfs + SET_TARGET_PROPERTIES(opentrack-proto-libevdev PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") endif() + install(TARGETS opentrack-proto-libevdev DESTINATION .) +endif() - if(WIN32 AND SDK_VJOY) - include_directories(${SDK_VJOY}) - add_library(opentrack-proto-vjoy SHARED ${opentrack-proto-vjoy-c} ${opentrack-proto-vjoy-h} ${opentrack-proto-vjoy-moc} ${opentrack-proto-vjoy-uih} ${opentrack-proto-vjoy-rcc}) +if(WIN32) + if(SDK_FSUIPC) + add_library(opentrack-proto-fsuipc SHARED ${opentrack-proto-fsuipc-c} ${opentrack-proto-fsuipc-h} ${opentrack-proto-fsuipc-moc} ${opentrack-proto-fsuipc-uih} ${opentrack-proto-fsuipc-rcc}) + target_link_libraries(opentrack-proto-fsuipc ${MY_QT_LIBS} "${SDK_FSUIPC}/FSUIPC_User.lib") if(MSVC) - target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.lib") - else() - target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} "${SDK_VJOY}/VJoy.dll") - endif() - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-proto-vjoy - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt -Wl,--enable-stdcall-fixup") + set_target_properties(opentrack-proto-fsuipc PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc") endif() endif() - if(UNIX AND SDK_ENABLE_LIBEVDEV) - add_library(opentrack-proto-libevdev SHARED ${opentrack-proto-libevdev-c} ${opentrack-proto-libevdev-h} ${opentrack-proto-libevdev-moc} ${opentrack-proto-libevdev-uih} ${opentrack-proto-libevdev-rcc}) - target_link_libraries(opentrack-proto-libevdev ${MY_QT_LIBS} evdev) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-proto-libevdev - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() - install(TARGETS opentrack-proto-libevdev DESTINATION .) + if(SDK_SIMCONNECT) + add_library(opentrack-proto-simconnect SHARED ${opentrack-proto-simconnect-c} ${opentrack-proto-simconnect-h} ${opentrack-proto-simconnect-moc} ${opentrack-proto-simconnect-uih} ${opentrack-proto-simconnect-rcc}) + target_link_libraries(opentrack-proto-simconnect ${MY_QT_LIBS}) + include_directories("${SDK_SIMCONNECT}/inc") + target_link_libraries(opentrack-proto-simconnect "${SDK_SIMCONNECT}/lib/SimConnect.lib") endif() - if(WIN32) - if(SDK_FSUIPC) - add_library(opentrack-proto-fsuipc SHARED ${opentrack-proto-fsuipc-c} ${opentrack-proto-fsuipc-h} ${opentrack-proto-fsuipc-moc} ${opentrack-proto-fsuipc-uih} ${opentrack-proto-fsuipc-rcc}) - target_link_libraries(opentrack-proto-fsuipc ${MY_QT_LIBS} "${SDK_FSUIPC}/FSUIPC_User.lib") - if(MSVC) - set_target_properties(opentrack-proto-fsuipc PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc") - endif() - endif() - - if(SDK_SIMCONNECT) - add_library(opentrack-proto-simconnect SHARED ${opentrack-proto-simconnect-c} ${opentrack-proto-simconnect-h} ${opentrack-proto-simconnect-moc} ${opentrack-proto-simconnect-uih} ${opentrack-proto-simconnect-rcc}) - target_link_libraries(opentrack-proto-simconnect ${MY_QT_LIBS}) - include_directories("${SDK_SIMCONNECT}/inc") - target_link_libraries(opentrack-proto-simconnect "${SDK_SIMCONNECT}/lib/SimConnect.lib") - endif() - - add_library(opentrack-proto-freetrack SHARED ${opentrack-proto-freetrack-c} ${opentrack-proto-freetrack-h} ${opentrack-proto-freetrack-moc} ${opentrack-proto-freetrack-uih} ${opentrack-proto-freetrack-rcc}) - target_link_libraries(opentrack-proto-freetrack opentrack-csv ${MY_QT_LIBS} opentrack-compat) + add_library(opentrack-proto-freetrack SHARED ${opentrack-proto-freetrack-c} ${opentrack-proto-freetrack-h} ${opentrack-proto-freetrack-moc} ${opentrack-proto-freetrack-uih} ${opentrack-proto-freetrack-rcc}) + target_link_libraries(opentrack-proto-freetrack opentrack-csv ${MY_QT_LIBS} opentrack-compat) - add_library(opentrack-proto-win32-mouse SHARED ${opentrack-proto-win32-mouse-c} ${opentrack-proto-win32-mouse-h} ${opentrack-proto-win32-mouse-moc} ${opentrack-proto-win32-mouse-uih} ${opentrack-proto-win32-mouse-rcc}) - target_link_libraries(opentrack-proto-win32-mouse ${MY_QT_LIBS}) - if(CMAKE_COMPILER_IS_GNUCC) - add_library(freetrackclient SHARED ${opentrack-freetrack-c} ${opentrack-freetrack-h} "${CMAKE_SOURCE_DIR}/freetrackclient/freetrackclient.def") - set_target_properties(freetrackclient PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup") - else() - add_library(freetrackclient SHARED ${opentrack-freetrack-c} ${opentrack-freetrack-h}) - endif() + add_library(opentrack-proto-win32-mouse SHARED ${opentrack-proto-win32-mouse-c} ${opentrack-proto-win32-mouse-h} ${opentrack-proto-win32-mouse-moc} ${opentrack-proto-win32-mouse-uih} ${opentrack-proto-win32-mouse-rcc}) + target_link_libraries(opentrack-proto-win32-mouse ${MY_QT_LIBS}) + if(CMAKE_COMPILER_IS_GNUCC) + add_library(freetrackclient SHARED ${opentrack-freetrack-c} ${opentrack-freetrack-h} "${CMAKE_SOURCE_DIR}/freetrackclient/freetrackclient.def") + set_target_properties(freetrackclient PROPERTIES LINK_FLAGS "-Wl,--enable-stdcall-fixup") + else() + add_library(freetrackclient SHARED ${opentrack-freetrack-c} ${opentrack-freetrack-h}) endif() +endif() + +add_library(opentrack-proto-udp SHARED ${opentrack-proto-udp-c} ${opentrack-proto-udp-h} ${opentrack-proto-udp-moc} ${opentrack-proto-udp-uih} ${opentrack-proto-udp-rcc}) +target_link_libraries(opentrack-proto-udp ${MY_QT_LIBS}) +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-proto-udp + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") +endif() - add_library(opentrack-proto-udp SHARED ${opentrack-proto-udp-c} ${opentrack-proto-udp-h} ${opentrack-proto-udp-moc} ${opentrack-proto-udp-uih} ${opentrack-proto-udp-rcc}) - target_link_libraries(opentrack-proto-udp ${MY_QT_LIBS}) +if(WIN32) + add_library(opentrack-tracker-joystick SHARED ${opentrack-tracker-joystick-c} ${opentrack-tracker-joystick-h} ${opentrack-tracker-joystick-moc} ${opentrack-tracker-joystick-uih} ${opentrack-tracker-joystick-rcc}) + target_link_libraries(opentrack-tracker-joystick ${MY_QT_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-proto-udp + SET_TARGET_PROPERTIES(opentrack-tracker-joystick PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") endif() +endif() - if(WIN32) - add_library(opentrack-tracker-joystick SHARED ${opentrack-tracker-joystick-c} ${opentrack-tracker-joystick-h} ${opentrack-tracker-joystick-moc} ${opentrack-tracker-joystick-uih} ${opentrack-tracker-joystick-rcc}) - target_link_libraries(opentrack-tracker-joystick ${MY_QT_LIBS}) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-tracker-joystick - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() +if(NOT WIN32 AND SDK_WINE_PREFIX) + add_library(opentrack-proto-wine SHARED ${opentrack-proto-wine-c} ${opentrack-proto-wine-h} ${opentrack-proto-wine-moc} ${opentrack-proto-wine-uih} ${opentrack-proto-wine-rcc}) + target_link_libraries(opentrack-proto-wine ${MY_QT_LIBS} opentrack-compat opentrack-csv) + if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-proto-wine + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") endif() - - if(NOT WIN32 AND SDK_WINE_PREFIX) - add_library(opentrack-proto-wine SHARED ${opentrack-proto-wine-c} ${opentrack-proto-wine-h} ${opentrack-proto-wine-moc} ${opentrack-proto-wine-uih} ${opentrack-proto-wine-rcc}) - target_link_libraries(opentrack-proto-wine ${MY_QT_LIBS} opentrack-compat opentrack-csv) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-proto-wine - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() - if(NOT SDK_WINE_NO_WRAPPER) - add_custom_command( - OUTPUT opentrack-wrapper-wine.exe.so - DEPENDS "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx" - COMMAND "${SDK_WINE_PREFIX}/bin/wineg++" -g -O2 -m32 -o - opentrack-wrapper-wine.exe -I "${CMAKE_SOURCE_DIR}" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx" - "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx" - -lrt) - add_custom_target(wine-wrapper ALL DEPENDS opentrack-wrapper-wine.exe.so) - add_dependencies(wine-wrapper opentrack-compat opentrack-proto-wine) - endif() + if(NOT SDK_WINE_NO_WRAPPER) + add_custom_command( + OUTPUT opentrack-wrapper-wine.exe.so + DEPENDS "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx" + "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx" + "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx" + COMMAND "${SDK_WINE_PREFIX}/bin/wineg++" -g -O2 -m32 -o + opentrack-wrapper-wine.exe -I "${CMAKE_SOURCE_DIR}" + "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-main.cxx" + "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-posix.cxx" + "${CMAKE_SOURCE_DIR}/ftnoir_protocol_wine/opentrack-wrapper-wine-windows.cxx" + -lrt) + add_custom_target(wine-wrapper ALL DEPENDS opentrack-wrapper-wine.exe.so) + add_dependencies(wine-wrapper opentrack-compat opentrack-proto-wine) endif() +endif() - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-proto-fgfs - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-proto-fgfs + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") +endif() - add_library(opentrack-tracker-ht SHARED ${opentrack-tracker-ht-c} ${opentrack-tracker-ht-h} ${opentrack-tracker-ht-moc} ${opentrack-tracker-ht-uih} ${opentrack-tracker-ht-rcc}) - target_link_libraries(opentrack-tracker-ht ${MY_QT_LIBS} opentrack-compat) +add_library(opentrack-tracker-ht SHARED ${opentrack-tracker-ht-c} ${opentrack-tracker-ht-h} ${opentrack-tracker-ht-moc} ${opentrack-tracker-ht-uih} ${opentrack-tracker-ht-rcc}) +target_link_libraries(opentrack-tracker-ht ${MY_QT_LIBS} opentrack-compat) +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-tracker-ht + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") +endif() + +if(SDK_ARUCO_LIBPATH) + include_directories(${CMAKE_SOURCE_DIR}/ftnoir_tracker_aruco/include) + add_library(opentrack-tracker-aruco SHARED ${opentrack-tracker-aruco-c} ${opentrack-tracker-aruco-h} ${opentrack-tracker-aruco-moc} ${opentrack-tracker-aruco-uih} ${opentrack-tracker-aruco-rcc}) + target_link_libraries(opentrack-tracker-aruco ${MY_QT_LIBS} ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-tracker-ht + SET_TARGET_PROPERTIES(opentrack-tracker-aruco PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") endif() +endif() - if(SDK_ARUCO_LIBPATH) - include_directories(${CMAKE_SOURCE_DIR}/ftnoir_tracker_aruco/include) - add_library(opentrack-tracker-aruco SHARED ${opentrack-tracker-aruco-c} ${opentrack-tracker-aruco-h} ${opentrack-tracker-aruco-moc} ${opentrack-tracker-aruco-uih} ${opentrack-tracker-aruco-rcc}) - target_link_libraries(opentrack-tracker-aruco ${MY_QT_LIBS} ${SDK_ARUCO_LIBPATH} ${OpenCV_LIBS}) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-tracker-aruco - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() +if(WIN32) + target_link_libraries(opentrack-tracker-ht + "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" + "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" + uuid) + target_link_libraries(opentrack-tracker-joystick + "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" + "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" + "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" + uuid) +endif() + +if(OpenCV_FOUND) + include_directories(${OpenCV_INCLUDE_DIRS}) + include_directories(${OpenCV_DIR}/include) + include_directories(${OpenCV_CONFIG_PATH}/include) +endif() + +if(OpenCV_FOUND) + add_library(opentrack-tracker-pt SHARED ${opentrack-tracker-pt-c} ${opentrack-tracker-pt-h} ${opentrack-tracker-pt-moc} ${opentrack-tracker-pt-uih} ${opentrack-tracker-pt-rcc}) + target_link_libraries(opentrack-tracker-pt ${MY_QT_LIBS} ${OpenCV_LIBS}) + if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-tracker-pt + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") endif() if(WIN32) - target_link_libraries(opentrack-tracker-ht - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - uuid) - target_link_libraries(opentrack-tracker-joystick - "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" + target_link_libraries(opentrack-tracker-pt "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" uuid) endif() +endif() - if(OpenCV_FOUND) - include_directories(${OpenCV_INCLUDE_DIRS}) - include_directories(${OpenCV_DIR}/include) - include_directories(${OpenCV_CONFIG_PATH}/include) - endif() - - if(OpenCV_FOUND) - add_library(opentrack-tracker-pt SHARED ${opentrack-tracker-pt-c} ${opentrack-tracker-pt-h} ${opentrack-tracker-pt-moc} ${opentrack-tracker-pt-uih} ${opentrack-tracker-pt-rcc}) - target_link_libraries(opentrack-tracker-pt ${MY_QT_LIBS} ${OpenCV_LIBS}) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-tracker-pt - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() - - if(WIN32) - target_link_libraries(opentrack-tracker-pt - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - uuid) - endif() - endif() +add_library(opentrack-tracker-udp SHARED ${opentrack-tracker-udp-c} ${opentrack-tracker-udp-h} ${opentrack-tracker-udp-moc} ${opentrack-tracker-udp-uih} ${opentrack-tracker-udp-rcc}) +target_link_libraries(opentrack-tracker-udp ${MY_QT_LIBS}) +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-tracker-udp + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") +endif() - add_library(opentrack-tracker-udp SHARED ${opentrack-tracker-udp-c} ${opentrack-tracker-udp-h} ${opentrack-tracker-udp-moc} ${opentrack-tracker-udp-uih} ${opentrack-tracker-udp-rcc}) - target_link_libraries(opentrack-tracker-udp ${MY_QT_LIBS}) - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-tracker-udp - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() - - if(SDK_RIFT) - include_directories("${SDK_RIFT}/Include") - include_directories("${SDK_RIFT}/Src") - add_library(opentrack-tracker-rift SHARED ${opentrack-tracker-rift-c} ${opentrack-tracker-rift-h} ${opentrack-tracker-rift-moc} ${opentrack-tracker-rift-uih} ${opentrack-tracker-rift-rcc}) - target_link_libraries(opentrack-tracker-rift ${MY_QT_LIBS}) - if(MSVC) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/Lib/Win32/libovr.lib" winmm.lib) +if(SDK_RIFT) + include_directories("${SDK_RIFT}/Include") + include_directories("${SDK_RIFT}/Src") + add_library(opentrack-tracker-rift SHARED ${opentrack-tracker-rift-c} ${opentrack-tracker-rift-h} ${opentrack-tracker-rift-moc} ${opentrack-tracker-rift-uih} ${opentrack-tracker-rift-rcc}) + target_link_libraries(opentrack-tracker-rift ${MY_QT_LIBS}) + if(MSVC) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/Lib/Win32/libovr.lib" winmm.lib) + else() + if(WIN32) + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/LibOVR.a" winmm.lib setupapi.lib) else() - if(WIN32) - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/LibOVR.a" winmm.lib setupapi.lib) - else() - target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/LibOVR.a" udev Xinerama) - endif() + target_link_libraries(opentrack-tracker-rift "${SDK_RIFT}/LibOVR.a" udev Xinerama) endif() - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-tracker-rift - PROPERTIES - LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt" - COMPILE_FLAGS "-fno-strict-aliasing" - ) - endif() - endif() - - if(SDK_HYDRA) - include_directories("${SDK_HYDRA}/include") - include_directories("${SDK_HYDRA}/include/sixense_utils") - add_library(opentrack-tracker-hydra SHARED ${opentrack-tracker-hydra-c} ${opentrack-tracker-hydra-h} ${opentrack-tracker-hydra-moc} ${opentrack-tracker-hydra-uih} ${opentrack-tracker-hydra-rcc}) - target_link_libraries(opentrack-tracker-hydra ${MY_QT_LIBS}) - if(WIN32) - target_link_libraries(opentrack-tracker-hydra - "${SDK_HYDRA}/lib/win32/release_dll/sixense.lib" - "${SDK_HYDRA}/lib/win32/release_dll/sixense_utils.lib") - install(FILES "${SDK_HYDRA}/bin/win32/release_dll/sixense.dll" "${SDK_HYDRA}/bin/win32/release_dll/sixense_utils.dll" DESTINATION .) - else() - if(SDK_HYDRA_AMD64) - set(underscore-sixtyfour _x64) - else() - set(underscore-sixtyfour) - endif() - if(APPLE) - set(underscore-dll _dll) - set(soext dylib) - set(sixense-plat osx) - else() - set(underscore-dll) - set(soext so) - set(sixense-plat linux) - endif() - install(FILES - "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense${underscore-sixtyfour}.${soext}" - "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense_utils${underscore-sixtyfour}.${soext}" - DESTINATION .) - target_link_libraries(opentrack-tracker-hydra "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense${underscore-sixtyfour}.${soext}" "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense_utils${underscore-sixtyfour}.${soext}") - endif() - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) - SET_TARGET_PROPERTIES(opentrack-tracker-hydra - PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") - endif() - endif() - - if(WIN32 AND NOT SDK_CONSOLE_DEBUG) - set(opentrack-win32-executable WIN32) - else() - set(opentrack-win32-executable "") - endif() - if(UNIX) - add_library(opentrack-qxt-mini SHARED ${qxt-mini-c}) - SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES COMPILE_FLAGS "-DBUILD_QXT_CORE=42 -DBUILD_QXT_WIDGETS=42 -DBUILD_QXT_GUI=42") - target_link_libraries(opentrack-qxt-mini ${MY_QT_LIBS}) - endif() - add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-h} ${opentrack-bin-moc} ${opentrack-bin-uih} ${opentrack-bin-rcc}) - set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") - if(UNIX) - target_link_libraries(opentrack opentrack-qxt-mini) + endif() + if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-tracker-rift + PROPERTIES + LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt" + COMPILE_FLAGS "-fno-strict-aliasing" + ) endif() - - if(UNIX) - install(TARGETS opentrack-qxt-mini DESTINATION .) endif() +if(SDK_HYDRA) + include_directories("${SDK_HYDRA}/include") + include_directories("${SDK_HYDRA}/include/sixense_utils") + add_library(opentrack-tracker-hydra SHARED ${opentrack-tracker-hydra-c} ${opentrack-tracker-hydra-h} ${opentrack-tracker-hydra-moc} ${opentrack-tracker-hydra-uih} ${opentrack-tracker-hydra-rcc}) + target_link_libraries(opentrack-tracker-hydra ${MY_QT_LIBS}) if(WIN32) - target_link_libraries(opentrack "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" - "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" - "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" - winmm - uuid - ) - endif() - if(MSVC) - SET_TARGET_PROPERTIES(opentrack PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup /NODEFAULTLIB:LIBCMT.LIB") - endif() - target_link_libraries(opentrack opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) - if(NOT WIN32) - target_link_libraries(opentrack dl) - endif() - if(SDK_GOOGLE_BREAKPAD) - if(MSVC) - target_link_libraries(opentrack - "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/crash_generation_client.lib" - "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/exception_handler.lib" - "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/common.lib") + target_link_libraries(opentrack-tracker-hydra + "${SDK_HYDRA}/lib/win32/release_dll/sixense.lib" + "${SDK_HYDRA}/lib/win32/release_dll/sixense_utils.lib") + install(FILES "${SDK_HYDRA}/bin/win32/release_dll/sixense.dll" "${SDK_HYDRA}/bin/win32/release_dll/sixense_utils.dll" DESTINATION .) else() - target_link_libraries(opentrack "${SDK_GOOGLE_BREAKPAD}/lib/libbreakpad_client.a" - "${SDK_GOOGLE_BREAKPAD}/lib/libbreakpad.a") + if(SDK_HYDRA_AMD64) + set(underscore-sixtyfour _x64) + else() + set(underscore-sixtyfour) + endif() + if(APPLE) + set(underscore-dll _dll) + set(soext dylib) + set(sixense-plat osx) + else() + set(underscore-dll) + set(soext so) + set(sixense-plat linux) + endif() + install(FILES + "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense${underscore-sixtyfour}.${soext}" + "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense_utils${underscore-sixtyfour}.${soext}" + DESTINATION .) + target_link_libraries(opentrack-tracker-hydra "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense${underscore-sixtyfour}.${soext}" "${SDK_HYDRA}/lib/${sixense-plat}${underscore-sixtyfour}/release${underscore-dll}/libsixense_utils${underscore-sixtyfour}.${soext}") + endif() + if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-tracker-hydra + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") endif() - endif() - set_target_properties(opentrack PROPERTIES COMPILE_FLAGS -DOPENTRACK_MAIN) endif() -# make install +if(WIN32 AND NOT SDK_CONSOLE_DEBUG) + set(opentrack-win32-executable WIN32) +else() + set(opentrack-win32-executable "") +endif() +if(UNIX) + add_library(opentrack-qxt-mini SHARED ${qxt-mini-c}) + SET_TARGET_PROPERTIES(opentrack-qxt-mini PROPERTIES COMPILE_FLAGS "-DBUILD_QXT_CORE=42 -DBUILD_QXT_WIDGETS=42 -DBUILD_QXT_GUI=42") + target_link_libraries(opentrack-qxt-mini ${MY_QT_LIBS}) +endif() +add_executable(opentrack ${opentrack-win32-executable} ${opentrack-bin-c} ${opentrack-bin-h} ${opentrack-bin-moc} ${opentrack-bin-uih} ${opentrack-bin-rcc}) +set_target_properties(opentrack PROPERTIES COMPILE_DEFINITIONS OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\") +if(UNIX) + target_link_libraries(opentrack opentrack-qxt-mini) +endif() -if(SDK_SM_FACEAPI_PATH) - include_directories("${SDK_SM_FACEAPI_PATH}/include") - if(WIN32 AND NOT SDK_FACEAPI_ONLY) - add_library(opentrack-tracker-faceapi SHARED ${opentrack-tracker-faceapi-c} ${opentrack-tracker-faceapi-h} ${opentrack-tracker-faceapi-moc} ${opentrack-tracker-faceapi-uih} ${opentrack-tracker-faceapi-rcc}) - target_link_libraries(opentrack-tracker-faceapi ${MY_QT_LIBS} opentrack-compat) - endif() - if(MSVC80 OR MINGW) - add_executable(opentrack-faceapi-wrapper ${opentrack-faceapi-wrapper-c} ${opentrack-faceapi-wrapper-h}) - target_link_libraries(opentrack-faceapi-wrapper "${SDK_SM_FACEAPI_PATH}/bin/smft32.lib") - endif() +if(UNIX) + install(TARGETS opentrack-qxt-mini DESTINATION .) +endif() + +if(WIN32) + target_link_libraries(opentrack "${CMAKE_SOURCE_DIR}/dinput/dinput8.lib" + "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" + "${CMAKE_SOURCE_DIR}/dinput/strmiids.lib" + winmm + uuid + ) +endif() +if(MSVC) + SET_TARGET_PROPERTIES(opentrack PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup /NODEFAULTLIB:LIBCMT.LIB") +endif() +target_link_libraries(opentrack opentrack-pose-widget opentrack-spline-widget ${MY_QT_LIBS} ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTWIDGETS_LIB_RELEASE}) +if(NOT WIN32) + target_link_libraries(opentrack dl) endif() + if(SDK_GOOGLE_BREAKPAD) + if(MSVC) + target_link_libraries(opentrack + "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/crash_generation_client.lib" + "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/exception_handler.lib" + "${SDK_GOOGLE_BREAKPAD}/src/client/windows/Release/lib/common.lib") + else() + target_link_libraries(opentrack "${SDK_GOOGLE_BREAKPAD}/lib/libbreakpad_client.a" + "${SDK_GOOGLE_BREAKPAD}/lib/libbreakpad.a") + endif() + endif() +set_target_properties(opentrack PROPERTIES COMPILE_FLAGS -DOPENTRACK_MAIN) + +# make install install(FILES "${CMAKE_SOURCE_DIR}/README.md" DESTINATION .) -if(NOT SDK_FACEAPI_ONLY) - if(SDK_XPLANE) - install(TARGETS opentrack-xplane-plugin LIBRARY DESTINATION . NAMELINK_SKIP) - endif() - if(WIN32) - install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/tracker-ht" DESTINATION .) - install(TARGETS freetrackclient RUNTIME DESTINATION .) - endif() - install(DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty-notices" DESTINATION .) +if(SDK_XPLANE) + install(TARGETS opentrack-xplane-plugin LIBRARY DESTINATION . NAMELINK_SKIP) +endif() +if(WIN32) + install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/tracker-ht" DESTINATION .) + install(TARGETS freetrackclient RUNTIME DESTINATION .) +endif() + install(DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty-notices" DESTINATION .) - install(FILES "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe" DESTINATION .) - install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/settings" "${CMAKE_SOURCE_DIR}/facetracknoir/clientfiles" DESTINATION .) +install(FILES "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe" DESTINATION .) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/settings" "${CMAKE_SOURCE_DIR}/facetracknoir/clientfiles" DESTINATION .) - if(NOT WIN32 AND SDK_WINE_PREFIX) - install(FILES "${CMAKE_BINARY_DIR}/opentrack-wrapper-wine.exe.so" - DESTINATION .) - install(TARGETS opentrack-proto-wine DESTINATION .) - endif() +if(NOT WIN32 AND SDK_WINE_PREFIX) + install(FILES "${CMAKE_BINARY_DIR}/opentrack-wrapper-wine.exe.so" + DESTINATION .) + install(TARGETS opentrack-proto-wine DESTINATION .) +endif() - if(OpenCV_FOUND) - install(TARGETS opentrack-tracker-pt RUNTIME DESTINATION . LIBRARY DESTINATION .) - endif() +if(OpenCV_FOUND) + install(TARGETS opentrack-tracker-pt RUNTIME DESTINATION . LIBRARY DESTINATION .) +endif() - if(SDK_ARUCO_LIBPATH) - install(TARGETS opentrack-tracker-aruco RUNTIME DESTINATION . LIBRARY DESTINATION .) - endif() +if(SDK_ARUCO_LIBPATH) + install(TARGETS opentrack-tracker-aruco RUNTIME DESTINATION . LIBRARY DESTINATION .) +endif() - install(TARGETS - opentrack-compat - opentrack-csv - opentrack-pose-widget - opentrack-spline-widget - opentrack-filter-accela - opentrack-filter-ewma - opentrack-proto-fgfs - opentrack-proto-udp - opentrack-tracker-ht - opentrack-tracker-udp - opentrack - RUNTIME DESTINATION . - LIBRARY DESTINATION . - NAMELINK_SKIP +install(TARGETS + opentrack-compat + opentrack-csv + opentrack-pose-widget + opentrack-spline-widget + opentrack-filter-accela + opentrack-filter-ewma + opentrack-proto-fgfs + opentrack-proto-udp + opentrack-tracker-ht + opentrack-tracker-udp + opentrack + RUNTIME DESTINATION . + LIBRARY DESTINATION . + NAMELINK_SKIP +) + +if(WIN32) + install(TARGETS opentrack-tracker-joystick RUNTIME DESTINATION . LIBRARY DESTINATION . NAMELINK_SKIP) +endif() + +if(WIN32 AND SDK_VJOY) + install(TARGETS opentrack-proto-vjoy + RUNTIME DESTINATION . + LIBRARY DESTINATION . + NAMELINK_SKIP) + install(FILES "${SDK_VJOY}/VJoy.dll" DESTINATION .) +endif() + +if(SDK_RIFT) + install( + TARGETS opentrack-tracker-rift + RUNTIME DESTINATION . + LIBRARY DESTINATION . + NAMELINK_SKIP ) +endif() - if(WIN32) - install(TARGETS opentrack-tracker-joystick RUNTIME DESTINATION . LIBRARY DESTINATION . NAMELINK_SKIP) - endif() +if(SDK_HYDRA) + install( + TARGETS opentrack-tracker-hydra + RUNTIME DESTINATION . + LIBRARY DESTINATION . + NAMELINK_SKIP + ) +endif() - if(WIN32 AND SDK_VJOY) - install(TARGETS opentrack-proto-vjoy +if(WIN32) + install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION .) + if(SDK_SIMCONNECT) + install(TARGETS opentrack-proto-simconnect RUNTIME DESTINATION . LIBRARY DESTINATION . NAMELINK_SKIP) - install(FILES "${SDK_VJOY}/VJoy.dll" DESTINATION .) endif() - - if(SDK_RIFT) - install( - TARGETS opentrack-tracker-rift - RUNTIME DESTINATION . - LIBRARY DESTINATION . - NAMELINK_SKIP + if(OpenCV_FOUND AND NOT SDK_OPENCV_STATIC) + get_filename_component(opentrack-opencv-dir "${OpenCV_LIB_DIR_OPT}" PATH) + if(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC) + set(LIB-PREFIX "../bin/Release/") + else() + set(LIB-PREFIX "lib") + endif() + file(GLOB opentrack-opencv-files + "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_calib3d*.dll" + "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_core*.dll" + "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_highgui*.dll" + "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_imgproc*.dll" + "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_flann*.dll" + "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_features2d*.dll" + ) + install(FILES ${opentrack-opencv-files} DESTINATION .) + endif() + if(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC) + GET_FILENAME_COMPONENT(qt-dirname "${Qt5Core_DIR}" PATH) + SET(qt-dirname "${qt-dirname}/../../bin") + install(FILES + "${qt-dirname}/Qt5Core.dll" + "${qt-dirname}/Qt5Gui.dll" + "${qt-dirname}/Qt5Widgets.dll" + "${qt-dirname}/Qt5Network.dll" + "${qt-dirname}/Qt5Xml.dll" + DESTINATION . ) endif() - - if(SDK_HYDRA) - install( - TARGETS opentrack-tracker-hydra + install(TARGETS + opentrack-proto-freetrack + opentrack-proto-win32-mouse + #opentrack-proto-simconnect RUNTIME DESTINATION . LIBRARY DESTINATION . NAMELINK_SKIP - ) - endif() - - if(WIN32) - install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION .) - if(SDK_SIMCONNECT) - install(TARGETS opentrack-proto-simconnect + ) + if(SDK_FSUIPC) + install(TARGETS opentrack-proto-fsuipc RUNTIME DESTINATION . LIBRARY DESTINATION . NAMELINK_SKIP) - endif() - if(OpenCV_FOUND AND NOT SDK_OPENCV_STATIC) - get_filename_component(opentrack-opencv-dir "${OpenCV_LIB_DIR_OPT}" PATH) - if(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC) - set(LIB-PREFIX "../bin/Release/") - else() - set(LIB-PREFIX "lib") - endif() - file(GLOB opentrack-opencv-files - "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_calib3d*.dll" - "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_core*.dll" - "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_highgui*.dll" - "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_imgproc*.dll" - "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_flann*.dll" - "${opentrack-opencv-dir}/${LIB-PREFIX}opencv_features2d*.dll" - ) - install(FILES ${opentrack-opencv-files} DESTINATION .) - endif() - if(WIN32 AND NOT CMAKE_COMPILER_IS_GNUCC) - GET_FILENAME_COMPONENT(qt-dirname "${Qt5Core_DIR}" PATH) - SET(qt-dirname "${qt-dirname}/../../bin") - install(FILES - "${qt-dirname}/Qt5Core.dll" - "${qt-dirname}/Qt5Gui.dll" - "${qt-dirname}/Qt5Widgets.dll" - "${qt-dirname}/Qt5Network.dll" - "${qt-dirname}/Qt5Xml.dll" - DESTINATION . - ) - endif() - install(TARGETS - opentrack-proto-freetrack - opentrack-proto-win32-mouse - #opentrack-proto-simconnect - RUNTIME DESTINATION . - LIBRARY DESTINATION . - NAMELINK_SKIP - ) - if(SDK_FSUIPC) - install(TARGETS opentrack-proto-fsuipc - RUNTIME DESTINATION . - LIBRARY DESTINATION . - NAMELINK_SKIP) - endif() - endif() -endif() -if(SDK_SM_FACEAPI_PATH AND NOT SDK_FACEAPI_ONLY) - install(TARGETS opentrack-tracker-faceapi - RUNTIME DESTINATION . - LIBRARY DESTINATION . - NAMELINK_SKIP - ) + endif() if(MSVC) - file(GLOB pdbs1 "${CMAKE_BINARY_DIR}/Release/*.pdb") - file(GLOB pdbs2 "${CMAKE_BINARY_DIR}/*.pdb") - install(FILES ${pdbs1} ${pdbs2} DESTINATION .) +file(GLOB pdbs1 "${CMAKE_BINARY_DIR}/Release/*.pdb") +file(GLOB pdbs2 "${CMAKE_BINARY_DIR}/*.pdb") +install(FILES ${pdbs1} ${pdbs2} DESTINATION .) endif() -if(SDK_SM_FACEAPI_PATH AND (MSVC80 OR MINGW)) - install(TARGETS opentrack-faceapi-wrapper - RUNTIME DESTINATION faceapi - LIBRARY DESTINATION faceapi - NAMELINK_SKIP - ) - install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION faceapi) - install(FILES - "${SDK_SM_FACEAPI_PATH}/bin/computation6.0.dll" - "${SDK_SM_FACEAPI_PATH}/bin/foundation6.0.dll" - "${SDK_SM_FACEAPI_PATH}/bin/image6.0.dll" - "${SDK_SM_FACEAPI_PATH}/bin/libpng13.dll" - "${SDK_SM_FACEAPI_PATH}/bin/pgrflycapturegui.dll" - "${SDK_SM_FACEAPI_PATH}/bin/QtCore0.dll" - "${SDK_SM_FACEAPI_PATH}/bin/qt-mt334.dll" - "${SDK_SM_FACEAPI_PATH}/bin/QtXml4.dll" - "${SDK_SM_FACEAPI_PATH}/bin/smft32.dll" - "${SDK_SM_FACEAPI_PATH}/bin/zlib1.dll" - "${SDK_SM_FACEAPI_PATH}/doc/RELEASE NOTES.txt" - DESTINATION faceapi - ) - install(DIRECTORY - "${SDK_SM_FACEAPI_PATH}/bin/cal" - "${SDK_SM_FACEAPI_PATH}/bin/resources" - DESTINATION faceapi - ) -endif() diff --git a/faceapi/build_options.h b/faceapi/build_options.h deleted file mode 100644 index e298686e..00000000 --- a/faceapi/build_options.h +++ /dev/null @@ -1,8 +0,0 @@ -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// Build Options -// -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -//controls whether or not FaceAPI should use the callback or poll -#define USE_HEADPOSE_CALLBACK 1 diff --git a/faceapi/ftnoir-faceapi-wrapper.exe.manifest b/faceapi/ftnoir-faceapi-wrapper.exe.manifest deleted file mode 100644 index b6c98376..00000000 --- a/faceapi/ftnoir-faceapi-wrapper.exe.manifest +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> - <dependency> - <dependentAssembly> - <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.4053" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"> - </assemblyIdentity> - </dependentAssembly> - </dependency> - <dependency> - <dependentAssembly> - <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"> - </assemblyIdentity> - </dependentAssembly> - </dependency> -</assembly>
\ No newline at end of file diff --git a/faceapi/ftnoir-faceapi-wrapper.rc b/faceapi/ftnoir-faceapi-wrapper.rc deleted file mode 100644 index 54cbb863..00000000 --- a/faceapi/ftnoir-faceapi-wrapper.rc +++ /dev/null @@ -1,2 +0,0 @@ -#include "winuser.h" -2 RT_MANIFEST ftnoir-faceapi-wrapper.exe.manifest
\ No newline at end of file diff --git a/faceapi/lock.h b/faceapi/lock.h deleted file mode 100644 index bb095675..00000000 --- a/faceapi/lock.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef SM_API_TESTAPPCONSOLE_LOCK_H -#define SM_API_TESTAPPCONSOLE_LOCK_H - -#include "mutex.h" - -namespace sm -{ - namespace faceapi - { - namespace samplecode - { - // A very simple scoped-lock class for sample code purposes. - // It is recommended that you use the boost threads library. - class Lock - { - public: - Lock(const Mutex &mutex): _mutex(mutex) - { - _mutex.lock(); - } - ~Lock() - { - _mutex.unlock(); - } - private: - // Noncopyable - Lock(const Lock &); - Lock &operator=(const Lock &); - private: - const Mutex &_mutex; - }; - } - } -} -#endif diff --git a/faceapi/lockfree.h b/faceapi/lockfree.h deleted file mode 100644 index 47b810fa..00000000 --- a/faceapi/lockfree.h +++ /dev/null @@ -1,65 +0,0 @@ -//lock free queue template class by Herb Sutter -//Dr Dobbs Journal article http://www.drdobbs.com/cpp/210604448;jsessionid=OQGQPSMNL4X4XQE1GHPSKH4ATMY32JVN?pgno=1 - -template <typename T> class LockFreeQueue -{ -private: - struct Node - { - Node( T val ) : value(val), next(nullptr) { } - T value; - Node* next; - }; - - Node* first; // for producer only - Node* divider, last; // shared - - //not working in VC2008 - //atomic<Node*> divider, last; // shared - -public: - LockFreeQueue() - { - // add dummy separator - first = divider = last = new Node( T() ); - } - - ~LockFreeQueue() - { - while( first != nullptr ) - { - // release the list - Node* tmp = first; - first = tmp->next; - delete tmp; - } - } - - void Produce( const T& t ) - { - last->next = new Node(t); // add the new item - last = last->next; // publish it - - while( first != divider ) - { - // trim unused nodes - Node* tmp = first; - first = first->next; - delete tmp; - } - } - - bool Consume( T& result ) - { - if( divider != last ) - { - // if queue is nonempty - result = divider->next->value; // copy it back - divider = divider->next; // publish that we took it - return true; // and report success - } - - return false; // else report empty - } -}; - diff --git a/faceapi/main.cpp b/faceapi/main.cpp deleted file mode 100644 index fb7d3f0a..00000000 --- a/faceapi/main.cpp +++ /dev/null @@ -1,529 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of the some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2013 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -*********************************************************************************/ - -//Precompiled header -#include "stdafx.h" - -//FaceAPI headers -#include <sm_api.h> -#include "ftnoir_tracker_sm/ftnoir_tracker_sm_types.h" -#include "utils.h" -#include <exception> - -//local headers -#include "build_options.h" - -//namespaces -using namespace std; -using namespace sm::faceapi::samplecode; - -// -// global variables -// -HANDLE hSMMemMap = NULL; -SMMemMap *pMemData; -HANDLE hSMMutex; -smEngineHeadPoseData new_head_pose; -bool stopCommand = false; -bool ftnoirConnected = false; - -//enums -enum GROUP_ID -{ - GROUP0=0, -}; - -enum EVENT_ID -{ - EVENT_PING=0, - EVENT_INIT, -}; - -enum INPUT_ID -{ - INPUT0=0, -}; - -//function definitions -void updateHeadPose(smEngineHeadPoseData* temp_head_pose); -bool SMCreateMapping(); - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -//FaceAPI function implementations -// -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void STDCALL receiveLogMessage(void *, const char *buf, int /*buf_len*/) -{ - Lock lock(g_mutex); // serialize logging calls from different threads to avoid garbled output. - //cout << string(buf); -} - -// Callback function for face-data -void STDCALL receiveFaceData(void *, smEngineFaceData face_data, smCameraVideoFrame video_frame) -{ - Lock lock(g_mutex); - - // Get info including data pointer to original image from camera - smImageInfo video_frame_image_info; - THROW_ON_ERROR(smImageGetInfo(video_frame.image_handle, &video_frame_image_info)); // reentrant, so ok - - // video_frame_image_info.plane_addr[*] now point to the image memory planes. - // The memory is only valid until the end of this routine unless you call smImageAddRef(video_frame.image_handle). - // So you can deep copy the image data here, or use smImageAddRef() and just copy the pointer. - // If you use smImageAddRef() you are responsible for calling smImageDestroy() to avoid a memory leak later. - - // In this callback you will typically want to copy the smEngineFaceData data into your own data-structure. - // Since the smEngineFaceData contains multiple pod types copying it is not atomic and - // a mutex is required to avoid the race-condition with any thread simultaneously - // reading from your data-structure. - // Such a race condition will not crash your code but will create weird noise in the tracking data. - - if (g_do_face_data_printing) - { - //cout << video_frame << " " << face_data; - - // Save any face texture to a PNG file - if (face_data.texture) - { - // Create a unique filename - std::stringstream filename; - filename << "face_" << video_frame.frame_num << ".png"; - // Try saving to a file - if (saveToPNGFile(filename.str(), face_data.texture->image_info) == SM_API_OK) - { - cout << "Saved face-texture to " << filename.str() << std::endl; - } - else - { - cout << "Error saving face-texture to " << filename.str() << std::endl; - } - } - } -} - -// Callback function for head-pose -void STDCALL receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVideoFrame video_frame) -{ - Lock lock(g_mutex); - - // Get info including data pointer to original image from camera - smImageInfo video_frame_image_info; - THROW_ON_ERROR(smImageGetInfo(video_frame.image_handle, &video_frame_image_info)); // reentrant, so ok - - // video_frame_image_info.plane_addr[*] now point to the image memory planes. - // The memory is only valid until the end of this routine unless you call smImageAddRef(video_frame.image_handle). - // So you can deep copy the image data here, or use smImageAddRef() and just copy the pointer. - // If you use smImageAddRef() you are responsible for calling smImageDestroy() to avoid a memory leak later. - - // In this callback you will typically want to copy the smEngineFaceData data into your own data-structure. - // Since the smEngineFaceData contains multiple pod types copying it is not atomic and - // a mutex is required to avoid the race-condition with any thread simultaneously - // reading from your data-structure. - // Such a race condition will not crash your code but will create weird noise in the tracking data. - - if (g_do_head_pose_printing) - { - //cout << video_frame << " " << head_pose << std::endl; - } - - //make a copy of the new head pose data and send it to simconnect - //when we get a simmconnect frame event the new offset will be applied to the camera - updateHeadPose(&head_pose); -} - -// Create the first available camera detected on the system, and return its handle -smCameraHandle createFirstCamera() -{ - // Detect cameras - smCameraInfoList info_list; - THROW_ON_ERROR(smCameraCreateInfoList(&info_list)); - - if (info_list.num_cameras == 0) - { - throw std::exception(); - } - else - { - cout << "The followings cameras were detected: " << endl; - for (int i=0; i<info_list.num_cameras; ++i) - { - char buf[1024]; - cout << " " << i << ". Type: " << info_list.info[i].type; - THROW_ON_ERROR(smStringWriteBuffer(info_list.info[i].model,buf,1024)); - cout << " Model: " << string(buf); - cout << " Instance: " << info_list.info[i].instance_index << endl; - // Print all the possible formats for the camera - for (int j=0; j<info_list.info[i].num_formats; j++) - { - smCameraVideoFormat video_format = info_list.info[i].formats[j]; - cout << " - Format: "; - cout << " res (" << video_format.res.w << "," << video_format.res.h << ")"; - cout << " image code " << video_format.format; - cout << " framerate " << video_format.framerate << "(hz)"; - cout << " upside-down? " << (video_format.is_upside_down ? "y":"n") << endl; - } - } - } - - // Create the first camera detected on the system - smCameraHandle camera_handle = 0; - THROW_ON_ERROR(smCameraCreate(&info_list.info[0], // Use first camera - 0, // Use default settings for lens - &camera_handle)); - - // Destroy the info list - smCameraDestroyInfoList(&info_list); - - return camera_handle; -} - -// The main function: setup a tracking engine and show a video window, then loop on the keyboard. -void run() -{ - int state; - - // Capture control-C -// signal(SIGINT, CtrlCHandler); - - // Make the console window a bit bigger (see utils.h) - initConsole(); - - #ifdef _DEBUG - // Log API debugging information to a file - THROW_ON_ERROR(smLoggingSetFileOutputEnable(SM_API_TRUE)); - - // Hook up log message callback - THROW_ON_ERROR(smLoggingRegisterCallback(0,receiveLogMessage)); - #endif - - // Get the version - int major, minor, maint; - THROW_ON_ERROR(smAPIVersion(&major, &minor, &maint)); - cout << endl << "API VERSION: " << major << "." << minor << "." << maint << "." << endl << endl; - // Print detailed license info - char *buff; - int size; - THROW_ON_ERROR(smAPILicenseInfoString(0,&size,SM_API_TRUE)); - buff = new char[size]; - THROW_ON_ERROR(smAPILicenseInfoString(buff,&size,SM_API_TRUE)); - cout << "LICENSE: " << buff << endl << endl; - // Determine if non-commercial restrictions apply - const bool non_commercial_license = smAPINonCommercialLicense() == SM_API_TRUE; - - // Initialize the API - THROW_ON_ERROR(smAPIInit()); - - #ifdef _DEBUG - // Get the path to the logfile - smStringHandle logfile_path_handle = 0; - THROW_ON_ERROR(smStringCreate(&logfile_path_handle)); - THROW_ON_ERROR(smLoggingGetPath(logfile_path_handle)); - int buf_len = 0; - unsigned short *buf = 0; - THROW_ON_ERROR(smStringGetBufferW(logfile_path_handle,(wchar_t **)&buf,&buf_len)); - wcout << "Writing log to file: " << wstring((wchar_t *)buf) << endl; - THROW_ON_ERROR(smStringDestroy(&logfile_path_handle)); - #endif - - // Register the WDM category of cameras - THROW_ON_ERROR(smCameraRegisterType(SM_API_CAMERA_TYPE_WDM)); - - smEngineHandle engine_handle = 0; - smCameraHandle camera_handle = 0; - if (non_commercial_license) - { - // Create a new Head-Tracker engine that uses the camera - THROW_ON_ERROR(smEngineCreate(SM_API_ENGINE_LATEST_HEAD_TRACKER,&engine_handle)); - } - else - { - // Print out a list of connected cameras, and choose the first camera on the system - camera_handle = createFirstCamera(); - // Create a new Head-Tracker engine that uses the camera - THROW_ON_ERROR(smEngineCreateWithCamera(SM_API_ENGINE_LATEST_HEAD_TRACKER,camera_handle,&engine_handle)); - } - - // Check license for particular engine version (always ok for non-commercial license) - const bool engine_licensed = smEngineIsLicensed(engine_handle) == SM_API_OK; - - cout << "-----------------------------------------------------" << endl; - cout << "Press 'r' to restart tracking" << endl; - cout << "Press 'a' to toggle auto-restart mode" << endl; - if (!non_commercial_license) - { - cout << "Press 'l' to toggle lip-tracking" << endl; - cout << "Press 'e' to toggle eyebrow-tracking" << endl; - } - if (engine_licensed) - { - cout << "Press 'h' to toggle printing of head-pose data" << endl; - cout << "Press 'f' to toggle printing of face-landmark data" << endl; - } - cout << "Press '1' to toggle face coordinate frame axes" << endl; - cout << "Press '2' to toggle performance info" << endl; - cout << "Press '3' to toggle face mask" << endl; - cout << "Press '4' to toggle face landmarks" << endl; - cout << "Press CTRL-C or 'q' to quit" << endl; - cout << "-----------------------------------------------------" << endl; - - // Hook up callbacks to receive output data from engine. - // These functions will return errors if the engine is not licensed. - if (engine_licensed) - { - #if (USE_HEADPOSE_CALLBACK==1) - #pragma message("Using Headpose Callback") - THROW_ON_ERROR(smHTRegisterHeadPoseCallback(engine_handle,0,receiveHeadPose)); - #endif - if (!non_commercial_license) - { - THROW_ON_ERROR(smHTRegisterFaceDataCallback(engine_handle,0,receiveFaceData)); - } - } - else - { - cout << "Engine is not licensed, cannot obtain any output data." << endl; - } - - if (!non_commercial_license) - { - // Enable lip and eyebrow tracking - THROW_ON_ERROR(smHTSetLipTrackingEnabled(engine_handle,SM_API_TRUE)); - THROW_ON_ERROR(smHTSetEyebrowTrackingEnabled(engine_handle,SM_API_TRUE)); - } - - // Create and show a video-display window - // Set the initial filter-level, from the INI-file - smVideoDisplayHandle video_display_handle = 0; - if (pMemData) { - THROW_ON_ERROR(smVideoDisplayCreate(engine_handle,&video_display_handle,(smWindowHandle) pMemData->handle,TRUE)); - THROW_ON_ERROR(smHTV2SetHeadPoseFilterLevel(engine_handle, pMemData->initial_filter_level)); - pMemData->handshake = 0; - } - else { - THROW_ON_ERROR(smVideoDisplayCreate(engine_handle,&video_display_handle,0,TRUE)); - } - - // Setup the VideoDisplay - THROW_ON_ERROR(smVideoDisplaySetFlags(video_display_handle,g_overlay_flags)); - - // Get the handle to the window and change the title to "Hello World" - smWindowHandle win_handle = 0; - THROW_ON_ERROR(smVideoDisplayGetWindowHandle(video_display_handle,&win_handle)); - SetWindowText(win_handle, _T("faceAPI Video-widget")); - MoveWindow(win_handle, 0, 0, 250, 180, true); - - // Loop on the keyboard - while (processKeyPress(engine_handle, video_display_handle) && !stopCommand) - { - // Read and print the current head-pose (if not using the callback mechanism) - #if (USE_HEADPOSE_CALLBACK==0) - #pragma message("Polling Headpose Manually") - if (engine_licensed) - { - smEngineHeadPoseData head_pose; - Lock lock(g_mutex); - - THROW_ON_ERROR(smHTCurrentHeadPose(engine_handle,&head_pose)); - if (g_do_head_pose_printing) - { - std::cout << head_pose << std::endl; - } - - } - #endif - - // NOTE: If you have a windows event loop in your program you - // will not need to call smAPIProcessEvents(). This manually redraws the video window. - THROW_ON_ERROR(smAPIProcessEvents()); - - // Prevent CPU overload in our simple loop. - const int frame_period_ms = 10; - Sleep(frame_period_ms); - - // - // Process the command sent by FaceTrackNoIR. - // - if (ftnoirConnected && (pMemData != 0)) { - - // - // Determine the trackers' state and send it to FaceTrackNoIR. - // - THROW_ON_ERROR(smEngineGetState(engine_handle, &state)); - pMemData->state = state; - pMemData->handshake += 1; - - // - // Check if FaceTrackNoIR is still 'in contact'. - // FaceTrackNoIR will reset the handshake, every time in writes data. - // If the value rises too high, this exe will stop itself... - // - if ( pMemData->handshake > 200) { - stopCommand = TRUE; - } - - // - // Check if a command was issued and do something with it! - // - switch (pMemData->command) { - case FT_SM_START: - - // - // Only execute Start, if the engine is not yet tracking. - // - if (state != SM_API_ENGINE_STATE_HT_TRACKING) { - THROW_ON_ERROR(smEngineStart(engine_handle)); // Start tracking - } - pMemData->command = 0; // Reset - break; - - case FT_SM_STOP: - THROW_ON_ERROR(smEngineStop(engine_handle)); // Stop tracking - pMemData->command = 0; // Reset - break; - - case FT_SM_EXIT: - THROW_ON_ERROR(smEngineStop(engine_handle)); // Stop tracking - stopCommand = TRUE; - pMemData->command = 0; // Reset - pMemData->state = SM_API_ENGINE_STATE_TERMINATED; // One last update, before quitting... - break; - - case FT_SM_SET_PAR_FILTER: - THROW_ON_ERROR(smHTV2SetHeadPoseFilterLevel(engine_handle, pMemData->par_val_int)); - pMemData->command = 0; // Reset - break; - - case FT_SM_SHOW_CAM: - THROW_ON_ERROR(smEngineShowCameraControlPanel(engine_handle)); - pMemData->command = 0; // Reset - break; - - default: - pMemData->command = 0; // Reset - // should never be reached - break; - } - } - } // While(1) - - // Destroy engine - THROW_ON_ERROR(smEngineDestroy(&engine_handle)); - // Destroy video display - THROW_ON_ERROR(smVideoDisplayDestroy(&video_display_handle)); - - if (ftnoirConnected) { - if ( pMemData != NULL ) { - UnmapViewOfFile ( pMemData ); - } - - if (hSMMutex != 0) { - CloseHandle( hSMMutex ); - } - hSMMutex = 0; - - if (hSMMemMap != 0) { - CloseHandle( hSMMemMap ); - } - hSMMemMap = 0; - } - -} // run() - -// Application entry point -int _tmain(int /*argc*/, _TCHAR** /*argv*/) -{ - OutputDebugString(_T("_tmain() says: Starting Function\n")); - - try - { - if (SMCreateMapping()) { - run(); - } - } - catch (exception &e) - { - cerr << e.what() << endl; - } - - return smAPIQuit(); -} - -// -// This is called exactly once for each FaceAPI callback and must be within an exclusive lock -// -void updateHeadPose(smEngineHeadPoseData* temp_head_pose) -{ - // - // Check if the pointer is OK and wait for the Mutex. - // - if ( (pMemData != NULL) && (WaitForSingleObject(hSMMutex, 100) == WAIT_OBJECT_0) ) { - - // - // Copy the Raw measurements directly to the client. - // - if (temp_head_pose->confidence > 0.0f) - { - memcpy(&pMemData->data.new_pose,temp_head_pose,sizeof(smEngineHeadPoseData)); - } - ReleaseMutex(hSMMutex); - } -}; - -// -// Create a memory-mapping to the faceAPI data. -// It contains the tracking data, a command-code from FaceTrackNoIR -// -// -bool SMCreateMapping() -{ - OutputDebugString(_T("FTCreateMapping says: Starting Function\n")); - - // - // A FileMapping is used to create 'shared memory' between the faceAPI and FaceTrackNoIR. - // FaceTrackNoIR creates the mapping, this program only opens it. - // If it's not there: the program was apparently started by the user instead of FaceTrackNoIR... - // - // Open an existing FileMapping, Read/Write access - // - hSMMemMap = OpenFileMappingA( FILE_MAP_WRITE , false , (LPCSTR) SM_MM_DATA ); - if ( ( hSMMemMap != 0 ) ) { - ftnoirConnected = true; - OutputDebugString(_T("FTCreateMapping says: FileMapping opened successfully...\n")); - pMemData = (SMMemMap *) MapViewOfFile(hSMMemMap, FILE_MAP_WRITE, 0, 0, sizeof(TFaceData)); - if (pMemData != NULL) { - OutputDebugString(_T("FTCreateMapping says: MapViewOfFile OK.\n")); - pMemData->state = 0; - } - hSMMutex = CreateMutexA(NULL, false, SM_MUTEX); - } - else { - OutputDebugString(_T("FTCreateMapping says: FileMapping not opened...FaceTrackNoIR not connected!\n")); - ftnoirConnected = false; - pMemData = 0; - } - - return true; -} diff --git a/faceapi/mutex.h b/faceapi/mutex.h deleted file mode 100644 index b1a013e8..00000000 --- a/faceapi/mutex.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SM_API_TESTAPPCONSOLE_MUTEX_H -#define SM_API_TESTAPPCONSOLE_MUTEX_H - -#include <exception> - -namespace sm -{ - namespace faceapi - { - namespace samplecode - { - // A very simple mutex class for sample code purposes. - // It is recommended that you use the boost threads library. - class Mutex - { - public: - Mutex() - { - if (!InitializeCriticalSectionAndSpinCount(&_cs,0x80000400)) - { - throw std::exception(); - } - } - ~Mutex() - { - DeleteCriticalSection(&_cs); - } - void lock() const - { - EnterCriticalSection(&_cs); - } - void unlock() const - { - LeaveCriticalSection(&_cs); - } - private: - // Noncopyable - Mutex(const Mutex &); - Mutex &operator=(const Mutex &); - private: - mutable CRITICAL_SECTION _cs; - }; - } - } -} -#endif diff --git a/faceapi/stdafx.cpp b/faceapi/stdafx.cpp deleted file mode 100644 index 981c9e33..00000000 --- a/faceapi/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// TestAppConsole.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/faceapi/stdafx.h b/faceapi/stdafx.h deleted file mode 100644 index 92e24b3e..00000000 --- a/faceapi/stdafx.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#include <stdio.h> -#include <tchar.h> - -#ifndef _MSC_VER - -#include <inttypes.h> - -typedef uint64_t u_int64_t; -typedef uint32_t u_int32_t; -typedef uint16_t u_int16_t; -typedef uint8_t u_int8_t; -#endif - -#include <iostream> -#include <sstream> -#include <string> -#include <cassert> -#include <conio.h> -#include <sm_api_configure.h> -#ifdef SM_API -# undef SM_API -#endif -#ifdef STDCALL -# undef STDCALL -#endif - -#define SM_API(type) type __declspec(dllimport) __stdcall -#define STDCALL __stdcall - -#include <sm_api.h> diff --git a/faceapi/utils.h b/faceapi/utils.h deleted file mode 100644 index 80555d22..00000000 --- a/faceapi/utils.h +++ /dev/null @@ -1,349 +0,0 @@ -#ifndef SM_API_TESTAPPCONSOLE_UTILS_H -#define SM_API_TESTAPPCONSOLE_UTILS_H - -#include "lock.h" -#include <exception> -#include <iostream> - -#define THROW_ON_ERROR(x) \ -{ \ - smReturnCode result = (x); \ - if (result < 0) \ - { \ - std::stringstream s; \ - s << "API error code: " << result; \ - std::cerr << s; \ - throw std::exception(); \ - } \ -} - -namespace sm -{ - namespace faceapi - { - namespace samplecode - { - // Global variables - Mutex g_mutex; - bool g_ctrl_c_detected(false); - bool g_do_head_pose_printing(false); - bool g_do_face_data_printing(false); - unsigned short g_overlay_flags(SM_API_VIDEO_DISPLAY_HEAD_MESH | SM_API_VIDEO_DISPLAY_PERFORMANCE); - - // CTRL-C handler function - void __cdecl CtrlCHandler(int) - { - Lock lock(g_mutex); - std::cout << "Ctrl-C detected, stopping..." << std::endl; - g_ctrl_c_detected = true; - } - - // Radians to degrees conversion - float rad2deg(float rad) - { - return rad*57.2957795f; - } - - void toggleFlag(unsigned short &val, unsigned short flag) - { - if (val & flag) - { - val = val & ~flag; - } - else - { - val = val | flag; - } - } - - // Save an image to PNG file - smReturnCode saveToPNGFile(const std::string& filepath, smImageInfo image_info) - { - smBool ok; - smReturnCode error; - - // Create an API string - smStringHandle filepath_handle = 0; - ok = (error = smStringCreate(&filepath_handle)) == SM_API_OK; - ok = ok && (error = smStringReadBuffer(filepath_handle,filepath.c_str(),filepath.size())) == SM_API_OK; - - // Create an API image - smImageHandle image_handle = 0; - smImageMemoryCopyMode copy_mode = SM_API_IMAGE_MEMORYCOPYMODE_AUTO; - ok = ok && (error = smImageCreateFromInfo(&image_info,©_mode,&image_handle)) == SM_API_OK; - - // Save the image as PNG - ok = ok && (error = smImageSaveToPNG(image_handle,filepath_handle)) == SM_API_OK; - - // Destroy the image and string - smStringDestroy(&filepath_handle); - smImageDestroy(&image_handle); - return error; - } - - // Stream operators for printing - - std::ostream &operator<<(std::ostream & os, const smSize2i &s) - { - return os << "[" << s.h << "," << s.h << "]"; - } - - std::ostream &operator<<(std::ostream & os, const smCoord3f &pos) - { - return os << "(" << pos.x << "," << pos.y << "," << pos.z << ")"; - } - - std::ostream &operator<<(std::ostream & os, const smRotEuler &rot) - { - return os << "(" << rad2deg(rot.x_rads) << "," << rad2deg(rot.y_rads) << "," << rad2deg(rot.z_rads) << ")"; - } - - std::ostream &operator<<(std::ostream & os, const smPixel &p) - { - return os << "[" << static_cast<int>(p.x) << "," << static_cast<int>(p.y) << "]"; - } - - std::ostream &operator<<(std::ostream & os, const smFaceTexCoord &ftc) - { - return os << "{" << ftc.u << "," << ftc.v << "}"; - } - - std::ostream &operator<<(std::ostream & os, const smFaceLandmark &lm) - { - return os << "id "<< lm.id << " fc" << lm.fc << " ftc" << lm.ftc << " pc" << lm.pc << " wc" << lm.wc; - } - - std::ostream &operator<<(std::ostream & os, const smImageInfo &im) - { - os << "format "; - switch (im.format) - { - case SM_API_IMAGECODE_GRAY_8U: - os << "GRAY_8U"; - break; - case SM_API_IMAGECODE_GRAY_16U: - os << "GRAY_16U"; - break; - case SM_API_IMAGECODE_YUY2: - os << "YUY2"; - break; - case SM_API_IMAGECODE_I420: - os << "I420"; - break; - case SM_API_IMAGECODE_BGRA_32U: - os << "BGRA_32U"; - break; - case SM_API_IMAGECODE_ARGB_32U: - os << "ARGB_32U"; - break; - case SM_API_IMAGECODE_BGR_24U: - os << "BGR_24U"; - break; - case SM_API_IMAGECODE_RGB_24U: - os << "RGB_24U"; - break; - default: - os << "unknown"; - break; - } - os << " res" << im.res; - os << " plane_addr(" << static_cast<void *>(im.plane_addr[0]) << "," - << static_cast<void *>(im.plane_addr[1]) << "," - << static_cast<void *>(im.plane_addr[2]) << "," - << static_cast<void *>(im.plane_addr[3]) << ")"; - os << " step_bytes(" << im.step_bytes[0] << "," << im.step_bytes[1] << "," << im.step_bytes[2] << "," << im.step_bytes[3] << ")"; - os << " user_data " << im.user_data; - return os; - } - - std::ostream &operator<<(std::ostream & os, const smFaceTexture &t) - { - os << "type "; - switch (t.type) - { - case SM_ORTHOGRAPHIC_PROJECTION: - os << "orthographic"; - break; - default: - os << "unknown"; - break; - } - os << " origin" << t.origin << " scale" << t.scale << std::endl; - os << " image_info " << t.image_info << std::endl; - os << " num_mask_landmarks " << t.num_mask_landmarks << std::endl; - for (int i=0; i<t.num_mask_landmarks; i++) - { - os << " " << t.mask_landmarks[i] << std::endl; - } - return os; - } - - // Stream operator for printing face landmarks - std::ostream &operator<<(std::ostream &os, const smEngineFaceData &face_data) - { - fixed(os); - showpos(os); - os.precision(2); - os << "Face Data: " - << "origin_wc" << face_data.origin_wc << " " - << "num_landmarks " << face_data.num_landmarks - << std::endl; - for (int i=0; i<face_data.num_landmarks; i++) - { - os << " " << face_data.landmarks[i] << std::endl; - } - // Print any face texture info - if (face_data.texture) - { - os << "Face Texture: " << *face_data.texture; - } - return os; - } - - // Stream operator for printing head-pose data - std::ostream &operator<<(std::ostream & os, const smEngineHeadPoseData &head_pose) - { - fixed(os); - showpos(os); - os.precision(2); - return os << "Head Pose: " - << "head_pos" << head_pose.head_pos << " " - << "head_rot" << head_pose.head_rot << " " - << "left_eye_pos" << head_pose.left_eye_pos << " " - << "right_eye_pos" << head_pose.right_eye_pos << " " - << "confidence " << head_pose.confidence; - } - - std::ostream &operator<<(std::ostream & os, const smCameraVideoFrame &vf) - { - fixed(os); - showpos(os); - os.precision(2); - return os << "Framenum: " << vf.frame_num; - } - - // Handles keyboard events: return false if quit. - bool processKeyPress(smEngineHandle engine_handle, smVideoDisplayHandle video_display_handle) - { - Lock lock(g_mutex); - if (g_ctrl_c_detected) - { - return false; - } - if (!_kbhit()) - { - return true; - } - int key = _getch(); - switch (key) - { - case 'q': - return false; - case 'r': - { - // Manually restart the tracking - THROW_ON_ERROR(smEngineStart(engine_handle)); - std::cout << "Restarting tracking" << std::endl; - } - return true; - case 'a': - { - // Toggle auto-restart mode - int on; - THROW_ON_ERROR(smHTGetAutoRestartMode(engine_handle,&on)); - THROW_ON_ERROR(smHTSetAutoRestartMode(engine_handle,!on)); - std::cout << "Autorestart-mode is " << (on?"on":"off") << std::endl; - } - return true; - case '1': - toggleFlag(g_overlay_flags,SM_API_VIDEO_DISPLAY_REFERENCE_FRAME); - THROW_ON_ERROR(smVideoDisplaySetFlags(video_display_handle,g_overlay_flags)); - return true; - case '2': - toggleFlag(g_overlay_flags,SM_API_VIDEO_DISPLAY_PERFORMANCE); - THROW_ON_ERROR(smVideoDisplaySetFlags(video_display_handle,g_overlay_flags)); - return true; - case '3': - toggleFlag(g_overlay_flags,SM_API_VIDEO_DISPLAY_HEAD_MESH); - THROW_ON_ERROR(smVideoDisplaySetFlags(video_display_handle,g_overlay_flags)); - return true; - case '4': - toggleFlag(g_overlay_flags,SM_API_VIDEO_DISPLAY_LANDMARKS); - THROW_ON_ERROR(smVideoDisplaySetFlags(video_display_handle,g_overlay_flags)); - return true; - case 'l': - if (smAPINonCommercialLicense() == SM_API_TRUE) - { - return false; - } - else - { - int on; - THROW_ON_ERROR(smHTGetLipTrackingEnabled(engine_handle,&on)); - THROW_ON_ERROR(smHTSetLipTrackingEnabled(engine_handle,!on)); - } - return true; - case 'e': - if (smAPINonCommercialLicense() == SM_API_TRUE) - { - return false; - } - else - { - int on; - THROW_ON_ERROR(smHTGetEyebrowTrackingEnabled(engine_handle,&on)); - THROW_ON_ERROR(smHTSetEyebrowTrackingEnabled(engine_handle,!on)); - } - return true; - case 'h': - if (smEngineIsLicensed(engine_handle) != SM_API_OK) - { - return false; - } - else - { - g_do_head_pose_printing = !g_do_head_pose_printing; - std::cout << "HeadPose printing is " << (g_do_head_pose_printing?"on":"off") << std::endl; - } - return true; - case 'f': - if (smEngineIsLicensed(engine_handle) != SM_API_OK) - { - return false; - } - else - { - g_do_face_data_printing = !g_do_face_data_printing; - std::cout << "FaceData printing is " << (g_do_face_data_printing?"on":"off") << std::endl; - } - return true; - default: - return true; - } - } - - // Setup console window geometry / font etc - void initConsole() - { - HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - // Buffer of 255 x 1024 - COORD buffer_size; - buffer_size.X = 255; - buffer_size.Y = 1024; - SetConsoleScreenBufferSize(console_handle, buffer_size); - // Window size of 120 x 50 - SMALL_RECT window_size; - window_size.Left = 0; - window_size.Right = 120; - window_size.Top = 0; - window_size.Bottom = 50; - SetConsoleWindowInfo(console_handle,TRUE,&window_size); - // Green text - SetConsoleTextAttribute(console_handle, FOREGROUND_GREEN | FOREGROUND_INTENSITY); -// ShowWindow(GetConsoleWindow(), SW_HIDE); - } - } - } -} - -#endif diff --git a/ftnoir_tracker_sm/ftnoir_sm_controls.ui b/ftnoir_tracker_sm/ftnoir_sm_controls.ui deleted file mode 100644 index ecc252f1..00000000 --- a/ftnoir_tracker_sm/ftnoir_sm_controls.ui +++ /dev/null @@ -1,223 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UICSMClientControls</class>
- <widget class="QWidget" name="UICSMClientControls">
- <property name="windowModality">
- <enum>Qt::ApplicationModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>174</width>
- <height>188</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>faceAPI tracker settings FaceTrackNoIR</string>
- </property>
- <property name="windowIcon">
- <iconset>
- <normaloff>images/sm.png</normaloff>images/sm.png</iconset>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetMaximumSize</enum>
- </property>
- <item row="0" column="0">
- <widget class="QGroupBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Axis enablement</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <property name="labelAlignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="formAlignment">
- <set>Qt::AlignHCenter|Qt::AlignTop</set>
- </property>
- <property name="leftMargin">
- <number>10</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Roll:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="chkEnableRoll">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="styleSheet">
- <string notr="true"/>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Pitch:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="chkEnablePitch">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Yaw:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="chkEnableYaw">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_12">
- <property name="text">
- <string>X:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QCheckBox" name="chkEnableX">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_13">
- <property name="text">
- <string>Y:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QCheckBox" name="chkEnableY">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_14">
- <property name="text">
- <string>Z:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QCheckBox" name="chkEnableZ">
- <property name="maximumSize">
- <size>
- <width>20</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
- <slots>
- <slot>startEngineClicked()</slot>
- <slot>stopEngineClicked()</slot>
- <slot>cameraSettingsClicked()</slot>
- </slots>
-</ui>
diff --git a/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp b/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp deleted file mode 100644 index 18182153..00000000 --- a/ftnoir_tracker_sm/ftnoir_tracker_faceapi.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ -#include <QtGui> -#include <QMessageBox> -#include "facetracknoir/global-settings.h" -#include <QThread> -#include "ftnoir_tracker_sm/ftnoir_tracker_sm.h" - -FTNoIR_Tracker::FTNoIR_Tracker() : shm(SM_MM_DATA, SM_MUTEX, sizeof(SMMemMap)), started(false) -{ - pMemData = (SMMemMap*) shm.mem; -} - -static void wait_for_cmd(SMMemMap *pMemData, PortableLockedShm& shm) { - qDebug() << "faceapi: waiting for cmd"; - for (int _ = 0; _ < 3000; _++) - { - bool br = false; - shm.lock(); - if (pMemData->command == 0) - { - br = true; - } - shm.unlock(); - if (br) - break; - QThread::msleep(1); - } - qDebug() << "faceapi: done waiting for cmd"; -} - -// Send a command without parameter-value to the tracking Engine. -// -void FTNoIR_Tracker::doCommand(int command) -{ - shm.lock(); - pMemData->command = command; - shm.unlock(); - wait_for_cmd(pMemData, shm); -} - -// -// Send a command with integer parameter-value to the tracking Engine. -// -void FTNoIR_Tracker::doCommand(int command, int value) -{ - shm.lock(); - pMemData->command = command; // Send command - pMemData->par_val_int = value; - shm.unlock(); - wait_for_cmd(pMemData, shm); -} - -FTNoIR_Tracker::~FTNoIR_Tracker() -{ - qDebug() << "~FTNoIR_Tracker says: cleaning up"; - - bEnableRoll = true; - bEnablePitch = true; - bEnableYaw = true; - bEnableX = true; - bEnableY = true; - bEnableZ = true; -} - -void FTNoIR_Tracker::StartTracker(QFrame *videoframe ) -{ - qDebug() << "FTNoIR_Tracker::Initialize says: Starting "; - QMessageBox::warning(videoframe, - "Non-free software deprecation", - "SM FaceAPI is deprecated, hence this annoying message.\n" - "It'll be removed for 2.0-final.\n" - "The goal is to have only open-source software available.", - QMessageBox::Ok, QMessageBox::NoButton); - - loadSettings(); - - if ( pMemData != NULL ) { - pMemData->command = 0; // Reset any and all commands - if (videoframe != NULL) { - pMemData->handle = (HWND) videoframe->winId(); // Handle of Videoframe widget - } - else { - pMemData->handle = NULL; // reset Handle of Videoframe widget - } - } - - // - // Start FTNoIR_FaceAPI_EXE.exe. The exe contains all faceAPI-stuff and is non-Qt... - // - // XXX TODO isolate it into separate directory - faceAPI = new QProcess(); - faceAPI->setWorkingDirectory(QCoreApplication::applicationDirPath() + "/faceapi"); - faceAPI->start("\"" + QCoreApplication::applicationDirPath() + "/faceapi/opentrack-faceapi-wrapper" + "\""); - // Show the video widget - qDebug() << "FTNoIR_Tracker::Initialize says: videoframe = " << videoframe; - if (videoframe != NULL) { - videoframe->show(); - } -} - -void FTNoIR_Tracker::WaitForExit() -{ - - qDebug() << "FTNoIR_Tracker::StopTracker says: Starting "; - // stops the faceapi engine - if ( pMemData != NULL ) { -// if (exit == true) { - pMemData->command = FT_SM_EXIT; - //} - //else { - // pMemData->command = FT_SM_STOP; // Issue 'stop' command - //} - } -} - -bool FTNoIR_Tracker::GiveHeadPoseData(double *data) -{ - if (!started) - doStartEngine(); - started = true; - // - // Check if the pointer is OK and wait for the Mutex. - // - shm.lock(); - - // - // Copy the measurements to FaceTrackNoIR. - // - if (bEnableX) { - data[TX] = pMemData->data.new_pose.head_pos.x * 100.0f; // From meters to centimeters - } - if (bEnableY) { - data[TY] = pMemData->data.new_pose.head_pos.y * 100.0f; - } - if (bEnableZ) { - data[TZ] = pMemData->data.new_pose.head_pos.z * 100.0f; - } - if (bEnableYaw) { - data[Yaw] = pMemData->data.new_pose.head_rot.y_rads * 57.295781f; // From rads to degrees - } - if (bEnablePitch) { - data[Pitch] = pMemData->data.new_pose.head_rot.x_rads * 57.295781f; - } - if (bEnableRoll) { - data[Roll] = pMemData->data.new_pose.head_rot.z_rads * 57.295781f; - } - - // - // Reset the handshake, to let faceAPI know we're still here! - // - pMemData->handshake = 0; - shm.unlock(); - - return ( pMemData->data.new_pose.confidence > 0 ); -} - -// -// Load the current Settings from the currently 'active' INI-file. -// -void FTNoIR_Tracker::loadSettings() { - - qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; - QSettings settings("opentrack"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile; - - iniFile.beginGroup ( "SMTracker" ); - if (pMemData) { - pMemData->initial_filter_level = iniFile.value ( "FilterLevel", 1 ).toInt(); - } - - bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool(); - bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool(); - bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool(); - bEnableX = iniFile.value ( "EnableX", 1 ).toBool(); - bEnableY = iniFile.value ( "EnableY", 1 ).toBool(); - bEnableZ = iniFile.value ( "EnableZ", 1 ).toBool(); - - iniFile.endGroup (); -} - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker object. - -// Export both decorated and undecorated names. -// GetTracker - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTracker@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetTracker=_GetTracker@0") - -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() -{ - return new FTNoIR_Tracker; -} diff --git a/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp b/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp deleted file mode 100644 index 3510f3e9..00000000 --- a/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dialog.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ -#include <QtGui> -#include "ftnoir_tracker_sm/ftnoir_tracker_sm.h" -#include "facetracknoir/global-settings.h" - -//******************************************************************************************************* -// faceAPI Client Settings-dialog. -//******************************************************************************************************* - -// -// Constructor for server-settings-dialog -// -TrackerControls::TrackerControls() : settingsDirty(false) -{ - ui.setupUi( this ); - - //connect(ui.cbxFilterSetting, SIGNAL(currentIndexChanged(int)), this, SLOT(doSetFilter( int ))); - //connect(ui.btnCameraSettings, SIGNAL(clicked()), this, SLOT(doShowCam())); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - connect(ui.chkEnableRoll, SIGNAL(setChecked(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnablePitch, SIGNAL(setChecked(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnableYaw, SIGNAL(setChecked(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnableX, SIGNAL(setChecked(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnableY, SIGNAL(setChecked(int)), this, SLOT(settingChanged(int))); - connect(ui.chkEnableZ, SIGNAL(setChecked(int)), this, SLOT(settingChanged(int))); - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOk())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doOCancel())); -} - -// -// Destructor for server-dialog -// -TrackerControls::~TrackerControls() { - qDebug() << "~TrackerControls() says: started"; -} - -// -// Initialize tracker-client-dialog -// -void TrackerControls::Initialize(QWidget *parent) { - - QPoint offsetpos(200, 200); - if (parent) { - this->move(parent->pos() + offsetpos); - } - - // Load the settings from the current .INI-file - loadSettings(); - - show(); -} - -// -// OK clicked on server-dialog -// -void TrackerControls::doOK() { - save(); - this->close(); -} - -// override show event -void TrackerControls::showEvent ( QShowEvent * event ) { - loadSettings(); -} - -// -// Cancel clicked on server-dialog -// -void TrackerControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settingsDirty) { - int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - qDebug() << "doCancel says: answer =" << ret; - - switch (ret) { - case QMessageBox::Save: - save(); - this->close(); - break; - case QMessageBox::Discard: - this->close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked - break; - default: - // should never be reached - break; - } - } - else { - this->close(); - } -} - -// -// Load the current Settings from the currently 'active' INI-file. -// -void TrackerControls::loadSettings() { - -// qDebug() << "loadSettings says: Starting "; - QSettings settings("opentrack"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - -// qDebug() << "loadSettings says: iniFile = " << currentFile; - - iniFile.beginGroup ( "SMTracker" ); - ui.chkEnableRoll->setChecked(iniFile.value ( "EnableRoll", 1 ).toBool()); - ui.chkEnablePitch->setChecked(iniFile.value ( "EnablePitch", 1 ).toBool()); - ui.chkEnableYaw->setChecked(iniFile.value ( "EnableYaw", 1 ).toBool()); - ui.chkEnableX->setChecked(iniFile.value ( "EnableX", 1 ).toBool()); - ui.chkEnableY->setChecked(iniFile.value ( "EnableY", 1 ).toBool()); - ui.chkEnableZ->setChecked(iniFile.value ( "EnableZ", 1 ).toBool()); - - iniFile.endGroup (); - - settingsDirty = false; -} - -// -// Save the current Settings to the currently 'active' INI-file. -// -void TrackerControls::save() { - - QSettings settings("opentrack"); // Registry settings (in HK_USER) - - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - - iniFile.beginGroup ( "SMTracker" ); - iniFile.setValue ( "EnableRoll", ui.chkEnableRoll->isChecked() ); - iniFile.setValue ( "EnablePitch", ui.chkEnablePitch->isChecked() ); - iniFile.setValue ( "EnableYaw", ui.chkEnableYaw->isChecked() ); - iniFile.setValue ( "EnableX", ui.chkEnableX->isChecked() ); - iniFile.setValue ( "EnableY", ui.chkEnableY->isChecked() ); - iniFile.setValue ( "EnableZ", ui.chkEnableZ->isChecked() ); - - iniFile.endGroup (); - - settingsDirty = false; -} - - - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker-settings dialog object. - -// Export both decorated and undecorated names. -// GetTrackerDialog - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0") - -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() -{ - return new TrackerControls; -} diff --git a/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dll.cpp b/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dll.cpp deleted file mode 100644 index b1ab1d75..00000000 --- a/ftnoir_tracker_sm/ftnoir_tracker_faceapi_dll.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ -#include "ftnoir_tracker_sm.h" -#include <QDebug> -#include "facetracknoir/global-settings.h" - -FTNoIR_TrackerDll::FTNoIR_TrackerDll() { - //populate the description strings - trackerFullName = "faceAPI V3.2.6"; - trackerShortName = "faceAPI"; - trackerDescription = "SeeingMachines faceAPI V3.2.6"; -} - -FTNoIR_TrackerDll::~FTNoIR_TrackerDll() -{ - -} -void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) -{ - *strToBeFilled = trackerFullName; -}; - -void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled) -{ - *strToBeFilled = trackerShortName; -}; - -void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled) -{ - *strToBeFilled = trackerDescription; -}; - -void FTNoIR_TrackerDll::getIcon(QIcon *icon) -{ - *icon = QIcon(":/images/sm.png"); -}; - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker object. - -// Export both decorated and undecorated names. -// GetTrackerDll - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") - -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() -{ - return new FTNoIR_TrackerDll; -} diff --git a/ftnoir_tracker_sm/ftnoir_tracker_sm.h b/ftnoir_tracker_sm/ftnoir_tracker_sm.h deleted file mode 100644 index 4089983d..00000000 --- a/ftnoir_tracker_sm/ftnoir_tracker_sm.h +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ -#include <QObject> -#include <QWidget> -#include <QMessageBox> -#include <QSettings> -#include <QProcess> -#include <windows.h> -#include "math.h" -#include "facetracknoir/global-settings.h" -#include "compat/compat.h" -#include <QFrame> -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#include "ftnoir_tracker_sm/ftnoir_tracker_sm_types.h" -#include "ui_ftnoir_sm_controls.h" - -using namespace std; - -class FTNoIR_Tracker : public ITracker -{ -public: - FTNoIR_Tracker(); - ~FTNoIR_Tracker(); - - void StartTracker( QFrame* parent_window ); - void StopTracker( bool exit ); - bool GiveHeadPoseData(double *data); // Returns true if confidence is good - void WaitForExit(); - void doCommand(int foo); - void doCommand(int foo, int bar); - void doStartEngine(){ - doCommand(FT_SM_START); - doCommand(FT_SM_SET_PAR_FILTER, 0); - //doCommand(FT_SM_SHOW_CAM); - } - void loadSettings(); - -private: - // - // global variables - // - PortableLockedShm shm; - SMMemMap *pMemData; - QProcess *faceAPI; - - bool bEnableRoll; - bool bEnablePitch; - bool bEnableYaw; - bool bEnableX; - bool bEnableY; - bool bEnableZ; - bool started; -}; - -class TrackerControls: public QWidget, public ITrackerDialog -{ - Q_OBJECT -public: - explicit TrackerControls(); - virtual ~TrackerControls(); - void showEvent ( QShowEvent * event ); - - void Initialize(QWidget *parent); - void registerTracker(ITracker *tracker) { - } - void unRegisterTracker() { - } -protected slots: - void doOK(); - void doCancel(); - void save(); - void settingChanged() { settingsDirty = true; } - void settingChanged(int) { settingsDirty = true; } -private: - Ui::UICSMClientControls ui; - void loadSettings(); - bool settingsDirty; -}; - -//******************************************************************************************************* -// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker -//******************************************************************************************************* -class FTNoIR_TrackerDll : public Metadata -{ -public: - FTNoIR_TrackerDll(); - ~FTNoIR_TrackerDll(); - - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); - -private: - QString trackerFullName; // Trackers' name and description - QString trackerShortName; - QString trackerDescription; -}; diff --git a/ftnoir_tracker_sm/ftnoir_tracker_sm_types.h b/ftnoir_tracker_sm/ftnoir_tracker_sm_types.h deleted file mode 100644 index 526f8cdc..00000000 --- a/ftnoir_tracker_sm/ftnoir_tracker_sm_types.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Definitions for the Shared Memory to send the data to FaceTrackNoIR -// -#define SM_MM_DATA "SM_SharedMem" -#define SM_FACEAPI "SM_FaceAPI" -#define SM_MUTEX "SM_Mutex" - -#include "faceapi/stdafx.h" -#include <sm_api.h> - -struct TFaceData { - int DataID; - smEngineHeadPoseData new_pose; -}; -typedef TFaceData * PFaceData; - -struct SMMemMap { - int command; // Command from FaceTrackNoIR - int status; // Status from faceAPI - TFaceData data; - HANDLE handle; - int state; - int par_val_int; // Value of parameter, indicated by 'command' - int par_val_float; - int initial_filter_level; // Internal faceAPI Filter level - int handshake; -}; -typedef SMMemMap * PSMMemMap; - -enum FTNoIR_Tracker_Command { - FT_SM_START = 10, - FT_SM_STOP = 20, - FT_SM_SHOW_CAM = 30, - FT_SM_SET_PAR_FILTER = 50, - FT_SM_EXIT = 100 -}; diff --git a/ftnoir_tracker_sm/images/sm.png b/ftnoir_tracker_sm/images/sm.png Binary files differdeleted file mode 100644 index 4910d1f0..00000000 --- a/ftnoir_tracker_sm/images/sm.png +++ /dev/null diff --git a/ftnoir_tracker_sm/sm-tracker.qrc b/ftnoir_tracker_sm/sm-tracker.qrc deleted file mode 100644 index d17d0899..00000000 --- a/ftnoir_tracker_sm/sm-tracker.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>images/sm.png</file> - </qresource> -</RCC> |