CARLA
CarlaSettings.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include "Engine/StaticMesh.h"
10 
12 
13 #include "CarlaSettings.generated.h"
14 
15 /// Global settings for CARLA.
16 ///
17 /// Setting object used to hold both config settings and editable ones in one
18 /// place. To ensure the settings are saved to the specified config file make
19 /// sure to add props using the globalconfig or config meta.
20 UCLASS(BlueprintType, Blueprintable, config = Game, defaultconfig)
21 class CARLA_API UCarlaSettings : public UObject
22 {
23  GENERATED_BODY()
24 
25 public:
26 
27  /// Sets the new quality settings level and make changes in the game related
28  /// to it.
29  ///
30  /// @note This will not apply the quality settings. Use ApplyQualitySettings
31  /// functions instead
32  /// @param InQualityLevel Store the new quality.
33  UFUNCTION(BlueprintCallable, Category = "CARLA Settings")
34  void SetQualityLevel(EQualityLevel InQualityLevel)
35  {
36  QualityLevel = InQualityLevel;
37  }
38 
39  /// @return current quality settings level (could not have been applied yet).
40  UFUNCTION(BlueprintCallable, Category = "CARLA Settings")
41  EQualityLevel GetQualityLevel() const
42  {
43  return QualityLevel;
44  }
45 
46  /// Load the settings based on the command-line arguments and the INI file if
47  /// provided.
48  void LoadSettings();
49 
50  /// Load the settings from the given string (formatted as INI). CarlaServer
51  /// section is ignored.
52  void LoadSettingsFromString(const FString &INIFileContents);
53 
54  /// Log settings values.
55  void LogSettings() const;
56 
57 public:
58 
59  /// CARLA_ROAD name to tag road mesh actors.
60  static const FName CARLA_ROAD_TAG;
61 
62  /// CARLA_SKY name to tag the sky sphere (BPS) actors in the scenes.
63  static const FName CARLA_SKY_TAG;
64 
65 private:
66 
67  void LoadSettingsFromFile(const FString &FilePath, bool bLogOnFailure);
68 
69  /// File name of the settings file used to load this settings. Empty if none
70  /// used.
71  UPROPERTY(Category = "CARLA Settings|Debug", VisibleAnywhere)
72  FString CurrentFileName;
73 
74  // ===========================================================================
75  /// @name CARLA Server
76  // ===========================================================================
77  /// @{
78 
79 public:
80 
81  /// World port to listen for client connections.
82  UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
83  uint32 RPCPort = 2000u;
84 
85  /// Optional setting for the secondary port.
86  TOptional<uint32> StreamingPort;
87 
88  /// In synchronous mode, CARLA waits every tick until the control from the
89  /// client is received.
90  UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
91  bool bSynchronousMode = false;
92 
93  /// Enable or disable the viewport rendering of the world. Disabled by
94  /// default.
95  UPROPERTY(Category = "CARLA Server", VisibleAnywhere)
96  bool bDisableRendering = false;
97 
98  // ===========================================================================
99  /// @name Quality Settings
100  // ===========================================================================
101  /// @{
102 
103 private:
104 
105  /// Quality Settings level.
106  UPROPERTY(Category = "Quality Settings", VisibleAnywhere, meta = (AllowPrivateAccess = "true"))
108 
109 public:
110 
111  /// Low quality Road Materials. Uses slots name to set material for each part
112  /// of the road for low quality.
113  ///
114  /// @todo Move Low quality vars to a generic map of structs with the quality
115  /// level as key.
116  UPROPERTY(Category = "Quality Settings/Low",
117  BlueprintReadOnly,
118  EditAnywhere,
119  config,
120  DisplayName = "Road Materials List for Low Quality")
121  TArray<FStaticMaterial> LowRoadMaterials;
122 
123  /// Distance at which the light function should be completely faded to
124  /// DisabledBrightness. This is useful for hiding aliasing from light
125  /// functions applied in the distance.
126  UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config)
127  float LowLightFadeDistance = 1000.0f;
128 
129  /// Default low distance for all primitive components.
130  UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config,
131  meta = (ClampMin = "5000.0", ClampMax = "20000.0", UIMin = "5000.0", UIMax = "20000.0"))
132  float LowStaticMeshMaxDrawDistance = 10000.0f;
133 
134  /// Default low distance for roads meshes.
135  UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config,
136  meta = (ClampMin = "5000.0", ClampMax = "20000.0", UIMin = "5000.0", UIMax = "20000.0"))
137  float LowRoadPieceMeshMaxDrawDistance = 15000.0f;
138 
139  /// EPIC quality Road Materials. Uses slots name to set material for each part
140  /// of the road for Epic quality.
141  UPROPERTY(Category = "Quality Settings/Epic",
142  BlueprintReadOnly,
143  EditAnywhere,
144  config,
145  DisplayName = "Road Materials List for EPIC Quality")
146  TArray<FStaticMaterial> EpicRoadMaterials;
147 
148  /// @}
149 };
EQualityLevel
Global settings for CARLA.
Definition: CarlaSettings.h:21
static const FName CARLA_ROAD_TAG
CARLA_ROAD name to tag road mesh actors.
Definition: CarlaSettings.h:60
static const FName CARLA_SKY_TAG
CARLA_SKY name to tag the sky sphere (BPS) actors in the scenes.
Definition: CarlaSettings.h:63