Moved SendPixels to OnWorldPostActorTick.

This commit is contained in:
doterop 2020-09-30 16:44:09 +02:00 committed by Marc Garcia Puig
parent 7a522e1fc9
commit 83d752ef94
8 changed files with 15 additions and 14 deletions

View File

@ -28,7 +28,7 @@ ADepthCamera::ADepthCamera(const FObjectInitializer &ObjectInitializer)
);
}
void ADepthCamera::SendPixels()
void ADepthCamera::SendPixels(UWorld *World, ELevelTick TickType, float DeltaSeconds)
{
FPixelReader::SendPixelsInRenderThread(*this);
}

View File

@ -26,5 +26,5 @@ public:
protected:
void SendPixels() override;
void SendPixels(UWorld *World, ELevelTick TickType, float DeltaSeconds) override;
};

View File

@ -22,7 +22,7 @@ ASceneCaptureCamera::ASceneCaptureCamera(const FObjectInitializer &ObjectInitial
TEXT("Material'/Carla/PostProcessingMaterials/PhysicLensDistortion.PhysicLensDistortion'"));
}
void ASceneCaptureCamera::SendPixels()
void ASceneCaptureCamera::SendPixels(UWorld *World, ELevelTick TickType, float DeltaSeconds)
{
FPixelReader::SendPixelsInRenderThread(*this);
}

View File

@ -26,6 +26,6 @@ public:
protected:
void SendPixels() override;
void SendPixels(UWorld *World, ELevelTick TickType, float DeltaSeconds) override;
};

View File

@ -9,16 +9,17 @@
#include "Carla/Game/CarlaStatics.h"
#include "Async/Async.h"
#include "Components/DrawFrustumComponent.h"
#include "Engine/Classes/Engine/Scene.h"
#include "Components/SceneCaptureComponent2D.h"
#include "Components/StaticMeshComponent.h"
#include "Engine/TextureRenderTarget2D.h"
#include "HighResScreenshot.h"
#include "ContentStreaming.h"
#include "Async/Async.h"
#include "RHICommandList.h"
#include "Engine/Classes/Engine/Scene.h"
#include "Engine/TextureRenderTarget2D.h"
#include "HAL/UnrealMemory.h"
#include "HighResScreenshot.h"
#include "Misc/CoreDelegates.h"
#include "RHICommandList.h"
static auto SCENE_CAPTURE_COUNTER = 0u;
@ -490,7 +491,7 @@ void ASceneCaptureSensor::BeginPlay()
Super::BeginPlay();
SendPixelsDelegate = FCoreDelegates::OnEndFrame.AddUObject(this, &ASceneCaptureSensor::SendPixels);
SendPixelsDelegate = FWorldDelegates::OnWorldPostActorTick.AddUObject(this, &ASceneCaptureSensor::SendPixels);
}
void ASceneCaptureSensor::Tick(float DeltaTime)
@ -511,7 +512,7 @@ void ASceneCaptureSensor::EndPlay(const EEndPlayReason::Type EndPlayReason)
Super::EndPlay(EndPlayReason);
SCENE_CAPTURE_COUNTER = 0u;
FCoreDelegates::OnEndFrame.Remove(SendPixelsDelegate);
FWorldDelegates::OnWorldPostActorTick.Remove(SendPixelsDelegate);
}
// =============================================================================

View File

@ -280,7 +280,7 @@ protected:
virtual void SetUpSceneCaptureComponent(USceneCaptureComponent2D &SceneCapture) {}
virtual void SendPixels() {}
virtual void SendPixels(UWorld *World, ELevelTick TickType, float DeltaSeconds) {}
FDelegateHandle SendPixelsDelegate;

View File

@ -24,7 +24,7 @@ ASemanticSegmentationCamera::ASemanticSegmentationCamera(
TEXT("Material'/Carla/PostProcessingMaterials/GTMaterial.GTMaterial'"));
}
void ASemanticSegmentationCamera::SendPixels()
void ASemanticSegmentationCamera::SendPixels(UWorld *World, ELevelTick TickType, float DeltaSeconds)
{
FPixelReader::SendPixelsInRenderThread(*this);
}

View File

@ -26,5 +26,5 @@ public:
protected:
void SendPixels() override;
void SendPixels(UWorld *World, ELevelTick TickType, float DeltaSeconds) override;
};