u/space_overseer: Make it possible set root as unbounded

This commit is contained in:
Niharika Challapalli 2024-01-03 19:08:52 +00:00 committed by Jakob Bornecrantz
parent 613d08ebbc
commit 428c511924
6 changed files with 23 additions and 3 deletions

View file

@ -150,6 +150,7 @@ u_builder_create_space_overseer_legacy(struct xrt_session_event_sink *broadcast,
struct xrt_device *right,
struct xrt_device **xdevs,
uint32_t xdev_count,
bool root_is_unbounded,
struct xrt_space_overseer **out_xso)
{
/*
@ -178,7 +179,13 @@ u_builder_create_space_overseer_legacy(struct xrt_session_event_sink *broadcast,
struct xrt_pose T_stage_local = XRT_POSE_IDENTITY;
T_stage_local.position.y = 1.6;
u_space_overseer_legacy_setup(uso, xdevs, xdev_count, head, &T_stage_local);
u_space_overseer_legacy_setup( //
uso, // uso
xdevs, // xdevs
xdev_count, // xdev_count
head, // head
&T_stage_local, // local_offset
root_is_unbounded); // root_is_unbounded
*out_xso = (struct xrt_space_overseer *)uso;
}
@ -240,6 +247,7 @@ u_builder_roles_helper_open_system(struct xrt_builder *xb,
ubrh.right, // right
xsysd->xdevs, // xdevs
xsysd->xdev_count, // xdev_count
false, // root_is_unbounded
out_xso); // out_xso
return XRT_SUCCESS;

View file

@ -173,6 +173,7 @@ u_builder_create_space_overseer_legacy(struct xrt_session_event_sink *broadcast,
struct xrt_device *right,
struct xrt_device **xdevs,
uint32_t xdev_count,
bool root_is_unbounded,
struct xrt_space_overseer **out_xso);
/*!

View file

@ -775,7 +775,8 @@ u_space_overseer_legacy_setup(struct u_space_overseer *uso,
struct xrt_device **xdevs,
uint32_t xdev_count,
struct xrt_device *head,
const struct xrt_pose *local_offset)
const struct xrt_pose *local_offset,
bool root_is_unbounded)
{
struct xrt_space *root = uso->base.semantic.root; // Convenience
@ -810,13 +811,20 @@ u_space_overseer_legacy_setup(struct u_space_overseer *uso,
assert(uso->base.semantic.view == NULL);
assert(uso->base.semantic.stage == NULL);
assert(uso->base.semantic.local == NULL);
assert(uso->base.semantic.unbounded == NULL);
xrt_space_reference(&uso->base.semantic.view, NULL);
xrt_space_reference(&uso->base.semantic.stage, NULL);
xrt_space_reference(&uso->base.semantic.local, NULL);
xrt_space_reference(&uso->base.semantic.unbounded, NULL);
// Assume the root space is the center of the stage space.
xrt_space_reference(&uso->base.semantic.stage, uso->base.semantic.root);
// If the system wants to support the space, set root as unbounded.
if (root_is_unbounded) {
xrt_space_reference(&uso->base.semantic.unbounded, uso->base.semantic.root);
}
// Set local to the local offset.
u_space_overseer_create_offset_space(uso, uso->base.semantic.root, local_offset, &uso->base.semantic.local);

View file

@ -48,7 +48,8 @@ u_space_overseer_legacy_setup(struct u_space_overseer *uso,
struct xrt_device **xdevs,
uint32_t xdev_count,
struct xrt_device *head,
const struct xrt_pose *local_offset);
const struct xrt_pose *local_offset,
bool root_is_unbounded);
/*!
* Creates a space without any offset, this is just for optimisation over a

View file

@ -175,6 +175,7 @@ steamvr_open_system(struct xrt_builder *xb,
right, // right
xsysd->xdevs, // xdevs
xsysd->xdev_count, // xdev_count
false, // root_is_unbounded
out_xso); // out_xso
return XRT_SUCCESS;

View file

@ -152,6 +152,7 @@ sdl_system_devices_init(struct sdl_program *sp)
NULL, // right
sp->xsysd_base.xdevs, // xdevs
sp->xsysd_base.xdev_count, // xdev_count
false, // root_is_unbounded
&sp->xso); // out_xso
}