UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FDynamicMeshBuilder Class Reference

#include <DynamicMeshBuilder.h>

Public Member Functions

ENGINE_API FDynamicMeshBuilder (ERHIFeatureLevel::Type InFeatureLevel, uint32 InNumTexCoords=1, uint32 InLightmapCoordinateIndex=0, bool InUse16bitTexCoord=false, FDynamicMeshBufferAllocator *InDynamicMeshBufferAllocator=nullptr)
 
ENGINE_API ~FDynamicMeshBuilder ()
 
ENGINE_API int32 AddVertex (const FVector3f &InPosition, const FVector2f &InTextureCoordinate, const FVector3f &InTangentX, const FVector3f &InTangentY, const FVector3f &InTangentZ, const FColor &InColor)
 
ENGINE_API int32 AddVertex (const FDynamicMeshVertex &InVertex)
 
ENGINE_API void AddTriangle (int32 V0, int32 V1, int32 V2)
 
ENGINE_API int32 AddVertices (const TArray< FDynamicMeshVertex > &InVertices)
 
ENGINE_API void AddTriangles (const TArray< uint32 > &InIndices)
 
ENGINE_API void ReserveVertices (int32 InNumVertices)
 
ENGINE_API void ReserveTriangles (int32 InNumTriangles)
 
ENGINE_API void GetMesh (const FMatrix &LocalToWorld, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup, bool bDisableBackfaceCulling, bool bReceivesDecals, int32 ViewIndex, FMeshElementCollector &Collector)
 
ENGINE_API void GetMesh (const FMatrix &LocalToWorld, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup, bool bDisableBackfaceCulling, bool bReceivesDecals, bool bUseSelectionOutline, int32 ViewIndex, FMeshElementCollector &Collector, HHitProxy *HitProxy)
 
ENGINE_API void GetMesh (const FMatrix &LocalToWorld, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup, bool bDisableBackfaceCulling, bool bReceivesDecals, bool bUseSelectionOutline, int32 ViewIndex, FMeshElementCollector &Collector, const FHitProxyId HitProxyId=FHitProxyId())
 
ENGINE_API void GetMesh (const FMatrix &LocalToWorld, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup, const FDynamicMeshBuilderSettings &Settings, FDynamicMeshDrawOffset const *const DrawOffset, int32 ViewIndex, FMeshElementCollector &Collector, const FHitProxyId HitProxyId=FHitProxyId())
 
ENGINE_API void GetMesh (const FMatrix &LocalToWorld, const FMatrix &PrevLocalToWorld, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup, const FDynamicMeshBuilderSettings &Settings, FDynamicMeshDrawOffset const *const DrawOffset, int32 ViewIndex, FMeshElementCollector &Collector, const FHitProxyId HitProxyId=FHitProxyId())
 
ENGINE_API void GetMeshElement (const FMatrix &LocalToWorld, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup, bool bDisableBackfaceCulling, bool bReceivesDecals, int32 ViewIndex, FMeshBuilderOneFrameResources &OneFrameResource, FMeshBatch &Mesh)
 
ENGINE_API void GetMeshElement (const FPrimitiveUniformShaderParameters &PrimitiveParams, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup, bool bDisableBackfaceCulling, int32 ViewIndex, FMeshBuilderOneFrameResources &OneFrameResource, FMeshBatch &Mesh)
 
ENGINE_API void Draw (FPrimitiveDrawInterface *PDI, const FMatrix &LocalToWorld, const FMaterialRenderProxy *MaterialRenderProxy, uint8 DepthPriorityGroup, bool bDisableBackfaceCulling=false, bool bReceivesDecals=true, const FHitProxyId HitProxyId=FHitProxyId())
 

Detailed Description

A utility used to construct dynamically generated meshes, and render them to a FPrimitiveDrawInterface. Note: This is meant to be easy to use, not fast. It moves the data around more than necessary, and requires dynamically allocating RHI resources. Exercise caution.

Constructor & Destructor Documentation

◆ FDynamicMeshBuilder()

FDynamicMeshBuilder::FDynamicMeshBuilder ( ERHIFeatureLevel::Type  InFeatureLevel,
uint32  InNumTexCoords = 1,
uint32  InLightmapCoordinateIndex = 0,
bool  InUse16bitTexCoord = false,
FDynamicMeshBufferAllocator InDynamicMeshBufferAllocator = nullptr 
)

Initialization constructor.

◆ ~FDynamicMeshBuilder()

FDynamicMeshBuilder::~FDynamicMeshBuilder ( )

Destructor.

Member Function Documentation

◆ AddTriangle()

void FDynamicMeshBuilder::AddTriangle ( int32  V0,
int32  V1,
int32  V2 
)

Adds a triangle to the mesh.

◆ AddTriangles()

void FDynamicMeshBuilder::AddTriangles ( const TArray< uint32 > &  InIndices)

Add many indices to the mesh.

◆ AddVertex() [1/2]

int32 FDynamicMeshBuilder::AddVertex ( const FDynamicMeshVertex InVertex)

