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

#include <MeshDescriptionBuilder.h>

Public Member Functions

MESHCONVERSION_API void SetMeshDescription (FMeshDescription *Description)
 
MESHCONVERSION_API void ReserveNewVertices (int32 Count)
 
MESHCONVERSION_API FVertexID AppendVertex (const FVector &Position)
 
MESHCONVERSION_API FVertexID AppendVertexWithId (int32 NewVertexID, const FVector &Position)
 
MESHCONVERSION_API FVector GetPosition (const FVertexID &VertexID)
 
MESHCONVERSION_API FVector GetPosition (const FVertexInstanceID &InstanceID)
 
MESHCONVERSION_API void SetPosition (const FVertexID &VertexID, const FVector &NewPosition)
 
MESHCONVERSION_API void SetNumUVLayers (int32 NumUVLayers)
 
MESHCONVERSION_API void ReserveNewUVs (int32 Count, int UVLayerIndex)
 
MESHCONVERSION_API FUVID AppendUV (const FVector2D &UVvalue, int32 UVLayerIndex)
 
MESHCONVERSION_API FVertexInstanceID AppendInstance (const FVertexID &VertexID)
 
MESHCONVERSION_API void SetInstanceUV (const FVertexInstanceID &InstanceID, const FVector2D &InstanceUV, int32 UVLayerIndex=0)
 
MESHCONVERSION_API void SetInstanceNormal (const FVertexInstanceID &InstanceID, const FVector &Normal)
 
MESHCONVERSION_API void SetInstanceTangentSpace (const FVertexInstanceID &InstanceID, const FVector &Normal, const FVector &Tangent, float Sign)
 
MESHCONVERSION_API void SetInstanceColor (const FVertexInstanceID &InstanceID, const FVector4f &Color)
 
MESHCONVERSION_API void EnablePolyGroups ()
 
MESHCONVERSION_API void SetPolyGroupID (const FTriangleID &TriangleID, int GroupID)
 
MESHCONVERSION_API void AppendUVTriangle (const FTriangleID &TriangleID, const FUVID UVverterxID0, const FUVID UVvertexID1, const FUVID UVvertexID2, int32 UVLayerIndex)
 
MESHCONVERSION_API FTriangleID AppendTriangle (const FVertexID &Vertex0, const FVertexID &Vertex1, const FVertexID &Vertex2, const FPolygonGroupID &PolygonGroup)
 
MESHCONVERSION_API FTriangleID AppendTriangle (const FVertexID *Triangle, const FPolygonGroupID &PolygonGroup)
 
MESHCONVERSION_API FTriangleID AppendTriangle (const FVertexInstanceID &Instance0, const FVertexInstanceID &Instance1, const FVertexInstanceID &Instance2, const FPolygonGroupID &PolygonGroup)
 
MESHCONVERSION_API FPolygonID AppendPolygon (const TArray< FVertexID > &Vertices, const FPolygonGroupID &PolygonGroup)
 
MESHCONVERSION_API FPolygonGroupID AppendPolygonGroup (FName MaterialSlotName=NAME_None)
 
template<typename T >
void SetVertexAttributeValue (FName AttributeName, FVertexID VertexID, const T &Value)
 
MESHCONVERSION_API void SetAllEdgesHardness (bool bHard)
 
MESHCONVERSION_API void Translate (const FVector &Translation)
 
MESHCONVERSION_API FBox ComputeBoundingBox () const
 
MESHCONVERSION_API void SuspendMeshDescriptionIndexing ()
 
MESHCONVERSION_API void ResumeMeshDescriptionIndexing ()
 

Protected Attributes

FMeshDescriptionMeshDescription
 
TVertexAttributesRef< FVector3fVertexPositions
 
TVertexInstanceAttributesRef< FVector2fInstanceUVs
 
TVertexInstanceAttributesRef< FVector3fInstanceNormals
 
TVertexInstanceAttributesRef< FVector3fInstanceTangents
 
TVertexInstanceAttributesRef< floatInstanceBiTangentSign
 
TVertexInstanceAttributesRef< FVector4fInstanceColors
 
TArray< TUVAttributesRef< FVector2f > > UVCoordinateLayers
 
TArray< FVertexIDTempBuffer
 
TArray< FUVIDTempUVBuffer
 
