d/survive: Remove useless loop

We already have a SurviveSimpleObject, no need to look for it through iteration
This commit is contained in:
Christoph Haag 2020-05-28 17:19:00 +02:00
parent d3b90e9548
commit 25bafd71c8

View file

@ -176,33 +176,28 @@ _get_survive_pose(const SurviveSimpleObject *survive_object,
out_relation->relation_flags = 0;
for (const SurviveSimpleObject *it =
survive_simple_get_first_object(ctx);
it != 0; it = survive_simple_get_next_object(ctx, it)) {
// const char *codename = survive_simple_object_name(it);
if (survive_simple_object_get_type(it) !=
if (survive_simple_object_get_type(survive_object) !=
SurviveSimpleObject_OBJECT &&
survive_simple_object_get_type(it) !=
survive_simple_object_get_type(survive_object) !=
SurviveSimpleObject_HMD) {
continue;
return;
}
if (it != survive_object)
continue;
SurvivePose pose;
uint32_t timecode =
survive_simple_object_get_latest_pose(it, &pose);
survive_simple_object_get_latest_pose(survive_object, &pose);
(void)timecode;
struct xrt_quat out_rot = {.x = pose.Rot[1],
.y = pose.Rot[2],
.z = pose.Rot[3],
.w = pose.Rot[0]};
// printf ("quat %f %f %f %f\n", out_rot.x, out_rot.y,
// out_rot.z, out_rot.w);
/*
printf("quat %f %f %f %f\n", out_rot.x, out_rot.y, out_rot.z,
out_rot.w);
*/
/* libsurvive looks down when it should be looking forward, so
* rotate the quat.
@ -235,7 +230,6 @@ _get_survive_pose(const SurviveSimpleObject *survive_object,
XRT_SPACE_RELATION_POSITION_VALID_BIT |
XRT_SPACE_RELATION_POSITION_TRACKED_BIT;
}
}
static bool
_try_update_codenames(struct survive_system *sys)