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

Unified Diff: device/vr/android/gvr/gvr_gamepad_data_provider.h

Issue 2762003002: Refactor GVR controller gamepad API integration (Closed)
Patch Set: Fix comment, include gvr_types only for data provider Created 3 years, 9 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_gamepad_data_fetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/android/gvr/gvr_gamepad_data_provider.h
diff --git a/device/vr/android/gvr/gvr_gamepad_data_provider.h b/device/vr/android/gvr/gvr_gamepad_data_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..2e3663f775b5ef2b0923ddebc217a0b6b5a28581
--- /dev/null
+++ b/device/vr/android/gvr/gvr_gamepad_data_provider.h
@@ -0,0 +1,42 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H
+#define DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H
+
+#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
+
+namespace device {
+
+// Subset of GVR controller data needed for the gamepad API. Filled in
+// by vr_shell's VrController and consumed by GvrGamepadDataFetcher.
+struct GvrGamepadData {
+ int64_t timestamp;
+ gvr_vec2f touch_pos;
+ gvr_quatf orientation;
+ gvr_vec3f accel;
+ gvr_vec3f gyro;
+ bool is_touching;
+ bool controller_button_pressed;
+ bool right_handed;
+};
+
+// This class exposes GVR controller data to the gamepad API. Data is
+// polled by VrShellGl, then posted to VrShell which implements the
+// GvrGamepadDataProvider interface.
+class GvrGamepadDataProvider {
+ public:
+ // Refresh current GVR controller data for use by gamepad API. The
+ // implementation also lazily creates and registers the GVR
+ // GamepadDataFetcherFactory with the GamepadDataFetcherManager as
+ // needed.
+ virtual void GamepadDataUpdate(GvrGamepadData data) = 0;
mthiesse 2017/03/21 17:35:13 nit: Update/GetGamepadData? GamepadDataGet is stra
klausw 2017/03/21 18:28:55 Renamed both to put the verb first. I don't like O
+
+ // Called by the gamepad data fetcher to retrieve the latest snapshot
+ // of controller data.
+ virtual GvrGamepadData GamepadDataGet() = 0;
+};
+
+} // namespace device
+#endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H
« no previous file with comments | « device/vr/android/gvr/gvr_gamepad_data_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698