mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
webxr: Update hand input to match latest spec (#32958)
* Update IDLs Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update XRHand and XRJointSpace methods/bindings Signed-off-by: Daniel Adams <msub2official@gmail.com> * Implement fillJointRadii Signed-off-by: Daniel Adams <msub2official@gmail.com> * Implement fillPoses Signed-off-by: Daniel Adams <msub2official@gmail.com> * Formatting Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update test expectations Signed-off-by: Daniel Adams <msub2official@gmail.com> * Tidy, missing spec link Signed-off-by: Daniel Adams <msub2official@gmail.com> * Remove idlharness expectation files, update hands pref Signed-off-by: Daniel Adams <msub2official@gmail.com> * Update interfaces Signed-off-by: Daniel Adams <msub2official@gmail.com> * XRJointPose interface Signed-off-by: Daniel Adams <msub2official@gmail.com> * XRHand interface Signed-off-by: Daniel Adams <msub2official@gmail.com> --------- Signed-off-by: Daniel Adams <msub2official@gmail.com>
This commit is contained in:
parent
057873c94a
commit
825d6f10e9
12 changed files with 314 additions and 553 deletions
|
@ -6,6 +6,8 @@ use dom_struct::dom_struct;
|
|||
use euclid::RigidTransform3D;
|
||||
use webxr_api::{BaseSpace, Frame, InputId, Joint, JointFrame, Space};
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::XRHandBinding::XRHandJoint;
|
||||
use crate::dom::bindings::codegen::Bindings::XRJointSpaceBinding::XRJointSpaceMethods;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
|
@ -21,14 +23,21 @@ pub struct XRJointSpace {
|
|||
#[ignore_malloc_size_of = "defined in rust-webxr"]
|
||||
#[no_trace]
|
||||
joint: Joint,
|
||||
hand_joint: XRHandJoint,
|
||||
}
|
||||
|
||||
impl XRJointSpace {
|
||||
pub fn new_inherited(session: &XRSession, input: InputId, joint: Joint) -> XRJointSpace {
|
||||
pub fn new_inherited(
|
||||
session: &XRSession,
|
||||
input: InputId,
|
||||
joint: Joint,
|
||||
hand_joint: XRHandJoint,
|
||||
) -> XRJointSpace {
|
||||
XRJointSpace {
|
||||
xrspace: XRSpace::new_inherited(session),
|
||||
input,
|
||||
joint,
|
||||
hand_joint,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,8 +47,12 @@ impl XRJointSpace {
|
|||
session: &XRSession,
|
||||
input: InputId,
|
||||
joint: Joint,
|
||||
hand_joint: XRHandJoint,
|
||||
) -> DomRoot<XRJointSpace> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited(session, input, joint)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(Self::new_inherited(session, input, joint, hand_joint)),
|
||||
global,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn space(&self) -> Space {
|
||||
|
@ -61,3 +74,10 @@ impl XRJointSpace {
|
|||
self.frame(frame).map(|f| f.pose).map(|t| t.cast_unit())
|
||||
}
|
||||
}
|
||||
|
||||
impl XRJointSpaceMethods for XRJointSpace {
|
||||
/// <https://www.w3.org/TR/webxr-hand-input-1/#xrjointspace-jointname>
|
||||
fn JointName(&self) -> XRHandJoint {
|
||||
self.hand_joint
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue