Agrarsense
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ACamera Class Reference

#include <Camera.h>

Inheritance diagram for ACamera:
Inheritance graph
[legend]
Collaboration diagram for ACamera:
Collaboration graph
[legend]

Public Member Functions

 ACamera (const FObjectInitializer &ObjectInitializer)
 
virtual void Init (FCameraBaseParameters parameters, bool SimulateSensor=true)
 
virtual ESensorTypes GetSensorType () const override
 
void ChangeCameraParameters (FCameraBaseParameters newParameters)
 
FCameraBaseParameters GetCameraParameters ()
 
void AddPostProcessingMaterial (const FString &Path, float Weight=1.0f)
 
void RemovePostProcessingMaterial (UMaterial *Material)
 
USceneCaptureComponent2D * GetCaptureComponent2D () const
 
UTextureRenderTarget2D * GetCaptureRenderTarget2D () const
 
void AddWidgetToWindow (UWidget *WidgetToAdd)
 
void RemoveWidgetFromWindow (UWidget *WidgetToRemove)
 
void SetShadowRendering (bool RenderShadows)
 
void DisableShowFlags ()
 
void SetTemporalAA (bool SetTemporal)
 
void ResizeCamera (int32 Width=1280, int32 Height=720)
 
void AddHiddenActor (AActor *Actor)
 
void SaveCurrentFrameToDisk ()
 
int32 GetCameraWidth () const
 
int32 GetCameraHeight () const
 
void SetUseGimbal (bool UseGimbal)
 
virtual FString GetParametersAsString () const override
 
- Public Member Functions inherited from ASensor
 ASensor (const FObjectInitializer &ObjectInitializer)
 
FString ExportToJsonFile (const FString &FileName)
 
virtual ESensorTypes GetSensorType () const
 
FString GetSensorIdentifier () const
 
void SetSensorIdentifier (const FString newIdentifier)
 
FString GetSensorName () const
 
virtual FString GetParametersAsString () const
 
AVehicleIsAttachedToVehicle () const
 
void SetSensorName (const FString newName)
 
FString GetTopicName ()
 
UTopic * GetROSTopic () const
 
void SetSimulateSensor (bool SimulateSensor)
 
bool CanSimulateSensor () const
 
ASensorModelGetSensorModel () const
 
void SetSensorModel (ASensorModel *NewSensorModel)
 
FORCEINLINE bool IsROSConnected () const
 
UROSIntegrationGameInstance * GetROSGameInstance () const
 
virtual FString GetActorID_Implementation () const override
 
virtual FString GetActorName_Implementation () const override
 
virtual FString GetActorInformation_Implementation () const override
 
virtual void SetActorName_Implementation (const FString &NewActorName) override
 
virtual void SetActorIDAndName_Implementation (const FString &NewActorName, const FString &NewID) override
 
void SetParentActorPtr (AActor *ParentActorPtr)
 
- Public Member Functions inherited from IActorInformation
FString GetActorID () const
 
FString GetActorName () const
 
FString GetActorInformation () const
 
void SetActorName (const FString &NewActorName)
 
void SetActorIDAndName (const FString &NewActorName, const FString &NewID)
 

Public Attributes

TEnumAsByte< ETextureRenderTargetFormat > TextureFormat = ETextureRenderTargetFormat::RTF_RGBA8
 
FCameraDelegate_OnWindowClosed OnCameraWindowClosed
 
FCameraDelegate_OnWindowResized OnCameraWindowResized
 
- Public Attributes inherited from ASensor
FSensorDestroy OnSensorDestroy
 
FString AttachedToComponent
 
FName AttachedToBone
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason) override
 
void PreActorTick (UWorld *World, ELevelTick TickType, float DeltaSeconds)
 
void EndOfFrame (UWorld *World, ELevelTick TickType, float DeltaSeconds)
 
void EndOfFrameParellel (float DeltaTime)
 
virtual void AddProcessingToFrameBuffer (TArray< FColor > &buffer)
 
void ApplyGammaCorrectionLUT (TArray< FColor > &Buffer)
 
void SendImageDataToROS (const TArray< FColor > &FrameBuffer, int32 Width, int32 Height)
 
void HidePrimitiveComponent (UPrimitiveComponent *PrimitiveComponent)
 
void SaveImageToDisk (const TArray< FColor > FrameBuffer, int32 Width, int32 Height)
 
void SaveCameraMetaDataToDisk (const FString &ImageName)
 
void CreateLogFile () override
 
- Protected Member Functions inherited from ASensor
virtual void BeginPlay () override
 
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason) override
 
FString CreateTimeStampString () const
 
virtual void CreateROSTopic ()
 
virtual void DestroyROSTopic ()
 
virtual void CreateDataSavePath ()
 
bool IsLogFileCreated ()
 
virtual void CreateLogFile ()
 
void WriteToLogFile (const FString &Message)
 

Protected Attributes

bool UseParallelLateTick = true
 
FDelegateHandle OnPreTickDelegate
 
FDelegateHandle OnPostTickDelegate
 
FString CameraName = "Camera "
 
FString FilePrefix = "Data/Camera_"
 
UTextureRenderTarget2D * CaptureRenderTarget = nullptr
 
USceneCaptureComponent2D * CaptureComponent2D = nullptr
 
UTexture2D * CaptureFrameTexture
 
TSharedPtr< FUnrealWindowUnrealWindow
 
FTickEntry TickEntry
 
TWeakObjectPtr< UMaterialInstanceDynamic > IceMaterialInstance
 
TWeakObjectPtr< UMaterial > PhysicLensDistortion
 
APIDDroneDronePtr = nullptr
 
FRotator SensorSetRotation
 
bool AllowGimbal = true
 
- Protected Attributes inherited from ASensor
UTopic * ROSTopic = nullptr
 
bool SendDataToROS = true
 
ULogFileLogFile = nullptr
 
AActor * ParentActor = nullptr
 
FString FileSavePath
 
UROSIntegrationGameInstance * ROSInstance = nullptr
 

Private Member Functions

void StartFrameGrabber ()
 
void ReleaseFrameGrabber ()
 
void FrameGrabberCapture ()
 
void OnWindowClosed (const TSharedRef< SWindow > &Window)
 
void SetupCamera (FCameraBaseParameters parameters)
 
bool ShouldSimulate (const float DeltaSeconds)
 

Private Attributes

TSharedPtr< FFrameGrabber > FrameGrabber
 
FCameraBaseParameters CameraParameters
 
FCameraBaseParameters TempParams
 
AGeoReferencingSystem * GeoReferencingSystem = nullptr
 
bool ParametersChanged = false
 
FOnWindowClosed OnWindowClosedDelegate
 
TSharedPtr< ROSMessages::sensor_msgs::Image > ImageMsg
 
int32 ImageWidth = 1280
 
int32 ImageHeight = 720
 
bool SaveCurrentFrameToDiskRequested = false
 
bool ShouldSimulateCamera = true
 
float CameraFrameRate = 0.0f
 
float FrameRateTimer = 0.0f
 
int32 ImageNumber = 0
 
uint8 * BGR8Buffer = nullptr
 
int32 CurrentBufferSize = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from ASensor
static void HideComponentForAllCameras (UPrimitiveComponent *PrimitiveComponent)
 
static TMap< FString, FColor > GetSemanticColors ()
 
static TArray< TWeakObjectPtr< UPrimitiveComponent > > GetComponentsToHide ()
 
- Static Public Member Functions inherited from IActorInformation
static void SetAndValidateActorIDAndName (FString &ActorName, FString &ActorID, TWeakObjectPtr< AActor > Actor)
 
static bool DestroyActorByID (const FString &ID)
 
static AActor * GetActorByID (const FString &ID)
 
template<typename T >
static TArray< T * > GetActorsWithInterface ()
 
static void PrintAllIds ()
 
- Static Protected Member Functions inherited from ASensor
template<typename InStructType >
static FString StructToString (const InStructType &InStruct)
 
- Static Protected Attributes inherited from ASensor
static FPrimitiveAdded OnPrimitiveAdded
 
static const FName NiagaraPointsInt = "User.PointCount"
 
static const FName NiagaraHitPoints = "User.HitPoints"
 
static const FName NiagaraHitColors = "User.HitColors"
 
static const FName NiagaraPointsFloat = "User.Test"
 

Detailed Description

Camera sensor base class. All other Camera sensors are inherited from this class.

This creates custom Unreal Engine Window and renders USceneCaptureComponent2D into it. Then the Window screen pixels are read by FrameGrabber API which depending on the Camera type, might add processing on the read pixels. The pixels are then saved to disk if SaveDataToDisk is set to true and data is sent to ROS.

Definition at line 52 of file Camera.h.

Constructor & Destructor Documentation

◆ ACamera()

ACamera::ACamera ( const FObjectInitializer &  ObjectInitializer)

Setup new ACamera class

Parameters
FObjectInitializerdefault ObjectInitializer

Definition at line 33 of file Camera.cpp.

