Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: device/vr/android/gvr/gvr_gamepad_data_fetcher.cc

Issue 2814443004: Refactor VR math off of GVR types, onto gfx types where possible. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
diff --git a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
index 2a029c44f890a22f219c247bbfccac19369f1ab3..1264a353d820bc1435e5bbc2f61e2502e17ee801 100644
--- a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
+++ b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
@@ -6,8 +6,8 @@
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
-
#include "device/vr/android/gvr/gvr_gamepad_data_provider.h"
+#include "device/vr/vr_types.h"
#include "third_party/WebKit/public/platform/WebGamepads.h"
namespace device {
@@ -105,9 +105,9 @@ void GvrGamepadDataFetcher::GetGamepadData(bool devices_changed_hint) {
pad.timestamp = provided_data.timestamp;
if (provided_data.is_touching) {
- gvr_vec2f touch_position = provided_data.touch_pos;
- pad.axes[0] = (touch_position.x * 2.0f) - 1.0f;
- pad.axes[1] = (touch_position.y * 2.0f) - 1.0f;
+ gfx::Vector2dF touch_position = provided_data.touch_pos;
+ pad.axes[0] = (touch_position.x() * 2.0f) - 1.0f;
+ pad.axes[1] = (touch_position.y() * 2.0f) - 1.0f;
} else {
pad.axes[0] = 0.0f;
pad.axes[1] = 0.0f;
@@ -121,24 +121,24 @@ void GvrGamepadDataFetcher::GetGamepadData(bool devices_changed_hint) {
pad.pose.hasOrientation = true;
pad.pose.hasPosition = false;
- gvr_quatf orientation = provided_data.orientation;
+ vr::Quatf orientation = provided_data.orientation;
pad.pose.orientation.notNull = true;
pad.pose.orientation.x = orientation.qx;
pad.pose.orientation.y = orientation.qy;
pad.pose.orientation.z = orientation.qz;
pad.pose.orientation.w = orientation.qw;
- gvr_vec3f accel = provided_data.accel;
+ gfx::Vector3dF accel = provided_data.accel;
pad.pose.linearAcceleration.notNull = true;
- pad.pose.linearAcceleration.x = accel.x;
- pad.pose.linearAcceleration.y = accel.y;
- pad.pose.linearAcceleration.z = accel.z;
+ pad.pose.linearAcceleration.x = accel.x();
+ pad.pose.linearAcceleration.y = accel.y();
+ pad.pose.linearAcceleration.z = accel.z();
- gvr_vec3f gyro = provided_data.gyro;
+ gfx::Vector3dF gyro = provided_data.gyro;
pad.pose.angularVelocity.notNull = true;
- pad.pose.angularVelocity.x = gyro.x;
- pad.pose.angularVelocity.y = gyro.y;
- pad.pose.angularVelocity.z = gyro.z;
+ pad.pose.angularVelocity.x = gyro.x();
+ pad.pose.angularVelocity.y = gyro.y();
+ pad.pose.angularVelocity.z = gyro.z();
}
void GvrGamepadDataFetcher::PauseHint(bool paused) {}

Powered by Google App Engine
This is Rietveld 408576698