Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Unified Diff: device/vr/openvr/openvr_device.cc

Issue 2825493002: Implement linearVelocity and angularVelocity of VRPose for OpenVRDevice (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/openvr/openvr_device.cc
diff --git a/device/vr/openvr/openvr_device.cc b/device/vr/openvr/openvr_device.cc
index 88f7f4a4fd0975a9f5dbdc5f9f26f71f64c3a6ff..0ced4955479130030373965f02ccf665e0073148 100644
--- a/device/vr/openvr/openvr_device.cc
+++ b/device/vr/openvr/openvr_device.cc
@@ -24,6 +24,15 @@ device::mojom::VRFieldOfViewPtr openVRFovToWebVRFov(vr::IVRSystem* vr_system,
return out;
}
+std::vector<float> HmdVector3ToWebVR(const vr::HmdVector3_t& vec) {
+ std::vector<float> out;
+ out.resize(3);
+ out[0] = vec.v[0];
+ out[1] = vec.v[1];
+ out[2] = vec.v[2];
+ return out;
+}
+
} // namespace
namespace device {
@@ -164,6 +173,9 @@ device::mojom::VRPosePtr OpenVRDevice::OpenVRRenderLoop::getPose() {
pose->position.value()[0] = m[0][3];
pose->position.value()[1] = m[1][3];
pose->position.value()[2] = m[2][3];
+
+ pose->linearVelocity = HmdVector3ToWebVR(hmdPose.vVelocity);
+ pose->angularVelocity = HmdVector3ToWebVR(hmdPose.vAngularVelocity);
}
return std::move(pose);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698