Skip to content
Snippets Groups Projects
Commit 4ce616c6 authored by Malte Christian Kögel's avatar Malte Christian Kögel
Browse files

WIP seems to work. Needs some final testing in eyetracking test map, then...

WIP seems to work. Needs some final testing in eyetracking test map, then removal of debugging functions
parent f2dda872
No related branches found
No related tags found
No related merge requests found
...@@ -27,16 +27,19 @@ bool USFGazeTracker::Tick(float DeltaTime) ...@@ -27,16 +27,19 @@ bool USFGazeTracker::Tick(float DeltaTime)
#ifdef WITH_SRANIPAL #ifdef WITH_SRANIPAL
bIsAsyncEyeTrackingTaskRunning = true; bIsAsyncEyeTrackingTaskRunning = true;
ViveSR::anipal::Eye::EyeData_v2 TempEyeData; ViveSR::anipal::Eye::EyeData_v2 TempEyeData;
AsyncTask(ENamedThreads::AnyThread, [TempEyeDataAddr = &TempEyeData, SranipalEyeData = MoveTemp(SranipalEyeData), bIsAsyncEyeTrackingTaskRunning = MoveTemp(bIsAsyncEyeTrackingTaskRunning), bDataLogged = MoveTemp(bDataLogged)]() //transfer 'this' into the function in order to have access to the boolean member variables in the nested GameThread-async task
AsyncTask(ENamedThreads::AnyThread, [this]()
{ {
int Result = ViveSR::anipal::Eye::GetEyeData_v2(TempEyeDataAddr); ViveSR::anipal::Eye::EyeData_v2 LocalEyeData;
int Result = ViveSR::anipal::Eye::GetEyeData_v2(&LocalEyeData);
AsyncTask(ENamedThreads::GameThread, [TempEyeDataAddr =TempEyeDataAddr, SranipalEyeData, bIsAsyncEyeTrackingTaskRunning, bDataLogged, Result]() mutable // Set member variables from GameThread to avoid race conditions
AsyncTask(ENamedThreads::GameThread, [this, LocalEyeData =MoveTemp(LocalEyeData), Result]() mutable
{ {
SranipalEyeData = *TempEyeDataAddr; //UE_LOG(LogTemp, Warning, TEXT("Tried to get EyeData, Result: %d"), Result);
SranipalEyeData = LocalEyeData;
bDataLogged = false; bDataLogged = false;
bIsAsyncEyeTrackingTaskRunning = false; bIsAsyncEyeTrackingTaskRunning = false;
UE_LOG(LogTemp, Warning, TEXT("Tried to get EyeData, Result: %d"), Result); //UE_LOG(LogTemp, Warning, TEXT("finished async task"));
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment