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

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

Issue 2848283003: VR: Refresh controller handedness when resuming the controller. (Closed)
Patch Set: 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 f71ece01a3eaa3a2a2ab7f61fe625a0307d112cf..74aa9ec9498aaf40d493c6b0d38b9c2be12021fb 100644
--- a/chrome/browser/android/vr_shell/elbow_model.cc
+++ b/chrome/browser/android/vr_shell/elbow_model.cc
@@ -32,13 +32,16 @@ constexpr float kDefaultElbowRotationRatio = 0.4f;
} // namespace
ElbowModel::ElbowModel(gvr::ControllerHandedness handedness)
- : handedness_(handedness),
- alpha_value_(1.0f),
- torso_direction_{0.0f, 0.0f, 0.0f} {}
+ : alpha_value_(1.0f), torso_direction_{0.0f, 0.0f, 0.0f} {
+ UpdateHandedness(handedness);
+}
ElbowModel::~ElbowModel() = default;
-void ElbowModel::UpdateHandedness() {
+void ElbowModel::UpdateHandedness(gvr::ControllerHandedness handedness) {
+ if (handedness == handedness_)
acondor_ 2017/05/02 14:18:34 We might need an invalid default handedness value
mthiesse 2017/05/02 15:23:37 Done.
+ return;
+ handedness_ = handedness;
handed_multiplier_ = {
handedness_ == GVR_CONTROLLER_RIGHT_HANDED ? 1.0f : -1.0f, 1.0f, 1.0f};
shoulder_rotation_ = kNoRotation;
@@ -47,7 +50,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