OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H | 5 #ifndef DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H |
6 #define DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H | 6 #define DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H |
7 | 7 |
8 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 8 #include "device/vr/vr_types.h" |
9 | 9 |
10 namespace device { | 10 namespace device { |
11 | 11 |
12 class GvrGamepadDataFetcher; | 12 class GvrGamepadDataFetcher; |
13 | 13 |
14 // Subset of GVR controller data needed for the gamepad API. Filled in | 14 // Subset of GVR controller data needed for the gamepad API. Filled in |
15 // by vr_shell's VrController and consumed by GvrGamepadDataFetcher. | 15 // by vr_shell's VrController and consumed by GvrGamepadDataFetcher. |
16 struct GvrGamepadData { | 16 struct GvrGamepadData { |
17 int64_t timestamp; | 17 int64_t timestamp; |
18 gvr_vec2f touch_pos; | 18 gfx::Vector2dF touch_pos; |
19 gvr_quatf orientation; | 19 vr::Quatf orientation; |
20 gvr_vec3f accel; | 20 gfx::Vector3dF accel; |
21 gvr_vec3f gyro; | 21 gfx::Vector3dF gyro; |
22 bool is_touching; | 22 bool is_touching; |
23 bool controller_button_pressed; | 23 bool controller_button_pressed; |
24 bool right_handed; | 24 bool right_handed; |
25 }; | 25 }; |
26 | 26 |
27 // This class exposes GVR controller data to the gamepad API. Data is | 27 // This class exposes GVR controller data to the gamepad API. Data is |
28 // polled by VrShellGl, then pushed from VrShell which implements the | 28 // polled by VrShellGl, then pushed from VrShell which implements the |
29 // GvrGamepadDataProvider interface. | 29 // GvrGamepadDataProvider interface. |
30 // | 30 // |
31 // More specifically, here's the lifecycle, assuming VrShell | 31 // More specifically, here's the lifecycle, assuming VrShell |
(...skipping 26 matching lines...) Expand all Loading... |
58 virtual void UpdateGamepadData(GvrGamepadData data) = 0; | 58 virtual void UpdateGamepadData(GvrGamepadData data) = 0; |
59 | 59 |
60 // Called by the gamepad data fetcher constructor to register itself | 60 // Called by the gamepad data fetcher constructor to register itself |
61 // for receiving data via SetGamepadData. The fetcher must remain | 61 // for receiving data via SetGamepadData. The fetcher must remain |
62 // alive while the provider is calling SetGamepadData on it. | 62 // alive while the provider is calling SetGamepadData on it. |
63 virtual void RegisterGamepadDataFetcher(GvrGamepadDataFetcher*) = 0; | 63 virtual void RegisterGamepadDataFetcher(GvrGamepadDataFetcher*) = 0; |
64 }; | 64 }; |
65 | 65 |
66 } // namespace device | 66 } // namespace device |
67 #endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H | 67 #endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H |
OLD | NEW |