diff options
Diffstat (limited to 'components/script/dom/xrframe.rs')
-rw-r--r-- | components/script/dom/xrframe.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/xrframe.rs b/components/script/dom/xrframe.rs index 2381d4864d9..914d96333b5 100644 --- a/components/script/dom/xrframe.rs +++ b/components/script/dom/xrframe.rs @@ -20,6 +20,8 @@ use crate::dom::xrviewerpose::XRViewerPose; use dom_struct::dom_struct; use std::cell::Cell; use webxr_api::Frame; +use webxr_api::LayerId; +use webxr_api::SubImages; #[dom_struct] pub struct XRFrame { @@ -59,6 +61,14 @@ impl XRFrame { pub fn get_pose(&self, space: &XRSpace) -> Option<ApiPose> { space.get_pose(&self.data) } + + pub fn get_sub_images(&self, layer_id: LayerId) -> Option<&SubImages> { + self.data + .sub_images + .iter() + .filter(|sub_images| sub_images.layer_id == layer_id) + .next() + } } impl XRFrameMethods for XRFrame { |