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
Branches
Tags
No related merge requests found
......@@ -27,16 +27,19 @@ bool USFGazeTracker::Tick(float DeltaTime)
#ifdef WITH_SRANIPAL
bIsAsyncEyeTrackingTaskRunning = true;
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);
AsyncTask(ENamedThreads::GameThread, [TempEyeDataAddr =TempEyeDataAddr, SranipalEyeData, bIsAsyncEyeTrackingTaskRunning, bDataLogged, Result]() mutable
ViveSR::anipal::Eye::EyeData_v2 LocalEyeData;
int Result = ViveSR::anipal::Eye::GetEyeData_v2(&LocalEyeData);
// 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;
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