Move CaptureScene to PostPhysTick for ASceneCaptureSensors.

This commit is contained in:
Marcel Pi 2024-03-20 12:33:55 +01:00 committed by Blyron
parent 5e1d6e4ed2
commit 5a2eadd161
8 changed files with 2 additions and 7 deletions

View File

@ -136,7 +136,6 @@ void ADVSCamera::PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaTim
}
/// Immediate enqueues render commands of the scene at the current time.
EnqueueRenderSceneImmediate();
WaitForRenderThreadToFinish();
//Super (ASceneCaptureSensor) Capture the Scene in a (UTextureRenderTarget2D) CaptureRenderTarge from the CaptureComponent2D

View File

@ -34,7 +34,6 @@ void ADepthCamera::PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaS
{
TRACE_CPUPROFILER_EVENT_SCOPE(ADepthCamera::PostPhysTick);
EnqueueRenderSceneImmediate();
ImageUtil::ReadSensorImageDataAsyncFColor(*this, [this](
TArrayView<const FColor> Pixels,
FIntPoint Size) -> bool

View File

@ -63,7 +63,6 @@ void AInstanceSegmentationCamera::PostPhysTick(UWorld *World, ELevelTick TickTyp
SceneCapture->ShowOnlyComponents.Emplace(Component);
}
EnqueueRenderSceneImmediate();
ImageUtil::ReadSensorImageDataAsyncFColor(*this, [this](
TArrayView<const FColor> Pixels,
FIntPoint Size) -> bool

View File

@ -28,7 +28,6 @@ void ANormalsCamera::PostPhysTick(UWorld *World, ELevelTick TickType, float Delt
{
TRACE_CPUPROFILER_EVENT_SCOPE(ANormalsCamera::PostPhysTick);
EnqueueRenderSceneImmediate();
ImageUtil::ReadSensorImageDataAsyncFColor(*this, [this](
TArrayView<const FColor> Pixels,
FIntPoint Size) -> bool

View File

@ -63,7 +63,6 @@ void ASceneCaptureCamera::PostPhysTick(UWorld *World, ELevelTick TickType, float
}
);
EnqueueRenderSceneImmediate();
ImageUtil::ReadSensorImageDataAsyncFColor(*this, [this](
TArrayView<const FColor> Pixels,
FIntPoint Size) -> bool

View File

@ -516,6 +516,7 @@ void ASceneCaptureSensor::PrePhysTick(float DeltaSeconds)
void ASceneCaptureSensor::PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaTime)
{
Super::PostPhysTick(World, TickType, DeltaTime);
EnqueueRenderSceneImmediate();
}
void ASceneCaptureSensor::EndPlay(const EEndPlayReason::Type EndPlayReason)

View File

@ -28,7 +28,6 @@ void ASemanticSegmentationCamera::PostPhysTick(UWorld *World, ELevelTick TickTyp
{
TRACE_CPUPROFILER_EVENT_SCOPE(ASemanticSegmentationCamera::PostPhysTick);
EnqueueRenderSceneImmediate();
ImageUtil::ReadSensorImageDataAsyncFColor(*this, [this](
TArrayView<const FColor> Pixels,
FIntPoint Size) -> bool

View File

@ -234,7 +234,7 @@ void ASensorSpawnerActor::SaveSensorData(float DeltaSeconds)
if(ASceneCaptureSensor* CaptureSensor = Cast<ASceneCaptureSensor>(CurrentSensor))
{
const FString FinalPath = FPaths::Combine(SaveImagePath, CaptureSensor->GetName(), FString::Printf(TEXT("%lld"), FDateTime::Now().ToUnixTimestamp()) + "-Frame_" + FrameNumber + ".png");
CaptureSensor->EnqueueRenderSceneImmediate();
// CaptureSensor->EnqueueRenderSceneImmediate();
CaptureSensor->SaveCaptureToDisk(FinalPath);
continue;
}