33 : Super(ObjectInitializer)
34{
35 PrimaryActorTick.bCanEverTick = true;
36 PrimaryActorTick.TickGroup = TG_PostUpdateWork;
37
38 CaptureRenderTarget = CreateDefaultSubobject<UTextureRenderTarget2D>(FName(*FString::Printf(TEXT("CaptureRenderTarget"))));
39 CaptureRenderTarget->CompressionSettings = TextureCompressionSettings::TC_Default;
40 CaptureRenderTarget->SRGB = false;
41 CaptureRenderTarget->bAutoGenerateMips = false;
42 CaptureRenderTarget->bGPUSharedFlag = true;
43 CaptureRenderTarget->AddressX = TextureAddress::TA_Clamp;
44 CaptureRenderTarget->AddressY = TextureAddress::TA_Clamp;
45
46 CaptureComponent2D = CreateDefaultSubobject<USceneCaptureComponent2D>(FName(*FString::Printf(TEXT("SceneCaptureComponent2D"))));
47 CaptureComponent2D->SetupAttachment(RootComponent);
48 CaptureComponent2D->PrimitiveRenderMode = ESceneCapturePrimitiveRenderMode::PRM_RenderScenePrimitives;
49 CaptureComponent2D->bCaptureOnMovement = false;
50 CaptureComponent2D->bCaptureEveryFrame = false;
51 CaptureComponent2D->bAlwaysPersistRenderingState = true;
52}
USceneCaptureComponent2D * CaptureComponent2D
Definition: Camera.h:287
UTextureRenderTarget2D * CaptureRenderTarget
Definition: Camera.h:284

References CaptureComponent2D, and CaptureRenderTarget.

Member Function Documentation

◆ AddHiddenActor()

void ACamera::AddHiddenActor ( AActor *  Actor)

Definition at line 890 of file Camera.cpp.

891{
892 if (Actor && CaptureComponent2D)
893 {
894 CaptureComponent2D->HiddenActors.AddUnique(Actor);
895 }
896}

References CaptureComponent2D.

◆ AddPostProcessingMaterial()

void ACamera::AddPostProcessingMaterial ( const FString &  Path,
float  Weight = 1.0f 
)

Adds a post-processing material from the specified file path.

Parameters
PathThe file path to the post-processing material.
WeightThe weight or influence of the material. Default is 1.0f.

Definition at line 59 of file Camera.cpp.

60{
61 UMaterial* PostProcessingMat = Cast<UMaterial>(StaticLoadObject(UMaterial::StaticClass(), nullptr, *Path));
62 if (PostProcessingMat && CaptureComponent2D)
63 {
64 FPostProcessSettings& PostProcessSettings = CaptureComponent2D->PostProcessSettings;
65 PostProcessSettings.AddBlendable(PostProcessingMat, Weight);
66 }
67 else
68 {
69 const FString ErrorMessage = FString::Printf(TEXT("Failed to add post-processing material to sensor: %s"), *GetSensorName());
70 SimulatorLog::Log(ErrorMessage);
71 }
72}
FString GetSensorName() const
Definition: Sensor.h:96
static void Log(const FString &Message, bool LogToTextFile=true, bool LogToROS=true)

References CaptureComponent2D, ASensor::GetSensorName(), and SimulatorLog::Log().

Referenced by AInstanceSegmentationCamera::Init(), ASemanticSegmentationCamera::Init(), and ADepthCamera::SetupDepthMaterial().

◆ AddProcessingToFrameBuffer()

void ACamera::AddProcessingToFrameBuffer ( TArray< FColor > &  buffer)
protectedvirtual

Reimplemented in ADepthCamera, AInstanceSegmentationCamera, ASemanticSegmentationCamera, and ADVSCamera.

Definition at line 593 of file Camera.cpp.

594{
595 return;
596}

Referenced by FrameGrabberCapture().

◆ AddWidgetToWindow()

void ACamera::AddWidgetToWindow ( UWidget *  WidgetToAdd)

Add Widget to custom Unreal Window

Definition at line 842 of file Camera.cpp.

843{
844 if (UnrealWindow.IsValid() && WidgetToAdd)
845 {
846 UnrealWindow->AddUWidgetToWindow(WidgetToAdd);
847 }
848}
TSharedPtr< FUnrealWindow > UnrealWindow
Definition: Camera.h:296

References UnrealWindow.

Referenced by SetupCamera().

◆ ApplyGammaCorrectionLUT()

void ACamera::ApplyGammaCorrectionLUT ( TArray< FColor > &  Buffer)
protected

Definition at line 598 of file Camera.cpp.

599{
600 static uint8 GammaLUT[256];
601 static bool LUTInitialized = false;
602 if (!LUTInitialized)
603 {
604 LUTInitialized = true;
605 for (int32 i = 0; i < 256; ++i)
606 {
607 float Linear = FMath::Pow(i / 255.0f, 2.2f);
608 GammaLUT[i] = FMath::RoundToInt(Linear * 255.0f);
609 }
610 }
611
612 FColor* RESTRICT BufferPtr = Buffer.GetData();
613 const int32 Num = Buffer.Num();
614
615 const int32 ChunkSize = 512;
616 const int32 NumChunks = (Num + ChunkSize - 1) / ChunkSize;
617
618 ParallelFor(NumChunks, [BufferPtr, Num](int32 ChunkIndex)
619 {
620 const int32 Start = ChunkIndex * ChunkSize;
621 const int32 End = FMath::Min(Start + ChunkSize, Num);
622
623 for (int32 i = Start; i < End; ++i)
624 {
625 FColor& C = BufferPtr[i];
626 C.R = GammaLUT[C.R];
627 C.G = GammaLUT[C.G];
628 C.B = GammaLUT[C.B];
629 }
630 }, false);
631}

Referenced by ADepthCamera::AddProcessingToFrameBuffer(), AInstanceSegmentationCamera::AddProcessingToFrameBuffer(), and ASemanticSegmentationCamera::AddProcessingToFrameBuffer().

◆ BeginPlay()

void ACamera::BeginPlay ( )
overrideprotectedvirtual

Reimplemented from ASensor.

Definition at line 391 of file Camera.cpp.

392{
393 Super::BeginPlay();
394
395 // Register to PreActorTick where USceneCaptureComponent2D will get rendered.
396 OnPreTickDelegate = FWorldDelegates::OnWorldPreActorTick.AddUObject(this, &ACamera::PreActorTick);
397
398 // Check if we should use ATickManager which ticks in parallel, or use Post actor tick
399 // In there we capture the screen pixels with FrameGrabber API,
400 // might do some extra processing, save image to disk and send data to ROS.
402 {
403 SetActorTickEnabled(false);
404 TickEntry = ATickManager::AddTick(this, BindTick(this, &ACamera::EndOfFrameParellel), ETickType::LateTickParallel);
405 }
406 else
407 {
408 SetActorTickEnabled(true);
409 OnPostTickDelegate = FWorldDelegates::OnWorldPostActorTick.AddUObject(this, &ACamera::EndOfFrame);
410 }
411
412 // Get all existing components set to be hidden for all Camera sensors (like Lidar point cloud visualization).
413 auto Components = ASensor::GetComponentsToHide();
414 for (int32 i = 0; i < Components.Num(); i++)
415 {
416 UPrimitiveComponent* Primitive = Components[i].Get();
417 if (Primitive)
418 {
419 HidePrimitiveComponent(Primitive);
420 }
421 }
422
423 OnPrimitiveAdded.AddUniqueDynamic(this, &ACamera::HidePrimitiveComponent);
424
425 GetWorld()->GetTimerManager().SetTimerForNextTick([this]()
426 {
427 if (IsValid(this))
428 {
429 DronePtr = Cast<APIDDrone>(GetAttachParentActor());
430 if (!DronePtr)
431 {
432 AllowGimbal = false;
433 }
434 }
435 });
436}
static auto BindTick(ObjectType *Object, FunctionType Function)
Definition: TickManager.h:162
bool UseParallelLateTick
Definition: Camera.h:235
FTickEntry TickEntry
Definition: Camera.h:298
APIDDrone * DronePtr
Definition: Camera.h:305
FDelegateHandle OnPostTickDelegate
Definition: Camera.h:240
FDelegateHandle OnPreTickDelegate
Definition: Camera.h:237
void HidePrimitiveComponent(UPrimitiveComponent *PrimitiveComponent)
Definition: Camera.cpp:633
void EndOfFrameParellel(float DeltaTime)
Definition: Camera.cpp:521
void EndOfFrame(UWorld *World, ELevelTick TickType, float DeltaSeconds)
Definition: Camera.cpp:516
void PreActorTick(UWorld *World, ELevelTick TickType, float DeltaSeconds)
Definition: Camera.cpp:486
bool AllowGimbal
Definition: Camera.h:307
static FPrimitiveAdded OnPrimitiveAdded
Definition: Sensor.h:377
static TArray< TWeakObjectPtr< UPrimitiveComponent > > GetComponentsToHide()
Definition: Sensor.h:270
static FTickEntry AddTick(UObject *Object, std::function< void(float)> Function, ETickType Type)
Definition: TickManager.cpp:51

References ATickManager::AddTick(), AllowGimbal, BindTick(), DronePtr, EndOfFrame(), EndOfFrameParellel(), ASensor::GetComponentsToHide(), HidePrimitiveComponent(), OnPostTickDelegate, OnPreTickDelegate, ASensor::OnPrimitiveAdded, PreActorTick(), TickEntry, and UseParallelLateTick.

◆ ChangeCameraParameters()

void ACamera::ChangeCameraParameters ( FCameraBaseParameters  newParameters)

Change Camera parameters on the fly. Callable from blueprint.

Parameters
FCameraBaseParametersCameraParameters struct

Definition at line 54 of file Camera.cpp.

55{
56 SetupCamera(newParameters);
57}
void SetupCamera(FCameraBaseParameters parameters)
Definition: Camera.cpp:126

References SetupCamera().

Referenced by ADepthCamera::ChangeDepthCameraParameters(), ADVSCamera::ChangeParametersInternal(), AThermalCamera::ChangeThermalCameraParameters(), ResizeCamera(), and ADataCapture::SetupDataCapture().

◆ CreateLogFile()

