1 | /*
|
---|
2 | * Copyright (C) 2020 Igalia S.L. All rights reserved.
|
---|
3 | *
|
---|
4 | * Redistribution and use in source and binary forms, with or without
|
---|
5 | * modification, are permitted provided that the following conditions
|
---|
6 | * are met:
|
---|
7 | * 1. Redistributions of source code must retain the above copyright
|
---|
8 | * notice, this list of conditions and the following disclaimer.
|
---|
9 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer in the
|
---|
11 | * documentation and/or other materials provided with the distribution.
|
---|
12 | *
|
---|
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
---|
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
---|
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
---|
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
---|
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
---|
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
---|
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
---|
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
---|
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
---|
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
---|
23 | * THE POSSIBILITY OF SUCH DAMAGE.
|
---|
24 | */
|
---|
25 |
|
---|
26 | [
|
---|
27 | Conditional=WEBXR,
|
---|
28 | EnabledBySetting=WebXREnabled,
|
---|
29 | InterfaceName=FakeXRInputController,
|
---|
30 | LegacyNoInterfaceObject
|
---|
31 | ] interface WebFakeXRInputController {
|
---|
32 | // Indicates that the handedness of the device has changed.
|
---|
33 | undefined setHandedness(XRHandedness handedness);
|
---|
34 |
|
---|
35 | // Indicates that the target ray mode of the device has changed.
|
---|
36 | undefined setTargetRayMode(XRTargetRayMode targetRayMode);
|
---|
37 |
|
---|
38 | // Indicates that the list of profiles representing the device has changed.
|
---|
39 | undefined setProfiles(sequence<DOMString> profiles);
|
---|
40 |
|
---|
41 | // Sets or clears the position of the controller. If not set, the controller is assumed to
|
---|
42 | // not be tracked.
|
---|
43 | undefined setGripOrigin(FakeXRRigidTransformInit gripOrigin, optional boolean emulatedPosition = false);
|
---|
44 | undefined clearGripOrigin();
|
---|
45 |
|
---|
46 | // Sets the pointer origin for the controller.
|
---|
47 | undefined setPointerOrigin(FakeXRRigidTransformInit pointerOrigin, optional boolean emulatedPosition = false);
|
---|
48 |
|
---|
49 | // Temporarily disconnect the input device
|
---|
50 | undefined disconnect();
|
---|
51 |
|
---|
52 | // Reconnect a disconnected input device
|
---|
53 | undefined reconnect();
|
---|
54 |
|
---|
55 | // Start a selection for the current frame with the primary input
|
---|
56 | // If a gamepad is supported, should update the state of the primary button accordingly.
|
---|
57 | undefined startSelection();
|
---|
58 |
|
---|
59 | // End selection for the current frame with the primary input
|
---|
60 | // If a gamepad is supported, should update the state of the primary button accordingly.
|
---|
61 | undefined endSelection();
|
---|
62 |
|
---|
63 | // Simulates a start/endSelection for the current frame with the primary input
|
---|
64 | // If a gamepad is supported, should update the state of the primary button accordingly.
|
---|
65 | undefined simulateSelect();
|
---|
66 |
|
---|
67 | // Updates the set of supported buttons, including any initial state.
|
---|
68 | // Note that this method should not be generally used to update the state of the
|
---|
69 | // buttons, as the UA may treat this as re-creating the Gamepad.
|
---|
70 | // Note that if any FakeXRButtonType is repeated the behavior is undefined.
|
---|
71 | undefined setSupportedButtons(sequence<FakeXRButtonStateInit> supportedButtons);
|
---|
72 |
|
---|
73 | // Used to update the state of a button currently supported by the input source
|
---|
74 | // Will not add support for that button if it is not currently supported.
|
---|
75 | undefined updateButtonState(FakeXRButtonStateInit buttonState);
|
---|
76 |
|
---|
77 | [Conditional=WEBXR_HANDS] undefined updateHandJoints(sequence<FakeXRJointStateInit> handJoints);
|
---|
78 | };
|
---|