UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LandscapeNaniteComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "Misc/Guid.h"
11
12#include "LandscapeNaniteComponent.generated.h"
13
14class ALandscape;
15class ALandscapeProxy;
16class ULandscapeComponent;
21
23{
24 // Copy of Component level data required to generate Nanite asynchronously
32
33 // Context for an Async Static Mesh (nanite) build
34 // Also serving double duty as input parameter bag for ExportToRawMeshDataCopy
36 {
39
42
45
51
52 // event triggered when this build is complete (only used in the async case)
54
56
57 std::atomic<bool> bExportResult = false;
58 std::atomic<bool> bIsComplete = false;
59 std::atomic<bool> bCancelled = false;
60 std::atomic<bool> bStaticMeshNeedsToCallPostMeshBuild = false; // true if we are waiting for the UStaticMesh PostMeshBuild async callback
61 FDelegateHandle PostMeshBuildDelegateHandle; // post mesh build delegate handle (so we can remove it cleanly)
62
63 bool bWarnedStall = false; // true if we've notified the user of a stall on this task
64
65 double TimeStamp_Requested = -1.0; // when the Nanite build was requested
66 double TimeStamp_ExportMeshStart = -1.0; // start of the export mesh task
67 double TimeStamp_ExportMeshEnd = -1.0; // end of the export mesh task
68 double TimeStamp_StaticMeshBuildStart = -1.0; // start of the mesh build task
69 double TimeStamp_StaticMeshBatchBuildStart = -1.0; // call to UStaticMesh::BatchBuild
70 double TimeStamp_StaticMeshBatchBuildPostMeshBuildCall = -1.0; // when we received the async PostMeshBuild callback (if async) - may be out of order
71 double TimeStamp_StaticMeshBuildEnd = -1.0; // end of the mesh build task
72 double TimeStamp_LandscapeUpdateStart = -1.0; // start of the LandscapeUpdate / CompleteStaticMesh call
73 double TimeStamp_LandscapeUpdateEnd = -1.0; // end of the LandscapeUpdate / CompleteStaticMesh call
74 double TimeStamp_Complete = -1.0; // time we marked the task bIsComplete
75 double TimeStamp_Cancelled = -1.0; // first time that the pipeline realized the task was cancelled
76
78 };
79}
80
81UCLASS(hidecategories = (Display, Attachment, Physics, Debug, Collision, Movement, Rendering, PrimitiveComponent, Object, Transform, Mobility, VirtualTexture), showcategories = ("Rendering|Material"), MinimalAPI, Within = LandscapeProxy)
82class ULandscapeNaniteComponent : public UStaticMeshComponent
83{
85
86public:
88
90
92 LANDSCAPE_API ALandscapeProxy* GetLandscapeProxy() const;
93
95 LANDSCAPE_API ALandscape* GetLandscapeActor() const;
96
97 inline const FGuid& GetProxyContentId() const
98 {
99 return ProxyContentId;
100 }
101
103 {
105 }
106
108
109 void SetEnabled(bool bValue);
110
111 inline bool IsEnabled() const
112 {
113 return bEnabled;
114 }
115
116 virtual bool NeedsLoadForServer() const override { return false; }
117 virtual bool NeedsLoadForTargetPlatform(const class ITargetPlatform* TargetPlatform) const override;
118
120 void UpdateMaterials();
121
124private:
125
127 virtual void CollectPSOPrecacheData(const FPSOPrecacheParams& BasePrecachePSOParams, FMaterialInterfacePSOPrecacheParamsList& OutParams) override;
128
129 /* The landscape proxy identity this Nanite representation was generated for */
130 UPROPERTY()
132
134 bool bEnabled;
135
137 UPROPERTY()
138 TArray<TObjectPtr<ULandscapeComponent>> SourceLandscapeComponents;
139
140public:
141#if WITH_EDITOR
150
152
153 UE_DEPRECATED(5.6, "Use the new version of InitializeForLandscapeAsync (above)")
155 {
157 }
158
166 LANDSCAPE_API bool InitializePlatformForLandscape(ALandscapeProxy* Landscape, const ITargetPlatform* TargetPlatform);
167#endif
168
169 virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
170
171 virtual bool IsHLODRelevant() const override;
172};
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
DIRECTLINK_API Display
Definition DirectLinkLog.h:8
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
Definition IDelegateInstance.h:14
Definition UObjectGlobals.h:1292
Definition PrimitiveSceneProxy.h:296
Definition Landscape.Build.cs:7
Definition Array.h:670
Definition Actor.h:203
Definition SharedPointer.h:692
Definition StrongObjectPtrTemplates.h:26
Definition LandscapeSubsystem.h:103
Definition LandscapeNaniteComponent.h:23
Definition VirtualTextureRecreate.cpp:16
Definition Guid.h:109
Definition MeshDescription.h:94
Definition PSOPrecache.h:30
Definition StaticMeshSourceData.h:37
Definition ObjectPtr.h:488
Definition WeakObjectPtrTemplates.h:25
Definition LandscapeNaniteComponent.h:36
FGraphEventRef BuildCompleteEvent
Definition LandscapeNaniteComponent.h:53
double TimeStamp_StaticMeshBatchBuildPostMeshBuildCall
Definition LandscapeNaniteComponent.h:70
double TimeStamp_ExportMeshEnd
Definition LandscapeNaniteComponent.h:67
FStaticMeshSourceModel * SourceModel
Definition LandscapeNaniteComponent.h:49
double TimeStamp_LandscapeUpdateEnd
Definition LandscapeNaniteComponent.h:73
double TimeStamp_Requested
Definition LandscapeNaniteComponent.h:65
std::atomic< bool > bCancelled
Definition LandscapeNaniteComponent.h:59
double TimeStamp_StaticMeshBuildStart
Definition LandscapeNaniteComponent.h:68
std::atomic< bool > bStaticMeshNeedsToCallPostMeshBuild
Definition LandscapeNaniteComponent.h:60
double TimeStamp_LandscapeUpdateStart
Definition LandscapeNaniteComponent.h:72
TWeakObjectPtr< ULandscapeSubsystem > LandscapeSubSystemWeakRef
Definition LandscapeNaniteComponent.h:41
double TimeStamp_ExportMeshStart
Definition LandscapeNaniteComponent.h:66
ComponentDataMap ComponentData
Definition LandscapeNaniteComponent.h:38
TSharedPtr< FStaticMeshAttributes > MeshAttributes
Definition LandscapeNaniteComponent.h:50
TStrongObjectPtr< UStaticMesh > NaniteStaticMesh
Definition LandscapeNaniteComponent.h:43
TWeakObjectPtr< ALandscapeProxy > LandscapeWeakRef
Definition LandscapeNaniteComponent.h:40
TInlineComponentArray< ULandscapeComponent * > InputComponents
Definition LandscapeNaniteComponent.h:48
FMeshDescription * NaniteMeshDescription
Definition LandscapeNaniteComponent.h:44
std::atomic< bool > bIsComplete
Definition LandscapeNaniteComponent.h:58
FDelegateHandle PostMeshBuildDelegateHandle
Definition LandscapeNaniteComponent.h:61
double TimeStamp_Cancelled
Definition LandscapeNaniteComponent.h:75
int32 LOD
Definition LandscapeNaniteComponent.h:55
double TimeStamp_StaticMeshBatchBuildStart
Definition LandscapeNaniteComponent.h:69
bool bWarnedStall
Definition LandscapeNaniteComponent.h:63
double TimeStamp_Complete
Definition LandscapeNaniteComponent.h:74
TArray< UMaterialInterface *, TInlineAllocator< 4 > > InputMaterials
Definition LandscapeNaniteComponent.h:46
TArray< FName, TInlineAllocator< 4 > > InputMaterialSlotNames
Definition LandscapeNaniteComponent.h:47
double TimeStamp_StaticMeshBuildEnd
Definition LandscapeNaniteComponent.h:71
std::atomic< bool > bExportResult
Definition LandscapeNaniteComponent.h:57
Definition LandscapeNaniteComponent.h:26
TSharedPtr< FLandscapeComponentDataInterfaceBase > ComponentDataInterface
Definition LandscapeNaniteComponent.h:29
int32 Stride
Definition LandscapeNaniteComponent.h:30
TArray< FColor > HeightAndNormalData
Definition LandscapeNaniteComponent.h:27
TArray< uint8 > Visibility
Definition LandscapeNaniteComponent.h:28