TPolygonAttributesRef< int > PolyGroups
 
TPolygonGroupAttributesRef< FNameGroupMaterialSlotNames
 

Detailed Description

Utility class to construct MeshDescription instances. NB: this will add a vertex-instance UV to the Description, if it has none.

Member Function Documentation

◆ AppendInstance()

FVertexInstanceID FMeshDescriptionBuilder::AppendInstance ( const FVertexID VertexID)

Append new vertex instance and return ID

◆ AppendPolygon()

FPolygonID FMeshDescriptionBuilder::AppendPolygon ( const TArray< FVertexID > &  Vertices,
const FPolygonGroupID PolygonGroup 
)

Append an arbitrary polygon to the mesh with the given PolygonGroup ID Unique Vertex instances will be created for each polygon-vertex.

◆ AppendPolygonGroup()

FPolygonGroupID FMeshDescriptionBuilder::AppendPolygonGroup ( FName  MaterialSlotName = NAME_None)

Create a new MeshDescription PolygonGroup and return it's ID. PolygonGroups are not the same as Polygroups, they essentially represent Mesh Sections, which then reference Material Slots, etc

◆ AppendTriangle() [1/3]

FTriangleID FMeshDescriptionBuilder::AppendTriangle ( const FVertexID Vertex0,
const FVertexID Vertex1,
const FVertexID Vertex2,
const FPolygonGroupID PolygonGroup 
)

Append a triangle to the mesh with the given PolygonGroup ID

◆ AppendTriangle() [2/3]

FTriangleID FMeshDescriptionBuilder::AppendTriangle ( const FVertexID Triangle,
const FPolygonGroupID PolygonGroup 
)

Append a triangle to the mesh with the given PolygonGroup ID

◆ AppendTriangle() [3/3]

FTriangleID FMeshDescriptionBuilder::AppendTriangle ( const FVertexInstanceID Instance0,
const FVertexInstanceID Instance1,
const FVertexInstanceID Instance2,
const FPolygonGroupID PolygonGroup 
)

Append a triangle to the mesh using the given vertex instances and PolygonGroup ID

◆ AppendUV()

FUVID FMeshDescriptionBuilder::AppendUV ( const FVector2D UVvalue,
int32  UVLayerIndex 
)

Append a UV 'vertex' and return a new UV ID

◆ AppendUVTriangle()

void FMeshDescriptionBuilder::AppendUVTriangle ( const FTriangleID TriangleID,
const FUVID  UVverterxID0,
const FUVID  UVvertexID1,
const FUVID  UVvertexID2,
int32  UVLayerIndex 
)

Append a UV triangle to the specified UV layer. This will use both shared and per-instance UV storage

◆ AppendVertex()

FVertexID FMeshDescriptionBuilder::AppendVertex ( const FVector Position)

Append vertex and return new vertex ID

◆ AppendVertexWithId()

FVertexID FMeshDescriptionBuilder::AppendVertexWithId ( int32  NewVertexID,
const FVector Position 
)

Append vertex with a specific ID and return it

◆ ComputeBoundingBox()

FBox FMeshDescriptionBuilder::ComputeBoundingBox ( ) const

Return the current bounding box of the mesh

◆ EnablePolyGroups()

void FMeshDescriptionBuilder::EnablePolyGroups ( )

Enable per-triangle integer attribute named PolyTriGroups

◆ GetPosition() [1/2]

FVector FMeshDescriptionBuilder::GetPosition ( const FVertexID VertexID)

Return position of vertex

◆ GetPosition() [2/2]

FVector FMeshDescriptionBuilder::GetPosition ( const FVertexInstanceID InstanceID)

Return position of vertex parent of instance

◆ ReserveNewUVs()

void FMeshDescriptionBuilder::ReserveNewUVs ( int32  Count,
int  UVLayerIndex 
)

Pre-allocate space in the mesh description for UVs in the indicated UVLayer

◆ ReserveNewVertices()

void FMeshDescriptionBuilder::ReserveNewVertices ( int32  Count)

Pre-allocate space in the mesh description

◆ ResumeMeshDescriptionIndexing()

void FMeshDescriptionBuilder::ResumeMeshDescriptionIndexing ( )

Enable the construction of secondary data structures in the mesh description

◆ SetAllEdgesHardness()

