UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LandscapeComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "CoreMinimal.h"
8#include "Misc/Guid.h"
13#include "LandscapeInfo.h"
18
19#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_6
21#endif
22
23#include "LandscapeComponent.generated.h"
24
25class ALandscape;
26class ALandscapeProxy;
31class ITargetPlatform;
32class ULandscapeComponent;
35class ULandscapeInfo;
37class ULightComponent;
40class UTexture2D;
41struct FConvexVolume;
42struct FEngineShowFlags;
48struct FLandscapeGroup;
49enum class ELandscapeTextureUsage : uint8;
50enum class ELandscapeTextureType : uint8;
51
52//
53// FLandscapeEditToolRenderData
54//
55USTRUCT()
57{
58public:
60
62 {
63 ST_NONE = 0,
64 ST_COMPONENT = 1,
65 ST_REGION = 2,
66 // = 4...
67 };
68
70 : ToolMaterial(NULL),
71 GizmoMaterial(NULL),
72 SelectedType(ST_NONE),
73 DebugChannelR(INDEX_NONE),
74 DebugChannelG(INDEX_NONE),
75 DebugChannelB(INDEX_NONE),
76 DataTexture(NULL),
77 LayerContributionTexture(NULL),
78 DirtyTexture(NULL)
79 {}
80
81 // Material used to render the tool.
82 UPROPERTY(NonTransactional)
84
85 // Material used to render the gizmo selection region...
86 UPROPERTY(NonTransactional)
88
89 // Component is selected
90 UPROPERTY(NonTransactional)
91 int32 SelectedType;
92
93 UPROPERTY(NonTransactional)
94 int32 DebugChannelR;
95
96 UPROPERTY(NonTransactional)
97 int32 DebugChannelG;
98
99 UPROPERTY(NonTransactional)
100 int32 DebugChannelB;
101
102 UPROPERTY(NonTransactional)
103 TObjectPtr<UTexture2D> DataTexture; // Data texture other than height/weight
104
105 UPROPERTY(NonTransactional)
106 TObjectPtr<UTexture2D> LayerContributionTexture; // Data texture used to represent layer contribution
107
108 UPROPERTY(NonTransactional)
109 TObjectPtr<UTexture2D> DirtyTexture; // Data texture used to represent layer blend dirtied area
110
111#if WITH_EDITOR
112 void UpdateDebugColorMaterial(const ULandscapeComponent* const Component);
113 void UpdateSelectionMaterial(int32 InSelectedType, const ULandscapeComponent* const Component);
114#endif
115};
116
117/* Used to uniquely reference a landscape vertex in a component. */
138
140USTRUCT()
142{
144
145 UPROPERTY()
147
148 UPROPERTY()
149 uint8 WeightmapTextureIndex;
150
151 UPROPERTY()
152 uint8 WeightmapTextureChannel;
153
155 : LayerInfo(nullptr)
156 , WeightmapTextureIndex(0)
157 , WeightmapTextureChannel(0)
158 {
159 }
160
161
163 : LayerInfo(InLayerInfo)
164 , WeightmapTextureIndex(255) // Indicates an invalid allocation
165 , WeightmapTextureChannel(255)
166 {
167 }
168
169 bool operator == (const FWeightmapLayerAllocationInfo& RHS) const
170 {
171 return (LayerInfo == RHS.LayerInfo)
172 && (WeightmapTextureIndex == RHS.WeightmapTextureIndex)
173 && (WeightmapTextureChannel == RHS.WeightmapTextureChannel);
174 }
175
176 FName GetLayerName() const;
177
178 uint32 GetHash() const;
179
180 void Free()
181 {
182 WeightmapTextureChannel = 255;
183 WeightmapTextureIndex = 255;
184 }
185
186 bool IsAllocated() const { return (WeightmapTextureChannel != 255 && WeightmapTextureIndex != 255); }
187};
188
190{
191 return InAllocInfo.GetHash();
192}
193
194template<typename T>
196{
197 // copy up to Count elements to Dest, in X then Y order (standard image order)
198 virtual void CopyTo(T* Dest, int32 Count) const = 0;
199
200 // copy up to Count elements to Dest, in X then Y order (standard image order)
201 virtual bool CopyToAndCalcIsAllZero(T* Dest, int32 Count) const = 0;
202
203 // return the total number of elements
204 virtual int32 Num() const = 0;
205};
206
208{
209#if WITH_EDITORONLY_DATA
210 // Variables used to detect when grass data needs to be regenerated:
211
212 // Guid per material instance in the hierarchy between the assigned landscape material (instance) and the root UMaterial
213 // used to detect changes to material instance parameters or the root material that could affect the grass maps
214 UE_DEPRECATED(all, "GenerationHash is now used")
216 // cached component rotation when material world-position-offset is used,
217 // as this will affect the direction of world-position-offset deformation (included in the HeightData below)
218 UE_DEPRECATED(all, "GenerationHash is now used")
220
221 // Variable used to detect when grass data needs to be regenerated:
223#endif
224
225#if WITH_EDITORONLY_DATA
226 // Height data for LODs 1+, keyed on LOD index
228#endif // WITH_EDITORONLY_DATA
229
230 static constexpr int32 UnknownNumElements = -1;
231 // Elements per contiguous array: for validation and also to indicate whether the grass data is valid (NumElements >= 0, meaning 0 elements is valid but the grass data is all zero and
232 // therefore empty) or not known yet (== UnknownNumElements)
234 // Serialized in one block to prevent Slack waste
237
238 // Note: We need to explicitly disable warnings on these constructors/operators for clang to be happy with deprecated variables
241 FLandscapeComponentGrassData(ULandscapeComponent* Component);
248
249 // Returns whether grass data has been computed (or serialized) yet. Returns true even if the data is completely empty (e.g. all-zero weightmap data)
250 bool HasValidData() const;
251
252 // Returns whether the data is completely empty (e.g. all-zero weightmap data). Returns false if the data just wasn't computed yet :
253 bool HasData() const;
254
255 void InitializeFrom(const TArray<uint16>& HeightData, const TMap<ULandscapeGrassType*, TArray<uint8>>& WeightData);
257
258 bool HasWeightData() const;
260 bool Contains(ULandscapeGrassType* GrassType) const;
262
263 SIZE_T GetAllocatedSize() const;
264
265 // Check whether we can discard any data not needed with current scalability settings
267
269};
270
271USTRUCT(NotBlueprintable, meta = (Deprecated = "5.1"))
273{
275
276 UPROPERTY(EditAnywhere, Category = LandscapeComponent, meta=(UIMin=0, UIMax=8, ClampMin=0, ClampMax=8))
277 FPerPlatformInt LODIndex;
278
279 UPROPERTY(EditAnywhere, Category = LandscapeComponent)
281};
282
283USTRUCT(NotBlueprintable)
285{
287
288 UPROPERTY(EditAnywhere, Category = Material, meta = (UIMin = 0, UIMax = 8, ClampMin = 0, ClampMax = 8))
289 int32 LODIndex = 0;
290
291 UPROPERTY(EditAnywhere, Category = Material)
293
294 bool operator == (const FLandscapePerLODMaterialOverride & InOther) const
295 {
296 return (LODIndex == InOther.LODIndex)
297 && (Material == InOther.Material);
298 }
299};
300
301USTRUCT(NotBlueprintable)
315
316USTRUCT(NotBlueprintable)
324
325USTRUCT(NotBlueprintable)
327{
329
331
332#if WITH_EDITOR
334 : DebugName(InDebugName)
335 {}
336
337#endif // WITH_EDITOR
338
339#if WITH_EDITORONLY_DATA
340 // Edit layers are referenced by Guid, this name is just there to provide some insights as to what edit layer name this layer data corresponded to in case of a missing edit layer guid
341 UPROPERTY()
342 FName DebugName;
343#endif // WITH_EDITORONLY_DATA
344
345 UPROPERTY()
346 FHeightmapData HeightmapData;
347
348 UPROPERTY()
349 FWeightmapData WeightmapData;
350
351 bool IsInitialized() const { return HeightmapData.Texture != nullptr || WeightmapData.Textures.Num() > 0; }
352};
353
354#if WITH_EDITOR
356{
357 // Will call UpdateCollisionHeightData, UpdateCacheBounds, UpdateComponentToWorld on Component
359 // Will call UdateCollisionLayerData on Component
361 // Will call RecreateCollision on Component
363 // Will update Component clients: Navigation data, Foliage, Grass, etc.
365 // Will update Component clients while editing
367 // Will compute component approximated bounds
369};
370
372{
373 // No Update
374 Update_None = 0,
375 // Update types
376 Update_Heightmap_All = 1 << 0,
379 Update_Weightmap_All = 1 << 3,
382 // Combinations
388 // In cases where we couldn't update the clients right away this flag will be set in RegenerateLayersContent
389 Update_Client_Deferred = 1 << 6,
390 // Update landscape component clients while editing
391 Update_Client_Editing = 1 << 7
392};
393
394static const uint32 DefaultSplineHash = 0xFFFFFFFF;
395
396#endif
397
398UENUM()
399enum UE_DEPRECATED(5.7, "Use ELandscapeToolTargetTypeFlags instead.") ELandscapeClearMode : int
400{
401 Clear_Weightmap = 1 << 0 UMETA(DisplayName = "Paint"),
402 Clear_Heightmap = 1 << 1 UMETA(DisplayName = "Sculpt"),
403 Clear_All = Clear_Weightmap | Clear_Heightmap UMETA(DisplayName = "All")
404};
405
406UCLASS(MinimalAPI)
411
412UCLASS(hidecategories=(Display, Attachment, Physics, Debug, Collision, Movement, Rendering, PrimitiveComponent, Object, Transform, Mobility, VirtualTexture), showcategories=("Rendering|Material"), MinimalAPI, Within=LandscapeProxy)
413class ULandscapeComponent : public UPrimitiveComponent
414{
416
417
418 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=LandscapeComponent)
419 int32 SectionBaseX;
420
422 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=LandscapeComponent)
423 int32 SectionBaseY;
424
426 UPROPERTY()
427 int32 ComponentSizeQuads;
428
430 UPROPERTY()
431 int32 SubsectionSizeQuads;
432
434 UPROPERTY()
435 int32 NumSubsections;
436
437 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=LandscapeComponent)
438 TObjectPtr<UMaterialInterface> OverrideMaterial;
439
440 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=LandscapeComponent, AdvancedDisplay)
442
443#if WITH_EDITORONLY_DATA
445 UE_DEPRECATED(all, "OverrideMaterials has been deprecated, use PerLODOverrideMaterials instead.")
446 UPROPERTY()
449
450 UE_DEPRECATED(all, "MaterialInstance has been deprecated, use MaterialInstances instead.")
451 UPROPERTY()
453#endif // WITH_EDITORONLY_DATA
454
455 UPROPERTY(TextExportTransient)
457
458 UPROPERTY(Transient, TextExportTransient)
460
462 UPROPERTY(TextExportTransient)
463 TArray<int8> LODIndexToMaterialIndex;
464
465 UE_DEPRECATED(5.7, "RetopologizeTool/XYOffset deprecated with the removal of non-edit layer landscapes")
466 UPROPERTY()
468
470 UPROPERTY()
471 FVector4 WeightmapScaleBias;
472
474 UPROPERTY()
475 float WeightmapSubsectionOffset;
476
478 UPROPERTY()
479 FVector4 HeightmapScaleBias;
480
482 UPROPERTY()
483 FBox CachedLocalBox;
484
493 UPROPERTY()
495
496#if WITH_EDITORONLY_DATA
497 UE_DEPRECATED(all, "CollisionComponent has been deprecated")
498 UPROPERTY()
500#endif // !WITH_EDITORONLY_DATA
501
502private:
504 UPROPERTY()
506
510
512 bool bNaniteActive;
513
514#if WITH_EDITORONLY_DATA
516 UPROPERTY()
518
520 UPROPERTY()
522
527
528 // Final layer data
531
534
537
540
542
543 // Physical material has been invalidated and no new physical material task has been started since then
545
548#endif // WITH_EDITORONLY_DATA
549
551 UPROPERTY()
552 TObjectPtr<UTexture2D> HeightmapTexture;
553
555 UPROPERTY()
557
559 UPROPERTY()
560 TArray<TObjectPtr<UTexture2D>> WeightmapTextures;
561
562 UPROPERTY(EditAnywhere, Category = LandscapeComponent)
564
565#if WITH_EDITORONLY_DATA
568#endif // WITH_EDITORONLY_DATA
569
574 UPROPERTY()
576
577public:
578 // Non-serialized runtime cache of values derived from the assigned grass types.
579 // Call ALandscapeProxy::UpdateGrassTypeSummary() to update.
581 {
582 bool bInvalid = true;
583 bool bHasAnyGrass = true;
585 };
587 inline bool IsGrassTypeSummaryValid() { return GrassTypeSummary.bInvalid; }
588
591
593 UPROPERTY()
594 FGuid MapBuildDataId;
595
597 UPROPERTY(EditAnywhere, Category=LandscapeComponent)
598 int32 CollisionMipLevel;
599
601 UPROPERTY(EditAnywhere, Category=LandscapeComponent)
602 int32 SimpleCollisionMipLevel;
603
606 UPROPERTY(EditAnywhere, Category=LandscapeComponent)
608
611 UPROPERTY(EditAnywhere, Category=LandscapeComponent)
613
615 UPROPERTY(EditAnywhere, Category=LandscapeComponent, meta=(ClampMax = 4096))
616 float StaticLightingResolution;
617
619 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=LandscapeComponent)
620 int32 ForcedLOD;
621
623 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=LandscapeComponent)
624 int32 LODBias;
625
631 UPROPERTY(Transient, DuplicateTransient, NonTransactional)
634
635#if WITH_EDITORONLY_DATA
637 UE_DEPRECATED(all, "IrrelevantLights is officially deprecated now")
638 UPROPERTY()
640
642 UPROPERTY(EditAnywhere, Category=LandscapeComponent)
644
645 // List of layers allowed to be painted on this component
646 UPROPERTY(EditAnywhere, Category=LandscapeComponent)
648
650 UPROPERTY(Transient, DuplicateTransient, NonTransactional)
652
654 UPROPERTY(NonPIEDuplicateTransient)
656
658 UPROPERTY(NonPIEDuplicateTransient)
660
663
664 UPROPERTY()
666
668 UPROPERTY()
670
674
675 UE_DEPRECATED(all, "MobileMaterialInterface has been deprecated and will be removed in a future version")
676 UPROPERTY(NonPIEDuplicateTransient)
678
679 UE_DEPRECATED(all, "MobileCombinationMaterialInstance has been deprecated and will be removed in a future version")
680 UPROPERTY(NonPIEDuplicateTransient)
682#endif // WITH_EDITORONLY_DATA
683
685 UPROPERTY(NonPIEDuplicateTransient)
687
690 UPROPERTY(NonPIEDuplicateTransient)
692
693 UPROPERTY(NonPIEDuplicateTransient)
695
697 UPROPERTY()
699
700#if WITH_EDITORONLY_DATA
703 UPROPERTY(NonPIEDuplicateTransient)
705#endif // WITH_EDITORONLY_DATA
706
707public:
710
711 // This wrapper is needed to filter out exclude boxes that are completely inside of another exclude box
712 struct FExcludeBox
713 {
714 FBox Box;
715
716 FExcludeBox() = default;
717 FExcludeBox(const FBox& InBox) : Box(InBox) {}
718
719 bool operator==(const FExcludeBox& Other) const
720 {
721 return Box.IsInsideOrOn(Other.Box);
722 }
723 };
726
727#if WITH_EDITOR
731
737#endif // WITH_EDITOR
738
739 //~ Begin UObject Interface.
740 virtual void PostInitProperties() override;
741 virtual void Serialize(FArchive& Ar) override;
742 virtual void GetResourceSizeEx(FResourceSizeEx& CumulativeResourceSize) override;
743 virtual void BeginDestroy() override;
744 virtual void PostLoad() override;
745#if WITH_EDITORONLY_DATA
747#endif
748
749 static void AddReferencedObjects(UObject* InThis, FReferenceCollector& Collector);
750
751#if WITH_EDITOR
752 virtual void BeginCacheForCookedPlatformData(const ITargetPlatform* TargetPlatform) override;
753 virtual void PreEditUndo() override;
754 virtual void PostEditUndo() override;
755 virtual void PreEditChange(FProperty* PropertyThatWillChange) override;
756 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
757 //~ End UObject Interface
758
760
764
767
768 // Update layer allow list to include the currently painted layers
770
771 //~ Begin UPrimitiveComponent Interface.
772 virtual bool GetLightMapResolution( int32& Width, int32& Height ) const override;
773 virtual int32 GetStaticLightMapResolution() const override;
774 virtual void GetLightAndShadowMapMemoryUsage( int32& LightMapMemoryUsage, int32& ShadowMapMemoryUsage ) const override;
776 virtual void AddMapBuildDataGUIDs(TSet<FGuid>& InGUIDs) const override;
777#endif
778 virtual void GetUsedMaterials(TArray<UMaterialInterface*>& OutMaterials, bool bGetDebugMaterials = false) const override;
779 virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
780 virtual ELightMapInteractionType GetStaticLightingType() const override;
782 virtual bool IsPrecomputedLightingValid() const override;
783 virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType TeleportType) override;
784
785 virtual TArray<URuntimeVirtualTexture*> const& GetRuntimeVirtualTextures() const override;
786 virtual ERuntimeVirtualTextureMainPassType GetVirtualTextureRenderPassType() const override;
787
788 // Returns the heightmap for this component. If InReturnEditingHeightmap is passed, returns the currently active edit layer's heightmap :
789 LANDSCAPE_API UTexture2D* GetHeightmap(bool InReturnEditingHeightmap = false) const;
790 // Returns the heightmap for this component and the edit layer specified by InLayerGuid. If InLayerGuid is invalid, returns the final (base) heightmap :
791 LANDSCAPE_API UTexture2D* GetHeightmap(const FGuid& InLayerGuid) const;
797
802
805
808
809 LANDSCAPE_API void SetHeightmap(UTexture2D* NewHeightmap);
812
813#if WITH_EDITOR
816
819
825
826 LANDSCAPE_API bool HasLayersData() const;
829
831
832 // Obsolete edit layer helpers
837
842
846
849
854
857#endif // WITH_EDITOR
858
859 virtual bool IsShown(const FEngineShowFlags& ShowFlags) const override;
860
861#if WITH_EDITOR
862 virtual int32 GetNumMaterials() const override;
863 virtual UMaterialInterface* GetMaterial(int32 ElementIndex) const override;
864 virtual void SetMaterial(int32 ElementIndex, UMaterialInterface* Material) override;
866#endif
867 //~ End UPrimitiveComponent Interface.
868
869 //~ Begin USceneComponent Interface.
870#if WITH_EDITOR
871 virtual bool GetMaterialPropertyPath(int32 ElementIndex, UObject*& OutOwner, FString& OutPropertyPath, FProperty*& OutProperty) override;
872#endif // WITH_EDITOR
873 virtual void DestroyComponent(bool bPromoteChildren = false) override;
874 virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override;
875 //~ End USceneComponent Interface.
876
877 //~ Begin UActorComponent Interface.
878 virtual void OnRegister() override;
879 virtual void OnUnregister() override;
880#if WITH_EDITOR
881 virtual void InvalidateLightingCacheDetailed(bool bInvalidateBuildEnqueuedLighting, bool bTranslationOnly) override;
882#endif
883 virtual void PropagateLightingScenarioChange() override;
884 virtual bool IsHLODRelevant() const override;
885 //~ End UActorComponent Interface.
886
888 LANDSCAPE_API ULandscapeInfo* GetLandscapeInfo() const;
889
890 UFUNCTION(BlueprintCallable, Category = "Landscape|Grass", meta=(DisplayName = "GetGrassTypes", Tooltip = "Returns the grass types used by the landscape material on this component"))
891 const TArray<ULandscapeGrassType*>& GetGrassTypesBP() const { return ObjectPtrDecay(GrassTypes); }
892
894 const TArray<TObjectPtr<ULandscapeGrassType>>& GetGrassTypes() const { return GrassTypes; }
895
898 {
899 GrassTypes = InGrassTypes;
901 }
902
903 bool MaterialHasGrass() const { return !GetGrassTypes().IsEmpty(); }
904
905 double GetGrassTypesMaxDiscardDistance() const { return GrassTypeSummary.MaxInstanceDiscardDistance; }
907
909 LANDSCAPE_API bool UpdateGrassTypes(bool bForceUpdate = false);
910
930
931#if WITH_EDITOR
934
937
940
943
946
950
951#endif // WITH_EDITOR
952
954 void RemoveGrassMap();
955
956 /* Could a grassmap currently be generated, disregarding whether our textures are streamed in? */
957 LANDSCAPE_API bool CanRenderGrassMap() const;
958
959#if WITH_EDITOR
962
963 /* Returns true if the component HAS grass data, but it is not up to date */
964 bool IsGrassMapOutdated() const;
965
968
969 /* Serialize all hashes/guids that record the current state of this component */
971
972 // Generates mobile platform data for this component
974 void GenerateMobilePlatformPixelData(bool bIsCooking, const ITargetPlatform* TargetPlatform);
975
977 void CheckGenerateMobilePlatformData(bool bIsCooking, const ITargetPlatform* TargetPlatform);
978
980#endif
981
984
986 LANDSCAPE_API class UMaterialInstance* GetMaterialInstance(int32 InIndex, bool InDynamic = true) const;
987
989 UFUNCTION(BlueprintCallable, Category = "Landscape|Runtime|Material")
991
993 UFUNCTION(BlueprintCallable, Category = "Landscape|Editor")
995
997 UFUNCTION(BlueprintCallable, Category = "Landscape|Editor")
999
1001 LANDSCAPE_API ALandscape* GetLandscapeActor() const;
1002
1004 ULevel* GetLevel() const;
1005
1006#if WITH_EDITOR
1011#endif // WITH_EDITOR
1012
1014 LANDSCAPE_API ALandscapeProxy* GetLandscapeProxy() const;
1015
1017 FIntPoint GetSectionBase() const
1018 {
1019 return FIntPoint(SectionBaseX, SectionBaseY);
1020 }
1021
1024 {
1025 return GetSectionBase() / ComponentSizeQuads;
1026 }
1027
1029 void SetSectionBase(FIntPoint InSectionBase)
1030 {
1031 SectionBaseX = InSectionBase.X;
1032 SectionBaseY = InSectionBase.Y;
1033 }
1034
1040 int32 GetNumRelevantMips() const;
1041
1043 const FGuid& GetLightingGuid() const
1044 {
1045#if WITH_EDITORONLY_DATA
1046 return LightingGuid;
1047#else
1048 static const FGuid NullGuid( 0, 0, 0, 0 );
1049 return NullGuid;
1050#endif // WITH_EDITORONLY_DATA
1051 }
1052
1054 void SetLightingGuid()
1055 {
1056#if WITH_EDITORONLY_DATA
1058#endif // WITH_EDITORONLY_DATA
1059 }
1060
1061 FGuid GetMapBuildDataId() const
1062 {
1063 return MapBuildDataId;
1064 }
1065
1066 LANDSCAPE_API const FMeshMapBuildData* GetMeshMapBuildData() const;
1067
1070
1072 LANDSCAPE_API UMaterialInterface* GetLandscapeMaterial(int8 InLODIndex = INDEX_NONE) const;
1073
1075 LANDSCAPE_API UMaterialInterface* GetLandscapeHoleMaterial() const;
1076
1078
1079#if WITH_EDITOR
1083 LANDSCAPE_API bool UpdateCachedBounds(bool bInApproximateBounds = false);
1084
1091
1092 // Internal implementation of UpdateMaterialInstances, not safe to call directly
1094
1109
1115 LANDSCAPE_API static void CreateEmptyTextureMips(UTexture2D* Texture, ELandscapeTextureUsage TextureUsage, ELandscapeTextureType TextureType, bool bClear = false);
1116
1122 template<typename DataType>
1123
1126
1129
1133 template<typename DataType>
1134
1137
1140
1143
1151
1155 void DestroyCollisionData();
1156
1160
1163
1166
1174
1179
1190
1195
1198
1201
1203
1207 static FString GetLayerAllocationKey(const TArray<FWeightmapLayerAllocationInfo>& Allocations, UMaterialInterface* LandscapeMaterial, bool bMobile = false);
1208
1210
1212 void GetLayerDebugColorKey(int32& R, int32& G, int32& B) const;
1213
1217
1220
1223
1226
1228 LANDSCAPE_API void GetComponentExtent(int32& MinX, int32& MinY, int32& MaxX, int32& MaxY) const;
1229
1232
1234 LANDSCAPE_API void RequestWeightmapUpdate(bool bUpdateAll = false, bool bUpdateCollision = true, bool bInUserTriggered = false);
1235 LANDSCAPE_API void RequestHeightmapUpdate(bool bUpdateAll = false, bool bUpdateCollision = true, bool bInUserTriggered = false);
1240
1242
1246#endif
1247
1249 void UpdateNavigationRelevance();
1250
1253
1256
1257 friend class FLandscapeComponentSceneProxy;
1259
1260 LANDSCAPE_API void SetLOD(bool bForced, int32 InLODValue);
1261
1262 UFUNCTION(BlueprintCallable, Category = "LandscapeComponent")
1263 LANDSCAPE_API void SetForcedLOD(int32 InForcedLOD);
1264
1265 UFUNCTION(BlueprintCallable, Category = "LandscapeComponent")
1266 LANDSCAPE_API void SetLODBias(int32 InLODBias);
1267
1268 void SetNaniteActive(bool bValue);
1269
1270 inline bool IsNaniteActive() const
1271 {
1272 return bNaniteActive;
1273 }
1274
1275 ULandscapeHeightfieldCollisionComponent* GetCollisionComponent() const { return CollisionComponentRef.Get(); }
1277
1279 {
1281 }
1282
1284 {
1286 }
1287
1288protected:
1289
1290#if WITH_EDITOR
1295#endif
1296
1298 virtual bool SupportsStaticLighting() const override
1299 {
1300 return true;
1301 }
1302
1303#if WITH_EDITOR
1304public:
1308#endif // WITH_EDITOR
1309};
#define NULL
Definition oodle2base.h:134
EUpdateTransformFlags
Definition ActorComponent.h:95
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
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
ETeleportType
Definition EngineTypes.h:2401
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
uint32 GetTypeHash(const FWeightmapLayerAllocationInfo &InAllocInfo)
Definition LandscapeComponent.h:189
ELandscapeToolTargetTypeFlags
Definition LandscapeEditTypes.h:22
ELandscapeTextureType
Definition LandscapeTextureHash.h:13
ELandscapeTextureUsage
Definition LandscapeTextureHash.h:21
void Init()
Definition LockFreeList.h:4
FInt32Point FIntPoint
Definition MathFwd.h:124
#define MAX_int32
Definition NumericLimits.h:25
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UMETA(...)
Definition ObjectMacros.h:747
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
const U & ObjectPtrDecay(const T &Value)
Definition ObjectPtr.h:1744
ERuntimeVirtualTextureMainPassType
Definition RuntimeVirtualTextureEnum.h:58
ELightMapInteractionType
Definition SceneTypes.h:111
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition LandscapeRender.h:702
Definition LightingBuildOptions.h:14
Definition MaterialShared.h:3326
Definition MapBuildDataRegistry.h:56
Definition NameTypes.h:617
Definition UnrealType.h:3087
Definition PrimitiveSceneProxy.h:296
Definition UnrealType.h:174
Definition UObjectGlobals.h:2492
Definition TextureStreamingTypes.h:223
Definition Landscape.Build.cs:7
Definition ArrayView.h:139
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
Definition AssetRegistryState.h:50
Definition UnrealString.h.inl:34
Definition SharedPointer.h:153
Definition StaticArray.h:26
Definition SubclassOf.h:30
Definition Class.h:3793
Definition LandscapeGrassType.h:172
Definition LandscapeHeightfieldCollisionComponent.h:41
Definition LandscapeEdgeFixup.h:205
Definition LandscapeInfo.h:109
Definition LandscapeComponent.h:408
Definition LandscapeLayerInfoObject.h:60
Definition LandscapeWeightmapUsage.h:14
Definition Level.h:423
Definition MaterialInstanceConstant.h:21
Definition MaterialInstanceDynamic.h:15
Definition MaterialInstance.h:627
Definition MaterialInterface.h:296
Definition Object.h:95
Definition StreamableRenderAsset.h:37
Definition Texture2D.h:26
Type
Definition RHIFeatureLevel.h:20
bool operator==(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:501
ENGINE_API FBox CalcBounds(const FVector &P0, const FVector &P1, const FVector &P2, const FVector &P3)
Definition BezierUtilities.cpp:26
uint32 ComputeGrassMapGenerationHash(const ULandscapeComponent *Component, UMaterialInterface *Material)
Definition LandscapeGrassMapsBuilder.cpp:154
LANDSCAPE_API bool CanRenderGrassMap(ULandscapeComponent *Component)
Definition LandscapeGrassMapsBuilder.cpp:214
Definition VirtualTextureRecreate.cpp:16
@ false
Definition radaudio_common.h:23
Definition Color.h:486
Definition ConvexVolume.h:44
Definition ShowFlags.h:56
Definition Guid.h:109
static CORE_API FGuid NewGuid()
Definition Guid.cpp:236
Definition LandscapeComponent.h:318
TObjectPtr< UTexture2D > Texture
Definition LandscapeComponent.h:322
Definition LandscapeComponent.h:208
void InitializeFrom(const TArray< uint16 > &HeightData, const TMap< ULandscapeGrassType *, TArray< uint8 > > &WeightData)
Definition LandscapeGrass.cpp:1467
PRAGMA_DISABLE_DEPRECATION_WARNINGS FLandscapeComponentGrassData()=default
bool Contains(ULandscapeGrassType *GrassType) const
Definition LandscapeGrass.cpp:1451
FLandscapeComponentGrassData(const FLandscapeComponentGrassData &)=default
void ConditionalDiscardDataOnLoad()
Definition LandscapeGrass.cpp:1656
PRAGMA_ENABLE_DEPRECATION_WARNINGS bool HasValidData() const
Definition LandscapeGrass.cpp:1410
int32 NumElements
Definition LandscapeComponent.h:233
FLandscapeComponentGrassData & operator=(const FLandscapeComponentGrassData &)=default
static constexpr int32 UnknownNumElements
Definition LandscapeComponent.h:230
TArrayView< uint8 > GetWeightData(const ULandscapeGrassType *GrassType)
Definition LandscapeGrass.cpp:1435
SIZE_T GetAllocatedSize() const
Definition LandscapeGrass.cpp:1400
FLandscapeComponentGrassData & operator=(FLandscapeComponentGrassData &&)=default
TArrayView< uint16 > GetHeightData()
Definition LandscapeGrass.cpp:1456
FLandscapeComponentGrassData(FLandscapeComponentGrassData &&)=default
bool HasWeightData() const
Definition LandscapeGrass.cpp:1405
TArray< uint8 > HeightWeightData
Definition LandscapeComponent.h:236
friend FArchive & operator<<(FArchive &Ar, FLandscapeComponentGrassData &Data)
Definition LandscapeGrass.cpp:1557
TMap< TObjectPtr< ULandscapeGrassType >, int32 > WeightOffsets
Definition LandscapeComponent.h:235
bool HasData() const
Definition LandscapeGrass.cpp:1418
Definition LandscapeComponent.h:57
FLandscapeEditToolRenderData()
Definition LandscapeComponent.h:69
SelectionType
Definition LandscapeComponent.h:62
Definition LandscapeGroup.h:22
Definition LandscapeComponent.h:327
Definition LandscapeComponent.h:285
Definition LandscapeComponent.h:119
uint32 SubX
Definition LandscapeComponent.h:129
uint32 X
Definition LandscapeComponent.h:127
uint32 SubY
Definition LandscapeComponent.h:130
uint32 Y
Definition LandscapeComponent.h:128
static int32 GetVertexIndex(FLandscapeVertexRef Vert, int32 SubsectionCount, int32 SubsectionVerts)
Definition LandscapeComponent.h:133
FLandscapeVertexRef(int16 InX, int16 InY, int8 InSubX, int8 InSubY)
Definition LandscapeComponent.h:120
Definition PerPlatformProperties.h:211
Definition UnrealType.h:6865
Definition ResourceSize.h:31
Definition StaticLighting.h:506
Definition LandscapeComponent.h:303
TArray< TObjectPtr< UTexture2D > > Textures
Definition LandscapeComponent.h:307
Definition LandscapeComponent.h:142
FWeightmapLayerAllocationInfo(ULandscapeLayerInfoObject *InLayerInfo)
Definition LandscapeComponent.h:162
TObjectPtr< ULandscapeLayerInfoObject > LayerInfo
Definition LandscapeComponent.h:146
bool IsAllocated() const
Definition LandscapeComponent.h:186
uint8 WeightmapTextureChannel
Definition LandscapeComponent.h:152
uint8 WeightmapTextureIndex
Definition LandscapeComponent.h:149
void Free()
Definition LandscapeComponent.h:180
Definition LandscapeComponent.h:196
virtual bool CopyToAndCalcIsAllZero(T *Dest, int32 Count) const =0
virtual void CopyTo(T *Dest, int32 Count) const =0
virtual int32 Num() const =0
Definition LazyObjectPtr.h:230
Definition ObjectPtr.h:488
Definition BoxSphereBounds.h:25
Definition IntPoint.h:25
IntType X
Definition IntPoint.h:34