Пример #1
0
        private void Update()
        {
            var provider           = TobiiXR.Internal.Provider;
            var eyeTrackingData    = EyeTrackingDataHelper.Clone(provider.EyeTrackingDataLocal);
            var localToWorldMatrix = provider.LocalToWorldMatrix;
            var worldForward       = localToWorldMatrix.MultiplyVector(Vector3.forward);

            EyeTrackingDataHelper.TransformGazeData(eyeTrackingData, localToWorldMatrix);
            var gazeModifierFilter = TobiiXR.Internal.Filter as GazeModifierFilter;

            if (gazeModifierFilter != null)
            {
                gazeModifierFilter.FilterAccuracyOnly(eyeTrackingData, worldForward);
            }

            var gazeRay = eyeTrackingData.GazeRay;

            _spriteRenderer.enabled = gazeRay.IsValid;
            if (_spriteRenderer.enabled == false)
            {
                return;
            }

            SetPositionAndScale(gazeRay);

            if (ScaleAffectedByPrecision && gazeModifierFilter != null)
            {
                UpdatePrecisionScale(gazeModifierFilter.GetMaxPrecisionAngleDegrees(eyeTrackingData.GazeRay.Direction, worldForward));
            }
        }
Пример #2
0
        private static void Tick()
        {
            EyeTrackingDataHelper.Copy(_eyeTrackingProvider.EyeTrackingData, _eyeTrackingData);
            if (Internal.Filter != null)
            {
                Internal.Filter.Filter(_eyeTrackingData);
            }
            var data = CreateDeviceData(_eyeTrackingData);

            Internal.G2OM.Tick(data);
        }
Пример #3
0
        private static void Tick()
        {
            Internal.Provider.Tick();
            EyeTrackingDataHelper.Copy(Internal.Provider.EyeTrackingDataLocal, _eyeTrackingDataLocal);
            EyeTrackingDataHelper.TransformGazeData(Internal.Provider.EyeTrackingDataLocal, _eyeTrackingDataWorld, Internal.Provider.LocalToWorldMatrix);

            if (Internal.Filter != null && Internal.Filter.enabled)
            {
                var worldForward = Internal.Provider.LocalToWorldMatrix.MultiplyVector(Vector3.forward);
                Internal.Filter.Filter(_eyeTrackingDataLocal, Vector3.forward);
                Internal.Filter.Filter(_eyeTrackingDataWorld, worldForward);
            }
            var g2omData = CreateG2OMData(_eyeTrackingDataWorld);

            Internal.G2OM.Tick(g2omData);
        }
Пример #4
0
        public void Tick()
        {
            _streamEngineTracker.Tick();
            _hmdToWorldTransformer.Tick();

            var data = _streamEngineTracker.LocalLatestData;

            _eyeTrackingData.Timestamp                  = Time.unscaledTime;
            _eyeTrackingData.GazeRay                    = data.GazeRay;
            _eyeTrackingData.IsLeftEyeBlinking          = data.IsLeftEyeBlinking;
            _eyeTrackingData.IsRightEyeBlinking         = data.IsRightEyeBlinking;
            _eyeTrackingData.ConvergenceDistance        = data.ConvergenceDistance;
            _eyeTrackingData.ConvergenceDistanceIsValid = data.ConvergenceDistanceIsValid;

            _localToWorldMatrix = _hmdToWorldTransformer.GetLocalToWorldMatrix();
            EyeTrackingDataHelper.TransformGazeData(_eyeTrackingData, _localToWorldMatrix);
        }
Пример #5
0
        private void OnAdvancedWearableData(ref tobii_wearable_advanced_data_t data)
        {
            var advancedData = _advancedData.Count >= AdvancedDataQueueSize
                ? _advancedData.Dequeue()
                : new TobiiXR_AdvancedEyeTrackingData();

            StreamEngineDataMapper.MapAdvancedData(advancedData, ref data,
                                                   _streamEngineTracker.ConvergenceDistanceSupported, CoordinatesHelper.GetHeadToCenterEyeTranslation());
            _advancedData.Enqueue(advancedData);

            // Keep a copy of latest received value
            EyeTrackingDataHelper.Copy(advancedData, _advancedEyeTrackingData);

            // Also fill in consumer api
            StreamEngineDataMapper.FromAdvancedData(_eyeTrackingDataLocal, ref data,
                                                    _streamEngineTracker.ConvergenceDistanceSupported, CoordinatesHelper.GetHeadToCenterEyeTranslation());
            _eyeTrackingDataLocal.Timestamp = Time.unscaledTime;
        }
        public void Tick()
        {
            _headToCenterEyeTranslation = CoordinatesHelper.GetHeadToCenterEyeTranslation();
            _hmdToWorldTransformer.Tick();
            _localToWorldMatrix = _hmdToWorldTransformer.GetLocalToWorldMatrix();

            // Copy consumer data
            lock (_lockEyeTrackingDataLocal)
            {
                EyeTrackingDataHelper.Copy(_eyeTrackingDataLocalInternal, _eyeTrackingDataLocal);
            }
            _eyeTrackingDataLocal.Timestamp = Time.unscaledTime;

            // Shuffle data from internal queue to public queue
            lock (_lockAdvancedData)
            {
                while (_advancedInternalQueue.Count > 1)
                {
                    _advancedPublicQueue.Enqueue(_advancedInternalQueue.Dequeue());
                }

                // Copy newest data to _advancedEyeTrackingData
                if (_advancedInternalQueue.Count == 1)
                {
                    var data = _advancedInternalQueue.Dequeue();
                    EyeTrackingDataHelper.Copy(data, _advancedEyeTrackingData);
                    _advancedPublicQueue.Enqueue(data);
                }

                // Limit size of public queue
                while (_advancedPublicQueue.Count > AdvancedDataQueueSize)
                {
                    _advancedPublicQueue.Dequeue();
                }
            }
        }
 public void GetEyeTrackingDataLocal(TobiiXR_EyeTrackingData data)
 {
     EyeTrackingDataHelper.Copy(_eyeTrackingDataLocal, data);
 }