예제 #1
0
        public double ConvertToPupilTime(double unityTime)
        {
            if (!IsConnected)
            {
                Debug.LogWarning("Not connected");
                return(0);
            }

            return(timeSync.ConvertToPupilTime(unityTime));
        }
예제 #2
0
        void Update()
        {
            if (!isSetup || pauseStreaming)
            {
                return;
            }

            if (IgnoreFrameBasedOnFPS())
            {
                return;
            }

            UpdateIntrinsics();

            AsyncGPUReadback.Request
            (
                renderTexture, 0, TextureFormat.RGB24,
                (AsyncGPUReadbackRequest r) => ReadbackDone(r, timeSync.ConvertToPupilTime(Time.realtimeSinceStartup))
            );
        }
예제 #3
0
        private void UpdateCalibration()
        {
            UpdateMarker();

            float tNow = Time.time;

            if (tNow - tLastSample >= 1f / settings.SampleRate - Time.deltaTime / 2f)
            {
                if (tNow - tLastTarget < settings.ignoreInitialSeconds - Time.deltaTime / 2f)
                {
                    return;
                }

                tLastSample = tNow;

                //Adding the calibration reference data to the list that will be passed on, once the required sample amount is met.
                double sampleTimeStamp = timeSync.ConvertToPupilTime(Time.realtimeSinceStartup);
                AddSample(sampleTimeStamp);

                targetSampleCount++;//Increment the current calibration sample. (Default sample amount per calibration point is 120)

                if (targetSampleCount >= settings.samplesPerTarget || tNow - tLastTarget >= settings.secondsPerTarget)
                {
                    calibration.SendCalibrationReferenceData();

                    if (targetIdx < targets.GetTargetCount())
                    {
                        targetSampleCount = 0;

                        UpdatePosition();
                    }
                    else
                    {
                        StopCalibration();
                    }
                }
            }
        }
예제 #4
0
        public void SendAnnotation(string label, float duration = 0.0f, Dictionary <string, object> customData = null)
        {
            double pupiltime = timeSync.ConvertToPupilTime(Time.realtimeSinceStartup);

            SendAnnotation(label, pupiltime, duration, customData);
        }