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

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

Issue 2822983002: Implement displayName and stageParameters of VRDisplay 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..52e7625700d8beefb0edcfd2d2c71e93d8f54170 100644
--- a/device/vr/openvr/openvr_device.cc
+++ b/device/vr/openvr/openvr_device.cc
@@ -24,6 +24,22 @@ device::mojom::VRFieldOfViewPtr openVRFovToWebVRFov(vr::IVRSystem* vr_system,
return out;
}
+std::string getOpenVRString(vr::IVRSystem* vr_system,
+ vr::TrackedDeviceProperty prop) {
+ std::string out;
+
+ vr::TrackedPropertyError error = vr::TrackedProp_Success;
+ char openvr_string[vr::k_unMaxPropertyStringSize];
+ vr_system->GetStringTrackedDeviceProperty(
+ vr::k_unTrackedDeviceIndex_Hmd, prop, openvr_string,
+ vr::k_unMaxPropertyStringSize, &error);
+
+ if (error == vr::TrackedProp_Success)
+ out = openvr_string;
+
+ return out;
+}
+
} // namespace
namespace device {
@@ -45,6 +61,9 @@ void OpenVRDevice::CreateVRDisplayInfo(
mojom::VRDisplayInfoPtr device = mojom::VRDisplayInfo::New();
device->index = id();
+ device->displayName =
+ getOpenVRString(vr_system, vr::Prop_ManufacturerName_String) + " " +
+ getOpenVRString(vr_system, vr::Prop_ModelNumber_String);
device->capabilities = mojom::VRDisplayCapabilities::New();
device->capabilities->hasPosition = true;
device->capabilities->hasExternalDisplay = true;
@@ -81,6 +100,37 @@ void OpenVRDevice::CreateVRDisplayInfo(
right_eye->renderWidth = left_eye->renderWidth;
right_eye->renderHeight = left_eye->renderHeight;
+ device->stageParameters = mojom::VRStageParameters::New();
+ vr::HmdMatrix34_t mat =
+ vr_system->GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
+ device->stageParameters->standingTransform.resize(16);
+ std::vector<float>& transform = device->stageParameters->standingTransform;
+ transform[0] = mat.m[0][0];
+ transform[1] = mat.m[1][0];
+ transform[2] = mat.m[2][0];
+ transform[3] = 0.0f;
+ transform[4] = mat.m[0][1];
+ transform[5] = mat.m[1][1];
+ transform[6] = mat.m[2][1];
+ transform[7] = 0.0f;
+ transform[8] = mat.m[0][2];
+ transform[9] = mat.m[1][2];
+ transform[10] = mat.m[2][2];
+ transform[11] = 0.0f;
+ transform[12] = mat.m[0][3];
+ transform[13] = mat.m[1][3];
+ transform[14] = mat.m[2][3];
+ transform[15] = 1.0f;
billorr 2017/04/17 17:56:08 converting transforms from openvr to mojo/webvr fo
+
+ vr::IVRChaperone* chaperone = vr::VRChaperone();
+ if (chaperone) {
+ chaperone->GetPlayAreaSize(&device->stageParameters->sizeX,
+ &device->stageParameters->sizeZ);
+ } else {
+ device->stageParameters->sizeX = 0.0f;
+ device->stageParameters->sizeZ = 0.0f;
+ }
+
render_loop_ = std::make_unique<OpenVRRenderLoop>(vr_system);
on_created.Run(std::move(device));
« 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