Chromium Code Reviews| 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_ |