diff options
Diffstat (limited to 'tracker-wii')
-rw-r--r-- | tracker-wii/wii_camera.cpp | 8 | ||||
-rw-r--r-- | tracker-wii/wii_frame.hpp | 9 | ||||
-rw-r--r-- | tracker-wii/wii_module.cpp | 17 | ||||
-rw-r--r-- | tracker-wii/wii_point_extractor.cpp | 8 | ||||
-rw-r--r-- | tracker-wii/wiiyourself/warns-begin.hpp | 7 | ||||
-rw-r--r-- | tracker-wii/wiiyourself/wiimote.cpp | 27 | ||||
-rw-r--r-- | tracker-wii/wiiyourself/wiimote.h | 2 |
7 files changed, 45 insertions, 33 deletions
diff --git a/tracker-wii/wii_camera.cpp b/tracker-wii/wii_camera.cpp index 83c6a0ce..ab216215 100644 --- a/tracker-wii/wii_camera.cpp +++ b/tracker-wii/wii_camera.cpp @@ -28,10 +28,10 @@ namespace pt_module { WIICamera::WIICamera(const QString& module_name) : s { module_name } { - cam_info.fps = 70; - cam_info.res_x = 1024; - cam_info.res_y = 768; - cam_info.fov = 42.0f; + cam_info.fps = 70; + cam_info.res_x = 1024; + cam_info.res_y = 768; + cam_info.fov = 42; cam_info.idx = 0; } diff --git a/tracker-wii/wii_frame.hpp b/tracker-wii/wii_frame.hpp index 10c1b122..5b55bec8 100644 --- a/tracker-wii/wii_frame.hpp +++ b/tracker-wii/wii_frame.hpp @@ -12,7 +12,10 @@ #include <opencv2/core.hpp> #include <QImage> - +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif namespace pt_module { @@ -62,3 +65,7 @@ private: }; } // ns pt_module + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif diff --git a/tracker-wii/wii_module.cpp b/tracker-wii/wii_module.cpp index 9f2a4b04..c4884f22 100644 --- a/tracker-wii/wii_module.cpp +++ b/tracker-wii/wii_module.cpp @@ -20,7 +20,12 @@ static const QString module_name = "tracker-wii-pt"; -using namespace pt_module; +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +namespace pt_module { struct wii_pt_module_traits final : pt_runtime_traits { @@ -63,6 +68,12 @@ struct wii_dialog_pt : TrackerDialog_PT wii_dialog_pt(); }; +} // ns pt_module + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + QString wii_metadata_pt::name() { return tr("WiiPointTracker 1.1"); @@ -73,13 +84,11 @@ QIcon wii_metadata_pt::icon() return QIcon(":/Resources/wii.png"); } -// ns pt_module - using namespace pt_module; wii_dialog_pt::wii_dialog_pt() : TrackerDialog_PT(module_name) { - ui.tabWidget->removeTab(0); + ui.tabWidget->removeTab(0); } OPENTRACK_DECLARE_TRACKER(wii_tracker_pt, wii_dialog_pt, wii_metadata_pt) diff --git a/tracker-wii/wii_point_extractor.cpp b/tracker-wii/wii_point_extractor.cpp index 2da91d01..c5c20c6a 100644 --- a/tracker-wii/wii_point_extractor.cpp +++ b/tracker-wii/wii_point_extractor.cpp @@ -72,8 +72,8 @@ bool WIIPointExtractor::draw_points(cv::Mat& preview_frame, const struct wii_inf if (dot.bvis) { //qDebug() << "wii:" << dot.RawX << "+" << dot.RawY; //anti-clockwise rotate the 2D point - const float RX = W - dot.ux; - const float RY = H - dot.uy; + const double RX = W - dot.ux; + const double RY = H - dot.uy; //vec2 dt((dot.RawX - W / 2.0f) / W, -(dot.RawY - H / 2.0f) / W); //vec2 dt((RX - W / 2.0f) / W, -(RY - H / 2.0f) / W); //vec2 dt((2.0f*RX - W) / W, -(2.0f*RY - H ) / W); @@ -99,8 +99,8 @@ void WIIPointExtractor::draw_bg(cv::Mat& preview_frame, const struct wii_info& w 2); //draw horizon - int pdelta = iround((preview_frame.rows / 4) * tan((wii.Pitch)* M_PI / 180.0f)); - int rdelta = iround((preview_frame.cols / 4) * tan((wii.Roll)* M_PI / 180.0f)); + int pdelta = iround((preview_frame.rows / 4.) * tan(((double)wii.Pitch)* M_PI / 180.)); + int rdelta = iround((preview_frame.cols / 4.) * tan(((double)wii.Roll)* M_PI / 180.)); cv::line(preview_frame, cv::Point(0, preview_frame.rows / 2 + rdelta - pdelta), diff --git a/tracker-wii/wiiyourself/warns-begin.hpp b/tracker-wii/wiiyourself/warns-begin.hpp index ca2b6b93..e4b148ef 100644 --- a/tracker-wii/wiiyourself/warns-begin.hpp +++ b/tracker-wii/wiiyourself/warns-begin.hpp @@ -3,7 +3,10 @@ # pragma GCC diagnostic ignored "-Wswitch" # pragma GCC diagnostic ignored "-Wreorder" # pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wunused-but-set-variable" # pragma GCC diagnostic ignored "-Wunused-parameter" -# pragma GCC diagnostic ignored "-Wcast-function-type" +# pragma GCC diagnostic ignored "-Wcast-align" +# ifndef __clang__ +# pragma GCC diagnostic ignored "-Wunused-but-set-variable" +# pragma GCC diagnostic ignored "-Wcast-function-type" +# endif #endif diff --git a/tracker-wii/wiiyourself/wiimote.cpp b/tracker-wii/wiiyourself/wiimote.cpp index 0da0113b..f6946fad 100644 --- a/tracker-wii/wiiyourself/wiimote.cpp +++ b/tracker-wii/wiiyourself/wiimote.cpp @@ -10,16 +10,10 @@ #include "warns-begin.hpp" -// VC-specifics: -#ifdef _MSC_VER - // disable warning "C++ exception handler used, but unwind semantics are not enabled." - // in <xstring> (I don't use it - or just enable C++ exceptions) -# pragma warning(disable: 4530) -// auto-link with the necessary libs -//# pragma comment(lib, "setupapi.lib") -//# pragma comment(lib, "hid.lib") // for HID API (from DDK) -//# pragma comment(lib, "winmm.lib") // for timeGetTime() -#endif // _MSC_VER +#include <cmath> +#include <new> +#include <cstring> +#include <cstdio> #include "wiimote.h" #include <setupapi.h> @@ -29,8 +23,6 @@ extern "C" { #include <sys/types.h> // for _stat #include <sys/stat.h> // " -#include <cstring> -#include <cstdio> #include <process.h> // for _beginthreadex() #include <math.h> // for orientation #include <mmreg.h> // for WAVEFORMATEXTENSIBLE @@ -251,8 +243,9 @@ bool wiimote::Connect(unsigned wiimote_index, bool force_hidwrites) // (bizarre way of doing it) create a buffer large enough to hold the // fixed-size detail struct components, and the variable string size - SP_DEVICE_INTERFACE_DETAIL_DATA *didetail = - (SP_DEVICE_INTERFACE_DETAIL_DATA*) new BYTE[req_size]; + using spdidd = SP_DEVICE_INTERFACE_DETAIL_DATA; + constexpr std::align_val_t align { alignof(spdidd) }; + spdidd *didetail = (spdidd*)operator new(req_size, align); _ASSERT(didetail); didetail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); @@ -1203,7 +1196,7 @@ bool wiimote::EstimateOrientationFrom(wiimote_state::acceleration &accel) // wiimote seems to be stationary: normalize the current acceleration // (ie. the assumed gravity vector) - float inv_len = 1.f / sqrt(length_sq); + float inv_len = 1.f / std::sqrt(length_sq); float x = accel.X * inv_len; float y = accel.Y * inv_len; float z = accel.Z * inv_len; @@ -1215,9 +1208,9 @@ bool wiimote::EstimateOrientationFrom(wiimote_state::acceleration &accel) // and extract pitch & roll from them: // (may not be optimal) - float pitch = -asin(y) * 57.2957795f; + float pitch = -std::asin(y) * 57.2957795f; // float roll = asin(x) * 57.2957795f; - float roll = atan2(x, z) * 57.2957795f; + float roll = std::atan2(x, z) * 57.2957795f; if (z < 0) { pitch = (y < 0) ? 180 - pitch : -180 - pitch; roll = (x < 0) ? -180 - roll : 180 - roll; diff --git a/tracker-wii/wiiyourself/wiimote.h b/tracker-wii/wiiyourself/wiimote.h index b4738026..9b6d3ba3 100644 --- a/tracker-wii/wiiyourself/wiimote.h +++ b/tracker-wii/wiiyourself/wiimote.h @@ -472,7 +472,7 @@ volatile int MotionPlusDetectCount; // waiting for the result volatile DWORD AsyncRumbleTimeout; // orientation estimation unsigned WiimoteNearGUpdates; - unsigned NunchukNearGUpdates; + //unsigned NunchukNearGUpdates; // audio HANDLE SampleThread; const wiimote_sample* volatile CurrentSample; // otherwise playing square wave |