Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81adbca5 authored by Albert Chaulk's avatar Albert Chaulk
Browse files

vrwm: Also recenter the controller when should_recenter_ is set

Bug: 36201389
Test: Manual, recenter controller with vrwm up
Change-Id: I776ac51578d692832baac5aad50993b5ed1b8eea
parent c428826f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -206,8 +206,9 @@ void Application::DrawFrame() {
    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 @@ void Application::DrawFrame() {
    OnEndFrame();

    dvrPresent(graphics_context_);
    should_recenter_ = false;
  }
}

+3 −0
Original line number Diff line number Diff line
@@ -80,6 +80,9 @@ class Application {
  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;
+0 −1
Original line number Diff line number Diff line
@@ -327,7 +327,6 @@ void ShellView::DrawEye(EyeType eye, const mat4& perspective,
    // 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_) {
+0 −3
Original line number Diff line number Diff line
@@ -84,9 +84,6 @@ class ShellView : public Application,
  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_;