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 "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h" | |
12 | |
13 namespace vr_shell { | |
14 | |
15 class ElbowModel { | |
16 public: | |
17 struct UpdateData { | |
18 bool connected; | |
19 gvr::Quatf orientation; | |
20 gvr::Vec3f gyro; | |
21 gvr::Vec3f head_direction; | |
22 float delta_time_seconds; | |
23 }; | |
24 | |
25 explicit ElbowModel( | |
26 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.
| |
27 ~ElbowModel(); | |
28 | |
29 const gvr::Vec3f& GetControllerPosition() const { return wrist_position_; } | |
30 const gvr::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_controller_handedness handedness_; | |
42 | |
43 gvr::Vec3f wrist_position_; | |
44 gvr::Quatf wrist_rotation_; | |
45 float alpha_value_; | |
46 | |
47 gvr::Vec3f elbow_position_; | |
48 gvr::Quatf elbow_rotation_; | |
49 gvr::Vec3f shoulder_position_; | |
50 gvr::Quatf shoulder_rotation_; | |
51 gvr::Vec3f torso_direction_; | |
52 gvr::Vec3f handed_multiplier_; | |
53 }; | |
54 | |
55 } // namespace vr_shell | |
56 | |
57 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_ELBOW_MODEL_H_ | |
OLD | NEW |