void ACamera::CreateLogFile ( )
overrideprotectedvirtual

Create Text file for this sensor if it has not been created already. Text file will be created to ROOT/Data/Run/Logs directory. Filename will be SensorName_ID_UnixTimestamp.txt Can be overriden by individual sensor if needed.

Reimplemented from ASensor.

Definition at line 90 of file Camera.cpp.

91{
92 if (IsValid(LogFile))
93 {
94 // File has already been created, return
95 return;
96 }
97
98 FLogFileSettings Settings;
101 Settings.QueueLength = MAX_int32; // Only write the log after destroying the sensor
102 Settings.KeepFileOpen = false;
103 Settings.Timestamp = false;
104 Settings.OverrideFilePath = true;
105 Settings.FilePath = FileSavePath;
106
107 LogFile = NewObject<ULogFile>(ULogFile::StaticClass());
108 if (IsValid(LogFile))
109 {
110 const FString FileName = "camera_metadata";
111 LogFile->Create(FileName, Settings);
112
113 // Write camera metadata first line to explain the values.
114 GeoReferencingSystem = AGeoReferencingSystem::GetGeoReferencingSystem(GetWorld());
116 {
117 WriteToLogFile("timestamp, image_name, X location, Y location, Z location, yaw rotation, pitch rotation, roll rotation, GPS latitude, GPS longitude, GPS altitude");
118 }
119 else
120 {
121 WriteToLogFile("timestamp, image_name, X location, Y location, Z location, yaw rotation, pitch rotation, roll rotation");
122 }
123 }
124}
AGeoReferencingSystem * GeoReferencingSystem
Definition: Camera.h:360
ULogFile * LogFile
Definition: Sensor.h:367
FString FileSavePath
Definition: Sensor.h:372
void WriteToLogFile(const FString &Message)
Definition: Sensor.cpp:302
void Create(const FString &FileNameWithoutExtension, FLogFileSettings Settings)
Definition: LogFile.cpp:40
bool KeepFileOpen
Definition: LogFile.h:42
bool Timestamp
Definition: LogFile.h:39
FString FilePath
Definition: LogFile.h:54
FFileWriteOptions FileWriteOptions
Definition: LogFile.h:45
int32 QueueLength
Definition: LogFile.h:48
bool OverrideFilePath
Definition: LogFile.h:51
FFileCreationOptions FileCreationOptions
Definition: LogFile.h:36

References ULogFile::Create(), FLogFileSettings::FileCreationOptions, FLogFileSettings::FilePath, ASensor::FileSavePath, FLogFileSettings::FileWriteOptions, GeoReferencingSystem, FLogFileSettings::KeepFileOpen, ASensor::LogFile, FLogFileSettings::OverrideFilePath, Overwrite, Queue, FLogFileSettings::QueueLength, FLogFileSettings::Timestamp, and ASensor::WriteToLogFile().

Referenced by FrameGrabberCapture(), and SetupCamera().

◆ DisableShowFlags()

void ACamera::DisableShowFlags ( )

Definition at line 898 of file Camera.cpp.

899{
901 {
902 return;
903 }
904
905 auto& ShowFlags = CaptureComponent2D->ShowFlags;
906
907 ShowFlags.SetDeferredLighting(false);
908 ShowFlags.SetSkyLighting(false);
909 ShowFlags.SetAmbientOcclusion(false);
910 ShowFlags.SetAntiAliasing(false);
911 ShowFlags.SetVolumetricFog(false);;
912 ShowFlags.SetBloom(false);
913 ShowFlags.SetCameraImperfections(false);
914 ShowFlags.SetCameraInterpolation(false);
915 ShowFlags.SetColorGrading(false);
916 ShowFlags.SetDepthOfField(false);
917 ShowFlags.SetDiffuse(false);
918 ShowFlags.SetDirectionalLights(false);
919 ShowFlags.SetDirectLighting(false);
920 ShowFlags.SetDynamicShadows(false);
921 ShowFlags.SetEyeAdaptation(false);
922 ShowFlags.SetFog(false);
923 ShowFlags.SetGlobalIllumination(false);
924 ShowFlags.SetGrain(false);
925 ShowFlags.SetHLODColoration(false);
926 ShowFlags.SetHMDDistortion(false);
927 ShowFlags.SetLensFlares(false);
928 ShowFlags.SetLightComplexity(false);
929 ShowFlags.SetLightFunctions(false);
930 ShowFlags.SetLightInfluences(false);
931 ShowFlags.SetLighting(false);
932 ShowFlags.SetLightMapDensity(false);
933 ShowFlags.SetLightRadius(false);
934 ShowFlags.SetLightShafts(false);
935 ShowFlags.SetLODColoration(false);
936 ShowFlags.SetMotionBlur(false);
937 ShowFlags.SetOnScreenDebug(false);
938 ShowFlags.SetParticles(false);
939 ShowFlags.SetPointLights(false);
940 ShowFlags.SetRefraction(false);
941 ShowFlags.SetSceneColorFringe(false);
942 ShowFlags.SetScreenSpaceAO(false);
943 ShowFlags.SetScreenSpaceReflections(false);
944 ShowFlags.SetSkyLighting(false);
945 ShowFlags.SetSpotLights(false);
946 ShowFlags.SetStationaryLightOverlap(false);
947 ShowFlags.SetSubsurfaceScattering(false);
948 ShowFlags.SetTonemapper(false);
949 ShowFlags.SetVisualizeBuffer(false);
950 ShowFlags.SetVisualizeDistanceFieldAO(false);
951 ShowFlags.SetVisualizeDOF(false);
952 ShowFlags.SetVisualizeHDR(false);
953 ShowFlags.SetVisualizeLightCulling(false);
954 ShowFlags.SetVisualizeMeshDistanceFields(false);
955 ShowFlags.SetVisualizeMotionBlur(false);
956 ShowFlags.SetVisualizeOutOfBoundsPixels(false);
957 ShowFlags.SetVisualizeSenses(false);
958 ShowFlags.SetVisualizeShadingModels(false);
959 ShowFlags.SetVisualizeSSR(false);
960 ShowFlags.SetVisualizeSSS(false);
961}

References CaptureComponent2D.

Referenced by ADepthCamera::Init(), AInstanceSegmentationCamera::Init(), and ASemanticSegmentationCamera::Init().

◆ EndOfFrame()

void ACamera::EndOfFrame ( UWorld *  World,
ELevelTick  TickType,
float  DeltaSeconds 
)
protected

Definition at line 516 of file Camera.cpp.

517{
519}
void FrameGrabberCapture()
Definition: Camera.cpp:553

References FrameGrabberCapture().

Referenced by BeginPlay().

◆ EndOfFrameParellel()

void ACamera::EndOfFrameParellel ( float  DeltaTime)
protected

Definition at line 521 of file Camera.cpp.

522{
524}

References FrameGrabberCapture().

Referenced by BeginPlay().

◆ EndPlay()

void ACamera::EndPlay ( const EEndPlayReason::Type  EndPlayReason)
overrideprotectedvirtual

Reimplemented from ASensor.

Reimplemented in AInstanceSegmentationCamera, ADepthCamera, ADVSCamera, and AThermalCamera.

Definition at line 438 of file Camera.cpp.

439{
440 Super::EndPlay(EndPlayReason);
441
442 FWorldDelegates::OnWorldPreActorTick.Remove(OnPreTickDelegate);
443
445 {
447 }
448 else
449 {
450 FWorldDelegates::OnWorldPostActorTick.Remove(OnPostTickDelegate);
451 }
452
453 if (UnrealWindow.IsValid())
454 {
455 OnWindowClosedDelegate.Unbind();
456 UnrealWindow->DestroyWindow();
457 UnrealWindow.Reset();
458 }
459
461
463 {
464 CaptureRenderTarget->ConditionalBeginDestroy();
465 CaptureRenderTarget = nullptr;
466 }
467
469 {
470 CaptureComponent2D->UnregisterComponent();
471 CaptureComponent2D->ConditionalBeginDestroy();
472 CaptureComponent2D = nullptr;
473 }
474
475 ImageMsg.Reset();
476 IceMaterialInstance.Reset();
477
478 if (BGR8Buffer)
479 {
480 delete[] BGR8Buffer;
481 BGR8Buffer = nullptr;
482 }
484}
FOnWindowClosed OnWindowClosedDelegate
Definition: Camera.h:364
TSharedPtr< ROSMessages::sensor_msgs::Image > ImageMsg
Definition: Camera.h:366
int32 CurrentBufferSize
Definition: Camera.h:382
void ReleaseFrameGrabber()
Definition: Camera.cpp:672
uint8 * BGR8Buffer
Definition: Camera.h:380
TWeakObjectPtr< UMaterialInstanceDynamic > IceMaterialInstance
Definition: Camera.h:300
static void RemoveTick(FTickEntry TickEntry)
Definition: TickManager.cpp:80

References BGR8Buffer, CaptureComponent2D, CaptureRenderTarget, CurrentBufferSize, IceMaterialInstance, ImageMsg, OnPostTickDelegate, OnPreTickDelegate, OnWindowClosedDelegate, ReleaseFrameGrabber(), ATickManager::RemoveTick(), TickEntry, UnrealWindow, and UseParallelLateTick.

◆ FrameGrabberCapture()

void ACamera::FrameGrabberCapture ( )
private

Capture screen pixels with FrameGrabber

Definition at line 553 of file Camera.cpp.

