CARLA
Loading...
Searching...
No Matches
MeshToLandscape.h
Go to the documentation of this file.
1// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de Barcelona (UAB). This work is licensed under the terms of the MIT license. For a copy, see <https://opensource.org/licenses/MIT>.
2
3#pragma once
4
5#include <util/ue-header-guard-begin.h>
6#include "CoreMinimal.h"
7#include "Modules/ModuleManager.h"
8#include "EngineMinimal.h"
9#include <util/ue-header-guard-end.h>
10
11#include "MeshToLandscape.generated.h"
12
13class ALandscape;
14class ULandscapeComponent;
15class AStaticMeshActor;
16class UStaticMeshComponent;
17
18USTRUCT(BlueprintType)
19struct CARLA_API FHitDisplacementEntry
20{
21 GENERATED_BODY()
22
23 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MeshToLandscapeUtil")
24 FString Pattern;
25
26 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MeshToLandscapeUtil")
27 double Displacement;
28};
29
30UCLASS(BlueprintType)
31class CARLA_API UMeshToLandscapeUtil :
33{
34 GENERATED_BODY()
35
36 static void FilterByClassList(
37 TArray<UActorComponent*>& Components,
38 const TArray<UClass*>& Blacklist,
39 const TArray<UClass*>& Whitelist);
40
41 static void FilterInvalidStaticMeshComponents(
42 TArray<UActorComponent*>& Components);
43
44 static void FilterStaticMeshComponentsByVariance(
45 TArray<UActorComponent*>& Components,
46 double MaxZVariance);
47
48 static void FilterComponentsByPatterns(
49 TArray<UActorComponent*>& Components,
50 const TArray<FString>& PatternWhitelist,
51 const TArray<FString>& PatternBlacklist);
52
53public:
54
55 UFUNCTION(BlueprintCallable, Category="CarlaTools")
56 static ALandscape* ConvertMeshesToLandscape(
57 const TArray<UActorComponent*>& Components,
58 int32 SubsectionSizeQuads,
59 int32 NumSubsections,
60 int32 SampleFrequency,
61 const TArray<FHitDisplacementEntry>& HitDisplacementMap);
62
63 UFUNCTION(BlueprintCallable, Category="CarlaTools", meta=(WorldContext="WorldContextObject"))
64 static void EnumerateLandscapeLikeStaticMeshComponents(
65 UObject* WorldContextObject,
66 const TArray<FString>& PatternWhitelist,
67 const TArray<FString>& PatternBlacklist,
68 const TArray<UClass*>& ClassWhitelist,
69 const TArray<UClass*>& ClassBlacklist,
70 double MaxZVariance,
71 TArray<UActorComponent*>& OutComponents);
72
73};