Exemple #1
0
        public FocusedObject GetFocusedObject(
            IEnumerable <global::Tobii.Framework.GazePoint> lastGazePoints, Camera camera)
        {
            var gazePoints = new List <global::Tobii.Framework.GazePoint>();

            /*Note: Do not use LINQ here - too inefficient to be called every update.*/
            foreach (var gazePoint in lastGazePoints)
            {
                if (gazePoint.IsValid)
                {
                    gazePoints.Add(gazePoint);
                }
            }

            foreach (var gazePoint in gazePoints)
            {
                var objectsInGaze = FindObjectsInGaze(gazePoint.Screen, camera);
                UpdateFocusConfidenceScore(objectsInGaze);
            }

            var focusChallenger = FindFocusChallenger();

            if (focusChallenger.GetScore() >
                _focusedObject.GetScore() + Threshold)
            {
                _focusedObject = focusChallenger;
            }

            return(FocusedGameObject);
        }
        public FocusedObject GetFocusedObject(
            IEnumerable <global::Tobii.Framework.GazePoint> lastGazePoints, Camera camera)
        {
            var objectsInGaze = FindObjectsInGaze(lastGazePoints, camera);

            UpdateFocusConfidenceScore(objectsInGaze);
            var focusChallenger = FindFocusChallenger();

            if (focusChallenger.GetScore()
                > _focusedObject.GetScore() + Threshold)
            {
                _focusedObject = focusChallenger;
            }

            return(FocusedGameObject);
        }