14#include <util/ue-header-guard-begin.h>
15#include "CoreMinimal.h"
16#include "GameFramework/Actor.h"
17#include "ProceduralMeshComponent.h"
18#include <util/ue-header-guard-end.h>
22#include "OpenDriveGenerator.generated.h"
24class UMaterialInterface;
27class UPCGGraphInterface;
36 UPROPERTY(Category =
"Procedural Mesh Actor", VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess =
"true"))
138 UPROPERTY(Category =
"Spawners", EditAnywhere)
141 UPROPERTY(Category =
"Spawners", EditAnywhere)
144 UPROPERTY(EditAnywhere)
147 UPROPERTY(EditAnywhere)
199 void Initialize(
const FBox &Bounds,
float InCellSize);
202 void RasterizeTriangle(
const FVector &A,
const FVector &B,
const FVector &C,
bool bIsDrive);
205 void BuildDistanceFields();
206 const FCell *CellAtWorld(
float X,
float Y)
const;
212 void DumpRasterAt(
float X,
float Y)
const;
218 UPROPERTY(Category =
"Materials", EditAnywhere)
219 TSoftObjectPtr<UMaterialInterface>
RoadMaterial = TSoftObjectPtr<UMaterialInterface>(
220 FSoftObjectPath(TEXT(
"/Game/Carla/Static/GenericMaterials/Roads/MI_RoadAsphalt_Town15.MI_RoadAsphalt_Town15")));
223 UPROPERTY(Category =
"Materials", EditAnywhere)
225 FSoftObjectPath(TEXT(
"/Game/Carla/Static/GenericMaterials/Sidewalk/MI_Sidewalk_Apartment.MI_Sidewalk_Apartment")));
234 UPROPERTY(Category =
"Materials", EditAnywhere)
235 TSoftObjectPtr<UMaterialInterface>
GroundMaterial = TSoftObjectPtr<UMaterialInterface>(
236 FSoftObjectPath(TEXT(
"/Game/Carla/Static/GenericMaterials/Ground/MI_LargeLandscape_Grass.MI_LargeLandscape_Grass")));
243 UPROPERTY(Category =
"Materials", EditAnywhere)
245 FSoftObjectPath(TEXT(
"/Game/Carla/Static/GenericMaterials/Roads/MI_Road_Asphalt_B_LaneMarkingWhite.MI_Road_Asphalt_B_LaneMarkingWhite")));
252 UPROPERTY(Category =
"Materials", EditAnywhere)
254 FSoftObjectPath(TEXT(
"/Game/Carla/Static/GenericMaterials/Roads/MI_Road_Asphalt_B_LaneMarkingWhite.MI_Road_Asphalt_B_LaneMarkingWhite")));
257 UPROPERTY(Category =
"Materials", EditAnywhere)
259 FSoftObjectPath(TEXT(
"/Game/Carla/Static/GenericMaterials/Roads/MI_Road_Asphalt_B_LaneMarkingYellow.MI_Road_Asphalt_B_LaneMarkingYellow")));
263 UPROPERTY(Category =
"Materials", EditAnywhere)
271 UPROPERTY(Category =
"Materials", EditAnywhere)
277 UPROPERTY(Category =
"Materials", EditAnywhere)
284 UPROPERTY(Category =
"Materials", EditAnywhere)
292 UPROPERTY(Category =
"Materials", EditAnywhere)
297 UPROPERTY(Category =
"Materials", EditAnywhere)
309 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
312 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
315 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
336 UPROPERTY(Category =
"Materials", EditAnywhere)
343 UPROPERTY(Category =
"Materials", EditAnywhere)
354 UPROPERTY(Category =
"Street Furniture", VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess =
"true"))
363 UPROPERTY(Category =
"Street Furniture", VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess =
"true"))
376 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
380 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
384 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
388 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
398 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
402 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
408 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
413 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
420 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
426 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
432 UPROPERTY(Category =
"Street Furniture", EditAnywhere)
443 const FName &Tag,
float Spacing,
float Offset,
float RoadClearance,
444 bool bMeasureFromCurb,
bool bKeepOnSidewalk,
float SOffset);
473 UPROPERTY(Category =
"Generation QA", EditAnywhere)
478 UPROPERTY(Category =
"Generation QA", EditAnywhere)
ACarlaProceduralMeshActor()
TObjectPtr< UProceduralMeshComponent > MeshComponent
bool LoadOpenDrive(const FString &OpenDrive)
Set the OpenDRIVE information as string and generates the queryable map structure.
TSoftObjectPtr< UMaterialInterface > LaneMarkingWhiteMaterial
Material applied to white lane-marking meshes.
FBox RoadMeshBounds
World-space bounding box of every road/sidewalk vertex generated by GenerateRoadMesh,...
const FString & GetOpenDrive() const
Get the OpenDRIVE information as string.
void RunGenerationQA()
Systematic post-generation validation, run automatically shortly after GenerateAll (delayed so the as...
float MedianFillMaxHeightDelta
Max height split (cm) of the driving surface samples WITHIN a single raster cell near a gap cell for ...
AOpenDriveGenerator(const FObjectInitializer &ObjectInitializer)
float SignageRoadClearance
float GroundUVTileSize
World-space size (cm) of one UV tile on the ground plane, i.e.
void GenerateGroundPlane()
Generates a terrain-following heightfield beneath the generated road network so gaps in the road/side...
void GeneratePoles()
Scatters street furniture (lamp poles, roadside vegetation, signage) along the generated road network...
float VegetationRoadClearance
FBox FurnitureAnchorBounds
Accumulated bounding box of every furniture anchor spawned for the current generation,...
TArray< float > GroundGridHeights
Evaluated ground heightfield (final terrain surface z per grid vertex, row-major, GroundGridNumY rows...
FRoadSurfaceRaster RoadRaster
TSoftObjectPtr< UMaterialInterface > GroundMaterial
Material applied to the ground plane (see GenerateGroundPlane).
FName LampAnchorTag
Tag used to mark lamp-pole anchor points for the PCG graph to sample.
void GenerateRoadMesh()
Generates the road and sidewalk mesh based on the OpenDRIVE information.
TObjectPtr< UBoxComponent > PCGBoundsComponent
Provides the PCG component's generation bounds: PCG derives its grid bounds from the owner actor's co...
float SignageAnchorOffset
Lateral offset (m) of signage anchors past the curb line, clamped onto the sidewalk like the lamps (s...
float GroundSkirtWidth
Width (cm) of the blend band past the road footprint over which the terrain transitions from exactly ...
float LampAnchorSpacing
Spacing (m) between lamp anchors along each road.
float LampAnchorOffset
Lateral offset (m) of lamp anchors past the curb line (the outer edge of the last roadway lane: parki...
FName VegetationAnchorTag
Tag used to mark roadside-vegetation anchor points.
TSoftObjectPtr< UMaterialInterface > SidewalkMaterial
Material applied to sidewalk mesh sections.
void GenerateLaneMarkings()
Generates the lane-marking meshes (white/yellow) based on the OpenDRIVE information.
float SampleGroundGridHeight(float X, float Y) const
Bilinear interpolation of GroundGridHeights at a world XY position.
TObjectPtr< UPCGComponent > PCGComponent
Drives the runtime PCG scatter (see GeneratePoles).
float DecalZOffset
Vertical offset (cm) applied to crosswalk and lane-marking meshes above the road surface,...
float VegetationAnchorSpacing
Spacing (m) between vegetation anchors along each road.
int32 GenerateFurnitureAnchors(const FName &Tag, float Spacing, float Offset, float RoadClearance, bool bMeasureFromCurb, bool bKeepOnSidewalk, float SOffset)
Spawns one AProceduralFurnitureAnchor per transform returned by Map::GetTreesTransform for the given ...
int32 StreetFurnitureSeed
PCG seed of the furniture scatter; with it, every server and run places the same furniture and banner...
void GenerateCrosswalkMesh()
Generates the crosswalk mesh based on the OpenDRIVE information.
TSoftObjectPtr< UPCGGraphInterface > StreetFurnitureGraph
PCG graph asset that samples the tagged anchors below (via a "GetActor Data" node per category,...
FVector2D GroundGridOrigin
float LampRoadClearance
Per-category clearance (cm) beyond the lane half-width that street furniture must keep from the neare...
virtual void BeginPlay() override
float QAStackedRoadGap
Min z spread (cm) within one sample cell that marks it as stacked roads (bridge over road) rather tha...
FName SignageAnchorTag
Tag used to mark decorative-signage anchor points.
void GenerateMedianFill()
Annotates the narrow unmapped strips between parallel carriageway roads so the terrain lofts flush ac...
float MedianFillMaxWidth
Widest gap (cm) between opposing driving surfaces that GenerateMedianFill closes with road surface; w...
TArray< TObjectPtr< AVehicleSpawnPoint > > VehicleSpawners
float QASupportGapMax
Max allowed gap (cm) between a road cell's lowest surface and the terrain below it before the cell co...
float SpawnersHeight
Determine the height where the spawners will be placed, relative to each RoutePlanner.
TSoftObjectPtr< UMaterialInterface > RoadMaterial
Material applied to driving-lane mesh sections.
TSoftObjectPtr< UMaterialInterface > CrosswalkMaterial
Material applied to the zebra-bar crosswalk meshes.
float GroundPlaneZOffset
Vertical offset (cm) applied below the road surface height where the terrain runs under road geometry...
bool IsStreetFurnitureGenerating() const
True while the street-furniture PCG scatter is still spawning; it finishes over the next frames.
float GroundHeightSampleCellSize
XY cell size (cm) of RoadRaster.
void GenerateSpawnPoints()
Generates spawn points along the road.
bool IsOpenDriveValid() const
Checks if the OpenDrive has been loaded and it's valid.
float GroundPlanePadding
How far (cm) the ground plane extends past the generated road/sidewalk bounding box on each side,...
float VegetationAnchorOffset
Lateral offset (m) of vegetation anchors – set past the lamp row so poles and trees don't overlap.
float SignageAnchorSpacing
Spacing (m) between signage anchors along each road.
TSoftObjectPtr< UMaterialInterface > LaneMarkingYellowMaterial
Material applied to yellow lane-marking meshes (centre line).
TArray< TObjectPtr< AActor > > ActorMeshList
AProceduralFurnitureAnchor()
Base class for spawner locations for walkers.
float GapSurfaceZ
Lofted road-surface height over a median/junction gap cell (FLT_MAX elsewhere).
uint8 bDriveCovered
Like bDrive but WITHOUT the rasterizer's negative barycentric tolerance: set only when the cell cente...
The authoritative "what is road surface, where, at what height" tool the rest of generation consumes.