UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LineBatchComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3
4#pragma once
5
6#include "CoreMinimal.h"
9
10#include "LineBatchComponent.generated.h"
11
13
14USTRUCT()
16{
18
19 UPROPERTY()
20 FVector Start;
21
22 UPROPERTY()
24
25 UPROPERTY()
27
28 UPROPERTY()
29 float Thickness;
30
31 UPROPERTY()
32 float RemainingLifeTime;
33
34 UPROPERTY()
35 uint8 DepthPriority;
36
37 UPROPERTY()
38 uint32 BatchID;
39
41 : Start(ForceInit)
42 , End(ForceInit)
44 , Thickness(0)
45 , RemainingLifeTime(0)
46 , DepthPriority(0)
47 , BatchID(0)
48 {}
50 : Start(InStart)
51 , End(InEnd)
52 , Color(InColor)
53 , Thickness(InThickness)
54 , RemainingLifeTime(InLifeTime)
55 , DepthPriority(InDepthPriority)
56 , BatchID(InBatchID)
57 {}
58};
59
60USTRUCT()
62{
64
65 UPROPERTY()
67
68 UPROPERTY()
70
71 UPROPERTY()
72 float PointSize;
73
74 UPROPERTY()
75 float RemainingLifeTime;
76
77 UPROPERTY()
78 uint8 DepthPriority;
79
80 UPROPERTY()
81 uint32 BatchID;
82
86 , PointSize(0)
87 , RemainingLifeTime(0)
88 , DepthPriority(0)
89 , BatchID(0)
90 {}
93 , Color(InColor)
94 , PointSize(InPointSize)
95 , RemainingLifeTime(InLifeTime)
96 , DepthPriority(InDepthPriority)
97 , BatchID(InBatchID)
98 {}
99};
100
121
126UCLASS(MinimalAPI)
127class ULineBatchComponent : public UPrimitiveComponent
128{
130
131
132 TArray<FBatchedLine> BatchedLines;
134 TArray<FBatchedPoint> BatchedPoints;
136 float DefaultLifeTime;
138 TArray<FBatchedMesh> BatchedMeshes;
140 uint32 bCalculateAccurateBounds:1;
141
143 static constexpr uint32 INVALID_ID = 0;
144
147
149 ENGINE_API void DrawBox(const FBox& Box, const FMatrix& TM, FLinearColor Color, uint8 InDepthPriorityGroup, uint32 BatchID = INVALID_ID);
150
152 ENGINE_API void DrawBox(const FVector& Center, const FVector& Box, FLinearColor Color, float LifeTime, uint8 DepthPriority, float Thickness, uint32 BatchID = INVALID_ID);
153
155 ENGINE_API void DrawBox(const FVector& Center, const FVector& Box, const FQuat& Rotation, FLinearColor Color, float LifeTime, uint8 DepthPriority, float Thickness, uint32 BatchID = INVALID_ID);
156
158 ENGINE_API void DrawDirectionalArrow(const FMatrix& ArrowToWorld, FLinearColor InColor, float Length, float ArrowSize, uint8 DepthPriority, uint32 BatchID = INVALID_ID);
159
161 ENGINE_API void DrawDirectionalArrow(const FVector& LineStart, const FVector& LineEnd, float ArrowSize, FLinearColor Color, float LifeTime, uint8 DepthPriority, float Thickness, uint32 BatchID = INVALID_ID);
162
164 ENGINE_API void DrawCircle(const FVector& Base, const FVector& X, const FVector& Y, FLinearColor Color, float Radius, int32 NumSides, uint8 DepthPriority, uint32 BatchID = INVALID_ID);
165
167 ENGINE_API void DrawSphere(const FVector& Center, float Radius, int32 Segments, FLinearColor Color, float LifeTime, uint8 DepthPriority, float Thickness, uint32 BatchID = INVALID_ID);
168
170 ENGINE_API void DrawCylinder(const FVector& Start, const FVector& End, float Radius, int32 Segments, FLinearColor Color, float LifeTime, uint8 DepthPriority, float Thickness, uint32 BatchID = INVALID_ID);
171
173 ENGINE_API void DrawCone(const FVector& Origin, const FVector& Direction, float Length, float AngleWidth, float AngleHeight, int32 NumSides, FLinearColor DrawColor, float LifeTime, uint8 DepthPriority, float Thickness, uint32 BatchID = INVALID_ID);
174
176 ENGINE_API void DrawCapsule(const FVector& Center, float HalfHeight, float Radius, const FQuat& Rotation, FLinearColor Color, float LifeTime, uint8 DepthPriority, float Thickness, uint32 BatchID = INVALID_ID);
177
178 ENGINE_API virtual void DrawLine(
179 const FVector& Start,
180 const FVector& End,
181 const FLinearColor& Color,
182 uint8 DepthPriority,
183 float Thickness = 0.0f,
184 float LifeTime = 0.0f,
185 uint32 BatchID = INVALID_ID
186 );
187 ENGINE_API virtual void DrawPoint(
188 const FVector& Position,
189 const FLinearColor& Color,
190 float PointSize,
191 uint8 DepthPriority,
192 float LifeTime = 0.0f,
193 uint32 BatchID = INVALID_ID
194 );
195
197 ENGINE_API void DrawSolidBox(FBox const& Box, FTransform const& Xform, const FColor& Color, uint8 DepthPriority, float LifeTime, uint32 BatchID = INVALID_ID);
199 ENGINE_API void DrawMesh(TArray<FVector> const& Verts, TArray<int32> const& Indices, FColor const& Color, uint8 DepthPriority, float LifeTime, uint32 BatchID = INVALID_ID);
200
201 //~ Begin UPrimitiveComponent Interface.
202 ENGINE_API virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
203 ENGINE_API virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override;
204 //~ End UPrimitiveComponent Interface.
205
206
207 //~ Begin UActorComponent Interface.
208 ENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
209 ENGINE_API virtual void ApplyWorldOffset(const FVector& InOffset, bool bWorldShift) override;
210 //~ End UActorComponent Interface.
211
213 ENGINE_API void Flush();
214
216 ENGINE_API void ClearBatch(uint32 InBatchID);
217
218protected:
219 void AddHalfCircle(const FVector& Base, const FVector& X, const FVector& Y, const FLinearColor& Color, const float Radius, int32 NumSides, const float LifeTime, uint8 DepthPriority, const float Thickness, const uint32 BatchID);
220 void AddCircle(const FVector& Base, const FVector& X, const FVector& Y, const FLinearColor& Color, const float Radius, int32 NumSides, const float LifeTime, uint8 DepthPriority, const float Thickness, const uint32 BatchID);
221};
@ ForceInit
Definition CoreMiscDefines.h:155
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
ELevelTick
Definition EngineBaseTypes.h:70
#define X(Name, Desc)
Definition FormatStringSan.h:47
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
void DrawCone(FPrimitiveDrawInterface *PDI, const FMatrix &ConeToWorld, float Angle1, float Angle2, uint32 NumSides, bool bDrawSideLines, const FLinearColor &SideLineColor, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriority)
Definition PrimitiveDrawingUtils.cpp:481
void DrawBox(FPrimitiveDrawInterface *PDI, const FMatrix &BoxToWorld, const FVector &Radii, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup)
Definition PrimitiveDrawingUtils.cpp:148
void DrawDirectionalArrow(FPrimitiveDrawInterface *PDI, const FMatrix &ArrowToWorld, const FLinearColor &InColor, float Length, float ArrowSize, uint8 DepthPriority, float Thickness)
Definition PrimitiveDrawingUtils.cpp:1437
void DrawSphere(FPrimitiveDrawInterface *PDI, const FVector &Center, const FRotator &Orientation, const FVector &Radii, int32 NumSides, int32 NumRings, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriority, bool bDisableBackfaceCulling)
Definition PrimitiveDrawingUtils.cpp:302
void DrawCylinder(FPrimitiveDrawInterface *PDI, const FVector &Base, const FVector &XAxis, const FVector &YAxis, const FVector &ZAxis, double Radius, double HalfHeight, uint32 Sides, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriority)
Definition PrimitiveDrawingUtils.cpp:744
void DrawCircle(FPrimitiveDrawInterface *PDI, const FVector &Base, const FVector &X, const FVector &Y, const FLinearColor &Color, double Radius, int32 NumSides, uint8 DepthPriority, float Thickness, float DepthBias, bool bScreenSpace)
Definition PrimitiveDrawingUtils.cpp:1071
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition PrimitiveSceneProxy.h:296
Definition ArrayView.h:139
Definition Array.h:670
Definition LineBatchComponent.h:128
Definition EngineBaseTypes.h:571
Definition LineBatchComponent.h:16
FBatchedLine(const FVector &InStart, const FVector &InEnd, const FLinearColor &InColor, float InLifeTime, float InThickness, uint8 InDepthPriority, uint32 InBatchID=0)
Definition LineBatchComponent.h:49
Definition LineBatchComponent.h:102
TArray< FVector > MeshVerts
Definition LineBatchComponent.h:114
float RemainingLifeTime
Definition LineBatchComponent.h:117
FColor Color
Definition LineBatchComponent.h:116
FBatchedMesh()=default
FBatchedMesh(TArray< FVector > const &InMeshVerts, TArray< int32 > const &InMeshIndices, FColor const &InColor, uint8 InDepthPriority, float LifeTime, uint32 InBatchID=0)
Definition LineBatchComponent.h:109
TArray< int32 > MeshIndices
Definition LineBatchComponent.h:115
uint32 BatchID
Definition LineBatchComponent.h:119
uint8 DepthPriority
Definition LineBatchComponent.h:118
Definition LineBatchComponent.h:62
FBatchedPoint(const FVector &InPosition, const FLinearColor &InColor, float InPointSize, float InLifeTime, uint8 InDepthPriority, uint32 InBatchID=0)
Definition LineBatchComponent.h:91
Definition Color.h:486
Definition Color.h:48
Definition BoxSphereBounds.h:25