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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
use super::*;
/// The XRFrame class.
/// [`XRFrame`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct XRFrame {
inner: Any,
}
impl FromVal for XRFrame {
fn from_val(v: &Any) -> Self {
XRFrame {
inner: Any::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for XRFrame {
type Target = Any;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for XRFrame {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for XRFrame {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for XRFrame {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<XRFrame> for Any {
fn from(s: XRFrame) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&XRFrame> for Any {
fn from(s: &XRFrame) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(XRFrame);
impl XRFrame {
/// Getter of the `session` attribute.
/// [`XRFrame.session`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/session)
pub fn session(&self) -> XRSession {
self.inner.get("session").as_::<XRSession>()
}
}
impl XRFrame {
/// Getter of the `predictedDisplayTime` attribute.
/// [`XRFrame.predictedDisplayTime`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/predictedDisplayTime)
pub fn predicted_display_time(&self) -> Any {
self.inner.get("predictedDisplayTime").as_::<Any>()
}
}
impl XRFrame {
/// Getter of the `trackedAnchors` attribute.
/// [`XRFrame.trackedAnchors`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/trackedAnchors)
pub fn tracked_anchors(&self) -> XRAnchorSet {
self.inner.get("trackedAnchors").as_::<XRAnchorSet>()
}
}
impl XRFrame {
/// Getter of the `detectedMeshes` attribute.
/// [`XRFrame.detectedMeshes`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/detectedMeshes)
pub fn detected_meshes(&self) -> XRMeshSet {
self.inner.get("detectedMeshes").as_::<XRMeshSet>()
}
}
impl XRFrame {
/// Getter of the `detectedPlanes` attribute.
/// [`XRFrame.detectedPlanes`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/detectedPlanes)
pub fn detected_planes(&self) -> XRPlaneSet {
self.inner.get("detectedPlanes").as_::<XRPlaneSet>()
}
}
impl XRFrame {
/// The getViewerPose method.
/// [`XRFrame.getViewerPose`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/getViewerPose)
pub fn get_viewer_pose(&self, reference_space: &XRReferenceSpace) -> XRViewerPose {
self.inner
.call("getViewerPose", &[reference_space.into()])
.as_::<XRViewerPose>()
}
}
impl XRFrame {
/// The getPose method.
/// [`XRFrame.getPose`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/getPose)
pub fn get_pose(&self, space: &XRSpace, base_space: &XRSpace) -> XRPose {
self.inner
.call("getPose", &[space.into(), base_space.into()])
.as_::<XRPose>()
}
}
impl XRFrame {
/// The createAnchor method.
/// [`XRFrame.createAnchor`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/createAnchor)
pub fn create_anchor(&self, pose: &XRRigidTransform, space: &XRSpace) -> Promise<XRAnchor> {
self.inner
.call("createAnchor", &[pose.into(), space.into()])
.as_::<Promise<XRAnchor>>()
}
}
impl XRFrame {
/// The getDepthInformation method.
/// [`XRFrame.getDepthInformation`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/getDepthInformation)
pub fn get_depth_information(&self, view: &XRView) -> XRCPUDepthInformation {
self.inner
.call("getDepthInformation", &[view.into()])
.as_::<XRCPUDepthInformation>()
}
}
impl XRFrame {
/// The getJointPose method.
/// [`XRFrame.getJointPose`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/getJointPose)
pub fn get_joint_pose(&self, joint: &XRJointSpace, base_space: &XRSpace) -> XRJointPose {
self.inner
.call("getJointPose", &[joint.into(), base_space.into()])
.as_::<XRJointPose>()
}
}
impl XRFrame {
/// The fillJointRadii method.
/// [`XRFrame.fillJointRadii`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillJointRadii)
pub fn fill_joint_radii(
&self,
joint_spaces: &TypedArray<XRJointSpace>,
radii: &Float32Array,
) -> bool {
self.inner
.call("fillJointRadii", &[joint_spaces.into(), radii.into()])
.as_::<bool>()
}
}
impl XRFrame {
/// The fillPoses method.
/// [`XRFrame.fillPoses`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/fillPoses)
pub fn fill_poses(
&self,
spaces: &TypedArray<XRSpace>,
base_space: &XRSpace,
transforms: &Float32Array,
) -> bool {
self.inner
.call(
"fillPoses",
&[spaces.into(), base_space.into(), transforms.into()],
)
.as_::<bool>()
}
}
impl XRFrame {
/// The getHitTestResults method.
/// [`XRFrame.getHitTestResults`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/getHitTestResults)
pub fn get_hit_test_results(
&self,
hit_test_source: &XRHitTestSource,
) -> TypedArray<XRHitTestResult> {
self.inner
.call("getHitTestResults", &[hit_test_source.into()])
.as_::<TypedArray<XRHitTestResult>>()
}
}
impl XRFrame {
/// The getHitTestResultsForTransientInput method.
/// [`XRFrame.getHitTestResultsForTransientInput`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/getHitTestResultsForTransientInput)
pub fn get_hit_test_results_for_transient_input(
&self,
hit_test_source: &XRTransientInputHitTestSource,
) -> TypedArray<XRTransientInputHitTestResult> {
self.inner
.call(
"getHitTestResultsForTransientInput",
&[hit_test_source.into()],
)
.as_::<TypedArray<XRTransientInputHitTestResult>>()
}
}
impl XRFrame {
/// The getLightEstimate method.
/// [`XRFrame.getLightEstimate`](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame/getLightEstimate)
pub fn get_light_estimate(&self, light_probe: &XRLightProbe) -> XRLightEstimate {
self.inner
.call("getLightEstimate", &[light_probe.into()])
.as_::<XRLightEstimate>()
}
}