UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DebugDrawPrimitives.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Chaos/Core.h"
5#include "Chaos/Declares.h"
6#include "Math/MathFwd.h"
7
8#define UE_API CHAOS_API
9
10#if CHAOS_DEBUG_DRAW
11
12namespace Chaos
13{
14 // A set of debug draw primitives.
15 //
16 // NOTE: these are convenient for quick temporary debug draw but it is usually better to
17 // create a custom debug draw command with its own data and generating the primitives
18 // at render time, rather than capture time. Deferring the primitive generation to render
19 // time means that decisions about color, line width etc. can be deferred which is useful
20 // for rewinding and changing how objects are displayed.
21 //
22 // A debug draw command is a deferred lambda that captures the data required for
23 // rendering and uses the IChaosDDRenderer interface to perform rendering. As the command
24 // is deferred, make sure all lambda parameters are captured by value, not reference!
25 // By convention the Draw function is a static member of a struct, but this is not required.
26 //
27 // See the DrawLine implementation for a trivial example. For a less-trivial example
28 // see FChaosDDCollisionConstraint, or for a complex example see FChaosDDParticle which
29 // supports capture-time and various render-time coloring modes.
30 //
32 {
33 static UE_API void DrawPoint(const FVector3d& Position, const FColor& Color, float PointSize, float Duration);
34 static UE_API void DrawLine(const FVector3d& A, const FVector3d& B, const FColor& Color, float LineThickness, float Duration);
35 static UE_API void DrawArrow(const FVector3d& A, const FVector3d& B, float ArrowSize, const FColor& Color, float LineThickness, float Duration);
36 static UE_API void DrawCircle(const FVector3d& Center, const FMatrix& Axes, float Radius, const FColor& Color, float LineThickness, float Duration);
37 static UE_API void DrawSphere(const FVector3d& Center, const float Radius, const FColor& Color, float LineThickness, float Duration);
38 static UE_API void DrawCapsule(const FVector3d& Center, const FQuat4d& Rotation, float HalfHeight, float Radius, const FColor& Color, float LineThickness, float Duration);
39 static UE_API void DrawBox(const FVector3d& Center, const FQuat4d& Rotation, const FVector3d& Size, const FColor& Color, float LineThickness, float Duration);
40 static UE_API void DrawTriangle(const FVector3d& A, const FVector3d& B, const FVector3d& C, const FColor& Color, float LineThickness, float Duration);
41 static UE_API void DrawString(const FVector3d& TextLocation, const FString& Text, const FColor& Color, float FontScale, bool bDrawShadow, float Duration);
42 };
43}
44
45#endif
46
47#undef UE_API
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
void DrawBox(FPrimitiveDrawInterface *PDI, const FMatrix &BoxToWorld, const FVector &Radii, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup)
Definition PrimitiveDrawingUtils.cpp:148
void DrawTriangle(class FPrimitiveDrawInterface *PDI, const FVector &A, const FVector &B, const FVector &C, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup)
Definition PrimitiveDrawingUtils.cpp:67
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 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
#define UE_API
Definition SColorGradingComponentViewer.h:12
uint32 Size
Definition VulkanMemory.cpp:4034
Definition SkeletalMeshComponent.h:307
Definition Color.h:486