Adds a vertex to the mesh.

◆ AddVertex() [2/2]

int32 FDynamicMeshBuilder::AddVertex ( const FVector3f InPosition,
const FVector2f InTextureCoordinate,
const FVector3f InTangentX,
const FVector3f InTangentY,
const FVector3f InTangentZ,
const FColor InColor 
)

Adds a vertex to the mesh.

◆ AddVertices()

int32 FDynamicMeshBuilder::AddVertices ( const TArray< FDynamicMeshVertex > &  InVertices)

Adds many vertices to the mesh.

Adds many vertices to the mesh. Returns start index of verts in the overall array.

◆ Draw()

void FDynamicMeshBuilder::Draw ( FPrimitiveDrawInterface PDI,
const FMatrix LocalToWorld,
const FMaterialRenderProxy MaterialRenderProxy,
uint8  DepthPriorityGroup,
bool  bDisableBackfaceCulling = false,
bool  bReceivesDecals = true,
const FHitProxyId  HitProxyId = FHitProxyId() 
)

Draws the mesh to the given primitive draw interface.

Parameters
PDI- The primitive draw interface to draw the mesh on.
LocalToWorld- The local to world transform to apply to the vertices of the mesh.
FMaterialRenderProxy- The material instance to render on the mesh.
DepthPriorityGroup- The depth priority group to render the mesh in.
HitProxyId- Hit proxy to use for this mesh. Use INDEX_NONE for no hit proxy.

◆ GetMesh() [1/5]

void FDynamicMeshBuilder::GetMesh ( const FMatrix LocalToWorld,
const FMaterialRenderProxy MaterialRenderProxy,
uint8  DepthPriorityGroup,
bool  bDisableBackfaceCulling,
bool  bReceivesDecals,
bool  bUseSelectionOutline,
int32  ViewIndex,
FMeshElementCollector Collector,
const FHitProxyId  HitProxyId = FHitProxyId() 
)

◆ GetMesh() [2/5]

void FDynamicMeshBuilder::GetMesh ( const FMatrix LocalToWorld,
const FMaterialRenderProxy MaterialRenderProxy,
uint8  DepthPriorityGroup,
bool  bDisableBackfaceCulling,
bool  bReceivesDecals,
bool  bUseSelectionOutline,
int32  ViewIndex,
FMeshElementCollector Collector,
HHitProxy HitProxy 
)

◆ GetMesh() [3/5]

void FDynamicMeshBuilder::GetMesh ( const FMatrix LocalToWorld,
const FMaterialRenderProxy MaterialRenderProxy,
uint8  DepthPriorityGroup,
bool  bDisableBackfaceCulling,
bool  bReceivesDecals,
int32  ViewIndex,
FMeshElementCollector Collector 
)

Adds a mesh of what's been built so far to the collector.

◆ GetMesh() [4/5]

void FDynamicMeshBuilder::GetMesh ( const FMatrix LocalToWorld,
const FMaterialRenderProxy MaterialRenderProxy,
uint8  DepthPriorityGroup,
const FDynamicMeshBuilderSettings Settings,
FDynamicMeshDrawOffset const *const  DrawOffset,
int32  ViewIndex,
FMeshElementCollector Collector,
const FHitProxyId  HitProxyId = FHitProxyId() 
)

◆ GetMesh() [5/5]

void FDynamicMeshBuilder::GetMesh ( const FMatrix LocalToWorld,
const FMatrix PrevLocalToWorld,
const FMaterialRenderProxy MaterialRenderProxy,
uint8  DepthPriorityGroup,
const FDynamicMeshBuilderSettings Settings,
FDynamicMeshDrawOffset const *const  DrawOffset,
int32  ViewIndex,
FMeshElementCollector Collector,
const FHitProxyId  HitProxyId = FHitProxyId() 
)

◆ GetMeshElement() [1/2]

void FDynamicMeshBuilder::GetMeshElement ( const FMatrix LocalToWorld,
const FMaterialRenderProxy MaterialRenderProxy,
uint8  DepthPriorityGroup,
bool  bDisableBackfaceCulling,
bool  bReceivesDecals,
int32  ViewIndex,
FMeshBuilderOneFrameResources OneFrameResource,
FMeshBatch Mesh 
)

◆ GetMeshElement() [2/2]

void FDynamicMeshBuilder::GetMeshElement ( const FPrimitiveUniformShaderParameters PrimitiveParams,
const FMaterialRenderProxy MaterialRenderProxy,
uint8  DepthPriorityGroup,
bool  bDisableBackfaceCulling,
int32  ViewIndex,
FMeshBuilderOneFrameResources OneFrameResource,
FMeshBatch Mesh 
)

◆ ReserveTriangles()

void FDynamicMeshBuilder::ReserveTriangles ( int32  InNumTriangles)

Pre-allocate space for the given number of triangles.

◆ ReserveVertices()

void FDynamicMeshBuilder::ReserveVertices ( int32  InNumVertices)

Pre-allocate space for the given number of vertices.


The documentation for this class was generated from the following files: