Beispiel #1
0
 /// <summary>
 /// Initializes this instance.
 /// </summary>
 public void initialize()
 {
     ETDevice = new EyeTrackingController();
     m_CalibrationCallback     = new CalibrationCallback(CalibrationCallbackFunction);
     m_SampleCallback          = new GetSampleCallback(GetSampleCallbackFunction);
     m_EventCallback           = new GetEventCallback(GetEventCallbackFunction);
     m_EyeImageCallback        = new GetEyeImageCallback(GetEyeImageCallbackFunction);
     m_SceneVideoCallback      = new GetSceneVideoCallback(GetSceneVideoCallbackFunction);
     m_TrackingMonitorCallback = new GetTrackingMonitorCallback(GetTrackingMonitorCallbackFunction);
 }
Beispiel #2
0
        public bool Initialize()
        {
            try
            {
                _screenRect = Screen.PrimaryScreen.Bounds;
                _eyeTracker = new EyeTrackingController();
                int ret = _eyeTracker.iV_Connect();
                if (ret != (int)SMIEyeTrackingController.EyeTrackingController.RetCode.Success)
                {
                    return(false);
                }

                _eyeTrackerReadThread = new Thread(new ThreadStart(GazeDataThreadProc));
                _eyeTrackerReadThread.Start();
            }
            catch (Exception ex)
            {
                _trace.TraceInformation(ex.Message);
                return(false);
            }
            return(true);
        }
		private void GetSampleCallbackFunction(EyeTrackingController.EyeTrackingController.SampleStruct sampleData)
		{
            // TODO rgtaylor 2015-04-22 Invert the y since SMI *appears* to define 0,0 at
            // the top left of the screen. Need to confirm.
			OnGazeChanged(new GazeEventArgs() 
            { 
				LeftX = (float)sampleData.leftEye.gazeX,
				LeftY = UnityEngine.Screen.height - (float)sampleData.leftEye.gazeY,
				LeftPupilDiameter = (float)sampleData.leftEye.diam,
				RightX = (float)sampleData.rightEye.gazeX,
                RightY = UnityEngine.Screen.height - (float)sampleData.rightEye.gazeY,
				RightPupilDiameter = (float)sampleData.rightEye.diam
			});			
		}
		private void CalibrationCallbackFunction(EyeTrackingController.EyeTrackingController.CalibrationPointStruct calibrationPoint)
		{
			DebugLog.Info("SMI Eye Tracker: CalibrationCallback - Number = {0} Position = ({1}, {2})", calibrationPoint.number, calibrationPoint.positionX, calibrationPoint.positionY);
		}