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

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: nit 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/BUILD.gn ('k') | chrome/browser/android/vr_shell/elbow_model.cc » ('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.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..afb990ba46a1a1d9a376a310671167f3ee3cc9a9
--- /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 "device/vr/vr_types.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;
+ vr::Quatf orientation;
+ gfx::Vector3dF gyro;
+ gfx::Vector3dF head_direction;
+ float delta_time_seconds;
+ };
+
+ explicit ElbowModel(gvr::ControllerHandedness handedness);
+ ~ElbowModel();
+
+ const gfx::Point3F& GetControllerPosition() const { return wrist_position_; }
+ const vr::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::ControllerHandedness handedness_;
+
+ gfx::Point3F wrist_position_;
+ vr::Quatf wrist_rotation_;
+ float alpha_value_;
+
+ gfx::Point3F elbow_position_;
+ vr::Quatf elbow_rotation_;
+ gfx::Point3F shoulder_position_;
+ vr::Quatf shoulder_rotation_;
+ gfx::Vector3dF torso_direction_;
+ gfx::Vector3dF handed_multiplier_;
+};
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_ELBOW_MODEL_H_
« no previous file with comments | « chrome/browser/android/vr_shell/BUILD.gn ('k') | chrome/browser/android/vr_shell/elbow_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698