554{
555 TRACE_CPUPROFILER_EVENT_SCOPE(ACamera::FrameGrabberCapture);
556
557 if (!ShouldSimulateCamera || !FrameGrabber.IsValid())
558 {
559 return;
560 }
561
563 {
564 return;
565 }
566
567 TArray<FCapturedFrameData> Frames = FrameGrabber->GetCapturedFrames();
568 if (Frames.Num())
569 {
570 FCapturedFrameData& LastFrame = Frames.Last();
571 TArray<FColor>& ImageBuffer = LastFrame.ColorBuffer;
572
573 AddProcessingToFrameBuffer(ImageBuffer);
574
576 {
578 {
581 }
582
583 AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [this, ImageBuffer]()
584 {
586 });
587 }
588
590 }
591}
TSharedPtr< FFrameGrabber > FrameGrabber
Definition: Camera.h:335
FCameraBaseParameters CameraParameters
Definition: Camera.h:351
void SaveImageToDisk(const TArray< FColor > FrameBuffer, int32 Width, int32 Height)
Definition: Camera.cpp:753
bool ShouldSimulateCamera
Definition: Camera.h:373
void SendImageDataToROS(const TArray< FColor > &FrameBuffer, int32 Width, int32 Height)
Definition: Camera.cpp:689
bool SaveCurrentFrameToDiskRequested
Definition: Camera.h:371
void CreateLogFile() override
Definition: Camera.cpp:90
virtual void AddProcessingToFrameBuffer(TArray< FColor > &buffer)
Definition: Camera.cpp:593
int32 ImageHeight
Definition: Camera.h:369
int32 ImageWidth
Definition: Camera.h:368
bool SendDataToROS
Definition: Sensor.h:364

References AddProcessingToFrameBuffer(), CameraParameters, CreateLogFile(), FrameGrabber, FrameGrabberCapture(), ImageHeight, ImageWidth, SaveCurrentFrameToDiskRequested, SaveImageToDisk(), FCameraBaseParameters::SaveImageToDisk, ASensor::SendDataToROS, SendImageDataToROS(), and ShouldSimulateCamera.

Referenced by EndOfFrame(), EndOfFrameParellel(), and FrameGrabberCapture().

◆ GetCameraHeight()

int32 ACamera::GetCameraHeight ( ) const
inline

Definition at line 207 of file Camera.h.

208 {
209 return ImageHeight;
210 }

Referenced by ADVSCamera::ChangeParametersInternal(), ADVSCamera::Init(), and ADVSCamera::SimulateDVS().

◆ GetCameraParameters()

FCameraBaseParameters ACamera::GetCameraParameters ( )
inline

Get current Camera parameters

Returns
FCameraBaseParameters struct

Definition at line 91 of file Camera.h.

92 {
93 return CameraParameters;
94 }

Referenced by USimulatorJsonExporter::ExportSensorToJSON(), and ADataCapture::SetupDataCapture().

◆ GetCameraWidth()

int32 ACamera::GetCameraWidth ( ) const
inline

Definition at line 201 of file Camera.h.

202 {
203 return ImageWidth;
204 }

Referenced by ADVSCamera::ChangeParametersInternal(), ADVSCamera::Init(), and ADVSCamera::SimulateDVS().

◆ GetCaptureComponent2D()

USceneCaptureComponent2D * ACamera::GetCaptureComponent2D ( ) const
inline

Get CaptureComponent USceneCaptureComponent2D pointer.

Returns
USceneCaptureComponent2D pointer

Definition at line 114 of file Camera.h.

115 {
116 return CaptureComponent2D;
117 }

Referenced by ADepthCamera::SetupDepthMaterial(), and AThermalCamera::SetupMaterial().

◆ GetCaptureRenderTarget2D()

UTextureRenderTarget2D * ACamera::GetCaptureRenderTarget2D ( ) const
inline

Get UTextureRenderTarget2D pointer.

Returns
UTextureRenderTarget2D pointer

Definition at line 124 of file Camera.h.

125 {
126 return CaptureRenderTarget;
127 }

◆ GetParametersAsString()

virtual FString ACamera::GetParametersAsString ( ) const
inlineoverridevirtual

Get current LidarParameters struct fields as one string.

Reimplemented from ASensor.

Reimplemented in ADepthCamera, ADVSCamera, and AThermalCamera.

Definition at line 221 of file Camera.h.

222 {
224 }
static FString StructToString(const InStructType &InStruct)
Definition: Sensor.h:325

◆ GetSensorType()

virtual ESensorTypes ACamera::GetSensorType ( ) const
inlineoverridevirtual

Get type of the sensor

Returns
Sensor's type

Reimplemented from ASensor.

Reimplemented in ADepthCamera, ADVSCamera, AInstanceSegmentationCamera, ASemanticSegmentationCamera, and AThermalCamera.

Definition at line 74 of file Camera.h.

75 {
77 }

References RGBCamera.

Referenced by SetupCamera(), and StartFrameGrabber().

◆ HidePrimitiveComponent()

void ACamera::HidePrimitiveComponent ( UPrimitiveComponent *  PrimitiveComponent)
protected

Definition at line 633 of file Camera.cpp.

634{
635 if (PrimitiveComponent && CaptureComponent2D)
636 {
637 CaptureComponent2D->HideComponent(PrimitiveComponent);
638 }
639}

References CaptureComponent2D.

Referenced by BeginPlay().

◆ Init()

void ACamera::Init ( FCameraBaseParameters  parameters,
bool  SimulateSensor = true 
)
virtual

Initialize new Camera sensor

Parameters
FCameraBaseParametersCameraParameters struct

Reimplemented in ADepthCamera, ADVSCamera, AInstanceSegmentationCamera, ASemanticSegmentationCamera, and AThermalCamera.

Definition at line 83 of file Camera.cpp.

84{
86 SetSimulateSensor(SimulateSensor);
87 SetupCamera(parameters);
88}
virtual void CreateDataSavePath()
Definition: Sensor.cpp:254
void SetSimulateSensor(bool SimulateSensor)
Definition: Sensor.h:160

References ASensor::CreateDataSavePath(), ASensor::SetSimulateSensor(), and SetupCamera().

Referenced by USensorFactory::SpawnCamera().

◆ OnWindowClosed()

void ACamera::OnWindowClosed ( const TSharedRef< SWindow > &  Window)
private

On camera window closed event

Parameters
Windowreference to SWindow pointer

Definition at line 829 of file Camera.cpp.

830{
831#if WITH_EDITOR
832 UE_LOG(LogTemp, Warning, TEXT("Camera.cpp: Camera window closed. Destroying Camera sensor.."));
833#endif
834
835 // Broadcast event that this Camera sensor is about be destroyed when user has clicked Window Close button.
836 OnCameraWindowClosed.Broadcast(this);
837
838 // Destroy this camera sensor
839 this->Destroy();
840}
FCameraDelegate_OnWindowClosed OnCameraWindowClosed
Definition: Camera.h:141

References Destroy, and OnCameraWindowClosed.

Referenced by SetupCamera().

◆ PreActorTick()

void ACamera::PreActorTick ( UWorld *  World,
ELevelTick  TickType,
float  DeltaSeconds 
)
protected

Definition at line 486 of file Camera.cpp.

487{
488 TRACE_CPUPROFILER_EVENT_SCOPE(ACamera::PreActorTick);
489
490 // If this Camera sensor is attached to Drone, keep the camera steady kind of like a Gimbal.
492 {
493 if (SensorSetRotation == FRotator::ZeroRotator)
494 {
495 // Save garage sensor values
496 SensorSetRotation = GetTransform().Rotator();
497 }
498 FRotator gimbalRot = FRotator(SensorSetRotation.Pitch, GetActorRotation().Yaw, SensorSetRotation.Roll);
499 SetActorRotation(gimbalRot);
500 }
501
502 if (ShouldSimulate(DeltaSeconds) && CaptureComponent2D)
503 {
504 // Capture scene now.
505 // We could use CaptureSceneDeferred but it would not work if World (Spectator) Rendering is disabled.
506 CaptureComponent2D->CaptureScene();
507
508 // Inform FrameGrabber to capture this frame
509 if (FrameGrabber.IsValid())
510 {
511 FrameGrabber->CaptureThisFrame(FFramePayloadPtr());
512 }
513 }
514}
FRotator SensorSetRotation
Definition: Camera.h:306
bool ShouldSimulate(const float DeltaSeconds)
Definition: Camera.cpp:526
bool IsVehicleInGarage() const
Definition: Vehicle.h:133

References AllowGimbal, CaptureComponent2D, DronePtr, FrameGrabber, AVehicle::IsVehicleInGarage(), PreActorTick(), SensorSetRotation, and ShouldSimulate().

Referenced by BeginPlay(), and PreActorTick().

◆ ReleaseFrameGrabber()

void ACamera::ReleaseFrameGrabber ( )
private

Release FrameGrabber and destroy UTexture2D

Definition at line 672 of file Camera.cpp.

673{
674 if (FrameGrabber.IsValid())
675 {
676 FrameGrabber->StopCapturingFrames();
677 FrameGrabber->Shutdown();
678 FrameGrabber.Reset();
679 }
680
682 {
683 CaptureFrameTexture->RemoveFromRoot();
684 CaptureFrameTexture->ConditionalBeginDestroy();
685 CaptureFrameTexture = nullptr;
686 }
687}
UTexture2D * CaptureFrameTexture
Definition: Camera.h:294

References CaptureFrameTexture, and FrameGrabber.

Referenced by EndPlay(), and StartFrameGrabber().

◆ RemovePostProcessingMaterial()

void ACamera::RemovePostProcessingMaterial ( UMaterial *  Material)

Removes a specified post-processing material.

Parameters
MaterialA pointer to the material to be removed.

