/// <summary> /// Tests eye gaze data when enable eye callback function. /// </summary> /// <param name="validity">A type of eye gaze data to test with.</param> /// <param name="gazeIndex">The index of a source of eye gaze data.</param> /// <param name="eye_data">ViveSR.anipal.Eye.EyeData. </param> /// <returns>Indicates whether a source of eye gaze data is found.</returns> public static bool TryGaze(SingleEyeDataValidity validity, out GazeIndex gazeIndex, EyeData eye_data) { bool[] valid = new bool[(int)GazeIndex.COMBINE + 1] { eye_data.verbose_data.left.GetValidity(validity), eye_data.verbose_data.right.GetValidity(validity), eye_data.verbose_data.combined.eye_data.GetValidity(validity) }; gazeIndex = GazeIndex.COMBINE; for (int i = (int)GazeIndex.COMBINE; i >= 0; --i) { if (valid[i]) { gazeIndex = (GazeIndex)i; return(true); } } return(false); }
public bool GetValidity(SingleEyeDataValidity validity) { return((eye_data_validata_bit_mask & (ulong)(1 << (int)validity)) > 0); }
/// <summary> /// Tests eye gaze data. /// </summary> /// <param name="validity">A type of eye gaze data to test with.</param> /// <param name="gazeIndex">The index of a source of eye gaze data.</param> /// <returns>Indicates whether a source of eye gaze data is found.</returns> public static bool TryGaze(SingleEyeDataValidity validity, out GazeIndex gazeIndex) { UpdateData(); return(TryGaze(validity, out gazeIndex, EyeData_)); }