standardFrame static method

XrFrame standardFrame(
  1. FakeXrSession session,
  2. int index
)

The default frame index of session: a head at 1.6 m looking down −z, two eyes 64 mm apart with a headset's asymmetric angles, in the session's space.

Implementation

static XrFrame standardFrame(FakeXrSession session, int index) {
  final head = RigidPose(
    position: Vector3(0.0, 1.6, 0.0),
    orientation: Quaternion.identity(),
  );
  return XrFrame(
    index: index,
    predictedDisplayTime: session.startTime + index * session.period,
    predictedDisplayPeriod: session.period,
    space: session.request?.space ?? XrSpace.localFloor,
    poses: <String, RigidPose>{XrPoseSources.head: head},
    views: <XrView>[
      for (final (i, x) in <(int, double)>[(0, -0.032), (1, 0.032)])
        XrView(
          index: i,
          pose: RigidPose(
            position: Vector3(x, 1.6, 0.0),
            orientation: Quaternion.identity(),
          ),
          fov: i == 0
              ? const XrFieldOfView(
                  left: -0.94,
                  right: 0.79,
                  up: 0.87,
                  down: -0.96,
                )
              : const XrFieldOfView(
                  left: -0.79,
                  right: 0.94,
                  up: 0.87,
                  down: -0.96,
                ),
        ),
    ],
  );
}