Definition at line 74 of file Camera.cpp.

75{
77 {
78 FPostProcessSettings& PostProcessSettings = CaptureComponent2D->PostProcessSettings;
79 PostProcessSettings.RemoveBlendable(Material);
80 }
81}

References CaptureComponent2D.

Referenced by ADepthCamera::SetupDepthMaterial().

◆ RemoveWidgetFromWindow()

void ACamera::RemoveWidgetFromWindow ( UWidget *  WidgetToRemove)

Remove Widget from custom Unreal Window

Definition at line 850 of file Camera.cpp.

851{
852 if (UnrealWindow.IsValid() && WidgetToRemove)
853 {
854 UnrealWindow->RemoveUWidgetFromWindow(WidgetToRemove);
855 }
856}

References UnrealWindow.

◆ ResizeCamera()

void ACamera::ResizeCamera ( int32  Width = 1280,
int32  Height = 720 
)

Resize camera and custom Unreal Window certain size

Definition at line 878 of file Camera.cpp.

879{
880 if (Width == 0 || Height == 0)
881 {
882 return;
883 }
884
885 CameraParameters.Width = Width;
886 CameraParameters.Height = Height;
888}
void ChangeCameraParameters(FCameraBaseParameters newParameters)
Definition: Camera.cpp:54

References CameraParameters, ChangeCameraParameters(), FCameraBaseParameters::Height, and FCameraBaseParameters::Width.

◆ SaveCameraMetaDataToDisk()

void ACamera::SaveCameraMetaDataToDisk ( const FString &  ImageName)
protected

Definition at line 794 of file Camera.cpp.

795{
796 if (!IsValid(LogFile))
797 {
798 // If the log file located in base class is not valid, return here.
799 return;
800 }
801
802 const FVector ActorPosition = GetActorLocation();
803 const FRotator ActorRotation = GetActorRotation();
804
805 const FString TimeStamp = CreateTimeStampString();
806 FString MetaData;
807
809 {
810 FGeographicCoordinates GeoCoordinates = UCoordinateConversionUtilities::UnrealToGeographicCoordinates(GeoReferencingSystem, ActorPosition);
811 MetaData = FString::Printf(TEXT("%s, %s, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f, %.8f, %.8f, %.8f"),
812 *TimeStamp, *ImageName,
813 ActorPosition.X, ActorPosition.Y, ActorPosition.Z,
814 ActorRotation.Pitch, ActorRotation.Yaw, ActorRotation.Roll,
815 GeoCoordinates.Latitude, GeoCoordinates.Longitude, GeoCoordinates.Altitude);
816 }
817 else
818 {
819 MetaData = FString::Printf(TEXT("%s, %s, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f"),
820 *TimeStamp, *ImageName,
821 ActorPosition.X, ActorPosition.Y, ActorPosition.Z,
822 ActorRotation.Pitch, ActorRotation.Yaw, ActorRotation.Roll);
823 }
824
825 // Write to the log file (this is written after sensor is destroyed)
826 WriteToLogFile(MetaData);
827}
FString CreateTimeStampString() const
Definition: Sensor.cpp:330
static FGeographicCoordinates UnrealToGeographicCoordinates(AGeoReferencingSystem *GeoReferencingSystem, const FVector &Position)

References ASensor::CreateTimeStampString(), GeoReferencingSystem, ASensor::LogFile, UCoordinateConversionUtilities::UnrealToGeographicCoordinates(), and ASensor::WriteToLogFile().

Referenced by SaveImageToDisk().

◆ SaveCurrentFrameToDisk()

void ACamera::SaveCurrentFrameToDisk ( )
inline

Saves this frame to disk even if CameraParameters.SaveImageToDisk is set to false.

Definition at line 192 of file Camera.h.

193 {
195 {
197 }
198 }

Referenced by ADataCapture::CaptureDataNow().

◆ SaveImageToDisk()

void ACamera::SaveImageToDisk ( const TArray< FColor >  FrameBuffer,
int32  Width,
int32  Height 
)
protected

Save Image data as png to disk

Parameters
FrameBufferImage buffer
widthImage width
heightImage height

Definition at line 753 of file Camera.cpp.

754{
755 TRACE_CPUPROFILER_EVENT_SCOPE(ACamera::SaveImageToDisk);
756
757 if (FrameBuffer.IsEmpty() || Width == 0 || Height == 0)
758 {
759 return;
760 }
761
762 int32 Size = Width * Height;
763 if (FrameBuffer.Num() != Size)
764 {
765 const FString Msg = "Camera sensor: Unable to save Image to disk. FrameBuffer size and resolution don't match!";
767 return;
768 }
769
770 const FString ImageName = FString::Printf(TEXT("image_%d.png"), ImageNumber);
771 const FString FullFileName = FString::Printf(TEXT("%s%s"), *FileSavePath, *ImageName);
772 ++ImageNumber;
773
774 SaveCameraMetaDataToDisk(ImageName);
775
776 FIntPoint DestSize(Width, Height);
777 TImagePixelData<FColor> PixelData(DestSize);
778 PixelData.Pixels = FrameBuffer;
779
780 // Create ImageTask
781 TUniquePtr<FImageWriteTask> ImageTask = MakeUnique<FImageWriteTask>();
782 ImageTask->PixelData = MakeUnique<TImagePixelData<FColor>>(PixelData);
783 ImageTask->Filename = FullFileName;
784 ImageTask->Format = EImageFormat::PNG;
785 ImageTask->CompressionQuality = (int32)EImageCompressionQuality::Default;
786 ImageTask->bOverwriteFile = true;
787 ImageTask->PixelPreProcessors.Add(TAsyncAlphaWrite<FColor>(255));
788
789 // Get Screenshot config and enqueue image save task
790 FHighResScreenshotConfig& HighResScreenshotConfig = GetHighResScreenshotConfig();
791 TFuture<bool> CompletionFuture = HighResScreenshotConfig.ImageWriteQueue->Enqueue(MoveTemp(ImageTask));
792}
int32 ImageNumber
Definition: Camera.h:378
void SaveCameraMetaDataToDisk(const FString &ImageName)
Definition: Camera.cpp:794

References ASensor::FileSavePath, ImageNumber, SimulatorLog::Log(), SaveCameraMetaDataToDisk(), and SaveImageToDisk().

Referenced by FrameGrabberCapture(), and SaveImageToDisk().

◆ SendImageDataToROS()

void ACamera::SendImageDataToROS ( const TArray< FColor > &  FrameBuffer,
int32  Width,
int32  Height 
)
protected

Construct ROS Image msg and send data to ROS topic

Parameters
FrameBufferPixel array
widthImage width
heightImage height

Definition at line 689 of file Camera.cpp.

690{
691 TRACE_CPUPROFILER_EVENT_SCOPE(ACamera::SendImageDataToROS);
692
693 UTopic* Topic = GetROSTopic();
694 if (!SendDataToROS
695 || !Topic
696 || !IsROSConnected()
697 || FrameBuffer.IsEmpty()
698 || !ImageMsg.IsValid())
699 {
700 return;
701 }
702
703 // Cast TArray<FColor> into uint8[] data with all channels (RBGA)
704 // If you want to send RGBA data, uncomment the following lines
705 // and comment the BGR8Buffer conversion below
706 //ImageMsg->encoding = "bgra8";
707 //ImageMsg->step = Width * 4;
708 //ImageMsg->data = const_cast<uint8*>(reinterpret_cast<const uint8*>(FrameBuffer.GetData()));
709
710 // Convert TArray<FColor> to uint8[] data without alpha channel
711 // By removing alpha channel, we reduce ~25% of ROS bandwidth,
712 // but costs a bit more in processing time here
713 const int32 BufferSize = Width * Height * 3;
714 if (!BGR8Buffer || CurrentBufferSize != BufferSize)
715 {
716 // Resize buffer if needed
717 delete[] BGR8Buffer;
718 BGR8Buffer = new uint8[BufferSize];
719 CurrentBufferSize = BufferSize;
720 }
721
722 const FColor* RESTRICT Source = FrameBuffer.GetData();
723 uint8* RESTRICT Dest = BGR8Buffer;
724 const int32 PixelCount = FrameBuffer.Num();
725 const int32 ChunkSize = 512;
726 const int32 NumChunks = (PixelCount + ChunkSize - 1) / ChunkSize;
727
728 ParallelFor(NumChunks, [Source, Dest, ChunkSize, PixelCount](int32 ChunkIndex)
729 {
730 const int32 StartIndex = ChunkIndex * ChunkSize;
731 const int32 EndIndex = FMath::Min(StartIndex + ChunkSize, PixelCount);
732
733 for (int32 i = StartIndex; i < EndIndex; ++i)
734 {
735 const FColor& Pixel = Source[i];
736 const int32 j = i * 3;
737 Dest[j + 0] = Pixel.B;
738 Dest[j + 1] = Pixel.G;
739 Dest[j + 2] = Pixel.R;
740 }
741 }, false);
742
743 ImageMsg->data = BGR8Buffer;
744 ImageMsg->step = Width * 3;
745
746 ImageMsg->height = Height;
747 ImageMsg->width = Width;
748 ImageMsg->header.time = FROSTime::Now();
749
750 Topic->Publish(ImageMsg);
751}
UTopic * GetROSTopic() const
Definition: Sensor.h:150
FORCEINLINE bool IsROSConnected() const
Definition: Sensor.h:201

References BGR8Buffer, CurrentBufferSize, ASensor::GetROSTopic(), ImageMsg, ASensor::IsROSConnected(), ASensor::SendDataToROS, and SendImageDataToROS().

