mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Add XRHitTestResult::getPose
This commit is contained in:
parent
c7b91523d0
commit
87bce8cde9
4 changed files with 31 additions and 9 deletions
|
@ -2,10 +2,13 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::codegen::Bindings::XRHitTestResultBinding::XRHitTestResultMethods;
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::xrframe::XRFrame;
|
||||
use crate::dom::xrpose::XRPose;
|
||||
use crate::dom::xrspace::XRSpace;
|
||||
use dom_struct::dom_struct;
|
||||
use webxr_api::HitTestResult;
|
||||
|
||||
|
@ -37,3 +40,12 @@ impl XRHitTestResult {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl XRHitTestResultMethods for XRHitTestResult {
|
||||
// https://immersive-web.github.io/hit-test/#dom-xrhittestresult-getpose
|
||||
fn GetPose(&self, base: &XRSpace) -> Option<DomRoot<XRPose>> {
|
||||
let base = self.frame.get_pose(base)?;
|
||||
let pose = base.inverse().pre_transform(&self.result.space);
|
||||
Some(XRPose::new(&self.global(), pose.cast_unit()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue