| 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 #include "device/vr/openvr/openvr_gamepad_data_fetcher.h" | 5 #include "device/vr/openvr/openvr_gamepad_data_fetcher.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 const vr::HmdMatrix34_t& mat = pose.mDeviceToAbsoluteTracking; | 188 const vr::HmdMatrix34_t& mat = pose.mDeviceToAbsoluteTracking; |
| 189 gfx::Transform transform( | 189 gfx::Transform transform( |
| 190 mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3], mat.m[1][0], | 190 mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3], mat.m[1][0], |
| 191 mat.m[1][1], mat.m[1][2], mat.m[1][3], mat.m[2][0], mat.m[2][1], | 191 mat.m[1][1], mat.m[1][2], mat.m[1][3], mat.m[2][0], mat.m[2][1], |
| 192 mat.m[2][2], mat.m[2][3], 0, 0, 0, 1); | 192 mat.m[2][2], mat.m[2][3], 0, 0, 0, 1); |
| 193 | 193 |
| 194 gfx::DecomposedTransform decomposed_transform; | 194 gfx::DecomposedTransform decomposed_transform; |
| 195 gfx::DecomposeTransform(&decomposed_transform, transform); | 195 gfx::DecomposeTransform(&decomposed_transform, transform); |
| 196 | 196 |
| 197 pad.pose.orientation.not_null = true; | 197 pad.pose.orientation.not_null = true; |
| 198 pad.pose.orientation.x = decomposed_transform.quaternion[0]; | 198 pad.pose.orientation.x = decomposed_transform.quaternion.x(); |
| 199 pad.pose.orientation.y = decomposed_transform.quaternion[1]; | 199 pad.pose.orientation.y = decomposed_transform.quaternion.y(); |
| 200 pad.pose.orientation.z = decomposed_transform.quaternion[2]; | 200 pad.pose.orientation.z = decomposed_transform.quaternion.z(); |
| 201 pad.pose.orientation.w = decomposed_transform.quaternion[3]; | 201 pad.pose.orientation.w = decomposed_transform.quaternion.w(); |
| 202 | 202 |
| 203 pad.pose.position.not_null = true; | 203 pad.pose.position.not_null = true; |
| 204 pad.pose.position.x = decomposed_transform.translate[0]; | 204 pad.pose.position.x = decomposed_transform.translate[0]; |
| 205 pad.pose.position.y = decomposed_transform.translate[1]; | 205 pad.pose.position.y = decomposed_transform.translate[1]; |
| 206 pad.pose.position.z = decomposed_transform.translate[2]; | 206 pad.pose.position.z = decomposed_transform.translate[2]; |
| 207 | 207 |
| 208 pad.pose.angular_velocity.not_null = true; | 208 pad.pose.angular_velocity.not_null = true; |
| 209 pad.pose.angular_velocity.x = pose.vAngularVelocity.v[0]; | 209 pad.pose.angular_velocity.x = pose.vAngularVelocity.v[0]; |
| 210 pad.pose.angular_velocity.y = pose.vAngularVelocity.v[1]; | 210 pad.pose.angular_velocity.y = pose.vAngularVelocity.v[1]; |
| 211 pad.pose.angular_velocity.z = pose.vAngularVelocity.v[2]; | 211 pad.pose.angular_velocity.z = pose.vAngularVelocity.v[2]; |
| 212 | 212 |
| 213 pad.pose.linear_velocity.not_null = true; | 213 pad.pose.linear_velocity.not_null = true; |
| 214 pad.pose.linear_velocity.x = pose.vVelocity.v[0]; | 214 pad.pose.linear_velocity.x = pose.vVelocity.v[0]; |
| 215 pad.pose.linear_velocity.y = pose.vVelocity.v[1]; | 215 pad.pose.linear_velocity.y = pose.vVelocity.v[1]; |
| 216 pad.pose.linear_velocity.z = pose.vVelocity.v[2]; | 216 pad.pose.linear_velocity.z = pose.vVelocity.v[2]; |
| 217 } else { | 217 } else { |
| 218 pad.pose.orientation.not_null = false; | 218 pad.pose.orientation.not_null = false; |
| 219 pad.pose.position.not_null = false; | 219 pad.pose.position.not_null = false; |
| 220 pad.pose.angular_velocity.not_null = false; | 220 pad.pose.angular_velocity.not_null = false; |
| 221 pad.pose.linear_velocity.not_null = false; | 221 pad.pose.linear_velocity.not_null = false; |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 void OpenVRGamepadDataFetcher::PauseHint(bool paused) {} | 226 void OpenVRGamepadDataFetcher::PauseHint(bool paused) {} |
| 227 | 227 |
| 228 } // namespace device | 228 } // namespace device |
| OLD | NEW |