UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NavMeshRenderingComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
7#include "MaterialShared.h"
11#include "MeshBatch.h"
12#include "LocalVertexFactory.h"
13#include "Math/GenericOctree.h"
14#include "StaticMeshResources.h"
17#include "NavMeshRenderingComponent.generated.h"
18
20class ARecastNavMesh;
24class UCanvas;
26
51
52// exported to API for GameplayDebugger module
53struct FNavMeshSceneProxyData : public TSharedFromThis<FNavMeshSceneProxyData, ESPMode::ThreadSafe>
54{
62
64 {
65 FDebugPoint(const FVector& InPosition, const FColor& InColor, const float InSize) : Position(InPosition), Color(InColor), Size(InSize) {}
68 float Size = 0.f;
69 };
70
80
82 {
84 FString Text;
85
88 FDebugText(const FString& InText) : Location(FNavigationSystem::InvalidLocation), Text(InText) {}
89 };
91
93
99
102
106
107#if WITH_RECAST
108 UE_DEPRECATED(5.5, "Use the version of this function that takes an array of FNavTileRefs instead")
109 NAVIGATIONSYSTEM_API void GatherData(const ARecastNavMesh* NavMesh, int32 InNavDetailFlags, const TArray<int32>& TileSet);
111
112#if RECAST_INTERNAL_DEBUG_DATA
114#endif //RECAST_INTERNAL_DEBUG_DATA
115
116#endif
117};
118
119// exported to API for GameplayDebugger module
121{
123public:
124 NAVIGATIONSYSTEM_API virtual SIZE_T GetTypeHash() const override;
125
127 NAVIGATIONSYSTEM_API virtual ~FNavMeshSceneProxy() override;
128
129 NAVIGATIONSYSTEM_API virtual void GetDynamicMeshElements(const TArray<const FSceneView*>& Views, const FSceneViewFamily& ViewFamily, uint32 VisibilityMap, FMeshElementCollector& Collector) const override;
130
131protected:
133
134 virtual uint32 GetMemoryFootprint(void) const override { return sizeof(*this) + GetAllocatedSizeInternal(); }
136
137private:
138 FNavMeshSceneProxyData ProxyData;
139
141 FStaticMeshVertexBuffers VertexBuffers;
142 FLocalVertexFactory VertexFactory;
143
145 TArray<FMeshBatchElement> MeshBatchElements;
146
147 FDebugDrawDelegate DebugTextDrawingDelegate;
148 FDelegateHandle DebugTextDrawingDelegateHandle;
150 uint32 bForceRendering : 1;
151 uint32 bSkipDistanceCheck : 1;
152 uint32 bUseThickLines : 1;
153};
154
155#if WITH_RECAST && UE_ENABLE_DEBUG_DRAWING
156class FNavMeshDebugDrawDelegateHelper : public FDebugDrawDelegateHelper
157{
158 typedef FDebugDrawDelegateHelper Super;
159
160public:
161 FNavMeshDebugDrawDelegateHelper()
162 : bForceRendering(false)
163 , bNeedsNewData(false)
164 {
165 }
166
168 {
169 DebugLabels.Reset();
170 DebugLabels.Append(InSceneProxy->ProxyData.DebugLabels);
171 bForceRendering = InSceneProxy->bForceRendering;
172 bNeedsNewData = InSceneProxy->ProxyData.bNeedsNewData;
173 }
174
175 void Reset()
176 {
177 DebugLabels.Reset();
178 bNeedsNewData = true;
179 }
180
181protected:
182 NAVIGATIONSYSTEM_API virtual void DrawDebugLabels(UCanvas* Canvas, APlayerController*) override;
183
184private:
186 uint32 bForceRendering : 1;
187 uint32 bNeedsNewData : 1;
188};
189#endif
190
191UCLASS(editinlinenew, ClassGroup = Debug, MinimalAPI)
193{
195
196public:
197 void ForceUpdate() { bForceUpdate = true; }
198 bool IsForcingUpdate() const { return bForceUpdate; }
199
200 static NAVIGATIONSYSTEM_API bool IsNavigationShowFlagSet(const UWorld* World);
201
202protected:
203 NAVIGATIONSYSTEM_API virtual void OnRegister() override;
204 NAVIGATIONSYSTEM_API virtual void OnUnregister() override;
205
206#if UE_ENABLE_DEBUG_DRAWING
207 NAVIGATIONSYSTEM_API virtual FDebugRenderSceneProxy* CreateDebugSceneProxy() override;
208#if WITH_RECAST
209 virtual FDebugDrawDelegateHelper& GetDebugDrawDelegateHelper() override { return NavMeshDebugDrawDelegateManager; }
210#endif // WITH_RECAST
211#endif // UE_ENABLE_DEBUG_DRAWING
212
213 NAVIGATIONSYSTEM_API virtual FBoxSphereBounds CalcBounds(const FTransform &LocalToWorld) const override;
214
217 NAVIGATIONSYSTEM_API virtual void GatherData(const ARecastNavMesh& NavMesh, FNavMeshSceneProxyData& OutProxyData) const;
218
219 NAVIGATIONSYSTEM_API void TimerFunction();
220
221protected:
225
226protected:
227#if WITH_RECAST && UE_ENABLE_DEBUG_DRAWING
228 FNavMeshDebugDrawDelegateHelper NavMeshDebugDrawDelegateManager;
229#endif
230};
231
233{
235
237}
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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
return true
Definition ExternalRpcRegistry.cpp:601
ENavMeshDetailFlags
Definition NavMeshRenderingComponent.h:28
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition PlayerController.h:261
Definition RecastNavMesh.h:574
Definition Archive.h:1208
Definition MaterialRenderProxy.h:309
Definition DebugRenderSceneProxy.h:41
Definition IDelegateInstance.h:14
Definition DynamicMeshBuilder.h:228
Definition LocalVertexFactory.h:51
Definition MeshElementCollector.h:26
Definition NavMeshRenderingComponent.h:121
virtual NAVIGATIONSYSTEM_API void GetDynamicMeshElements(const TArray< const FSceneView * > &Views, const FSceneViewFamily &ViewFamily, uint32 VisibilityMap, FMeshElementCollector &Collector) const override
Definition NavMeshRenderingComponent.cpp:1512
virtual NAVIGATIONSYSTEM_API ~FNavMeshSceneProxy() override
Definition NavMeshRenderingComponent.cpp:1503
virtual uint32 GetMemoryFootprint(void) const override
Definition NavMeshRenderingComponent.h:134
virtual NAVIGATIONSYSTEM_API SIZE_T GetTypeHash() const override
Definition NavMeshRenderingComponent.cpp:1426
NAVIGATIONSYSTEM_API uint32 GetAllocatedSizeInternal(void) const
Definition NavMeshRenderingComponent.cpp:1746
virtual NAVIGATIONSYSTEM_API FPrimitiveViewRelevance GetViewRelevance(const FSceneView *View) const override
Definition NavMeshRenderingComponent.cpp:1735
friend class FNavMeshDebugDrawDelegateHelper
Definition NavMeshRenderingComponent.h:122
Definition UnrealTemplate.h:321
Definition PrimitiveDrawInterface.h:19
Definition SceneView.h:2212
Definition SceneView.h:1425
Definition Array.h:670
void Reset(SizeType NewSize=0)
Definition Array.h:2246
void Append(const TArray< OtherElementType, OtherAllocatorType > &Source)
Definition Array.h:2412
Definition SharedPointer.h:1640
Definition Canvas.h:159
Definition DebugDrawComponent.h:50
Definition NavMeshRenderingComponent.h:193
uint32 bCollectNavigationData
Definition NavMeshRenderingComponent.h:222
FTimerHandle TimerHandle
Definition NavMeshRenderingComponent.h:224
uint32 bForceUpdate
Definition NavMeshRenderingComponent.h:223
bool IsForcingUpdate() const
Definition NavMeshRenderingComponent.h:198
void ForceUpdate()
Definition NavMeshRenderingComponent.h:197
Definition World.h:918
Definition NavMeshRenderingComponent.cpp:53
void AddTriangleIndices(FNavMeshSceneProxyData::FDebugMeshData &MeshData, int32 V0, int32 V1, int32 V2)
Definition NavMeshRenderingComponent.cpp:238
void AddVertex(FNavMeshSceneProxyData::FDebugMeshData &MeshData, const FVector &Pos, const FColor Color)
Definition NavMeshRenderingComponent.cpp:226
Definition NavigationTypes.h:38
ENGINE_API FBox CalcBounds(const FVector &P0, const FVector &P1, const FVector &P2, const FVector &P3)
Definition BezierUtilities.cpp:26
@ false
Definition radaudio_common.h:23
Definition Color.h:486
static CORE_API const FColor White
Definition Color.h:749
Definition DebugRenderSceneProxy.h:434
virtual ENGINE_API void DrawDebugLabels(UCanvas *Canvas, APlayerController *PlayerController)
Definition DebugRenderSceneProxy.cpp:174
Definition NavMeshRenderingComponent.h:56
TArray< uint32 > Indices
Definition NavMeshRenderingComponent.h:58
TArray< FDynamicMeshVertex > Vertices
Definition NavMeshRenderingComponent.h:57
FColor ClusterColor
Definition NavMeshRenderingComponent.h:59
Definition NavMeshRenderingComponent.h:64
FVector Position
Definition NavMeshRenderingComponent.h:66
float Size
Definition NavMeshRenderingComponent.h:68
FDebugPoint(const FVector &InPosition, const FColor &InColor, const float InSize)
Definition NavMeshRenderingComponent.h:65
FColor Color
Definition NavMeshRenderingComponent.h:67
Definition NavMeshRenderingComponent.h:82
FDebugText()
Definition NavMeshRenderingComponent.h:86
FVector Location
Definition NavMeshRenderingComponent.h:83
FString Text
Definition NavMeshRenderingComponent.h:84
FDebugText(const FVector &InLocation, const FString &InText)
Definition NavMeshRenderingComponent.h:87
FDebugText(const FString &InText)
Definition NavMeshRenderingComponent.h:88
Definition NavMeshRenderingComponent.h:54
TArray< FDebugRenderSceneProxy::FDebugLine > NavMeshEdgeLines
Definition NavMeshRenderingComponent.h:73
TArray< FDebugPoint > AuxPoints
Definition NavMeshRenderingComponent.h:77
TArray< FDebugRenderSceneProxy::FDebugLine > ClusterLinkLines
Definition NavMeshRenderingComponent.h:75
TArray< FDebugRenderSceneProxy::FDebugLine > ThickLineItems
Definition NavMeshRenderingComponent.h:71
int32 NavDetailFlags
Definition NavMeshRenderingComponent.h:98
FBox Bounds
Definition NavMeshRenderingComponent.h:94
TArray< FDebugRenderSceneProxy::FDebugLine > TileEdgeLines
Definition NavMeshRenderingComponent.h:72
FNavMeshSceneProxyData()
Definition NavMeshRenderingComponent.h:100
TArray< FBoxCenterAndExtent > OctreeBounds
Definition NavMeshRenderingComponent.h:92
NAVIGATIONSYSTEM_API void Reset()
Definition NavMeshRenderingComponent.cpp:321
TArray< FDebugRenderSceneProxy::FDebugLine > NavLinkLines
Definition NavMeshRenderingComponent.h:74
TArray< FDebugText > DebugLabels
Definition NavMeshRenderingComponent.h:90
TArray< FDebugMeshData > MeshBuilders
Definition NavMeshRenderingComponent.h:61
TArray< FDebugRenderSceneProxy::FDebugLine > AuxLines
Definition NavMeshRenderingComponent.h:76
NAVIGATIONSYSTEM_API uint32 GetAllocatedSize() const
Definition NavMeshRenderingComponent.cpp:482
uint32 bDataGathered
Definition NavMeshRenderingComponent.h:96
TArray< FDebugRenderSceneProxy::FMesh > Meshes
Definition NavMeshRenderingComponent.h:79
TArray< FDebugRenderSceneProxy::FDebugBox > AuxBoxes
Definition NavMeshRenderingComponent.h:78
uint32 bNeedsNewData
Definition NavMeshRenderingComponent.h:97
FVector NavMeshDrawOffset
Definition NavMeshRenderingComponent.h:95
Definition PrimitiveViewRelevance.h:14
Definition StaticMeshResources.h:320
Definition TimerHandle.h:12
Definition WeakObjectPtrTemplates.h:25
Definition BoxSphereBounds.h:25