OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_H_ |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/android/vr_shell/vr_controller_model.h" |
12 #include "device/vr/android/gvr/gvr_gamepad_data_provider.h" | 13 #include "device/vr/android/gvr/gvr_gamepad_data_provider.h" |
13 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 14 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
14 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 15 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
15 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 16 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
16 | 17 |
17 using blink::WebGestureEvent; | 18 using blink::WebGestureEvent; |
18 using blink::WebInputEvent; | 19 using blink::WebInputEvent; |
19 | 20 |
20 namespace gvr { | 21 namespace gvr { |
21 class ControllerState; | 22 class ControllerState; |
(...skipping 22 matching lines...) Expand all Loading... |
44 void UpdateState(); | 45 void UpdateState(); |
45 | 46 |
46 std::vector<std::unique_ptr<WebGestureEvent>> DetectGestures(); | 47 std::vector<std::unique_ptr<WebGestureEvent>> DetectGestures(); |
47 | 48 |
48 bool IsTouching(); | 49 bool IsTouching(); |
49 | 50 |
50 float TouchPosX(); | 51 float TouchPosX(); |
51 | 52 |
52 float TouchPosY(); | 53 float TouchPosY(); |
53 | 54 |
54 const gvr::Quatf Orientation(); | 55 gvr::Quatf Orientation() const; |
| 56 |
| 57 gvr::Mat4f GetTransform() const; |
| 58 |
| 59 VrControllerModel::State GetModelState() const; |
55 | 60 |
56 bool TouchDownHappened(); | 61 bool TouchDownHappened(); |
57 | 62 |
58 bool TouchUpHappened(); | 63 bool TouchUpHappened(); |
59 | 64 |
60 bool ButtonUpHappened(gvr::ControllerButton button); | 65 bool ButtonUpHappened(gvr::ControllerButton button); |
61 bool ButtonDownHappened(gvr::ControllerButton button); | 66 bool ButtonDownHappened(gvr::ControllerButton button); |
| 67 bool ButtonState(gvr::ControllerButton button) const; |
62 | 68 |
63 bool IsConnected(); | 69 bool IsConnected(); |
64 | 70 |
65 private: | 71 private: |
66 enum GestureDetectorState { | 72 enum GestureDetectorState { |
67 WAITING, // waiting for user to touch down | 73 WAITING, // waiting for user to touch down |
68 TOUCHING, // touching the touch pad but not scrolling | 74 TOUCHING, // touching the touch pad but not scrolling |
69 SCROLLING // scrolling on the touch pad | 75 SCROLLING // scrolling on the touch pad |
70 }; | 76 }; |
71 | 77 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 168 |
163 // Number of consecutively extrapolated touch points | 169 // Number of consecutively extrapolated touch points |
164 int extrapolated_touch_ = 0; | 170 int extrapolated_touch_ = 0; |
165 | 171 |
166 DISALLOW_COPY_AND_ASSIGN(VrController); | 172 DISALLOW_COPY_AND_ASSIGN(VrController); |
167 }; | 173 }; |
168 | 174 |
169 } // namespace vr_shell | 175 } // namespace vr_shell |
170 | 176 |
171 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_H_ | 177 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_H_ |
OLD | NEW |