CARLA
 
载入中...
搜索中...
未找到
CarlaSettings.h
浏览该文件的文档.
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/// Carla 的全局设置
16///
17/// 设置对象用于将配置设置和可编辑设置保存在一个位置。为确保设置保存到指定的配置文件,请确保使用全局配置或配置元数据添加属性。
18UCLASS(BlueprintType, Blueprintable, config = Game, defaultconfig)
19class CARLA_API UCarlaSettings : public UObject
20{
21 GENERATED_BODY()
22
23public:
24
25 /// 设置新的质量设置级别并在游戏中进行与之相关的更改。
26 ///
27 /// @note 这不会应用质量设置。请改用 ApplyQualitySettings 函数
28 /// @param InQualityLevel Store the new quality.
29 UFUNCTION(BlueprintCallable, Category = "CARLA Settings")
30 void SetQualityLevel(EQualityLevel InQualityLevel)
31 {
32 QualityLevel = InQualityLevel;
33 }
34
35 /// @return 当前质量设置级别(尚未应用)。
36 UFUNCTION(BlueprintCallable, Category = "CARLA Settings")
37 EQualityLevel GetQualityLevel() const
38 {
39 return QualityLevel;
40 }
41
42 /// 根据命令行参数和 INI 文件(如果提供)加载设置。
43 void LoadSettings();
44
45 /// 从给定的字符串(格式为 INI)加载设置。CarlaServer 部分被忽略。
46 void LoadSettingsFromString(const FString &INIFileContents);
47
48 /// 记录设置值。
49 void LogSettings() const;
50
51public:
52
53 /// CARLA_ROAD 名称用于标记道路网格参与者。
54 static const FName CARLA_ROAD_TAG;
55
56 /// CARLA_SKY 名称用于标记场景中的天空球(sky sphere, BPS)参与者。
57 static const FName CARLA_SKY_TAG;
58
59private:
60
61 void LoadSettingsFromFile(const FString &FilePath, bool bLogOnFailure);
62
63 /// 用于加载此设置的设置文件的文件名。如果没有使用则为空。
64 UPROPERTY(Category = "CARLA Settings|Debug", VisibleAnywhere)
65 FString CurrentFileName;
66
67 // ===========================================================================
68 /// @name CARLA 服务端
69 // ===========================================================================
70 /// @{
71
72public:
73
74 /// 用于监听客户端连接的世界端口。
75 UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
76 uint32 RPCPort = 2000u;
77
78 /// 流媒体端口的设置。
79 uint32 StreamingPort = 2001u;
80
81 /// 辅助服务器端口的设置。
82 uint32 SecondaryPort = 2002u;
83
84 /// 设置要连接的主服务器的IP和端口。
85 std::string PrimaryIP = "";
86 uint32 PrimaryPort = 2002u;
87
88 /// 在同步模式下,CARLA 会等待每个节拍信号,直到收到来自客户端的控制。
89 UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
90 bool bSynchronousMode = false;
91
92 /// 启用或禁用世界的视窗渲染。默认情况下禁用。
93 UPROPERTY(Category = "CARLA Server", VisibleAnywhere)
94 bool bDisableRendering = false;
95
96 // ===========================================================================
97 /// @name 画质设置
98 // ===========================================================================
99 /// @{
100
101private:
102
103 /// 画质设置等级
104 UPROPERTY(Category = "Quality Settings", VisibleAnywhere, meta = (AllowPrivateAccess = "true"))
106
107public:
108
109 /// 低质量道路材料。使用插槽名称为道路的每个部分设置低质量的材料。
110 ///
111 /// @todo Move Low quality vars to a generic map of structs with the quality
112 /// level as key.
113 UPROPERTY(Category = "Quality Settings/Low",
114 BlueprintReadOnly,
115 EditAnywhere,
116 config,
117 DisplayName = "Road Materials List for Low Quality")
118 TArray<FStaticMaterial> LowRoadMaterials;
119
120 /// 光照函数应完全淡化为 禁用亮度(DisabledBrightness)的距离。
121 /// 这对于隐藏在远处应用的光照函数的混叠很有用。
122 UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config)
123 float LowLightFadeDistance = 1000.0f;
124
125 /// 所有原始组件的默认 low 距离。
126 UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config,
127 meta = (ClampMin = "5000.0", ClampMax = "20000.0", UIMin = "5000.0", UIMax = "20000.0"))
128 float LowStaticMeshMaxDrawDistance = 10000.0f;
129
130 /// 道路网格的默认 low 距离。
131 UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config,
132 meta = (ClampMin = "5000.0", ClampMax = "20000.0", UIMin = "5000.0", UIMax = "20000.0"))
133 float LowRoadPieceMeshMaxDrawDistance = 15000.0f;
134
135 /// 史诗级质量道路材料。
136 /// 使用插槽名称为道路的每个部分设置质量的材料。
137 UPROPERTY(Category = "Quality Settings/Epic",
138 BlueprintReadOnly,
139 EditAnywhere,
140 config,
141 DisplayName = "Road Materials List for EPIC Quality")
142 TArray<FStaticMaterial> EpicRoadMaterials;
143
144 /// Enable ROS2
145 UPROPERTY(Category = "Quality Settings/ROS2",
146 BlueprintReadOnly,
147 EditAnywhere,
148 config,
149 DisplayName = "Enable ROS2")
150 bool ROS2 = false;
151
152 /// @}
153};
return true
for(int32 i=0;i< ResultPropJsonArray.Num();++i)
EQualityLevel
Carla 的全局设置
static const FName CARLA_SKY_TAG
CARLA_SKY 名称用于标记场景中的天空球(sky sphere, BPS)参与者。
static const FName CARLA_ROAD_TAG
CARLA_ROAD 名称用于标记道路网格参与者。