diff options
Diffstat (limited to 'ftnoir_tracker_pt/ftnoir_tracker_pt.cpp')
-rw-r--r-- | ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 5b9ec8b6..d3cf18c1 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -54,10 +54,23 @@ void Tracker_PT::reset_command(Command command) float Tracker_PT::get_focal_length() { + static constexpr float pi = 3.1415926; + float fov_; + switch (s.fov) + { + default: + case 0: + fov_ = 56; + break; + case 1: + fov_ = 75; + break; + } + + const float diag_fov = static_cast<int>(fov_) * pi / 180.f; CamInfo info = camera.get_info(); const int w = info.res_x, h = info.res_y; - static constexpr double pi = 3.1415926f; - const double diag = sqrt(w * w + h * h)/w, diag_fov = static_cast<int>(s.fov) * pi / 180.; + const double diag = sqrt(w * w + h * h)/w; const double fov = 2.*atan(tan(diag_fov/2.0)/sqrt(1. + diag*diag)); return .5 / tan(.5 * fov); } @@ -143,9 +156,35 @@ void Tracker_PT::apply_settings() qDebug()<<"Tracker:: Applying settings"; QMutexLocker l(&camera_mtx); QMutexLocker lock(&mutex); - camera.set_device_index(camera_name_to_index(s.camera_name)); - camera.set_res(s.cam_res_x, s.cam_res_y); - camera.set_fps(s.cam_fps); + camera.set_device_index(camera_name_to_index("PS3Eye Camera")); + int res_x, res_y, cam_fps; + switch (s.camera_mode) + { + default: + case 0: + res_x = 640; + res_y = 480; + cam_fps = 75; + break; + case 1: + res_x = 640; + res_y = 480; + cam_fps = 60; + break; + case 2: + res_x = 320; + res_y = 240; + cam_fps = 189; + break; + case 3: + res_x = 320; + res_y = 240; + cam_fps = 120; + break; + } + + camera.set_res(res_x, res_y); + camera.set_fps(cam_fps); qDebug()<<"Tracker::apply ends"; } @@ -211,14 +250,3 @@ void Tracker_PT::data(THeadPoseData *data) data[TZ] = t[2] / 10.0; } } - -//----------------------------------------------------------------------------- -#ifdef OPENTRACK_API -extern "C" OPENTRACK_EXPORT ITracker* GetConstructor() -#else -#pragma comment(linker, "/export:GetTracker=_GetTracker@0") -OPENTRACK_EXPORT ITrackerPtr __stdcall GetTracker() -#endif -{ - return new Tracker_PT; -} |