CARLA
Loading...
Searching...
No Matches
NormalsCamera.cpp
Go to the documentation of this file.
1// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
8#include "Carla.h"
10
15
16ANormalsCamera::ANormalsCamera(const FObjectInitializer &ObjectInitializer)
17 : Super(ObjectInitializer)
18{
19 Enable16BitFormat(false);
21 TEXT("Material'/Carla/PostProcessingMaterials/PhysicLensDistortion.PhysicLensDistortion'"));
23 TEXT("Material'/Carla/PostProcessingMaterials/NormalsEffectMaterial.NormalsEffectMaterial'"));
24}
25
26void ANormalsCamera::PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds)
27{
28 TRACE_CPUPROFILER_EVENT_SCOPE(ANormalsCamera::PostPhysTick);
29 Super::PostPhysTick(World, TickType, DeltaSeconds);
30
32 return;
33
34 auto CaptureContext = MakeCaptureContext(*this);
35 ImageUtil::ReadSensorImageDataAsyncFColor(*this, [this, CaptureContext](
36 TArrayView<const FColor> Pixels,
37 FIntPoint Size) -> bool
38 {
39 SendDataToClient(*this, Pixels, CaptureContext);
40 return true;
41 });
42}
static FActorDefinition GetSensorDefinition()
void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds) override
ANormalsCamera(const FObjectInitializer &ObjectInitializer)
void Enable16BitFormat(bool Enable=false)
static void SendDataToClient(SensorType &&Sensor, TArrayView< ElementType > SensorData, const FSensorCaptureContext &CaptureContext)
static FSensorCaptureContext MakeCaptureContext(const ASensor &Sensor)
Call on the game thread right after CaptureScene().
bool AddPostProcessingMaterial(const FString &Path)
Load the UMaterialInstanceDynamic at the given Path and append it to the list of shaders with Weight.
bool ReadSensorImageDataAsyncFColor(AShaderBasedSensor &Sensor, ReadImageDataAsyncCallbackFColor &&Callback)
A definition of a Carla Actor with all the variation and attributes.