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

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

Issue 2795793002: Implementation of elbow model for the controller position and rotation. (Closed)
Patch Set: Created 3 years, 9 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
Index: chrome/browser/android/vr_shell/elbow_model.h
diff --git a/chrome/browser/android/vr_shell/elbow_model.h b/chrome/browser/android/vr_shell/elbow_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..fe4965189fa4883338bc4869963e19d098fb9618
--- /dev/null
+++ b/chrome/browser/android/vr_shell/elbow_model.h
@@ -0,0 +1,57 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Adapted from:
+// https://github.com/googlevr/gvr-unity-sdk/blob/master/Samples/DaydreamLabsControllerPlayground/Assets/GoogleVR/Scripts/Controller/GvrArmModel.cs
+
+#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_ELBOW_MODEL_H_
+#define CHROME_BROWSER_ANDROID_VR_SHELL_ELBOW_MODEL_H_
+
+#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
+
+namespace vr_shell {
+
+class ElbowModel {
+ public:
+ struct UpdateData {
+ bool connected;
+ gvr::Quatf orientation;
+ gvr::Vec3f gyro;
+ gvr::Vec3f head_direction;
+ float delta_time_seconds;
+ };
+
+ explicit ElbowModel(
+ gvr_controller_handedness handedness = GVR_CONTROLLER_RIGHT_HANDED);
cjgrant 2017/04/03 19:24:59 I think use of default arguments is generally disc
acondor_ 2017/04/19 18:44:27 Done.
+ ~ElbowModel();
+
+ const gvr::Vec3f& GetControllerPosition() const { return wrist_position_; }
+ const gvr::Quatf& GetControllerRotation() const { return wrist_rotation_; }
+ float GetAlphaValue() const { return alpha_value_; }
+
+ void Update(const UpdateData& update);
+
+ private:
+ void UpdateHandedness();
+ void UpdateTorsoDirection(const UpdateData& update);
+ void ApplyArmModel(const UpdateData& update);
+ void UpdateTransparency(const UpdateData& update);
+
+ gvr_controller_handedness handedness_;
+
+ gvr::Vec3f wrist_position_;
+ gvr::Quatf wrist_rotation_;
+ float alpha_value_;
+
+ gvr::Vec3f elbow_position_;
+ gvr::Quatf elbow_rotation_;
+ gvr::Vec3f shoulder_position_;
+ gvr::Quatf shoulder_rotation_;
+ gvr::Vec3f torso_direction_;
+ gvr::Vec3f handed_multiplier_;
+};
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_ELBOW_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698