Added culling control (#3656)
* Added culling configuration to settings * Updated changelog
This commit is contained in:
parent
ae36a62461
commit
30db7e21d4
|
@ -1,4 +1,5 @@
|
|||
## Latest
|
||||
* Added parameter to carla settings to control culling
|
||||
* Added `load_map_layer` and `unload_map_layer` to control map layers on new maps that support subleveling
|
||||
* Added `get_environment_objects`call to get all the placed objects in the level
|
||||
* Added `enable_environment_objects`call to enable/disable objects of the level
|
||||
|
|
|
@ -37,10 +37,12 @@ namespace rpc {
|
|||
|
||||
int max_substeps = 10;
|
||||
|
||||
float max_culling_distance = 0.0f;
|
||||
|
||||
bool deterministic_ragdolls = true;
|
||||
|
||||
MSGPACK_DEFINE_ARRAY(synchronous_mode, no_rendering_mode, fixed_delta_seconds, substepping,
|
||||
max_substep_delta_time, max_substeps, deterministic_ragdolls);
|
||||
max_substep_delta_time, max_substeps, max_culling_distance, deterministic_ragdolls);
|
||||
|
||||
// =========================================================================
|
||||
// -- Constructors ---------------------------------------------------------
|
||||
|
@ -55,13 +57,16 @@ namespace rpc {
|
|||
bool substepping = true,
|
||||
double max_substep_delta_time = 0.01,
|
||||
int max_substeps = 10,
|
||||
float max_culling_distance = 0.0f,
|
||||
bool deterministic_ragdolls = true)
|
||||
: synchronous_mode(synchronous_mode),
|
||||
no_rendering_mode(no_rendering_mode),
|
||||
fixed_delta_seconds(
|
||||
fixed_delta_seconds > 0.0 ? fixed_delta_seconds : boost::optional<double>{}),
|
||||
substepping(substepping),
|
||||
max_substep_delta_time(max_substep_delta_time), max_substeps(max_substeps),
|
||||
max_substep_delta_time(max_substep_delta_time),
|
||||
max_substeps(max_substeps),
|
||||
max_culling_distance(max_culling_distance),
|
||||
deterministic_ragdolls(deterministic_ragdolls) {}
|
||||
|
||||
// =========================================================================
|
||||
|
@ -76,6 +81,7 @@ namespace rpc {
|
|||
(fixed_delta_seconds == rhs.fixed_delta_seconds) &&
|
||||
(max_substep_delta_time == rhs.max_substep_delta_time) &&
|
||||
(max_substeps == rhs.max_substeps) &&
|
||||
(max_culling_distance == rhs.max_culling_distance) &&
|
||||
(deterministic_ragdolls == rhs.deterministic_ragdolls);
|
||||
}
|
||||
|
||||
|
@ -97,6 +103,7 @@ namespace rpc {
|
|||
Settings.bSubstepping,
|
||||
Settings.MaxSubstepDeltaTime,
|
||||
Settings.MaxSubsteps,
|
||||
Settings.MaxCullingDistance,
|
||||
Settings.bDeterministicRagdolls) {}
|
||||
|
||||
operator FEpisodeSettings() const {
|
||||
|
@ -109,6 +116,7 @@ namespace rpc {
|
|||
Settings.bSubstepping = substepping;
|
||||
Settings.MaxSubstepDeltaTime = max_substep_delta_time;
|
||||
Settings.MaxSubsteps = max_substeps;
|
||||
Settings.MaxCullingDistance = max_culling_distance;
|
||||
Settings.bDeterministicRagdolls = deterministic_ragdolls;
|
||||
|
||||
return Settings;
|
||||
|
|
|
@ -141,19 +141,21 @@ void export_world() {
|
|||
;
|
||||
|
||||
class_<cr::EpisodeSettings>("WorldSettings")
|
||||
.def(init<bool, bool, double, bool, double, int, bool>(
|
||||
.def(init<bool, bool, double, bool, double, int, float, bool>(
|
||||
(arg("synchronous_mode")=false,
|
||||
arg("no_rendering_mode")=false,
|
||||
arg("fixed_delta_seconds")=0.0,
|
||||
arg("substepping")=true,
|
||||
arg("max_substep_delta_time")=0.01,
|
||||
arg("max_substeps")=10,
|
||||
arg("max_culling_distance")=0.0f,
|
||||
arg("deterministic_ragdolls")=false)))
|
||||
.def_readwrite("synchronous_mode", &cr::EpisodeSettings::synchronous_mode)
|
||||
.def_readwrite("no_rendering_mode", &cr::EpisodeSettings::no_rendering_mode)
|
||||
.def_readwrite("substepping", &cr::EpisodeSettings::substepping)
|
||||
.def_readwrite("max_substep_delta_time", &cr::EpisodeSettings::max_substep_delta_time)
|
||||
.def_readwrite("max_substeps", &cr::EpisodeSettings::max_substeps)
|
||||
.def_readwrite("max_culling_distance", &cr::EpisodeSettings::max_culling_distance)
|
||||
.def_readwrite("deterministic_ragdolls", &cr::EpisodeSettings::deterministic_ragdolls)
|
||||
.add_property("fixed_delta_seconds",
|
||||
+[](const cr::EpisodeSettings &self) {
|
||||
|
|
|
@ -103,6 +103,10 @@ void ACarlaGameModeBase::InitGame(
|
|||
|
||||
GameInstance->NotifyInitGame();
|
||||
|
||||
OnEpisodeSettingsChangeHandle = FCarlaStaticDelegates::OnEpisodeSettingsChange.AddUObject(
|
||||
this,
|
||||
&ACarlaGameModeBase::OnEpisodeSettingsChanged);
|
||||
|
||||
SpawnActorFactories();
|
||||
|
||||
// make connection between Episode and Recorder
|
||||
|
@ -182,6 +186,8 @@ void ACarlaGameModeBase::Tick(float DeltaSeconds)
|
|||
|
||||
void ACarlaGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
{
|
||||
FCarlaStaticDelegates::OnEpisodeSettingsChange.Remove(OnEpisodeSettingsChangeHandle);
|
||||
|
||||
Episode->EndPlay();
|
||||
GameInstance->NotifyEndEpisode();
|
||||
|
||||
|
@ -510,3 +516,8 @@ void ACarlaGameModeBase::OnUnloadStreamLevel()
|
|||
RegisterEnvironmentObjects();
|
||||
}
|
||||
}
|
||||
|
||||
void ACarlaGameModeBase::OnEpisodeSettingsChanged(const FEpisodeSettings &Settings)
|
||||
{
|
||||
CarlaSettingsDelegate->SetAllActorsDrawDistance(GetWorld(), Settings.MaxCullingDistance);
|
||||
}
|
|
@ -101,6 +101,8 @@ private:
|
|||
|
||||
void ConvertMapLayerMaskToMapNames(int32 MapLayer, TArray<FName>& OutLevelNames);
|
||||
|
||||
void OnEpisodeSettingsChanged(const FEpisodeSettings &Settings);
|
||||
|
||||
UPROPERTY()
|
||||
UCarlaGameInstance *GameInstance = nullptr;
|
||||
|
||||
|
@ -134,6 +136,8 @@ private:
|
|||
UPROPERTY()
|
||||
ATrafficLightManager* TrafficLightManager = nullptr;
|
||||
|
||||
FDelegateHandle OnEpisodeSettingsChangeHandle;
|
||||
|
||||
boost::optional<carla::road::Map> Map;
|
||||
|
||||
int PendingLevelsToLoad = 0;
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
UFUNCTION(BlueprintCallable, Category = "CARLA Settings", meta = (HidePin = "InWorld"))
|
||||
void ApplyQualityLevelPreRestart();
|
||||
|
||||
void SetAllActorsDrawDistance(UWorld *world, float max_draw_distance) const;
|
||||
|
||||
private:
|
||||
|
||||
UWorld *GetLocalWorld();
|
||||
|
@ -65,8 +67,6 @@ private:
|
|||
|
||||
void SetActorComponentsDrawDistance(AActor *actor, float max_draw_distance) const;
|
||||
|
||||
void SetAllActorsDrawDistance(UWorld *world, float max_draw_distance) const;
|
||||
|
||||
void SetPostProcessEffectsEnabled(UWorld *world, bool enabled) const;
|
||||
|
||||
/// Execute engine commands to apply the epic quality level to the world.
|
||||
|
|
|
@ -28,6 +28,8 @@ struct CARLA_API FEpisodeSettings
|
|||
|
||||
int MaxSubsteps = 10;
|
||||
|
||||
float MaxCullingDistance = 0.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool bDeterministicRagdolls = true;
|
||||
|
||||
|
|
Loading…
Reference in New Issue