d/survive: Port to u_device_get_view_pose

This commit is contained in:
Ryan Pavlik 2021-04-26 15:36:57 -05:00 committed by Jakob Bornecrantz
parent 6682bb0291
commit 2d47c496e6

View file

@ -447,27 +447,9 @@ survive_device_get_view_pose(struct xrt_device *xdev,
uint32_t view_index,
struct xrt_pose *out_pose)
{
struct xrt_pose pose = {{0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f}};
bool adjust = view_index == 0;
struct survive_device *survive = (struct survive_device *)xdev;
pose.orientation = survive->hmd.config.display.rot[view_index];
pose.position.x = eye_relation->x / 2.0f;
pose.position.y = eye_relation->y / 2.0f;
pose.position.z = eye_relation->z / 2.0f;
// Adjust for left/right while also making sure there aren't any -0.f.
if (pose.position.x > 0.0f && adjust) {
pose.position.x = -pose.position.x;
}
if (pose.position.y > 0.0f && adjust) {
pose.position.y = -pose.position.y;
}
if (pose.position.z > 0.0f && adjust) {
pose.position.z = -pose.position.z;
}
*out_pose = pose;
u_device_get_view_pose(eye_relation, view_index, out_pose);
out_pose->orientation = survive->hmd.config.display.rot[view_index];
}
enum InputComponent