|
CARLA
|
Show-only ("render layer") filter shared by every scene-capture camera. More...
#include <ShowOnlyFilter.h>
Public Types | |
| using | Label = carla::rpc::CityObjectLabel |
Public Member Functions | |
| void | ApplyTo (USceneCaptureComponent2D &Capture) const |
| Push the current list into Capture (or restore full-scene rendering when the filter is disabled). | |
| int32 | GetCachedActorCount () const |
| const TSet< Label > & | GetShadowCatcherTags () const |
| const TSet< uint32 > & | GetShowOnlyActorIds () const |
| const TSet< Label > & | GetShowOnlyTags () const |
| bool | IsEnabled () const |
| void | MarkDirty () |
| Force a rescan on the next Refresh. | |
| void | Refresh (UWorld *World, const UCarlaEpisode *Episode) |
| Rebuild the cached actor list if the world changed since the last call. | |
| void | SetShadowCatcherTags (const FString &CommaSeparated) |
| void | SetShowOnlyActorIds (const FString &CommaSeparated) |
| void | SetShowOnlyTags (const FString &CommaSeparated) |
Static Public Member Functions | |
| static bool | ParseLabels (const FString &CommaSeparated, TSet< Label > &OutLabels, FString &OutUnknown) |
| Parse a comma separated list of label names into OutLabels using the tagger's own name mapping. | |
Private Member Functions | |
| void | Rescan (UWorld *World, const UCarlaEpisode *Episode) |
Private Attributes | |
| TSet< uint32 > | ActorIds |
| bool | bDirty = true |
| TArray< TWeakObjectPtr< AActor > > | CachedActors |
| int32 | LastActorCount = -1 |
| TSet< Label > | ShadowCatcherTags |
| TSet< Label > | ShowOnlyTags |
Show-only ("render layer") filter shared by every scene-capture camera.
Selected through three blueprint attributes:
show_only_tags comma separated CARLA semantic label names ("Car,Truck,Bus,Motorcycle,Bicycle,Pedestrians"). shadow_catcher_tags same format; actors carrying these labels are rendered too so they can receive the cast shadows of the show-only actors ("Roads,Sidewalks"). show_only_actor_ids comma separated CARLA actor ids, added to the list whatever their labels.
When show_only_tags or show_only_actor_ids is non-empty the capture components switch to PRM_UseShowOnlyList and their ShowOnlyActors list is the set of world actors carrying at least one of the labels (any primitive component, ATagger label tag or custom-depth stencil), plus the id list. Everything else is neither rendered nor casts shadows into the capture (the renderer filters shadow casters through the same list), so the empty pixels carry only the sky / atmosphere in colour captures, stencil 0 in the segmentation captures and the far plane in depth.
The actor scan runs only when the world's actor count changes (spawn or destroy) so newly spawned vehicles show up on the next capture; every other tick costs one integer compare plus copying the cached list into the capture components.
Definition at line 48 of file ShowOnlyFilter.h.
Definition at line 50 of file ShowOnlyFilter.h.
| void FCarlaShowOnlyFilter::ApplyTo | ( | USceneCaptureComponent2D & | Capture | ) | const |
Push the current list into Capture (or restore full-scene rendering when the filter is disabled).
Definition at line 173 of file ShowOnlyFilter.cpp.
References CachedActors, and IsEnabled().
Referenced by ASceneCaptureSensor_WideAngleLens::CaptureSceneExtended(), and ASceneCaptureSensor::EnqueueRenderSceneImmediate().
|
inline |
Definition at line 84 of file ShowOnlyFilter.h.
|
inline |
Definition at line 69 of file ShowOnlyFilter.h.
|
inline |
Definition at line 70 of file ShowOnlyFilter.h.
|
inline |
Definition at line 68 of file ShowOnlyFilter.h.
|
inline |
Definition at line 63 of file ShowOnlyFilter.h.
Referenced by ApplyTo(), ASceneCaptureSensor_WideAngleLens::CaptureSceneExtended(), ASceneCaptureSensor::EnqueueRenderSceneImmediate(), and Refresh().
|
inline |
Force a rescan on the next Refresh.
Definition at line 82 of file ShowOnlyFilter.h.
|
static |
Parse a comma separated list of label names into OutLabels using the tagger's own name mapping.
Returns false and fills OutUnknown with the tokens that map to no label (they are skipped).
Definition at line 20 of file ShowOnlyFilter.cpp.
References ATagger::GetTagFromString().
Referenced by SetShadowCatcherTags(), and SetShowOnlyTags().
| void FCarlaShowOnlyFilter::Refresh | ( | UWorld * | World, |
| const UCarlaEpisode * | Episode | ||
| ) |
Rebuild the cached actor list if the world changed since the last call.
Cheap when nothing changed. Episode may be null (ids are then ignored).
Definition at line 102 of file ShowOnlyFilter.cpp.
References bDirty, IsEnabled(), LastActorCount, and Rescan().
Referenced by ASceneCaptureSensor_WideAngleLens::CaptureSceneExtended(), and ASceneCaptureSensor::EnqueueRenderSceneImmediate().
|
private |
Definition at line 117 of file ShowOnlyFilter.cpp.
References ActorIds, CachedActors, FActorRegistry::FindCarlaActor(), FCarlaActor::GetActor(), UCarlaEpisode::GetActorRegistry(), ATagger::GetTagOfTaggedComponent(), IsValid(), ShadowCatcherTags, and ShowOnlyTags.
Referenced by Refresh().
| void FCarlaShowOnlyFilter::SetShadowCatcherTags | ( | const FString & | CommaSeparated | ) |
Definition at line 69 of file ShowOnlyFilter.cpp.
References bDirty, ParseLabels(), ShadowCatcherTags, and ShowOnlyFilter_WarnUnknown().
| void FCarlaShowOnlyFilter::SetShowOnlyActorIds | ( | const FString & | CommaSeparated | ) |
Definition at line 77 of file ShowOnlyFilter.cpp.
| void FCarlaShowOnlyFilter::SetShowOnlyTags | ( | const FString & | CommaSeparated | ) |
Definition at line 61 of file ShowOnlyFilter.cpp.
References bDirty, ParseLabels(), ShowOnlyFilter_WarnUnknown(), and ShowOnlyTags.
|
private |
Definition at line 92 of file ShowOnlyFilter.h.
Referenced by Rescan(), and SetShowOnlyActorIds().
|
private |
Definition at line 96 of file ShowOnlyFilter.h.
Referenced by Refresh(), SetShadowCatcherTags(), SetShowOnlyActorIds(), and SetShowOnlyTags().
|
private |
Definition at line 94 of file ShowOnlyFilter.h.
|
private |
Definition at line 95 of file ShowOnlyFilter.h.
Referenced by Refresh().
|
private |
Definition at line 91 of file ShowOnlyFilter.h.
Referenced by Rescan(), and SetShadowCatcherTags().
|
private |
Definition at line 90 of file ShowOnlyFilter.h.
Referenced by Rescan(), and SetShowOnlyTags().