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

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: Fix tests 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
« no previous file with comments | « device/vr/android/gvr/gvr_device.cc ('k') | device/vr/android/gvr/gvr_gamepad_data_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1f4f503ea781a5154b7fab94df0821f571dac5f1..a18b6c6cae3382e2d50b27534d4a2b341470b765 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 {
@@ -106,9 +106,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;
@@ -122,24 +122,24 @@ void GvrGamepadDataFetcher::GetGamepadData(bool devices_changed_hint) {
pad.pose.has_orientation = true;
pad.pose.has_position = false;
- gvr_quatf orientation = provided_data.orientation;
+ vr::Quatf orientation = provided_data.orientation;
pad.pose.orientation.not_null = 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.linear_acceleration.not_null = true;
- pad.pose.linear_acceleration.x = accel.x;
- pad.pose.linear_acceleration.y = accel.y;
- pad.pose.linear_acceleration.z = accel.z;
+ pad.pose.linear_acceleration.x = accel.x();
+ pad.pose.linear_acceleration.y = accel.y();
+ pad.pose.linear_acceleration.z = accel.z();
- gvr_vec3f gyro = provided_data.gyro;
+ gfx::Vector3dF gyro = provided_data.gyro;
pad.pose.angular_velocity.not_null = true;
- pad.pose.angular_velocity.x = gyro.x;
- pad.pose.angular_velocity.y = gyro.y;
- pad.pose.angular_velocity.z = gyro.z;
+ pad.pose.angular_velocity.x = gyro.x();
+ pad.pose.angular_velocity.y = gyro.y();
+ pad.pose.angular_velocity.z = gyro.z();
}
void GvrGamepadDataFetcher::PauseHint(bool paused) {}
« no previous file with comments | « device/vr/android/gvr/gvr_device.cc ('k') | device/vr/android/gvr/gvr_gamepad_data_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698