Referenced by FrameGrabberCapture(), and SendImageDataToROS().

◆ SetShadowRendering()

void ACamera::SetShadowRendering ( bool  RenderShadows)

Set should this camera USceneCaptureComponent2D render shadows

Definition at line 858 of file Camera.cpp.

859{
861 {
862 auto& CameraShowFlags = CaptureComponent2D->ShowFlags;
863 CameraShowFlags.SetDynamicShadows(RenderShadows);
864 CameraShowFlags.SetContactShadows(RenderShadows);
865 CameraShowFlags.SetCapsuleShadows(RenderShadows);
866 }
867}

References CaptureComponent2D.

Referenced by ADepthCamera::Init(), AInstanceSegmentationCamera::Init(), ASemanticSegmentationCamera::Init(), and AThermalCamera::Init().

◆ SetTemporalAA()

void ACamera::SetTemporalAA ( bool  SetTemporal)

Set USceneCaptureComponent2D TemporalAA on or off.

Definition at line 869 of file Camera.cpp.

870{
872 {
873 auto& CameraShowFlags = CaptureComponent2D->ShowFlags;
874 CameraShowFlags.SetTemporalAA(SetTemporal);
875 }
876}

References CaptureComponent2D.

Referenced by SetupCamera().

◆ SetupCamera()

void ACamera::SetupCamera ( FCameraBaseParameters  parameters)
private

Setup all needed things to make Camera operate.

Definition at line 126 of file Camera.cpp.

127{
129 {
130#if WITH_EDITOR
131 UE_LOG(LogTemp, Warning, TEXT("Camera.cpp: CaptureComponent2D is nullptr!"));
132#endif
133 return;
134 }
135
136 CameraParameters = parameters;
137
139
141 {
143 }
144
145 const bool UsePostProcessingEffects = CameraParameters.PostProcessingEffects;
146 auto& PostProcessSettings = CaptureComponent2D->PostProcessSettings;
147
148 if (parameters.UsePhysicLensDistortionEffect)
149 {
150 if (!PhysicLensDistortion.IsValid())
151 {
152 const FString Path = "/Game/Agrarsense/Materials/PostProcessingMaterials/PhysicLensDistortion.PhysicLensDistortion";
153 PhysicLensDistortion = Cast<UMaterial>(StaticLoadObject(UMaterial::StaticClass(), nullptr, *Path));
154
155 if (PhysicLensDistortion.IsValid())
156 {
157 PostProcessSettings.AddBlendable(PhysicLensDistortion.Get(), 1.0f);
158#if WITH_EDITOR
159 UE_LOG(LogTemp, Warning, TEXT("Camera.cpp: Added physics lens distortion effect."));
160#endif
161 }
162 }
163 }
164 else if (PhysicLensDistortion.IsValid())
165 {
166 PostProcessSettings.RemoveBlendable(PhysicLensDistortion.Get());
167 PhysicLensDistortion.Reset();
168#if WITH_EDITOR
169 UE_LOG(LogTemp, Warning, TEXT("Camera.cpp: Removed physics lens distortion effect."));
170#endif
171 }
172
173 if (parameters.UseIceLensEffect)
174 {
175 if (!IceMaterialInstance.IsValid())
176 {
177 const FString Path = "/Game/Agrarsense/Materials/PostProcessingMaterials/CameraPostProcessEffects/m_ice_lens_effect";
178 UMaterial* LoadedIceMaterial = Cast<UMaterial>(StaticLoadObject(UMaterial::StaticClass(), nullptr, *Path));
179
180 // Create UMaterialInstanceDynamic from LoadedIceMaterial
181 IceMaterialInstance = UMaterialInstanceDynamic::Create(LoadedIceMaterial, nullptr);
182 if (IceMaterialInstance.IsValid())
183 {
184 // Add material to CaptureComponent2D PostProcessSettings
185 PostProcessSettings.AddBlendable(IceMaterialInstance.Get(), 1.0f);
186#if WITH_EDITOR
187 UE_LOG(LogTemp, Warning, TEXT("Camera.cpp: Added ice lens effect."));
188#endif
189 }
190 }
191
192 UMaterialInstanceDynamic* IceMatInstance = IceMaterialInstance.Get();
193 if (IceMatInstance)
194 {
195 // Set IceMaterialInstance scalar parameters values
196 IceMatInstance->SetScalarParameterValue(FName("Strength"), parameters.IceLensEffectStrength);
197 IceMatInstance->SetScalarParameterValue(FName("Angle"), parameters.IceLensEffectAngle);
198#if WITH_EDITOR
199 UE_LOG(LogTemp, Warning, TEXT("Camera.cpp: Changed ice lens effect parameters."));
200#endif
201 }
202 }
203 else if (IceMaterialInstance.IsValid())
204 {
205 UMaterialInstanceDynamic* IceMatInstance = IceMaterialInstance.Get();
206 if (IceMatInstance)
207 {
208 // Remove material from CaptureComponent2D PostProcessSettings
209 PostProcessSettings.RemoveBlendable(IceMatInstance);
210 IceMaterialInstance.Reset();
211
212#if WITH_EDITOR
213 UE_LOG(LogTemp, Warning, TEXT("Camera.cpp: Removed ice lens effect."));
214#endif
215 }
216 }
217
220 const float TargetGamma = CameraParameters.TargetGamma;
221 const bool Enable16BitFormat = CameraParameters.Enable16BitFormat;
222
223 CaptureRenderTarget->InitCustomFormat(ImageWidth, ImageHeight, Enable16BitFormat ? PF_FloatRGB : PF_B8G8R8A8, !UsePostProcessingEffects);
224
225 CaptureRenderTarget->TargetGamma = TargetGamma;
226
227 // Set PostProcessSettings override (on or off)
228 PostProcessSettings.bOverride_AutoExposureMethod = UsePostProcessingEffects;
229 PostProcessSettings.bOverride_AutoExposureBias = UsePostProcessingEffects;
230 PostProcessSettings.bOverride_AutoExposureMinBrightness = UsePostProcessingEffects;
231 PostProcessSettings.bOverride_AutoExposureMaxBrightness = UsePostProcessingEffects;
232 PostProcessSettings.bOverride_AutoExposureSpeedUp = UsePostProcessingEffects;
233 PostProcessSettings.bOverride_AutoExposureSpeedDown = UsePostProcessingEffects;
234 PostProcessSettings.bOverride_HistogramLogMin = UsePostProcessingEffects;
235 PostProcessSettings.bOverride_HistogramLogMax = UsePostProcessingEffects;
236 PostProcessSettings.bOverride_CameraShutterSpeed = UsePostProcessingEffects;
237 PostProcessSettings.bOverride_CameraISO = UsePostProcessingEffects;
238 PostProcessSettings.bOverride_DepthOfFieldFstop = UsePostProcessingEffects;
239 PostProcessSettings.bOverride_DepthOfFieldMinFstop = UsePostProcessingEffects;
240 PostProcessSettings.bOverride_DepthOfFieldBladeCount = UsePostProcessingEffects;
241 PostProcessSettings.bOverride_FilmSlope = UsePostProcessingEffects;
242 PostProcessSettings.bOverride_FilmToe = UsePostProcessingEffects;
243 PostProcessSettings.bOverride_FilmShoulder = UsePostProcessingEffects;
244 PostProcessSettings.bOverride_FilmWhiteClip = UsePostProcessingEffects;
245 PostProcessSettings.bOverride_FilmBlackClip = UsePostProcessingEffects;
246 PostProcessSettings.bOverride_MotionBlurAmount = UsePostProcessingEffects;
247 PostProcessSettings.bOverride_MotionBlurMax = UsePostProcessingEffects;
248 PostProcessSettings.bOverride_MotionBlurPerObjectSize = UsePostProcessingEffects;
249 PostProcessSettings.bOverride_WhiteTemp = UsePostProcessingEffects;
250 PostProcessSettings.bOverride_WhiteTint = UsePostProcessingEffects;
251 PostProcessSettings.bOverride_ColorContrast = UsePostProcessingEffects;
252 PostProcessSettings.bOverride_SceneFringeIntensity = UsePostProcessingEffects;
253 PostProcessSettings.bOverride_ChromaticAberrationStartOffset = UsePostProcessingEffects;
254 PostProcessSettings.bOverride_AmbientOcclusionIntensity = UsePostProcessingEffects;
255 PostProcessSettings.bOverride_AmbientOcclusionRadius = UsePostProcessingEffects;
256 PostProcessSettings.bOverride_AmbientOcclusionStaticFraction = UsePostProcessingEffects;
257 PostProcessSettings.bOverride_AmbientOcclusionFadeDistance = UsePostProcessingEffects;
258 PostProcessSettings.bOverride_AmbientOcclusionPower = UsePostProcessingEffects;
259 PostProcessSettings.bOverride_AmbientOcclusionBias = UsePostProcessingEffects;
260 PostProcessSettings.bOverride_AmbientOcclusionQuality = UsePostProcessingEffects;
261 PostProcessSettings.bOverride_BloomMethod = UsePostProcessingEffects;
262 PostProcessSettings.bOverride_BloomIntensity = UsePostProcessingEffects;
263 PostProcessSettings.bOverride_BloomThreshold = UsePostProcessingEffects;
264 PostProcessSettings.bOverride_LensFlareIntensity = UsePostProcessingEffects;
265 PostProcessSettings.bOverride_DepthOfFieldFocalDistance = UsePostProcessingEffects;
266 PostProcessSettings.bOverride_DepthOfFieldDepthBlurAmount = UsePostProcessingEffects;
267 PostProcessSettings.bOverride_DepthOfFieldDepthBlurRadius = UsePostProcessingEffects;
268
269 // Set PostProcessSettings values
270 PostProcessSettings.CameraShutterSpeed = CameraParameters.ShutterSpeed;
271 PostProcessSettings.CameraISO = CameraParameters.ISO;
272 PostProcessSettings.DepthOfFieldFstop = CameraParameters.Aperture;
273 PostProcessSettings.DepthOfFieldFocalDistance = CameraParameters.FocalDistance;
274 PostProcessSettings.DepthOfFieldDepthBlurAmount = CameraParameters.DepthBlurAmount;
275 PostProcessSettings.DepthOfFieldDepthBlurRadius = CameraParameters.DepthBlurRadius;
276 PostProcessSettings.DepthOfFieldMinFstop = CameraParameters.DofMinFStop;
277 PostProcessSettings.DepthOfFieldBladeCount = CameraParameters.DofBladeCount;
278 PostProcessSettings.FilmSlope = CameraParameters.FilmSlope;
279 PostProcessSettings.FilmToe = CameraParameters.FilmToe;
280 PostProcessSettings.FilmShoulder = CameraParameters.FilmShoulder;
281 PostProcessSettings.FilmBlackClip = CameraParameters.FilmBlackClip;
282 PostProcessSettings.FilmWhiteClip = CameraParameters.FilmWhiteClip;
283 PostProcessSettings.AutoExposureMinBrightness = CameraParameters.ExposureMinBrightness;
284 PostProcessSettings.AutoExposureMaxBrightness = CameraParameters.ExposureMaxBrightness;
285 PostProcessSettings.AutoExposureSpeedUp = CameraParameters.ExposureSpeedUp;
286 PostProcessSettings.AutoExposureSpeedDown = CameraParameters.ExposureSpeedDown;
287 PostProcessSettings.MotionBlurAmount = CameraParameters.MotionBlurIntensity;
288 PostProcessSettings.MotionBlurMax = CameraParameters.MotionBlurMax;
289 PostProcessSettings.MotionBlurPerObjectSize = CameraParameters.MotionBlurMinObjSize;
290 PostProcessSettings.LensFlareIntensity = CameraParameters.LensFlareIntensity;
291 PostProcessSettings.BloomIntensity = CameraParameters.BloomIntensity;
292 PostProcessSettings.WhiteTemp = CameraParameters.WhiteTemp;
293 PostProcessSettings.WhiteTint = CameraParameters.WhiteTint;
294 PostProcessSettings.SceneFringeIntensity = CameraParameters.ChromAberrIntensity;
295 PostProcessSettings.ChromaticAberrationStartOffset = CameraParameters.ChromAberrOffset;
296
299
301 {
303 }
304 else
305 {
306 CaptureComponent2D->MaxViewDistanceOverride = -1.0f; // Infinite
307 }
308
310 {
311 // Enable HDR on CaptureSource, only allowed for RGB Camera for now.
312 CaptureComponent2D->CaptureSource = ESceneCaptureSource::SCS_FinalToneCurveHDR;
313 }
314 else
315 {
316 CaptureComponent2D->CaptureSource = ESceneCaptureSource::SCS_FinalColorLDR;
317 }
318
319 CaptureComponent2D->bUseRayTracingIfEnabled = true;
320 CaptureComponent2D->UpdateContent();
321 CaptureComponent2D->Activate();
322
324
325 const FString Encoding = "bgr8";
326
327 // Create ROS Image message
328 ImageMsg.Reset();
329 ImageMsg = MakeShared<ROSMessages::sensor_msgs::Image>();
330 ImageMsg->header.frame_id = "world";
331 ImageMsg->height = ImageWidth;
332 ImageMsg->width = ImageHeight;
333 ImageMsg->encoding = Encoding;
334 ImageMsg->is_bigendian = 0;
335 ImageMsg->step = ImageWidth * 4;
336
338
339 if (!UnrealWindow.IsValid())
340 {
341 // Create and setup UnrealWindow
342 const FString WindowName = GetSensorIdentifier() + " Window";
344
345 // Set on Window closed event
347 UnrealWindow->GetSWindow()->SetOnWindowClosed(OnWindowClosedDelegate);
348
349 // try to create Camera parameter Widget from path
350 FSoftClassPath WidgetClassPath(TEXT("/Game/Agrarsense/Widgets/Camera/WBP_CameraControlsMenu.WBP_CameraControlsMenu_C"));
351 UClass* WidgetClass = WidgetClassPath.TryLoadClass<UUserWidget>();
352
353 APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
354
355 if (WidgetClass && PlayerController)
356 {
357 UCameraWidgetBase* WidgetInstance = CreateWidget<UCameraWidgetBase>(PlayerController, WidgetClass);
358 if (WidgetInstance)
359 {
360 bool ShowGuide = false;
361 WidgetInstance->Setup(this, ShowGuide);
362 this->AddWidgetToWindow(WidgetInstance);
363 }
364 }
365 }
366
367 bool Resized = false;
368 if (UnrealWindow.IsValid())
369 {
370 UnrealWindow->SetupComponent(CaptureRenderTarget);
371 if (UnrealWindow->GetWindowWidth() != ImageWidth || UnrealWindow->GetWindowHeight() != ImageHeight)
372 {
373 UnrealWindow->ResizeWindow(ImageWidth, ImageHeight);
374 Resized = true;
375 }
376 }
377
379
380 if (Resized)
381 {
383 }
384
386 {
388 }
389}
virtual ESensorTypes GetSensorType() const override
Definition: Camera.h:74
void OnWindowClosed(const TSharedRef< SWindow > &Window)
Definition: Camera.cpp:829
void StartFrameGrabber()
Definition: Camera.cpp:641
void AddWidgetToWindow(UWidget *WidgetToAdd)
Definition: Camera.cpp:842
void SetTemporalAA(bool SetTemporal)
Definition: Camera.cpp:869
TWeakObjectPtr< UMaterial > PhysicLensDistortion
Definition: Camera.h:302
FCameraDelegate_OnWindowResized OnCameraWindowResized
Definition: Camera.h:148
float CameraFrameRate
Definition: Camera.h:375
FString GetSensorIdentifier() const
Definition: Sensor.h:75
virtual void CreateROSTopic()
Definition: Sensor.cpp:197
static bool ShouldStartWindowMinimized()
virtual void Setup(ACamera *CameraRef, bool ShowOnStartup=true)

