Merge "vrwm: Also recenter the controller when should_recenter_ is set" into oc-dev am: 674436272e
am: 877371de15
Change-Id: I559a2fe643a03be0345a1586a8b9629436b552d4
diff --git a/services/vr/vr_window_manager/application.cpp b/services/vr/vr_window_manager/application.cpp
index b2f02e5..8b4460a 100644
--- a/services/vr/vr_window_manager/application.cpp
+++ b/services/vr/vr_window_manager/application.cpp
@@ -206,8 +206,9 @@
if (fade_value_ > 1.0f)
fade_value_ = 1.0f;
- controller_position_ = elbow_model_.Update(delta, last_pose_.GetRotation(),
- controller_orientation_, false);
+ controller_position_ =
+ elbow_model_.Update(delta, last_pose_.GetRotation(),
+ controller_orientation_, should_recenter_);
dvrBeginRenderFrameEds(graphics_context_, pose.orientation,
pose.translation);
@@ -233,6 +234,7 @@
OnEndFrame();
dvrPresent(graphics_context_);
+ should_recenter_ = false;
}
}
diff --git a/services/vr/vr_window_manager/application.h b/services/vr/vr_window_manager/application.h
index 4b36ecc..ed99157 100644
--- a/services/vr/vr_window_manager/application.h
+++ b/services/vr/vr_window_manager/application.h
@@ -80,6 +80,9 @@
bool shmem_controller_active_ = false;
uint64_t shmem_controller_buttons_;
+ // Used to center the scene when the shell becomes visible.
+ bool should_recenter_ = true;
+
bool is_visible_ = false;
std::chrono::time_point<std::chrono::system_clock> visibility_button_press_;
bool debug_mode_ = false;
diff --git a/services/vr/vr_window_manager/shell_view.cpp b/services/vr/vr_window_manager/shell_view.cpp
index 850f604..2b53cd6 100644
--- a/services/vr/vr_window_manager/shell_view.cpp
+++ b/services/vr/vr_window_manager/shell_view.cpp
@@ -327,7 +327,6 @@
// Position the quad horizontally aligned in the direction the user
// is facing, effectively taking out head roll.
displays_[0]->Recenter(GetHorizontallyAlignedMatrixFromPose(last_pose_));
- should_recenter_ = false;
}
for (auto& display : displays_) {
diff --git a/services/vr/vr_window_manager/shell_view.h b/services/vr/vr_window_manager/shell_view.h
index be2ae58..d90e833 100644
--- a/services/vr/vr_window_manager/shell_view.h
+++ b/services/vr/vr_window_manager/shell_view.h
@@ -84,9 +84,6 @@
bool is_touching_ = false;
int touchpad_buttons_ = 0;
- // Used to center the scene when the shell becomes visible.
- bool should_recenter_ = true;
-
std::mutex display_frame_mutex_;
std::vector<std::unique_ptr<DisplayView>> displays_;