CARLA
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
UCarlaSettingsDelegate Class Reference

Used to set settings for every actor that is spawned into the world. More...

#include <CarlaSettingsDelegate.h>

+ Inheritance diagram for UCarlaSettingsDelegate:

Public Member Functions

void ApplyQualityLevelPostRestart ()
 After loading a level, apply the current settings.
 
void ApplyQualityLevelPreRestart ()
 Before loading a level, apply the current settings.
 
void RegisterSpawnHandler (UWorld *World)
 Create the event trigger handler for all the newly spawned actors to be processed with a custom function here.
 
void Reset ()
 Reset settings to default.
 
void SetAllActorsDrawDistance (UWorld *world, float max_draw_distance) const
 
 UCarlaSettingsDelegate ()
 

Private Member Functions

void ApplyPerActorQualitySettings (UWorld *world, float light_fade_distance, bool cast_directional_shadows, bool hide_non_directional_lights, float draw_distance) const
 Single-pass replacement for SetAllLights + SetAllActorsDrawDistance when applying a quality tier.
 
void CheckCarlaSettings (UWorld *world)
 Check that the world, instance and settings are valid and save the CarlaSettings instance.
 
UWorld * GetLocalWorld ()
 
void SetActorComponentsDrawDistance (AActor *actor, float max_draw_distance) const
 
void SetAllLights (UWorld *world, float max_distance_fade, bool cast_shadows, bool hide_non_directional) const
 
void SetAllRoads (UWorld *world, float max_draw_distance, const TArray< FStaticMaterial > &road_pieces_materials) const
 
void SetPostProcessEffectsEnabled (UWorld *world, bool enabled) const
 

Private Attributes

UCarlaSettings * CarlaSettings = nullptr
 

Static Private Attributes

static EQualityLevel AppliedLowPostResetQualityLevel = EQualityLevel::Epic
 Currently applied quality level after level is restarted.
 

Detailed Description

Used to set settings for every actor that is spawned into the world.

Definition at line 23 of file CarlaSettingsDelegate.h.

Constructor & Destructor Documentation

◆ UCarlaSettingsDelegate()

UCarlaSettingsDelegate::UCarlaSettingsDelegate ( )

Definition at line 34 of file CarlaSettingsDelegate.cpp.

Member Function Documentation

◆ ApplyPerActorQualitySettings()

void UCarlaSettingsDelegate::ApplyPerActorQualitySettings ( UWorld *  world,
float  light_fade_distance,
bool  cast_directional_shadows,
bool  hide_non_directional_lights,
float  draw_distance 
) const
private

Single-pass replacement for SetAllLights + SetAllActorsDrawDistance when applying a quality tier.

Walks the actor list once and dispatches per-type, halving the cost of a tier change.

Definition at line 296 of file CarlaSettingsDelegate.cpp.

References UCarlaSettings::CARLA_ROAD_TAG, UCarlaSettings::CARLA_SKY_TAG, IsValid(), and SetActorComponentsDrawDistance().

Referenced by ApplyQualityLevelPostRestart().

◆ ApplyQualityLevelPostRestart()

void UCarlaSettingsDelegate::ApplyQualityLevelPostRestart ( )

◆ ApplyQualityLevelPreRestart()

void UCarlaSettingsDelegate::ApplyQualityLevelPreRestart ( )

Before loading a level, apply the current settings.

Definition at line 67 of file CarlaSettingsDelegate.cpp.

References UCarlaSettings::bDisableRendering, CarlaSettings, CheckCarlaSettings(), and IsValid().

Referenced by ACarlaGameModeBase::RestartPlayer().

◆ CheckCarlaSettings()

void UCarlaSettingsDelegate::CheckCarlaSettings ( UWorld *  world)
private

Check that the world, instance and settings are valid and save the CarlaSettings instance.

Parameters
worldused to get the instance of CarlaSettings.

Definition at line 97 of file CarlaSettingsDelegate.cpp.

References CarlaSettings, GetLocalWorld(), and IsValid().

Referenced by ApplyQualityLevelPostRestart(), ApplyQualityLevelPreRestart(), and RegisterSpawnHandler().

◆ GetLocalWorld()

UWorld * UCarlaSettingsDelegate::GetLocalWorld ( )
private

Definition at line 92 of file CarlaSettingsDelegate.cpp.

Referenced by CheckCarlaSettings().

◆ RegisterSpawnHandler()

void UCarlaSettingsDelegate::RegisterSpawnHandler ( UWorld *  World)

Create the event trigger handler for all the newly spawned actors to be processed with a custom function here.

Definition at line 41 of file CarlaSettingsDelegate.cpp.

References CheckCarlaSettings().

Referenced by ACarlaGameModeBase::InitGame().

◆ Reset()

void UCarlaSettingsDelegate::Reset ( )

Reset settings to default.

Definition at line 36 of file CarlaSettingsDelegate.cpp.

References AppliedLowPostResetQualityLevel, and Epic.

Referenced by ACarlaGameModeBase::EndPlay().

◆ SetActorComponentsDrawDistance()

void UCarlaSettingsDelegate::SetActorComponentsDrawDistance ( AActor *  actor,
float  max_draw_distance 
) const
private

◆ SetAllActorsDrawDistance()

void UCarlaSettingsDelegate::SetAllActorsDrawDistance ( UWorld *  world,
float  max_draw_distance 
) const

@TODO: use semantics to grab all actors by type (vehicles,ground,people,props) and set different distances configured in the global properties

Definition at line 205 of file CarlaSettingsDelegate.cpp.

References UCarlaSettings::CARLA_ROAD_TAG, UCarlaSettings::CARLA_SKY_TAG, IsValid(), and SetActorComponentsDrawDistance().

Referenced by ACarlaGameModeBase::OnEpisodeSettingsChanged().

◆ SetAllLights()

void UCarlaSettingsDelegate::SetAllLights ( UWorld *  world,
float  max_distance_fade,
bool  cast_shadows,
bool  hide_non_directional 
) const
private

Definition at line 258 of file CarlaSettingsDelegate.cpp.

References IsValid().

◆ SetAllRoads()

void UCarlaSettingsDelegate::SetAllRoads ( UWorld *  world,
float  max_draw_distance,
const TArray< FStaticMaterial > &  road_pieces_materials 
) const
private

Definition at line 114 of file CarlaSettingsDelegate.cpp.

References UCarlaSettings::CARLA_ROAD_TAG, and IsValid().

Referenced by ApplyQualityLevelPostRestart().

◆ SetPostProcessEffectsEnabled()

void UCarlaSettingsDelegate::SetPostProcessEffectsEnabled ( UWorld *  world,
bool  enabled 
) const
private

Definition at line 239 of file CarlaSettingsDelegate.cpp.

References IsValid().

Referenced by ApplyQualityLevelPostRestart().

Member Data Documentation

◆ AppliedLowPostResetQualityLevel

EQualityLevel UCarlaSettingsDelegate::AppliedLowPostResetQualityLevel = EQualityLevel::Epic
staticprivate

Currently applied quality level after level is restarted.

quality settings configuration between runs

Definition at line 86 of file CarlaSettingsDelegate.h.

Referenced by ApplyQualityLevelPostRestart(), and Reset().

◆ CarlaSettings

UCarlaSettings* UCarlaSettingsDelegate::CarlaSettings = nullptr
private

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