Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_types.h" | |
| 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 GvrGamepadDataFetcher. | |
| 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. The | |
| 31 // implementation also lazily creates and registers the GVR | |
| 32 // GamepadDataFetcherFactory with the GamepadDataFetcherManager as | |
| 33 // needed. | |
| 34 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
| |
| 35 | |
| 36 // Called by the gamepad data fetcher to retrieve the latest snapshot | |
| 37 // of controller data. | |
| 38 virtual GvrGamepadData GamepadDataGet() = 0; | |
| 39 }; | |
| 40 | |
| 41 } // namespace device | |
| 42 #endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H | |
| OLD | NEW |