References AddWidgetToWindow(), FCameraBaseParameters::Aperture, FCameraBaseParameters::BloomIntensity, CameraFrameRate, CameraParameters, CaptureComponent2D, CaptureRenderTarget, FCameraBaseParameters::ChromAberrIntensity, FCameraBaseParameters::ChromAberrOffset, CreateLogFile(), ASensor::CreateROSTopic(), FCameraBaseParameters::DepthBlurAmount, FCameraBaseParameters::DepthBlurRadius, FCameraBaseParameters::DofBladeCount, FCameraBaseParameters::DofMinFStop, FCameraBaseParameters::Enable16BitFormat, FCameraBaseParameters::ExposureMaxBrightness, FCameraBaseParameters::ExposureMinBrightness, FCameraBaseParameters::ExposureSpeedDown, FCameraBaseParameters::ExposureSpeedUp, FCameraBaseParameters::FilmBlackClip, FCameraBaseParameters::FilmShoulder, FCameraBaseParameters::FilmSlope, FCameraBaseParameters::FilmToe, FCameraBaseParameters::FilmWhiteClip, FCameraBaseParameters::FocalDistance, FCameraBaseParameters::FOV, ASensor::GetSensorIdentifier(), GetSensorType(), FCameraBaseParameters::Height, FCameraBaseParameters::IceLensEffectAngle, FCameraBaseParameters::IceLensEffectStrength, IceMaterialInstance, ImageHeight, ImageMsg, ImageWidth, FCameraBaseParameters::ISO, FCameraBaseParameters::LensFlareIntensity, FCameraBaseParameters::MaxViewDistanceInCmOverride, FCameraBaseParameters::MotionBlurIntensity, FCameraBaseParameters::MotionBlurMax, FCameraBaseParameters::MotionBlurMinObjSize, OnCameraWindowResized, OnWindowClosed(), OnWindowClosedDelegate, PhysicLensDistortion, FCameraBaseParameters::PostProcessingEffects, RGBCamera, FCameraBaseParameters::SaveImageToDisk, FCameraBaseParameters::SendDataToROS, ASensor::SendDataToROS, SetTemporalAA(), UCameraWidgetBase::Setup(), UAgrarsenseSettings::ShouldStartWindowMinimized(), FCameraBaseParameters::ShutterSpeed, StartFrameGrabber(), FCameraBaseParameters::TargetFrameRate, FCameraBaseParameters::TargetGamma, UnrealWindow, FCameraBaseParameters::UseHDR, FCameraBaseParameters::UseIceLensEffect, FCameraBaseParameters::UsePhysicLensDistortionEffect, FCameraBaseParameters::UseTemporalAA, FCameraBaseParameters::WhiteTemp, FCameraBaseParameters::WhiteTint, and FCameraBaseParameters::Width.

Referenced by ChangeCameraParameters(), and Init().

◆ SetUseGimbal()

void ACamera::SetUseGimbal ( bool  UseGimbal)
inline

Definition at line 213 of file Camera.h.

214 {
215 AllowGimbal = UseGimbal;
216 }

◆ ShouldSimulate()

bool ACamera::ShouldSimulate ( const float  DeltaSeconds)
private

Should this camera sensor be simulated this frame

Definition at line 526 of file Camera.cpp.

