mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
st/oxr: Support next-chained XrSpaceVelocity in XrSpaceLocation
This commit is contained in:
parent
bf086f8be2
commit
b7ea0ce2b3
|
@ -143,6 +143,9 @@ oxr_xrLocateSpace(XrSpace space,
|
||||||
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, location,
|
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, location,
|
||||||
XR_TYPE_SPACE_LOCATION);
|
XR_TYPE_SPACE_LOCATION);
|
||||||
|
|
||||||
|
OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(
|
||||||
|
&log, ((XrSpaceVelocity *)location->next), XR_TYPE_SPACE_VELOCITY);
|
||||||
|
|
||||||
if (time <= (XrTime)0) {
|
if (time <= (XrTime)0) {
|
||||||
return oxr_error(&log, XR_ERROR_TIME_INVALID,
|
return oxr_error(&log, XR_ERROR_TIME_INVALID,
|
||||||
"(time == %" PRIi64 ") is not a valid time.",
|
"(time == %" PRIi64 ") is not a valid time.",
|
||||||
|
|
|
@ -325,6 +325,9 @@ get_xr_space_location_flags(enum xrt_space_relation_flags relation_flags)
|
||||||
bool tracked_ori = (relation_flags & XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT) != 0;
|
bool tracked_ori = (relation_flags & XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT) != 0;
|
||||||
bool valid_pos = (relation_flags & XRT_SPACE_RELATION_POSITION_VALID_BIT) != 0;
|
bool valid_pos = (relation_flags & XRT_SPACE_RELATION_POSITION_VALID_BIT) != 0;
|
||||||
bool tracked_pos = (relation_flags & XRT_SPACE_RELATION_POSITION_TRACKED_BIT) != 0;
|
bool tracked_pos = (relation_flags & XRT_SPACE_RELATION_POSITION_TRACKED_BIT) != 0;
|
||||||
|
|
||||||
|
bool linear_vel = (relation_flags & XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT) != 0;
|
||||||
|
bool angular_vel = (relation_flags & XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT) != 0;
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
XrSpaceLocationFlags location_flags = (XrSpaceLocationFlags)0;
|
XrSpaceLocationFlags location_flags = (XrSpaceLocationFlags)0;
|
||||||
|
@ -340,6 +343,12 @@ get_xr_space_location_flags(enum xrt_space_relation_flags relation_flags)
|
||||||
if (tracked_pos) {
|
if (tracked_pos) {
|
||||||
location_flags |= XR_SPACE_LOCATION_POSITION_TRACKED_BIT;
|
location_flags |= XR_SPACE_LOCATION_POSITION_TRACKED_BIT;
|
||||||
}
|
}
|
||||||
|
if (linear_vel) {
|
||||||
|
location_flags |= XR_SPACE_VELOCITY_LINEAR_VALID_BIT;
|
||||||
|
}
|
||||||
|
if (angular_vel) {
|
||||||
|
location_flags |= XR_SPACE_VELOCITY_ANGULAR_VALID_BIT;
|
||||||
|
}
|
||||||
return location_flags;
|
return location_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,6 +390,22 @@ oxr_space_locate(struct oxr_logger *log,
|
||||||
location->locationFlags =
|
location->locationFlags =
|
||||||
get_xr_space_location_flags(result.relation_flags);
|
get_xr_space_location_flags(result.relation_flags);
|
||||||
|
|
||||||
|
XrSpaceVelocity *vel = (XrSpaceVelocity *)location->next;
|
||||||
|
if (vel) {
|
||||||
|
vel->linearVelocity.x = result.linear_velocity.x;
|
||||||
|
vel->linearVelocity.y = result.linear_velocity.y;
|
||||||
|
vel->linearVelocity.z = result.linear_velocity.z;
|
||||||
|
|
||||||
|
vel->angularVelocity.x = result.angular_velocity.x;
|
||||||
|
vel->angularVelocity.y = result.angular_velocity.y;
|
||||||
|
vel->angularVelocity.z = result.angular_velocity.z;
|
||||||
|
|
||||||
|
vel->velocityFlags |= (location->locationFlags &
|
||||||
|
XR_SPACE_VELOCITY_LINEAR_VALID_BIT);
|
||||||
|
vel->velocityFlags |= (location->locationFlags &
|
||||||
|
XR_SPACE_VELOCITY_ANGULAR_VALID_BIT);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
location->linearVelocity = *(XrVector3f *)&result.linear_velocity;
|
location->linearVelocity = *(XrVector3f *)&result.linear_velocity;
|
||||||
location->angularVelocity = *(XrVector3f *)&result.angular_velocity;
|
location->angularVelocity = *(XrVector3f *)&result.angular_velocity;
|
||||||
|
|
Loading…
Reference in a new issue