OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Adapted from: |
| 6 // https://github.com/googlevr/gvr-unity-sdk/blob/master/Samples/DaydreamLabsCon
trollerPlayground/Assets/GoogleVR/Scripts/Controller/GvrArmModel.cs |
| 7 |
| 8 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_ELBOW_MODEL_H_ |
| 9 #define CHROME_BROWSER_ANDROID_VR_SHELL_ELBOW_MODEL_H_ |
| 10 |
| 11 #include "device/vr/vr_types.h" |
| 12 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
| 13 |
| 14 namespace vr_shell { |
| 15 |
| 16 class ElbowModel { |
| 17 public: |
| 18 struct UpdateData { |
| 19 bool connected; |
| 20 vr::Quatf orientation; |
| 21 gfx::Vector3dF gyro; |
| 22 gfx::Vector3dF head_direction; |
| 23 float delta_time_seconds; |
| 24 }; |
| 25 |
| 26 explicit ElbowModel(gvr::ControllerHandedness handedness); |
| 27 ~ElbowModel(); |
| 28 |
| 29 const gfx::Point3F& GetControllerPosition() const { return wrist_position_; } |
| 30 const vr::Quatf& GetControllerRotation() const { return wrist_rotation_; } |
| 31 float GetAlphaValue() const { return alpha_value_; } |
| 32 |
| 33 void Update(const UpdateData& update); |
| 34 |
| 35 private: |
| 36 void UpdateHandedness(); |
| 37 void UpdateTorsoDirection(const UpdateData& update); |
| 38 void ApplyArmModel(const UpdateData& update); |
| 39 void UpdateTransparency(const UpdateData& update); |
| 40 |
| 41 gvr::ControllerHandedness handedness_; |
| 42 |
| 43 gfx::Point3F wrist_position_; |
| 44 vr::Quatf wrist_rotation_; |
| 45 float alpha_value_; |
| 46 |
| 47 gfx::Point3F elbow_position_; |
| 48 vr::Quatf elbow_rotation_; |
| 49 gfx::Point3F shoulder_position_; |
| 50 vr::Quatf shoulder_rotation_; |
| 51 gfx::Vector3dF torso_direction_; |
| 52 gfx::Vector3dF handed_multiplier_; |
| 53 }; |
| 54 |
| 55 } // namespace vr_shell |
| 56 |
| 57 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_ELBOW_MODEL_H_ |
OLD | NEW |