diff --git a/dom/vr/XRNativeOriginViewer.cpp b/dom/vr/XRNativeOriginViewer.cpp index d3aec73a918d0..3eb59dfe9ec1e 100644 --- a/dom/vr/XRNativeOriginViewer.cpp +++ b/dom/vr/XRNativeOriginViewer.cpp @@ -21,5 +21,12 @@ gfx::PointDouble3D XRNativeOriginViewer::GetPosition() { sensorState.pose.position[2]); } +gfx::QuaternionDouble XRNativeOriginViewer::GetOrientation() { + const gfx::VRHMDSensorState& sensorState = mDisplay->GetSensorState(); + return gfx::QuaternionDouble( + sensorState.pose.orientation[0], sensorState.pose.orientation[1], + sensorState.pose.orientation[2], sensorState.pose.orientation[3]); +} + } // namespace dom } // namespace mozilla diff --git a/dom/vr/XRNativeOriginViewer.h b/dom/vr/XRNativeOriginViewer.h index 32c87d517440f..adaa7366bc9b0 100644 --- a/dom/vr/XRNativeOriginViewer.h +++ b/dom/vr/XRNativeOriginViewer.h @@ -21,6 +21,7 @@ class XRNativeOriginViewer : public XRNativeOrigin { explicit XRNativeOriginViewer(gfx::VRDisplayClient* aDisplay); gfx::PointDouble3D GetPosition() override; + gfx::QuaternionDouble GetOrientation() override; private: ~XRNativeOriginViewer() = default;