mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add XRSession::requestHitTestSource()
This commit is contained in:
parent
f1d6a89150
commit
1b07b77323
9 changed files with 131 additions and 22 deletions
|
@ -11,7 +11,8 @@ use crate::dom::xrinputsource::XRInputSource;
|
|||
use crate::dom::xrreferencespace::XRReferenceSpace;
|
||||
use crate::dom::xrsession::{cast_transform, ApiPose, XRSession};
|
||||
use dom_struct::dom_struct;
|
||||
use webxr_api::Frame;
|
||||
use euclid::RigidTransform3D;
|
||||
use webxr_api::{BaseSpace, Frame, Space};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct XRSpace {
|
||||
|
@ -56,6 +57,24 @@ impl XRSpace {
|
|||
global,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn space(&self) -> Space {
|
||||
if let Some(rs) = self.downcast::<XRReferenceSpace>() {
|
||||
rs.space()
|
||||
} else if let Some(source) = self.input_source.get() {
|
||||
let base = if self.is_grip_space {
|
||||
BaseSpace::Grip(source.id())
|
||||
} else {
|
||||
BaseSpace::TargetRay(source.id())
|
||||
};
|
||||
Space {
|
||||
base,
|
||||
offset: RigidTransform3D::identity(),
|
||||
}
|
||||
} else {
|
||||
panic!("invalid space found")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl XRSpace {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue