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

Side by Side Diff: device/vr/android/gvr/gvr_gamepad_data_provider.h

Issue 2762003002: Refactor GVR controller gamepad API integration (Closed)
Patch Set: Add comments to help demystify this new abstraction 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H
6 #define DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H
7
8 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h"
cjgrant 2017/03/21 15:55:38 Is it only gvr_types.h needed here?
klausw 2017/03/21 16:55:56 Indeed, done.
9
10 namespace device {
11
12 // Subset of GVR controller data needed for the gamepad API. Filled in
13 // by vr_shell's VrController and consumed by GvrGamepaDataFetcher.
14 struct GvrGamepadData {
15 int64_t timestamp;
16 gvr_vec2f touch_pos;
17 gvr_quatf orientation;
18 gvr_vec3f accel;
19 gvr_vec3f gyro;
20 bool is_touching;
21 bool controller_button_pressed;
22 bool right_handed;
23 };
24
25 // This class exposes GVR controller data to the gamepad API. Data is
26 // polled by VrShellGl, then posted to VrShell which implements the
27 // GvrGamepadDataProvider interface.
28 class GvrGamepadDataProvider {
29 public:
30 // Refresh current GVR controller data for use by gamepad API.
31 // Also lazily creates and registers the gamepad data factory
32 // with the gamepad manager as needed.
33 virtual void GamepadDataUpdate(GvrGamepadData data) = 0;
34
35 // Called by the gamepad data fetcher to retrieve the latest snapshot
36 // of controller data.
37 virtual GvrGamepadData GamepadDataGet() = 0;
38 };
39
40 } // namespace device
41 #endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698