summaryrefslogtreecommitdiffhomepage
path: root/proto-ft
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-09 10:51:39 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-09 11:08:39 +0200
commite97094569e06906b88f8578b99e1c59332bb3215 (patch)
tree9130acb7cb067bd33478222dc6ab2abc5894efe6 /proto-ft
parent6c8df6354c8248c0d6b7f4049b8cb3e45152a769 (diff)
proto/freetrack: get rid of float <-> double promotions
Diffstat (limited to 'proto-ft')
-rw-r--r--proto-ft/ftnoir_protocol_ft.cpp24
-rw-r--r--proto-ft/ftnoir_protocol_ft.h2
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();