3 #include "HAL/IConsoleManager.h" 15 : Super(ObjectInitializer)
19 TEXT(
"Material'/Carla/PostProcessingMaterials/PhysicLensDistortion.PhysicLensDistortion'"));
21 TEXT(
"Material'/Carla/PostProcessingMaterials/VelocityMaterial.VelocityMaterial'"));
26 auto CVarForceOutputsVelocity =
IConsoleManager::Get().FindConsoleVariable(TEXT(
"r.BasePassForceOutputsVelocity"));
27 int32 OldValue = CVarForceOutputsVelocity->GetInt();
28 CVarForceOutputsVelocity->Set(1);
30 std::function<TArray<float>(
void *, uint32)> Conversor = [](
void *Data, uint32 Size)
32 TArray<float> IntermediateBuffer;
33 int32 Count = Size /
sizeof(FFloat16Color);
35 FFloat16Color *Buf =
reinterpret_cast<FFloat16Color *
>(Data);
36 IntermediateBuffer.Reserve(Count * 2);
37 for (
int i=0; i<Count; ++i)
39 float x = (Buf->R.GetFloat() - 0.5f) * 4.f;
40 float y = (Buf->G.GetFloat() - 0.5f) * 4.f;
41 IntermediateBuffer.Add(x);
42 IntermediateBuffer.Add(y);
45 return IntermediateBuffer;
47 FPixelReader::SendPixelsInRenderThread<AOpticalFlowCamera, float>(*
this,
true, Conversor);
49 CVarForceOutputsVelocity->Set(OldValue);
void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds) override
AOpticalFlowCamera(const FObjectInitializer &ObjectInitializer)
bool AddPostProcessingMaterial(const FString &Path)
Load the UMaterialInstanceDynamic at the given Path and append it to the list of shaders with Weight...
A definition of a Carla Actor with all the variation and attributes.
static T Get(carla::rpc::Response< T > &response)
#define DEBUG_ASSERT(predicate)
static FActorDefinition GetSensorDefinition()
static FActorDefinition MakeCameraDefinition(const FString &Id, bool bEnableModifyingPostProcessEffects=false)
void Enable16BitFormat(bool Enable=false)