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