527{
528 if (!CanSimulateSensor())
529 {
530 ShouldSimulateCamera = false;
532 }
533
535 {
538 }
539
540 FrameRateTimer += DeltaSeconds;
542 {
543 FrameRateTimer = 0.0f;
546 }
547
548 ShouldSimulateCamera = false;
549
551}
float FrameRateTimer
Definition: Camera.h:376
bool CanSimulateSensor() const
Definition: Sensor.h:170

References CameraFrameRate, CameraParameters, ASensor::CanSimulateSensor(), FrameRateTimer, ShouldSimulateCamera, and FCameraBaseParameters::TargetFrameRate.

Referenced by PreActorTick().

◆ StartFrameGrabber()

void ACamera::StartFrameGrabber ( )
private

Setup and start FrameGrabber

Definition at line 641 of file Camera.cpp.

642{
643 if (!UnrealWindow.IsValid())
644 {
645#if WITH_EDITOR
646 UE_LOG(LogTemp, Warning, TEXT("Camera.cpp: UnrealWindow is nullptr!"));
647#endif
648 return;
649 }
650
651 // Destroy old FrameGrabber
653
654 TSharedPtr<FSceneViewport> SceneViewport = UnrealWindow->GetSceneViewport();
655 if (SceneViewport.IsValid() && CaptureRenderTarget)
656 {
657 EPixelFormat PixelFormat = GetPixelFormatFromRenderTargetFormat(TextureFormat);
658 FIntPoint Size = SceneViewport->GetSize();
659
661 {
662 // Currently only DVS camera needs this texture to render DVS output into separate FUnrealWindow.
663 CaptureFrameTexture = UTexture2D::CreateTransient(Size.X, Size.Y, PixelFormat);
664 CaptureFrameTexture->UpdateResource();
665 }
666
667 FrameGrabber = MakeShareable(new FFrameGrabber(SceneViewport.ToSharedRef(), Size, PixelFormat));
668 FrameGrabber->StartCapturingFrames();
669 }
670}
TEnumAsByte< ETextureRenderTargetFormat > TextureFormat
Definition: Camera.h:134

References CaptureFrameTexture, CaptureRenderTarget, DVSCamera, FrameGrabber, GetSensorType(), ReleaseFrameGrabber(), TextureFormat, and UnrealWindow.

Referenced by SetupCamera().

Member Data Documentation

◆ AllowGimbal

bool ACamera::AllowGimbal = true
protected

Definition at line 307 of file Camera.h.

Referenced by BeginPlay(), and PreActorTick().

◆ BGR8Buffer

uint8* ACamera::BGR8Buffer = nullptr
private

Definition at line 380 of file Camera.h.

Referenced by EndPlay(), and SendImageDataToROS().

◆ CameraFrameRate

float ACamera::CameraFrameRate = 0.0f
private

Definition at line 375 of file Camera.h.

Referenced by SetupCamera(), and ShouldSimulate().

◆ CameraName

FString ACamera::CameraName = "Camera "
protected

Camera title name for the new Unreal Window For example: "Camera 2 Window" or "ThermalCamera 1 Window" Accessible in inherited classes.

Definition at line 279 of file Camera.h.

Referenced by ADepthCamera::Init(), ADVSCamera::Init(), AInstanceSegmentationCamera::Init(), ASemanticSegmentationCamera::Init(), and AThermalCamera::Init().

◆ CameraParameters

FCameraBaseParameters ACamera::CameraParameters
private

Current Camera parameters.

Definition at line 351 of file Camera.h.

Referenced by FrameGrabberCapture(), ResizeCamera(), SetupCamera(), and ShouldSimulate().

◆ CaptureComponent2D

USceneCaptureComponent2D* ACamera::CaptureComponent2D = nullptr
protected

◆ CaptureFrameTexture

UTexture2D* ACamera::CaptureFrameTexture
protected

public UTexture2D variable pointer BlueprintReadOnly.

Definition at line 294 of file Camera.h.

Referenced by ReleaseFrameGrabber(), StartFrameGrabber(), and ADVSCamera::UpdateDVSWindowOutput().

◆ CaptureRenderTarget

UTextureRenderTarget2D* ACamera::CaptureRenderTarget = nullptr
protected

Definition at line 284 of file Camera.h.

Referenced by ACamera(), EndPlay(), SetupCamera(), and StartFrameGrabber().

◆ CurrentBufferSize

int32 ACamera::CurrentBufferSize = 0
private

Definition at line 382 of file Camera.h.

Referenced by EndPlay(), and SendImageDataToROS().

◆ DronePtr

APIDDrone* ACamera::DronePtr = nullptr
protected

Definition at line 305 of file Camera.h.

Referenced by BeginPlay(), and PreActorTick().

◆ FilePrefix

FString ACamera::FilePrefix = "Data/Camera_"
protected

◆ FrameGrabber

TSharedPtr<FFrameGrabber> ACamera::FrameGrabber
private

FrameGrabber TSharedPtr

Definition at line 335 of file Camera.h.

Referenced by FrameGrabberCapture(), PreActorTick(), ReleaseFrameGrabber(), and StartFrameGrabber().

◆ FrameRateTimer

float ACamera::FrameRateTimer = 0.0f
private

Definition at line 376 of file Camera.h.

Referenced by ShouldSimulate().

◆ GeoReferencingSystem

AGeoReferencingSystem* ACamera::GeoReferencingSystem = nullptr
private

Definition at line 360 of file Camera.h.

Referenced by CreateLogFile(), and SaveCameraMetaDataToDisk().

◆ IceMaterialInstance

TWeakObjectPtr<UMaterialInstanceDynamic> ACamera::IceMaterialInstance
protected

Definition at line 300 of file Camera.h.

Referenced by EndPlay(), and SetupCamera().

◆ ImageHeight

int32 ACamera::ImageHeight = 720
private

Definition at line 369 of file Camera.h.

Referenced by FrameGrabberCapture(), and SetupCamera().

◆ ImageMsg

TSharedPtr<ROSMessages::sensor_msgs::Image> ACamera::ImageMsg
private

Definition at line 366 of file Camera.h.

Referenced by EndPlay(), SendImageDataToROS(), and SetupCamera().

◆ ImageNumber

int32 ACamera::ImageNumber = 0
private

Definition at line 378 of file Camera.h.

Referenced by SaveImageToDisk().

◆ ImageWidth

int32 ACamera::ImageWidth = 1280
private

Definition at line 368 of file Camera.h.

Referenced by FrameGrabberCapture(), and SetupCamera().

◆ OnCameraWindowClosed

FCameraDelegate_OnWindowClosed ACamera::OnCameraWindowClosed

On Camera sensor destroyed event. BlueprintAssignable.

Returns
ACamera pointer

Definition at line 141 of file Camera.h.

Referenced by OnWindowClosed().

◆ OnCameraWindowResized

FCameraDelegate_OnWindowResized ACamera::OnCameraWindowResized

On Camera sensor window resized event. BlueprintAssignable.

Returns
ACamera pointer

Definition at line 148 of file Camera.h.

Referenced by ADVSCamera::EndPlay(), ADVSCamera::Init(), and SetupCamera().

◆ OnPostTickDelegate

FDelegateHandle ACamera::OnPostTickDelegate
protected

Definition at line 240 of file Camera.h.

Referenced by BeginPlay(), and EndPlay().

◆ OnPreTickDelegate

FDelegateHandle ACamera::OnPreTickDelegate
protected

Definition at line 237 of file Camera.h.

Referenced by BeginPlay(), and EndPlay().

◆ OnWindowClosedDelegate

FOnWindowClosed ACamera::OnWindowClosedDelegate
private

Definition at line 364 of file Camera.h.

Referenced by EndPlay(), and SetupCamera().

◆ ParametersChanged

bool ACamera::ParametersChanged = false
private

Definition at line 362 of file Camera.h.

◆ PhysicLensDistortion

TWeakObjectPtr<UMaterial> ACamera::PhysicLensDistortion
protected

Definition at line 302 of file Camera.h.

Referenced by SetupCamera().

◆ SaveCurrentFrameToDiskRequested

bool ACamera::SaveCurrentFrameToDiskRequested = false
private

Definition at line 371 of file Camera.h.

Referenced by FrameGrabberCapture().

◆ SensorSetRotation

FRotator ACamera::SensorSetRotation
protected

Definition at line 306 of file Camera.h.

Referenced by PreActorTick().

◆ ShouldSimulateCamera

bool ACamera::ShouldSimulateCamera = true
private

Definition at line 373 of file Camera.h.

Referenced by FrameGrabberCapture(), and ShouldSimulate().

◆ TempParams

FCameraBaseParameters ACamera::TempParams
private

Definition at line 357 of file Camera.h.

◆ TextureFormat

TEnumAsByte<ETextureRenderTargetFormat> ACamera::TextureFormat = ETextureRenderTargetFormat::RTF_RGBA8

public TEnumAsByte<ETextureRenderTargetFormat> variable BlueprintReadOnly.

Definition at line 134 of file Camera.h.

Referenced by StartFrameGrabber().

◆ TickEntry

FTickEntry ACamera::TickEntry
protected

Definition at line 298 of file Camera.h.

Referenced by BeginPlay(), and EndPlay().

◆ UnrealWindow

TSharedPtr<FUnrealWindow> ACamera::UnrealWindow
protected

◆ UseParallelLateTick

bool ACamera::UseParallelLateTick = true
protected

Definition at line 235 of file Camera.h.

Referenced by ADVSCamera::ADVSCamera(), BeginPlay(), and EndPlay().


The documentation for this class was generated from the following files: