summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/xr/xr_frame.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/xr/xr_frame.cc')
-rw-r--r--chromium/third_party/blink/renderer/modules/xr/xr_frame.cc39
1 files changed, 19 insertions, 20 deletions
diff --git a/chromium/third_party/blink/renderer/modules/xr/xr_frame.cc b/chromium/third_party/blink/renderer/modules/xr/xr_frame.cc
index f4404b8a678..34e6219ead8 100644
--- a/chromium/third_party/blink/renderer/modules/xr/xr_frame.cc
+++ b/chromium/third_party/blink/renderer/modules/xr/xr_frame.cc
@@ -4,56 +4,55 @@
#include "third_party/blink/renderer/modules/xr/xr_frame.h"
-#include "third_party/blink/renderer/modules/xr/xr_coordinate_system.h"
-#include "third_party/blink/renderer/modules/xr/xr_device_pose.h"
#include "third_party/blink/renderer/modules/xr/xr_input_pose.h"
#include "third_party/blink/renderer/modules/xr/xr_input_source.h"
+#include "third_party/blink/renderer/modules/xr/xr_reference_space.h"
#include "third_party/blink/renderer/modules/xr/xr_session.h"
#include "third_party/blink/renderer/modules/xr/xr_view.h"
+#include "third_party/blink/renderer/modules/xr/xr_viewer_pose.h"
namespace blink {
XRFrame::XRFrame(XRSession* session) : session_(session) {}
-const HeapVector<Member<XRView>>& XRFrame::views() const {
- return session_->views();
-}
-
-XRDevicePose* XRFrame::getDevicePose(
- XRCoordinateSystem* coordinate_system) const {
+XRViewerPose* XRFrame::getViewerPose(XRReferenceSpace* reference_space) const {
session_->LogGetPose();
// If we don't have a valid base pose return null. Most common when tracking
// is lost.
- if (!base_pose_matrix_ || !coordinate_system) {
+ if (!base_pose_matrix_ || !reference_space) {
return nullptr;
}
// Must use a coordinate system created from the same session.
- if (coordinate_system->session() != session_) {
+ if (reference_space->session() != session_) {
return nullptr;
}
std::unique_ptr<TransformationMatrix> pose =
- coordinate_system->TransformBasePose(*base_pose_matrix_);
+ reference_space->TransformBasePose(*base_pose_matrix_);
if (!pose) {
return nullptr;
}
- return MakeGarbageCollected<XRDevicePose>(session(), std::move(pose));
+ // Can only update an XRViewerPose's views with an invertible matrix.
+ if (!pose->IsInvertible()) {
+ return nullptr;
+ }
+
+ return MakeGarbageCollected<XRViewerPose>(session(), std::move(pose));
}
-XRInputPose* XRFrame::getInputPose(
- XRInputSource* input_source,
- XRCoordinateSystem* coordinate_system) const {
- if (!input_source || !coordinate_system) {
+XRInputPose* XRFrame::getInputPose(XRInputSource* input_source,
+ XRReferenceSpace* reference_space) const {
+ if (!input_source || !reference_space) {
return nullptr;
}
// Must use an input source and coordinate system from the same session.
if (input_source->session() != session_ ||
- coordinate_system->session() != session_) {
+ reference_space->session() != session_) {
return nullptr;
}
@@ -68,7 +67,7 @@ XRInputPose* XRFrame::getInputPose(
// Multiply the head pose and pointer transform to get the final pointer.
std::unique_ptr<TransformationMatrix> pointer_pose =
- coordinate_system->TransformBasePose(*base_pose_matrix_);
+ reference_space->TransformBasePose(*base_pose_matrix_);
pointer_pose->Multiply(*(input_source->pointer_transform_matrix_));
return MakeGarbageCollected<XRInputPose>(std::move(pointer_pose),
@@ -84,7 +83,7 @@ XRInputPose* XRFrame::getInputPose(
// Just return the head pose as the pointer pose.
std::unique_ptr<TransformationMatrix> pointer_pose =
- coordinate_system->TransformBasePose(*base_pose_matrix_);
+ reference_space->TransformBasePose(*base_pose_matrix_);
return MakeGarbageCollected<XRInputPose>(
std::move(pointer_pose), nullptr, input_source->emulatedPosition());
@@ -96,7 +95,7 @@ XRInputPose* XRFrame::getInputPose(
}
std::unique_ptr<TransformationMatrix> grip_pose =
- coordinate_system->TransformBaseInputPose(
+ reference_space->TransformBaseInputPose(
*(input_source->base_pose_matrix_), *base_pose_matrix_);
if (!grip_pose) {