void FMeshDescriptionBuilder::SetAllEdgesHardness ( bool  bHard)

Set MeshAttribute::Edge::IsHard to true for all edges

◆ SetInstanceColor()

void FMeshDescriptionBuilder::SetInstanceColor ( const FVertexInstanceID InstanceID,
const FVector4f Color 
)

Set the Color of a vertex instance

◆ SetInstanceNormal()

void FMeshDescriptionBuilder::SetInstanceNormal ( const FVertexInstanceID InstanceID,
const FVector Normal 
)

Set the Normal of a vertex instance

◆ SetInstanceTangentSpace()

void FMeshDescriptionBuilder::SetInstanceTangentSpace ( const FVertexInstanceID InstanceID,
const FVector Normal,
const FVector Tangent,
float  Sign 
)

Set the full tangent space of a vertex instance, this is stored as a vec3 normal, vec3 tangent, and a bitangent sign

◆ SetInstanceUV()

void FMeshDescriptionBuilder::SetInstanceUV ( const FVertexInstanceID InstanceID,
const FVector2D InstanceUV,
int32  UVLayerIndex = 0 
)

Set the UV of a vertex instance. Note: this generally shouldn't be called directly because it alters the instance UVs but not the shared UVs When setting UVs use AppendUVTriangle

◆ SetMeshDescription()

void FMeshDescriptionBuilder::SetMeshDescription ( FMeshDescription Description)

◆ SetNumUVLayers()

void FMeshDescriptionBuilder::SetNumUVLayers ( int32  NumUVLayers)

Set the number of UV layers

◆ SetPolyGroupID()

void FMeshDescriptionBuilder::SetPolyGroupID ( const FTriangleID TriangleID,
int  GroupID 
)

Set the PolyTriGroups attribute value to a specific GroupID for a Triangle

◆ SetPosition()

void FMeshDescriptionBuilder::SetPosition ( const FVertexID VertexID,
const FVector NewPosition 
)

Set the position of a vertex

◆ SetVertexAttributeValue()

template<typename T >
void FMeshDescriptionBuilder::SetVertexAttributeValue ( FName  AttributeName,
FVertexID  VertexID,
const T &  Value 
)
inline

Set the specified value for the named attribute / vertex index combination. If a vertex attribute with the given name doesn't exist, it is created.

◆ SuspendMeshDescriptionIndexing()

void FMeshDescriptionBuilder::SuspendMeshDescriptionIndexing ( )

Disable the construction of secondary data structures in the mesh description

◆ Translate()

void FMeshDescriptionBuilder::Translate ( const FVector Translation)

Translate the MeshDescription vertex positions

Member Data Documentation

◆ GroupMaterialSlotNames

TPolygonGroupAttributesRef<FName> FMeshDescriptionBuilder::GroupMaterialSlotNames
protected

◆ InstanceBiTangentSign

TVertexInstanceAttributesRef<float> FMeshDescriptionBuilder::InstanceBiTangentSign
protected

◆ InstanceColors

TVertexInstanceAttributesRef<FVector4f> FMeshDescriptionBuilder::InstanceColors
protected

◆ InstanceNormals

TVertexInstanceAttributesRef<FVector3f> FMeshDescriptionBuilder::InstanceNormals
protected

◆ InstanceTangents

TVertexInstanceAttributesRef<FVector3f> FMeshDescriptionBuilder::InstanceTangents
protected

◆ InstanceUVs

TVertexInstanceAttributesRef<FVector2f> FMeshDescriptionBuilder::InstanceUVs
protected

◆ MeshDescription

FMeshDescription* FMeshDescriptionBuilder::MeshDescription
protected

◆ PolyGroups

TPolygonAttributesRef<int> FMeshDescriptionBuilder::PolyGroups
protected

◆ TempBuffer

TArray<FVertexID> FMeshDescriptionBuilder::TempBuffer
protected

◆ TempUVBuffer

TArray<FUVID> FMeshDescriptionBuilder::TempUVBuffer
protected

◆ UVCoordinateLayers

TArray<TUVAttributesRef<FVector2f> > FMeshDescriptionBuilder::UVCoordinateLayers
protected

◆ VertexPositions

TVertexAttributesRef<FVector3f> FMeshDescriptionBuilder::VertexPositions
protected

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