11#include <util/ue-header-guard-begin.h>
12#include "UObject/NoExportTypes.h"
13#include <util/ue-header-guard-end.h>
15#include "RoadMap.generated.h"
24 UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
28 UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
79 return SphericalCoords.SphericalToUnitCartesian();
82 FColor EncodeAsColor()
const;
86 static uint16 Encode(
bool IsRoad,
bool HasDirection,
const FVector &Direction);
101 URoadMap(
const FObjectInitializer& ObjectInitializer);
116 bool bInvertDirection =
false);
146 const FTransform &BoxTransform,
147 const FVector &BoxExtent,
148 float ChecksPerCentimeter)
const;
151 bool SaveAsPNG(
const FString &Folder,
const FString &MapName)
const;
159 void DrawDebugPixelsToLevel(UWorld *World,
bool bJustFlushDoNotDraw =
false)
const;
167 return PixelX +
Width * PixelY;
176 UPROPERTY(VisibleAnywhere)
180 UPROPERTY(VisibleAnywhere)
184 UPROPERTY(VisibleAnywhere)
188 UPROPERTY(VisibleAnywhere)
192 UPROPERTY(VisibleAnywhere)
ECityMapMeshTag
Tag to identify the meshes used by the ProceduralMapGenerator.
uint32 Height
Height of the map in pixels.
FVector GetWorldLocation(uint32 PixelX, uint32 PixelY) const
Return the world location of a given pixel.
int32 GetIndex(uint32 PixelX, uint32 PixelY) const
void Reset(uint32 Width, uint32 Height, float PixelsPerCentimeter, const FTransform &WorldToMap, const FVector &MapOffset)
Resets current map an initializes an empty map of the given size.
void SetPixelAt(uint32 PixelX, uint32 PixelY, ECityMapMeshTag Tag, const FTransform &Transform, bool bInvertDirection=false)
URoadMap(const FObjectInitializer &ObjectInitializer)
Creates a valid empty map (every point is off-road).
float PixelsPerCentimeter
Number of pixels per centimeter.
TArray< uint16 > RoadMapData
FVector MapOffset
Offset of the map in map coordinates.
uint32 Width
Width of the map in pixels.
FTransform WorldToMap
World-to-map transform.
bool SaveAsPNG(const FString &Folder, const FString &MapName) const
Save the current map as PNG with the pixel data encoded as color.
FRoadMapIntersectionResult Intersect(const FTransform &BoxTransform, const FVector &BoxExtent, float ChecksPerCentimeter) const
Intersect actor bounds with map.
FRoadMapPixelData GetDataAt(uint32 PixelX, uint32 PixelY) const
Retrieve the data stored at a given pixel.
Road map intersection result. See URoadMap.
float OppositeLane
Percentage of the box invading opposite lane (wrong direction).
float OffRoad
Percentage of the box lying off-road.
Data stored in a road map pixel. See URoadMap.
float GetDirectionAzimuthalAngle() const
Get the azimuth angle [-PI, PI] of the road direction (in spherical coordinates) at this pixel.
bool HasDirection() const
Whether this pixel has a direction defined (e.g.
static constexpr uint16 AngleMask
static constexpr uint16 MaximumEncodedAngle
FVector GetDirection() const
Get the road direction at this pixel.
bool IsRoad() const
Whether this pixel lies in-road.
static constexpr int HasDirectionRow
FRoadMapPixelData(uint16 inValue)
static constexpr int IsRoadRow