webxr: Update XRPose interface to latest spec (#33146)

* Update XRPose interface with missing members

Signed-off-by: Daniel Adams <msub2official@gmail.com>

* ./mach fmt

Signed-off-by: Daniel Adams <msub2official@gmail.com>

---------

Signed-off-by: Daniel Adams <msub2official@gmail.com>
This commit is contained in:
Daniel Adams 2024-08-21 00:41:04 -10:00 committed by GitHub
parent 8e224cb4d3
commit fb22dfb373
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 20 deletions

View file

@ -6,6 +6,9 @@
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
interface XRPose {
readonly attribute XRRigidTransform transform;
// readonly attribute boolean emulatedPosition;
[SameObject] readonly attribute XRRigidTransform transform;
[SameObject] readonly attribute DOMPointReadOnly? linearVelocity;
[SameObject] readonly attribute DOMPointReadOnly? angularVelocity;
readonly attribute boolean emulatedPosition;
};

View file

@ -7,6 +7,7 @@ use dom_struct::dom_struct;
use crate::dom::bindings::codegen::Bindings::XRPoseBinding::XRPoseMethods;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::dompointreadonly::DOMPointReadOnly;
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrrigidtransform::XRRigidTransform;
use crate::dom::xrsession::ApiRigidTransform;
@ -37,4 +38,23 @@ impl XRPoseMethods for XRPose {
fn Transform(&self) -> DomRoot<XRRigidTransform> {
DomRoot::from_ref(&self.transform)
}
/// <https://www.w3.org/TR/webxr/#dom-xrpose-linearvelocity>
fn GetLinearVelocity(&self) -> Option<DomRoot<DOMPointReadOnly>> {
// TODO: Expose from webxr crate
None
}
/// <https://www.w3.org/TR/webxr/#dom-xrpose-angularvelocity>
fn GetAngularVelocity(&self) -> Option<DomRoot<DOMPointReadOnly>> {
// TODO: Expose from webxr crate
None
}
/// <https://www.w3.org/TR/webxr/#dom-xrpose-emulatedposition>
fn EmulatedPosition(&self) -> bool {
// There are currently no instances in which we would need to rely
// on emulation for reporting pose, so return false.
false
}
}