@@ -33,29 +33,27 @@ namespace Unity
3333 public class VREye : MonoBehaviour
3434 {
3535 #region Private Variables
36- private DisplayController _displayController ;
3736 private VRSurface _surface ; //the surface associated with this eye
38- private int _eyeIndex ;
39- private bool updated = false ; //whether the headpose has been updated this frame
40- private bool updateEarly = false ; //if false, update in LateUpdate
37+ private VRViewer viewer ; //the viewer associated with this eye
38+ private uint _eyeIndex ;
4139
4240 #endregion
4341 #region Public Variables
44- public int EyeIndex
42+ public uint EyeIndex
4543 {
4644 get { return _eyeIndex ; }
4745 set { _eyeIndex = value ; }
4846 }
49- public DisplayController DisplayController
50- {
51- get { return _displayController ; }
52- set { _displayController = value ; }
53- }
5447 public VRSurface Surface
5548 {
5649 get { return _surface ; }
5750 set { _surface = value ; }
5851 }
52+ public VRViewer Viewer
53+ {
54+ get { return viewer ; }
55+ set { viewer = value ; }
56+ }
5957 [ HideInInspector ]
6058 public Transform cachedTransform ;
6159 #endregion
@@ -78,39 +76,13 @@ void Init()
7876 }
7977 #endregion
8078
81- #region Loop
82- // Update is called once per frame.
83- void Update ( )
84- {
85- updated = false ; // OK to recompute head pose.
86- if ( updateEarly )
87- {
88- UpdateEyePose ( ) ;
89- }
90- }
91- // LateUpdate is called once per frame, after Update has finished.
92- void LateUpdate ( )
93- {
94- UpdateEyePose ( ) ;
95- }
96- //Updates the position and rotation of the head
97- private void UpdateEyePose ( )
98- {
99- if ( updated )
100- { // Only one update per frame.
101- return ;
102- }
103- updated = true ;
104-
105- _displayController . UpdateClient ( ) ;
106-
107- OSVR . ClientKit . Pose3 eyePose = _displayController . DisplayConfig . GetViewerEyePose ( DisplayController . DEFAULT_VIEWER , ( byte ) _eyeIndex ) ;
79+ // Updates the position and rotation of the eye
80+ // Optionally, update the viewer associated with this eye
81+ public void UpdateEyePose ( OSVR . ClientKit . Pose3 eyePose )
82+ {
10883 cachedTransform . localPosition = Math . ConvertPosition ( eyePose . translation ) ;
10984 cachedTransform . localRotation = Math . ConvertOrientation ( eyePose . rotation ) ;
11085 }
111- #endregion
112-
113-
11486 }
11587 }
11688}
0 commit comments