Commit 8985a8ce authored by Piotr Bialecki's avatar Piotr Bialecki Committed by Commit Bot

WebXR hit test implementation - CL followup

Change-Id: Ifea3556a96b99f27a13c6ba0b3785d4ddefe28a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1937351
Commit-Queue: Klaus Weidner <klausw@chromium.org>
Auto-Submit: Piotr Bialecki <bialpio@chromium.org>
Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719386}
parent 908d29ec
...@@ -47,7 +47,7 @@ constexpr std::array<float, 6> kDisplayCoordinatesForTransform = { ...@@ -47,7 +47,7 @@ constexpr std::array<float, 6> kDisplayCoordinatesForTransform = {
constexpr uint32_t kInputSourceId = 1; constexpr uint32_t kInputSourceId = 1;
const char* kInputSourceProfileName = "generic-touchscreen"; const char kInputSourceProfileName[] = "generic-touchscreen";
gfx::Transform ConvertUvsToTransformMatrix(const std::vector<float>& uvs) { gfx::Transform ConvertUvsToTransformMatrix(const std::vector<float>& uvs) {
// We're creating a matrix that transforms viewport UV coordinates (for a // We're creating a matrix that transforms viewport UV coordinates (for a
......
...@@ -112,7 +112,7 @@ base::Optional<gfx::Transform> GetMojoFromInputSource( ...@@ -112,7 +112,7 @@ base::Optional<gfx::Transform> GetMojoFromInputSource(
return base::nullopt; return base::nullopt;
} }
auto viewer_from_pointer = gfx::Transform viewer_from_pointer =
*input_source_state->description->input_from_pointer; *input_source_state->description->input_from_pointer;
return mojo_from_viewer * viewer_from_pointer; return mojo_from_viewer * viewer_from_pointer;
...@@ -721,7 +721,7 @@ ArCoreImpl::GetHitTestSubscriptionResults( ...@@ -721,7 +721,7 @@ ArCoreImpl::GetHitTestSubscriptionResults(
*maybe_mojo_from_native_origin)); *maybe_mojo_from_native_origin));
} }
for (auto& subscribtion_id_and_data : for (const auto& subscribtion_id_and_data :
hit_test_subscription_id_to_transient_hit_test_data_) { hit_test_subscription_id_to_transient_hit_test_data_) {
auto input_source_ids_and_transforms = auto input_source_ids_and_transforms =
GetMojoFromInputSources(subscribtion_id_and_data.second.profile_name, GetMojoFromInputSources(subscribtion_id_and_data.second.profile_name,
...@@ -810,9 +810,7 @@ ArCoreImpl::GetMojoFromInputSources( ...@@ -810,9 +810,7 @@ ArCoreImpl::GetMojoFromInputSources(
for (const auto& input_state : *maybe_input_state) { for (const auto& input_state : *maybe_input_state) {
if (input_state && input_state->description) { if (input_state && input_state->description) {
if (std::count(input_state->description->profiles.begin(), if (base::Contains(input_state->description->profiles, profile_name)) {
input_state->description->profiles.end(),
profile_name) > 0) {
// Input source represented by input_state matches the profile, find // Input source represented by input_state matches the profile, find
// the transform and grab input source id. // the transform and grab input source id.
base::Optional<gfx::Transform> maybe_mojo_from_input_source = base::Optional<gfx::Transform> maybe_mojo_from_input_source =
...@@ -1021,7 +1019,7 @@ bool ArCoreImpl::RequestHitTest( ...@@ -1021,7 +1019,7 @@ bool ArCoreImpl::RequestHitTest(
&ar_trackable_type); &ar_trackable_type);
// Only consider trackables listed in arcore_entity_types. // Only consider trackables listed in arcore_entity_types.
if (arcore_entity_types.count(ar_trackable_type) == 0) { if (!base::Contains(arcore_entity_types, ar_trackable_type)) {
DVLOG(2) DVLOG(2)
<< __func__ << __func__
<< ": hit a trackable that is not in entity types set, ignoring it"; << ": hit a trackable that is not in entity types set, ignoring it";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment