UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LandscapeEditLayerMergeRenderContext.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"
11#include "LandscapeUtils.h"
12#include "EngineDefines.h"
14
15
16// ----------------------------------------------------------------------------------
17// Forward declarations
18
19class ALandscape;
20class ULandscapeComponent;
25
26namespace UE::Landscape
27{
28 class FRDGBuilderRecorder;
29} // namespace UE::Landscape
30
31
33{
35} //namespace UE::Landscape::EditLayers
36
37
38// ----------------------------------------------------------------------------------
39
41{
42
43#if WITH_EDITOR
44
45// ----------------------------------------------------------------------------------
46
53{
55
58
61
64
66 bool bRequestAllLayers = false;
67};
68
69
70// ----------------------------------------------------------------------------------
71
76{
78 enum class EType
79 {
80 Invalid,
81
82 BeginRenderCommandRecorder, // Initiates a render command recorder that will batch one or several RenderLayer_Recorded operations, runs on the game thread
83 EndRenderCommandRecorder, // Ends the render command recorder initiated by the last BeginRenderCommandRecorder, runs on the game thread but this is where the render command executing the recorded operations from (several) RenderLayer_Recorded step(s) will be pushed (on the render thread, this is where the FRDBuilder is created and executed)
84
85 BeginRenderLayerGroup, // Initiates a series of RenderLayer steps for renderers that can be rendered one after another without an intermediate BlendLayer. Triggers a call to BeginRenderLayerGroup() on the first renderer in the group
86 EndRenderLayerGroup, // Ends a series of RenderLayer steps for renderers that can be rendered one after another without an intermediate BlendLayer. Triggers a call to EndRenderLayerGroup() on the last renderer in the group
87
88 RenderLayer, // Performs the rendering of a target layer group on an edit layer on a given world region (i.e. in a batch), runs on the game thread. Use the command recorder to perform the render operations. In RenderMode_Recorded, these will be delayed until EndRenderCommandRecorder
89 BlendLayer, // Performs the rendering of a target layer group on an edit layer on a given world region (i.e. in a batch), runs on the game thread. Use the command recorder to perform the render operations. In RenderMode_Recorded, these will be delayed until EndRenderCommandRecorder
90
91 SignalBatchMergeGroupDone, // Final step when rendering a target layer group on a given world region (i.e. in a batch) : runs on the game thread and allows to retrieve the result of the merge and do something with it (e.g. resolve the final textures)
92 };
93
95 : Type(InType)
96 {}
97
98
100 : Type(InType)
103 {}
104
106 : Type(InType)
107 , RenderFlags(InRenderFlags)
111 {}
112
113 UE_DEPRECATED(5.6, "Use the other constructors")
116 {}
117
119 EType Type = EType::Invalid;
120
122 ERenderFlags RenderFlags = ERenderFlags::None;
123
126 FEditLayerRendererState RendererState = FEditLayerRendererState::GetDummyRendererState();
128
131
134
135 UE_DEPRECATED(5.6, "Renamed : use TargetLayerGroupBitIndices")
137};
138
139
140// ----------------------------------------------------------------------------------
141
147{
148 bool operator < (const FMergeRenderBatch& InOther) const;
149
150 ALandscape* Landscape = nullptr;
151
154
157
159 // TODO [jonathan.bard] : rename EffectiveResolution and make private maybe?
160 FIntPoint Resolution = FIntPoint(ForceInitToZero);
161
164
167
170
173
177
180
181public:
183
194
202 FIntRect ComputeSectionRect(ULandscapeComponent* InComponent, bool bInWithDuplicateBorders) const;
203
209
216
219};
220
221
222// ----------------------------------------------------------------------------------
223
228{
230 ULandscapeComponent* Component = nullptr;
231
234
237
239};
240
245struct FRenderParams
246{
255
258
261
264
269
272
273 // TODO [jonathan.bard] Verify that scale is correct
275 FTransform RenderAreaWorldTransform;
276
279
282
283 UE_DEPRECATED(5.6, "Renamed : use TargetLayerGroupLayerNames")
285 UE_DEPRECATED(5.6, "Renamed : use TargetLayerGroupLayerInfos")
287};
288
289
290// ----------------------------------------------------------------------------------
291
296{
297public:
298 friend class ::ALandscape;
299
301 virtual ~FMergeRenderContext();
304 FMergeRenderContext& operator=(const FMergeRenderContext& Other) = default;
305 FMergeRenderContext& operator=(FMergeRenderContext&& Other) = default;
306
307 bool IsValid() const;
308
319
324
326 {
335 {}
336
339
342
345
348
349 UE_DEPRECATED(5.6, "Renamed : use TargetLayerGroupLayerNames")
351 UE_DEPRECATED(5.6, "Renamed : use TargetLayerGroupLayerInfos")
354 const FMergeRenderBatch* RenderBatch = nullptr;
355 };
356 void Render(TFunction<void(const FOnRenderBatchTargetGroupDoneParams& /*InParams*/, UE::Landscape::FRDGBuilderRecorder& /*RDGBuilderRecorder*/)> OnRenderBatchTargetGroupDone);
357
359 inline const TArray<FMergeRenderBatch>& GetRenderBatches() const { return RenderBatches; }
362
366
367#if ENABLE_VISUAL_LOG
370#endif // ENABLE_VISUAL_LOG
371
378
385
393 LANDSCAPE_API void GenericBlendLayer(const FBlendParams& InBlendParams, FRenderParams& RenderParams, UE::Landscape::FRDGBuilderRecorder& RDGBuilderRecorder);
394
396 {
398 }
399
403 template <typename T, typename = std::enable_if_t<std::is_base_of_v<FLandscapeEditLayerMergeRenderBlackboardItem, std::decay_t<T>>>>
404 bool HasBlackboardItem() const;
405
411 template <typename T, typename... TArgs, typename = std::enable_if_t<std::is_base_of_v<FLandscapeEditLayerMergeRenderBlackboardItem, std::decay_t<T>>>>
412 T& AddBlackboardItem(TArgs&&... InArgs);
413
417 template <typename T, typename = std::enable_if_t<std::is_base_of_v<FLandscapeEditLayerMergeRenderBlackboardItem, std::decay_t<T>>>>
419
423 template <typename T, typename = std::enable_if_t<std::is_base_of_v<FLandscapeEditLayerMergeRenderBlackboardItem, std::decay_t<T>>>>
425
429 template <typename T, typename... TArgs, typename = std::enable_if_t<std::is_base_of_v<FLandscapeEditLayerMergeRenderBlackboardItem, std::decay_t<T>>>>
430 T& GetOrCreateBlackboardItem(TArgs&&... InArgs);
431
435 template <typename T, typename = std::enable_if_t<std::is_base_of_v<FLandscapeEditLayerMergeRenderBlackboardItem, std::decay_t<T>>>>
437
442
443private:
445 void AllocateResources();
447 void FreeResources();
452
453private:
454 // Blending is pretty much what we only do during the merge. It requires 3 render targets : 1 that we write to and therefore use as RTV (Write) and 2 that we read from and therefore use
455 // as SRV (one that contains the layer to merge, the other the accumulated result so far) : Previous(SRV) + Current(SRV) --> Write(RTV)
456 static constexpr int32 NumBlendRenderTargets = 3;
457
461
465
470
473
476
479
482 TArray<FMergeRenderBatch> RenderBatches;
483
486
489
491 double MaxLocalHeight = DBL_MIN;
492
495
498
501};
502
503#endif // WITH_EDITOR
504
505} //namespace UE::Landscape::EditLayers
506
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define PRAGMA_DISABLE_EXPERIMENTAL_WARNINGS
Definition CoreMiscDefines.h:370
#define PRAGMA_ENABLE_EXPERIMENTAL_WARNINGS
Definition CoreMiscDefines.h:371
@ ForceInitToZero
Definition CoreMiscDefines.h:156
@ ForceInit
Definition CoreMiscDefines.h:155
#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
#define FVector
Definition IOSSystemIncludes.h:8
bool operator<(const FTextFormatString &LHS, const FTextFormatString &RHS)
Definition ITextFormatArgumentModifier.h:147
FInt32Point FIntPoint
Definition MathFwd.h:124
#define MAX_int32
Definition NumericLimits.h:25
#define MIN_int32
Definition NumericLimits.h:16
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition NameTypes.h:617
Definition LandscapeEditLayerRenderer.h:260
Definition Landscape.Build.cs:7
Definition ArrayView.h:139
Definition Array.h:670
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition ContainerAllocationPolicies.h:894
Definition StaticArray.h:26
Definition LandscapeUtils.h:106
Definition LandscapeLayerInfoObject.h:60
Definition LandscapeEditResourcesSubsystem.h:83
Type
Definition PawnAction_Move.h:11
EType
Definition AccessDetection.h:11
Definition Landscape.h:55
Definition Landscape.h:55
Definition AdvancedWidgetsModule.cpp:13
Definition LandscapeEditLayerMergeRenderBlackboardItem.h:18
Definition IntPoint.h:25