Пример #1
0
    public void Update()
    {
        TobiiGameIntegrationApi.Update();
        {
            var gazePoints = TobiiGameIntegrationApi.GetGazePoints();
            if (gazePoints.Count > 0)
            {
                GazeX = (Math.Min(Math.Max(gazePoints.Last().X, -1.0f), 1.0f));
                GazeY = -(Math.Min(Math.Max(gazePoints.Last().Y, -1.0f), 1.0f));
            }

            var headPoses = TobiiGameIntegrationApi.GetHeadPoses();
            if (headPoses.Count > 0)
            {
                Yaw   = -headPoses.Last().Rotation.Yaw;
                Pitch = headPoses.Last().Rotation.Pitch;
                Roll  = headPoses.Last().Rotation.Roll;

                X = headPoses.Last().Position.X;
                Y = headPoses.Last().Position.Y;
                Z = headPoses.Last().Position.Z;

                TimeStampMicroSeconds = headPoses.Last().TimeStampMicroSeconds;
            }
        }

        _frame++;
        if (_frame > 60)
        {
            _frame      = 0;
            AspectRatio = GetDisplayAspectratio();
        }
    }
Пример #2
0
    protected override void UpdateAllChangedExtendedViewSettings()
    {
        if (!ExtendedViewSettingsForInspector.ShouldDeepEqual(GazeOnlySettings, _lastGazeOnlySettings))
        {
            TobiiGameIntegrationApi.UpdateExtendedViewGazeOnlySettings(GazeOnlySettings.ToExtendedViewSettings());
            _lastGazeOnlySettings = new ExtendedViewSettingsForInspector(GazeOnlySettings.ToExtendedViewSettings());
            if (GazeOnlySettingsUiEventsManager != null)
            {
                GazeOnlySettingsUiEventsManager.FillUiWithCurrentSettings();
            }
        }

        if (!ExtendedViewSettingsForInspector.ShouldDeepEqual(HeadOnlySettings, _lastHeadOnlySettings))
        {
            TobiiGameIntegrationApi.UpdateExtendedViewHeadOnlySettings(HeadOnlySettings.ToExtendedViewSettings());
            _lastHeadOnlySettings = new ExtendedViewSettingsForInspector(HeadOnlySettings.ToExtendedViewSettings());
            if (HeadOnlySettingsUiEventsManager != null)
            {
                HeadOnlySettingsUiEventsManager.FillUiWithCurrentSettings();
            }
        }

        if (!ExtendedViewSettingsForInspector.ShouldDeepEqual(HeadAndGazeSettings, _lastHeadAndGazeSettings))
        {
            TobiiGameIntegrationApi.UpdateExtendedViewSettings(HeadAndGazeSettings.ToExtendedViewSettings());
            _lastHeadAndGazeSettings = new ExtendedViewSettingsForInspector(HeadAndGazeSettings.ToExtendedViewSettings());
            if (HeadAndGazeSettingsUiEventsManager != null)
            {
                HeadAndGazeSettingsUiEventsManager.FillUiWithCurrentSettings();
            }
        }
    }
Пример #3
0
 private void TrackWindow()
 {
     if (_gameViewBoundsProvider.Hwnd != IntPtr.Zero)
     {
         TobiiGameIntegrationApi.TrackWindow(_gameViewBoundsProvider.Hwnd);
         IsInitialized = true;
     }
 }
Пример #4
0
        protected override void UpdateData()
        {
            var gazePoints = TobiiGameIntegrationApi.GetGazePoints();

            foreach (var gazePoint in gazePoints)
            {
                OnGazePoint(gazePoint);
            }
        }
Пример #5
0
        protected override void UpdateData()
        {
            var headPoses = TobiiGameIntegrationApi.GetHeadPoses();

            foreach (var headPose in headPoses)
            {
                OnHeadPose(headPose);
            }
        }
Пример #6
0
    public EyeTrackingHost()
    {
        _instance = this;

        Debug.Log("TobiiGameIntegrationApi.TrackWindow() before");
        TobiiGameIntegrationApi.TrackWindow(Process.GetCurrentProcess().MainWindowHandle);
        Debug.Log("TobiiGameIntegrationApi.TrackWindow() after");

        AspectRatio = 16f / 9f;
    }
Пример #7
0
        public void Shutdown()
        {
            _isShuttingDown = true;

            if (IsInitialized)
            {
#if !UNITY_EDITOR
                TobiiGameIntegrationApi.Shutdown();
#endif
                IsInitialized = false;
            }
        }
Пример #8
0
    protected virtual void LateUpdate()
    {
        _extendedViewTransformation = TobiiGameIntegrationApi.GetExtendedViewTransformation();

        UpdateSettings();
        SendUpdatedSettingsToTgi();

        UpdateExtendedViewAngles();
        UpdateTransform();

#if UNITY_EDITOR
        UpdateAllChangedExtendedViewSettings();
#endif
    }
Пример #9
0
        void Update()
        {
            if (Time.frameCount == _lastUpdatedFrame)
            {
                return;
            }

            _lastUpdatedFrame = Time.frameCount;

            TrackWindow();

            var gameViewBounds = _gameViewBoundsProvider.GetGameViewClientAreaNormalizedBounds();

            _gameViewInfo = new GameViewInfo(gameViewBounds);

            TobiiGameIntegrationApi.Update();

            _gazeFocus.UpdateGazeFocus();
        }
Пример #10
0
 public void UpdateAllExtendedViewSettings()
 {
     TobiiGameIntegrationApi.UpdateExtendedViewGazeOnlySettings(GazeOnlySettings.ToExtendedViewSettings());
     TobiiGameIntegrationApi.UpdateExtendedViewHeadOnlySettings(HeadOnlySettings.ToExtendedViewSettings());
     TobiiGameIntegrationApi.UpdateExtendedViewSettings(HeadAndGazeSettings.ToExtendedViewSettings());
 }
Пример #11
0
 public void Dispose()
 {
     Debug.Log("TobiiGameIntegrationApi.StopTracking() before");
     TobiiGameIntegrationApi.StopTracking();
     Debug.Log("TobiiGameIntegrationApi.StopTracking() after");
 }