| 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Controller API entry point. | 35 // Controller API entry point. |
| 36 explicit VrController(gvr_context* gvr_context); | 36 explicit VrController(gvr_context* gvr_context); |
| 37 ~VrController(); | 37 ~VrController(); |
| 38 | 38 |
| 39 // Must be called when the Activity gets OnResume(). | 39 // Must be called when the Activity gets OnResume(). |
| 40 void OnResume(); | 40 void OnResume(); |
| 41 | 41 |
| 42 // Must be called when the Activity gets OnPause(). | 42 // Must be called when the Activity gets OnPause(). |
| 43 void OnPause(); | 43 void OnPause(); |
| 44 | 44 |
| 45 // Must be called when the GL renderer gets OnSurfaceCreated(). | |
| 46 void Initialize(gvr_context* gvr_context); | |
| 47 | |
| 48 device::GvrGamepadData GetGamepadData(); | 45 device::GvrGamepadData GetGamepadData(); |
| 49 | 46 |
| 50 // Must be called when the GL renderer gets OnDrawFrame(). | 47 // Must be called when the GL renderer gets OnDrawFrame(). |
| 51 void UpdateState(const gfx::Vector3dF& head_direction); | 48 void UpdateState(const gfx::Vector3dF& head_direction); |
| 52 | 49 |
| 53 std::vector<std::unique_ptr<WebGestureEvent>> DetectGestures(); | 50 std::vector<std::unique_ptr<WebGestureEvent>> DetectGestures(); |
| 54 | 51 |
| 55 bool IsTouching(); | 52 bool IsTouching(); |
| 56 | 53 |
| 57 float TouchPosX(); | 54 float TouchPosX(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 void UpdateOverallVelocity(); | 131 void UpdateOverallVelocity(); |
| 135 | 132 |
| 136 // State of gesture detector. | 133 // State of gesture detector. |
| 137 GestureDetectorState state_; | 134 GestureDetectorState state_; |
| 138 | 135 |
| 139 std::unique_ptr<gvr::ControllerApi> controller_api_; | 136 std::unique_ptr<gvr::ControllerApi> controller_api_; |
| 140 | 137 |
| 141 // The last controller state (updated once per frame). | 138 // The last controller state (updated once per frame). |
| 142 std::unique_ptr<gvr::ControllerState> controller_state_; | 139 std::unique_ptr<gvr::ControllerState> controller_state_; |
| 143 | 140 |
| 141 std::unique_ptr<gvr::GvrApi> gvr_api_; |
| 142 |
| 144 float last_qx_; | 143 float last_qx_; |
| 145 bool pinch_started_; | 144 bool pinch_started_; |
| 146 bool zoom_in_progress_ = false; | 145 bool zoom_in_progress_ = false; |
| 147 bool touch_position_changed_ = false; | 146 bool touch_position_changed_ = false; |
| 148 | 147 |
| 149 // Handedness from user prefs (currently only read once on initialization) | 148 // Handedness from user prefs. |
| 150 gvr::ControllerHandedness handedness_; | 149 gvr::ControllerHandedness handedness_; |
| 151 | 150 |
| 152 // Current touch info after the extrapolation. | 151 // Current touch info after the extrapolation. |
| 153 std::unique_ptr<TouchInfo> touch_info_; | 152 std::unique_ptr<TouchInfo> touch_info_; |
| 154 | 153 |
| 155 // A pointer storing the touch point from previous frame. | 154 // A pointer storing the touch point from previous frame. |
| 156 std::unique_ptr<TouchPoint> prev_touch_point_; | 155 std::unique_ptr<TouchPoint> prev_touch_point_; |
| 157 | 156 |
| 158 // A pointer storing the touch point from current frame. | 157 // A pointer storing the touch point from current frame. |
| 159 std::unique_ptr<TouchPoint> cur_touch_point_; | 158 std::unique_ptr<TouchPoint> cur_touch_point_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 177 int extrapolated_touch_ = 0; | 176 int extrapolated_touch_ = 0; |
| 178 | 177 |
| 179 std::unique_ptr<ElbowModel> elbow_model_; | 178 std::unique_ptr<ElbowModel> elbow_model_; |
| 180 | 179 |
| 181 DISALLOW_COPY_AND_ASSIGN(VrController); | 180 DISALLOW_COPY_AND_ASSIGN(VrController); |
| 182 }; | 181 }; |
| 183 | 182 |
| 184 } // namespace vr_shell | 183 } // namespace vr_shell |
| 185 | 184 |
| 186 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_H_ | 185 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_CONTROLLER_H_ |
| OLD | NEW |