File: xrReferenceSpace_relationships.https.html

package info (click to toggle)
thunderbird 1%3A143.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,703,968 kB
  • sloc: cpp: 7,770,492; javascript: 5,943,842; ansic: 3,918,754; python: 1,418,263; xml: 653,354; asm: 474,045; java: 183,079; sh: 111,238; makefile: 20,410; perl: 14,359; objc: 13,059; yacc: 4,583; pascal: 3,405; lex: 1,720; ruby: 999; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 69; csh: 10
file content (58 lines) | stat: -rw-r--r-- 2,432 bytes parent folder | download | duplicates (22)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

<!DOCTYPE html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="resources/webxr_util.js"></script>
<script src="resources/webxr_test_constants.js"></script>
<script src="resources/webxr_test_asserts.js"></script>
<script>
let testName =
  "Bounded space, viewer space, local and local-floor space have correct poses w.r.t. each other";
// 1m above world origin.
const VIEWER_ORIGIN_TRANSFORM = {
  position: [0, 1, 0],
  orientation: [0, 0, 0, 1],
};
// 0.25m above world origin.
const FLOOR_ORIGIN_TRANSFORM = {
  position: [0, 0.25, 0],
  orientation: [0, 0, 0, 1],
};
const fakeDeviceInitParams = {
    supportsImmersive: true,
    supportedModes: ["inline", "immersive-vr"],
    views: VALID_VIEWS,
    viewerOrigin: VIEWER_ORIGIN_TRANSFORM,
    floorOrigin: FLOOR_ORIGIN_TRANSFORM,
    supportedFeatures: ALL_FEATURES
};
let testFunction = function(session, fakeDeviceController, t) {
  return new Promise((resolve, reject) => {
    Promise.all([
      session.requestReferenceSpace('bounded-floor'),
      session.requestReferenceSpace('local'),
      session.requestReferenceSpace('local-floor'),
      session.requestReferenceSpace('viewer')
    ]).then(([boundedSpace, localSpace, localFloorSpace, viewerSpace]) => {
      t.step(() => {
      });
      const onFrame = function(time, xrFrame) {
        const localFloorPoseInLocalSpace = xrFrame.getPose(localFloorSpace, localSpace);
        const viewerPoseInLocalFloorSpace = xrFrame.getPose(viewerSpace, localFloorSpace);
        const boundedFloorPoseInLocalFloorSpace = xrFrame.getPose(boundedSpace, localFloorSpace);
        t.step(() => {
          // Local floor space is supposed to be 0.25m above local space (aka world space).
          assert_equals(localFloorPoseInLocalSpace.transform.position.y, 0.25);
          // Bounded floor space should be at the same height as local floor space.
          assert_equals(boundedFloorPoseInLocalFloorSpace.transform.position.y, 0.0);
          // Viewer space should be additional 0.75m above local-floor space.
          assert_equals(viewerPoseInLocalFloorSpace.transform.position.y, 0.75);
        });
        resolve();
      }
      session.requestAnimationFrame(onFrame);
    });
  });
};
xr_session_promise_test(testName, testFunction, fakeDeviceInitParams, 'immersive-vr', { 'requiredFeatures': ['local-floor', 'bounded-floor'] });
</script>