9#include "UObject/NoExportTypes.h"
11#include "RoadMap.generated.h"
20 UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
24 UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
33 constexpr static int IsRoadRow = 15;
35 constexpr static int HasDirectionRow = 14;
37 constexpr static uint16 MaximumEncodedAngle = (1 << 14) - 1;
39 constexpr static uint16 AngleMask = (0xFFFF >> 2);
48 return (Value & (1 << IsRoadRow)) != 0;
55 return (Value & (1 << HasDirectionRow)) != 0;
64 const float Angle = AngleMask & Value;
66 return (Angle * 2.0f * PI / MaximumEncodedAngle) - PI;
74 const FVector2D SphericalCoords(HALF_PI, GetDirectionAzimuthalAngle());
75 return SphericalCoords.SphericalToUnitCartesian();
78 FColor EncodeAsColor()
const;
82 static uint16 Encode(
bool IsRoad,
bool HasDirection,
const FVector &Direction);
97 URoadMap(
const FObjectInitializer& ObjectInitializer);
111 const FTransform &Transform,
112 bool bInvertDirection =
false);
142 const FTransform &BoxTransform,
143 const FVector &BoxExtent,
144 float ChecksPerCentimeter)
const;
147 bool SaveAsPNG(
const FString &Folder,
const FString &MapName)
const;
155 void DrawDebugPixelsToLevel(UWorld *
World,
bool bJustFlushDoNotDraw =
false)
const;
163 return PixelX +
Width * PixelY;
172 UPROPERTY(VisibleAnywhere)
176 UPROPERTY(VisibleAnywhere)
180 UPROPERTY(VisibleAnywhere)
184 UPROPERTY(VisibleAnywhere)
188 UPROPERTY(VisibleAnywhere)
TSharedPtr< const FActorInfo > carla::rpc::ActorState UWorld * World
ECityMapMeshTag
用于标识ProceduralMapGenerator所使用的网格的标签
static bool IsValid(const ACarlaWheeledVehicle *Vehicle)
关卡路线图。包含哪些区域是道路的 2D 信息 和车道方向。
uint32 Height
地图的高度(以像素为单位)。
FVector GetWorldLocation(uint32 PixelX, uint32 PixelY) const
返回给定像素的世界位置。
int32 GetIndex(uint32 PixelX, uint32 PixelY) const
void Reset(uint32 Width, uint32 Height, float PixelsPerCentimeter, const FTransform &WorldToMap, const FVector &MapOffset)
重置当前映射 - 初始化给定大小的空映射。
void SetPixelAt(uint32 PixelX, uint32 PixelY, ECityMapMeshTag Tag, const FTransform &Transform, bool bInvertDirection=false)
URoadMap(const FObjectInitializer &ObjectInitializer)
创建有效的空地图(每个点都是越野的)。
float PixelsPerCentimeter
每厘米像素数。
TArray< uint16 > RoadMapData
FVector MapOffset
地图坐标中的偏移量。
uint32 Width
地图的宽度(以像素为单位)。
FTransform WorldToMap
世界到地图的转换。
bool SaveAsPNG(const FString &Folder, const FString &MapName) const
将当前地图另存为 PNG,并将像素数据编码为颜色。
FRoadMapIntersectionResult Intersect(const FTransform &BoxTransform, const FVector &BoxExtent, float ChecksPerCentimeter) const
将角色边界与地图相交。
FRoadMapPixelData GetDataAt(uint32 PixelX, uint32 PixelY) const
检索存储在给定像素处的数据。
数据存储在路线图像素中。请参阅 URoadMap。
float GetDirectionAzimuthalAngle() const
获取道路方向的方位角 [-PI, PI](球面 坐标)的 S Package。
bool HasDirection() const
此像素是否定义了方向(例如,道路交叉口为 不是越野,但都没有明确的方向)。
FVector GetDirection() const
获取此像素处的道路方向。
bool IsRoad() const
此像素是否位于道路上。
FRoadMapPixelData(uint16 inValue)