From e97094569e06906b88f8578b99e1c59332bb3215 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 9 Jun 2016 10:51:39 +0200 Subject: proto/freetrack: get rid of float <-> double promotions --- proto-ft/ftnoir_protocol_ft.cpp | 24 ++++++++++++------------ proto-ft/ftnoir_protocol_ft.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index e5648250..0e1739cd 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -37,13 +37,13 @@ FTNoIR_Protocol::~FTNoIR_Protocol() } void FTNoIR_Protocol::pose(const double* headpose) { - float yaw = -getRadsFromDegrees(headpose[Yaw]); - float pitch = -getRadsFromDegrees(headpose[Pitch]); - float roll = getRadsFromDegrees(headpose[Roll]); - float tx = headpose[TX] * 10.f; - float ty = headpose[TY] * 10.f; - float tz = headpose[TZ] * 10.f; - + const float yaw = -rads_to_degrees(headpose[Yaw]); + const float pitch = -rads_to_degrees(headpose[Pitch]); + const float roll = rads_to_degrees(headpose[Roll]); + const float tx = float(headpose[TX] * 10); + const float ty = float(headpose[TY] * 10); + const float tz = float(headpose[TZ] * 10); + FTHeap* ft = pMemData; FTData* data = &ft->data; @@ -53,14 +53,14 @@ void FTNoIR_Protocol::pose(const double* headpose) { data->RawPitch = 0; data->RawYaw = 0; data->RawRoll = 0; - + data->X = tx; data->Y = ty; data->Z = tz; data->Yaw = yaw; data->Pitch = pitch; data->Roll = roll; - + data->X1 = data->DataID; data->X2 = 0; data->X3 = 0; @@ -69,9 +69,9 @@ void FTNoIR_Protocol::pose(const double* headpose) { data->Y2 = 0; data->Y3 = 0; data->Y4 = 0; - + int32_t id = ft->GameID; - + if (intGameID != id) { QString gamename; @@ -85,7 +85,7 @@ void FTNoIR_Protocol::pose(const double* headpose) { QMutexLocker foo(&game_name_mutex); connected_game = gamename; } - + data->DataID += 1; } diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h index 467fc9cc..d2d40449 100644 --- a/proto-ft/ftnoir_protocol_ft.h +++ b/proto-ft/ftnoir_protocol_ft.h @@ -66,7 +66,7 @@ private: QMutex game_name_mutex; static check_for_first_run runonce_check; - static inline double getRadsFromDegrees(double degrees) { return degrees * 0.017453; } + static inline float rads_to_degrees(double degrees) { return float(degrees * 0.017453); } void start_tirviews(); void start_dummy(); -- cgit v1.2.3