Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3945)

Unified Diff: chrome/browser/android/vr_shell/elbow_model.cc

Issue 2848283003: VR: Refresh controller handedness when resuming the controller. (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/elbow_model.h ('k') | chrome/browser/android/vr_shell/vr_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/elbow_model.cc
diff --git a/chrome/browser/android/vr_shell/elbow_model.cc b/chrome/browser/android/vr_shell/elbow_model.cc
index f2cd825af75f56f90515bedbbf356bf0e49d46ee..723c3454f71682e49f8dca8bee04d08acd08a526 100644
--- a/chrome/browser/android/vr_shell/elbow_model.cc
+++ b/chrome/browser/android/vr_shell/elbow_model.cc
@@ -32,10 +32,19 @@ constexpr float kDefaultElbowRotationRatio = 0.4f;
} // namespace
ElbowModel::ElbowModel(gvr::ControllerHandedness handedness)
- : handedness_(handedness), alpha_value_(1.0f), torso_direction_(kForward) {}
+ : handedness_(handedness), alpha_value_(1.0f), torso_direction_(kForward) {
+ UpdateHandedness();
+}
ElbowModel::~ElbowModel() = default;
+void ElbowModel::SetHandedness(gvr::ControllerHandedness handedness) {
+ if (handedness == handedness_)
+ return;
+ handedness_ = handedness;
+ UpdateHandedness();
+}
+
void ElbowModel::UpdateHandedness() {
handed_multiplier_ = {
handedness_ == GVR_CONTROLLER_RIGHT_HANDED ? 1.0f : -1.0f, 1.0f, 1.0f};
@@ -45,7 +54,6 @@ void ElbowModel::UpdateHandedness() {
}
void ElbowModel::Update(const UpdateData& update) {
- UpdateHandedness();
UpdateTorsoDirection(update);
ApplyArmModel(update);
UpdateTransparency(update);
« no previous file with comments | « chrome/browser/android/vr_shell/elbow_model.h ('k') | chrome/browser/android/vr_shell/vr_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698