예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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);
 }