Base class for the CARLA Game Mode. More...
#include <CarlaGameModeBase.h>
Public Member Functions | |
ACarlaGameModeBase (const FObjectInitializer &ObjectInitializer) | |
void | ApplyTextureToActor (AActor *Actor, UTexture2D *Texture, const carla::rpc::MaterialParameter &TextureParam) |
void | CheckForEmptyMeshes () |
UTexture2D * | CreateUETexture (const carla::rpc::TextureColor &Texture) |
UTexture2D * | CreateUETexture (const carla::rpc::TextureFloatColor &Texture) |
void | DebugShowSignals (bool enable) |
void | EnableEnvironmentObjects (const TSet< uint64 > &EnvObjectIds, bool Enable) |
void | EnableOverlapEvents () |
AActor * | FindActorByName (const FString &ActorName) |
TArray< FBoundingBox > | GetAllBBsOfLevel (uint8 TagQueried=0xFF) const |
const UCarlaEpisode & | GetCarlaEpisode () const |
TArray< FEnvironmentObject > | GetEnvironmentObjects (uint8 QueriedTag=0xFF) const |
const FString | GetFullMapPath () const |
ALargeMapManager * | GetLMManager () const |
const boost::optional< carla::road::Map > & | GetMap () const |
TArray< FString > | GetNamesOfAllActors () |
const FString | GetRelativeMapPath () const |
const TArray< FTransform > & | GetSpawnPointsTransforms () const |
ATrafficLightManager * | GetTrafficLightManager () |
ULevel * | GetULevelFromName (FString LevelName) |
void | LoadMapLayer (int32 MapLayers) |
void | OnLoadStreamLevel () |
void | OnUnloadStreamLevel () |
void | UnLoadMapLayer (int32 MapLayers) |
Protected Member Functions | |
void | BeginPlay () override |
void | EndPlay (const EEndPlayReason::Type EndPlayReason) override |
void | InitGame (const FString &MapName, const FString &Options, FString &ErrorMessage) override |
void | RestartPlayer (AController *NewPlayer) override |
void | Tick (float DeltaSeconds) override |
Private Member Functions | |
void | ConvertMapLayerMaskToMapNames (int32 MapLayer, TArray< FName > &OutLevelNames) |
void | GenerateSpawnPoints () |
void | OnEpisodeSettingsChanged (const FEpisodeSettings &Settings) |
void | ParseOpenDrive () |
void | RegisterEnvironmentObjects () |
void | SpawnActorFactories () |
void | StoreSpawnPoints () |
Private Attributes | |
TSet< TSubclassOf< ACarlaActorFactory > > | ActorFactories |
List of actor spawners that will be used to define and spawn the actors available in game. More... | |
TArray< ACarlaActorFactory * > | ActorFactoryInstances |
UCarlaSettingsDelegate * | CarlaSettingsDelegate = nullptr |
UCarlaEpisode * | Episode = nullptr |
UCarlaGameInstance * | GameInstance = nullptr |
int32 | LatentInfoUUID = 0 |
ALargeMapManager * | LMManager = nullptr |
boost::optional< carla::road::Map > | Map |
UObjectRegister * | ObjectRegister = nullptr |
FDelegateHandle | OnEpisodeSettingsChangeHandle |
int | PendingLevelsToLoad = 0 |
int | PendingLevelsToUnLoad = 0 |
bool | ReadyToRegisterObjects = false |
ACarlaRecorder * | Recorder = nullptr |
TArray< FTransform > | SpawnPointsTransforms |
UTaggerDelegate * | TaggerDelegate = nullptr |
ATrafficLightManager * | TrafficLightManager = nullptr |
TSubclassOf< AWeather > | WeatherClass |
The class of Weather to spawn. More... | |
Base class for the CARLA Game Mode.
Definition at line 35 of file CarlaGameModeBase.h.
ACarlaGameModeBase::ACarlaGameModeBase | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 40 of file CarlaGameModeBase.cpp.
References CarlaSettingsDelegate, Episode, ObjectRegister, Recorder, and TaggerDelegate.
void ACarlaGameModeBase::ApplyTextureToActor | ( | AActor * | Actor, |
UTexture2D * | Texture, | ||
const carla::rpc::MaterialParameter & | TextureParam | ||
) |
Definition at line 323 of file CarlaGameModeBase.cpp.
Referenced by FCarlaServer::FPimpl::BindActions().
|
overrideprotected |
Definition at line 177 of file CarlaGameModeBase.cpp.
References AWeather::ApplyWeather(), CarlaReplayer::CheckPlayAfterMapLoaded(), ALargeMapManager::ConsiderSpectatorAsEgo(), carla::rpc::WeatherParameters::Default, EnableOverlapEvents(), Episode, GameInstance, UCarlaGameInstance::GetCurrentMapLayer(), ACarlaRecorder::GetReplayer(), UCarlaEpisode::GetSettings(), GetTrafficLightManager(), UCarlaEpisode::InitializeAtBeginPlay(), LMManager, LoadMapLayer(), UCarlaGameInstance::NotifyBeginEpisode(), PendingLevelsToLoad, ReadyToRegisterObjects, Recorder, RegisterEnvironmentObjects(), ALargeMapManager::RegisterInitialObjects(), UTaggerDelegate::SetSemanticSegmentationEnabled(), FEpisodeSettings::SpectatorAsEgo, ATagger::TagActorsInLevel(), TaggerDelegate, and UCarlaEpisode::Weather.
void ACarlaGameModeBase::CheckForEmptyMeshes | ( | ) |
Definition at line 484 of file CarlaGameModeBase.cpp.
|
private |
Definition at line 703 of file CarlaGameModeBase.cpp.
References carla::rpc::All, and carla::rpc::MapLayerToString().
Referenced by LoadMapLayer(), and UnLoadMapLayer().
UTexture2D * ACarlaGameModeBase::CreateUETexture | ( | const carla::rpc::TextureColor & | Texture | ) |
Definition at line 277 of file CarlaGameModeBase.cpp.
References carla::sensor::data::Color::a, carla::rpc::Texture< T >::At(), carla::sensor::data::Color::b, carla::sensor::data::Color::g, carla::rpc::Texture< T >::GetHeight(), carla::rpc::Texture< T >::GetWidth(), and carla::sensor::data::Color::r.
Referenced by FCarlaServer::FPimpl::BindActions().
UTexture2D * ACarlaGameModeBase::CreateUETexture | ( | const carla::rpc::TextureFloatColor & | Texture | ) |
Definition at line 300 of file CarlaGameModeBase.cpp.
References carla::sensor::data::Color::a, carla::rpc::Texture< T >::At(), carla::sensor::data::Color::b, carla::sensor::data::Color::g, carla::rpc::Texture< T >::GetHeight(), carla::rpc::Texture< T >::GetWidth(), and carla::sensor::data::Color::r.
void ACarlaGameModeBase::DebugShowSignals | ( | bool | enable | ) |
Definition at line 524 of file CarlaGameModeBase.cpp.
References carla::geom::Math::GenerateRange(), carla::geom::Rotation::GetUpVector(), and Map.
void ACarlaGameModeBase::EnableEnvironmentObjects | ( | const TSet< uint64 > & | EnvObjectIds, |
bool | Enable | ||
) |
Definition at line 646 of file CarlaGameModeBase.cpp.
References UObjectRegister::EnableEnvironmentObjects(), and ObjectRegister.
Referenced by FCarlaServer::FPimpl::BindActions().
void ACarlaGameModeBase::EnableOverlapEvents | ( | ) |
Definition at line 499 of file CarlaGameModeBase.cpp.
References ATagger::GetTagOfTaggedComponent().
Referenced by BeginPlay().
|
overrideprotected |
Definition at line 384 of file CarlaGameModeBase.cpp.
References CarlaSettingsDelegate, UCarlaEpisode::EndPlay(), Episode, GameInstance, UCarlaGameInstance::NotifyEndEpisode(), FCarlaStaticDelegates::OnEpisodeSettingsChange, OnEpisodeSettingsChangeHandle, and UCarlaSettingsDelegate::Reset().
AActor * ACarlaGameModeBase::FindActorByName | ( | const FString & | ActorName | ) |
Definition at line 262 of file CarlaGameModeBase.cpp.
Referenced by FCarlaServer::FPimpl::BindActions().
|
private |
Definition at line 437 of file CarlaGameModeBase.cpp.
References Map, and SpawnPointsTransforms.
Referenced by StoreSpawnPoints().
TArray< FBoundingBox > ACarlaGameModeBase::GetAllBBsOfLevel | ( | uint8 | TagQueried = 0xFF | ) | const |
Definition at line 624 of file CarlaGameModeBase.cpp.
References UBoundingBoxCalculator::GetBoundingBoxOfActors().
Referenced by FCarlaServer::FPimpl::BindActions().
|
inline |
Definition at line 43 of file CarlaGameModeBase.h.
|
inline |
Definition at line 73 of file CarlaGameModeBase.h.
Referenced by FCarlaServer::FPimpl::BindActions().
const FString ACarlaGameModeBase::GetFullMapPath | ( | ) | const |
Definition at line 69 of file CarlaGameModeBase.cpp.
References GetRelativeMapPath().
Referenced by FCarlaServer::FPimpl::BindActions(), and UOpenDrive::GetXODR().
|
inline |
Definition at line 99 of file CarlaGameModeBase.h.
Referenced by FCarlaServer::FPimpl::BindActions(), URayTracer::CastRay(), UCarlaStatics::GetLargeMapManager(), and URayTracer::ProjectPoint().
|
inline |
Definition at line 49 of file CarlaGameModeBase.h.
Referenced by AOpenDriveGenerator::GenerateRoadMesh(), AOpenDriveGenerator::GenerateSpawnPoints(), ATrafficLightManager::GetMap(), AOpenDriveGenerator::IsOpenDriveValid(), FTrafficSignData::RestoreActorData(), and FTrafficLightData::RestoreActorData().
TArray< FString > ACarlaGameModeBase::GetNamesOfAllActors | ( | ) |
Definition at line 245 of file CarlaGameModeBase.cpp.
Referenced by FCarlaServer::FPimpl::BindActions().
const FString ACarlaGameModeBase::GetRelativeMapPath | ( | ) | const |
Definition at line 60 of file CarlaGameModeBase.cpp.
Referenced by GetFullMapPath().
|
inline |
Definition at line 65 of file CarlaGameModeBase.h.
Referenced by UCarlaEpisode::GetRecommendedSpawnPoints().
ATrafficLightManager * ACarlaGameModeBase::GetTrafficLightManager | ( | ) |
Definition at line 464 of file CarlaGameModeBase.cpp.
References GetULevelFromName(), and TrafficLightManager.
Referenced by BeginPlay().
ULevel * ACarlaGameModeBase::GetULevelFromName | ( | FString | LevelName | ) |
Definition at line 745 of file CarlaGameModeBase.cpp.
Referenced by GetTrafficLightManager(), ATrafficLightManager::RegisterLightComponentFromOpenDRIVE(), ATrafficLightManager::SpawnSignals(), and ATrafficLightManager::SpawnTrafficLights().
|
overrideprotected |
Definition at line 75 of file CarlaGameModeBase.cpp.
References UCarlaSettingsDelegate::ApplyQualityLevelPostRestart(), CarlaSettingsDelegate, Episode, GameInstance, ALargeMapManager::GenerateLargeMap(), ALargeMapManager::GetNumTiles(), ALargeMapManager::LargeMapName, LMManager, Map, UCarlaEpisode::MapName, UCarlaGameInstance::NotifyInitGame(), FCarlaStaticDelegates::OnEpisodeSettingsChange, OnEpisodeSettingsChanged(), OnEpisodeSettingsChangeHandle, ParseOpenDrive(), Recorder, UTaggerDelegate::RegisterSpawnHandler(), UCarlaSettingsDelegate::RegisterSpawnHandler(), ACarlaRecorder::SetEpisode(), UCarlaEpisode::SetRecorder(), SpawnActorFactories(), StoreSpawnPoints(), TaggerDelegate, UCarlaEpisode::Weather, and WeatherClass.
void ACarlaGameModeBase::LoadMapLayer | ( | int32 | MapLayers | ) |
Definition at line 653 of file CarlaGameModeBase.cpp.
References ConvertMapLayerMaskToMapNames(), LatentInfoUUID, and PendingLevelsToLoad.
Referenced by BeginPlay(), and FCarlaServer::FPimpl::BindActions().
|
private |
Definition at line 790 of file CarlaGameModeBase.cpp.
References CarlaSettingsDelegate, FEpisodeSettings::MaxCullingDistance, and UCarlaSettingsDelegate::SetAllActorsDrawDistance().
Referenced by InitGame().
void ACarlaGameModeBase::OnLoadStreamLevel | ( | ) |
Definition at line 768 of file CarlaGameModeBase.cpp.
References PendingLevelsToLoad, ReadyToRegisterObjects, RegisterEnvironmentObjects(), and ATagger::TagActorsInLevel().
void ACarlaGameModeBase::OnUnloadStreamLevel | ( | ) |
Definition at line 780 of file CarlaGameModeBase.cpp.
References PendingLevelsToUnLoad, ReadyToRegisterObjects, and RegisterEnvironmentObjects().
|
private |
Definition at line 451 of file CarlaGameModeBase.cpp.
References Episode, UOpenDrive::GetXODR(), carla::opendrive::OpenDriveParser::Load(), Map, and UCarlaEpisode::MapGeoReference.
Referenced by InitGame().
|
private |
Definition at line 638 of file CarlaGameModeBase.cpp.
References ObjectRegister, and UObjectRegister::RegisterObjects().
Referenced by BeginPlay(), OnLoadStreamLevel(), and OnUnloadStreamLevel().
|
overrideprotected |
Definition at line 167 of file CarlaGameModeBase.cpp.
References UCarlaSettingsDelegate::ApplyQualityLevelPreRestart(), and CarlaSettingsDelegate.
|
private |
Definition at line 399 of file CarlaGameModeBase.cpp.
References ActorFactories, ActorFactoryInstances, Episode, and UCarlaEpisode::RegisterActorFactory().
Referenced by InitGame().
|
private |
Definition at line 422 of file CarlaGameModeBase.cpp.
References GenerateSpawnPoints(), and SpawnPointsTransforms.
Referenced by InitGame().
|
overrideprotected |
Definition at line 373 of file CarlaGameModeBase.cpp.
References Recorder.
void ACarlaGameModeBase::UnLoadMapLayer | ( | int32 | MapLayers | ) |
Definition at line 678 of file CarlaGameModeBase.cpp.
References ConvertMapLayerMaskToMapNames(), LatentInfoUUID, and PendingLevelsToUnLoad.
Referenced by FCarlaServer::FPimpl::BindActions().
|
private |
List of actor spawners that will be used to define and spawn the actors available in game.
Definition at line 168 of file CarlaGameModeBase.h.
Referenced by SpawnActorFactories().
|
private |
Definition at line 174 of file CarlaGameModeBase.h.
Referenced by SpawnActorFactories().
|
private |
Definition at line 150 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), EndPlay(), InitGame(), OnEpisodeSettingsChanged(), and RestartPlayer().
|
private |
Definition at line 153 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), BeginPlay(), EndPlay(), InitGame(), ParseOpenDrive(), and SpawnActorFactories().
|
private |
Definition at line 144 of file CarlaGameModeBase.h.
Referenced by BeginPlay(), EndPlay(), and InitGame().
|
private |
Definition at line 192 of file CarlaGameModeBase.h.
Referenced by LoadMapLayer(), and UnLoadMapLayer().
|
private |
Definition at line 179 of file CarlaGameModeBase.h.
Referenced by BeginPlay(), and InitGame().
|
private |
Definition at line 183 of file CarlaGameModeBase.h.
Referenced by DebugShowSignals(), GenerateSpawnPoints(), InitGame(), and ParseOpenDrive().
|
private |
Definition at line 159 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), EnableEnvironmentObjects(), and RegisterEnvironmentObjects().
|
private |
Definition at line 181 of file CarlaGameModeBase.h.
Referenced by EndPlay(), and InitGame().
|
private |
Definition at line 185 of file CarlaGameModeBase.h.
Referenced by BeginPlay(), LoadMapLayer(), and OnLoadStreamLevel().
|
private |
Definition at line 186 of file CarlaGameModeBase.h.
Referenced by OnUnloadStreamLevel(), and UnLoadMapLayer().
|
private |
Definition at line 188 of file CarlaGameModeBase.h.
Referenced by BeginPlay(), OnLoadStreamLevel(), and OnUnloadStreamLevel().
|
private |
Definition at line 156 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), BeginPlay(), InitGame(), and Tick().
|
private |
Definition at line 171 of file CarlaGameModeBase.h.
Referenced by GenerateSpawnPoints(), and StoreSpawnPoints().
|
private |
Definition at line 147 of file CarlaGameModeBase.h.
Referenced by ACarlaGameModeBase(), BeginPlay(), and InitGame().
|
private |
Definition at line 177 of file CarlaGameModeBase.h.
Referenced by GetTrafficLightManager().
|
private |
The class of Weather to spawn.
Definition at line 163 of file CarlaGameModeBase.h.
Referenced by InitGame().