FMeshMergeDataTracker

Used to keep track of in-flight data while meshes are merged and their corresponding materials baked down

Windows
MacOS
Linux

References

Module

MeshMergeUtilities

Header

/Engine/Source/Developer/MeshMergeUtilities/Public/MeshMergeDataTracker.h

Include

#include "MeshMergeDataTracker.h"

Syntax

class FMeshMergeDataTracker

Remarks

Used to keep track of in-flight data while meshes are merged and their corresponding materials baked down

Variables

Name Description

Protected variable

int32

 

AvailableLightMapUVChannel

First available UV channel across all RawMesh entries

Protected variable

bool[8][MAX_MES...

 

bOcuppiedUVChannels

Protected variable

bool[8]

 

bWithVertexColors

Flags for UV and vertex color usage

Protected variable

TMap< FMeshLODK...

 

ComponentToWedgeOffsets

Protected variable

TMap< FMeshLODK...

 

LightmapChannelLODs

Mesh / LOD index, lightmap channel.

Protected variable

TArray< int32 >

 

LODIndices

All LOD indices which should be populated in the final merged mesh

Protected variable

TMap< UMaterial...

 

MaterialInterfaceToMaterialSlotName

Use this map to recycle the material slot name.

Protected variable

TMap< FMeshLODK...

 

RawMeshLODs

Mesh / LOD index, RawMesh.

Protected variable

TArray< FMeshLO...

 

RequiresUniqueUVs

Whether a key requires unique UVs.

Protected variable

int32

 

SummedLightMapPixels

Protected variable

TMultiMap< FMes...

 

UniqueSectionIndexPerLOD

Remapping pairs for each mesh and LOD index combination

Protected variable

TArray< FSectio...

 

UniqueSections

Unique set of sections in mesh

Protected variable

TMultiMap< uint...

 

UniqueSectionToMeshLOD

Maps from each unique section index to all the RawMesh entries which contain an original section that's mapped to it

Constructors

Name Description

Public function

FMeshMergeDataTracker()

Functions

Name Description

Public function

FMeshDescrip...

 

AddAndRetrieveRawMesh

(
    int32 MeshIndex,
    int32 LODIndex,
    UStaticMesh* InMesh
)

Adds or retrieves raw mesh data for the mesh and LOD index

Public function

void

 

AddBakedMaterialSection

(
    const FSectionInfo& SectionInfo
)

Clears out unique section to be replaced with the baked material one

Public function

void

 

AddComponentToWedgeMapping

(
    int32 MeshIndex,
    int32 LODIndex,
    uint32 WedgeIndex
)

Public function

void

 

AddLightmapChannelRecord

(
    int32 MeshIndex,
    int32 LODIndex,
    int32 LightmapChannelIndex
)

Adds a record of what channel lightmap data is stored at

Public function

void

 

AddLightMapPixels

(
    int32 Pixels
)

Add number of lightmap pixels used for one of the Meshes

Public function

void

 

AddLODIndex

(
    int32 LODIndex
)

Adds a LOD index which will be part of the final merged mesh

Public function

void

 

AddMaterialSlotName

(
    UMaterialInterface* MaterialIn...,
    FName MaterialSlotName
)

Add a material slot name for a unique material instance.

Public function

int32

 

AddSection

(
    const FSectionInfo& SectionInfo
)

Adds (unique) section to stored data

Public function

void

 

AddSectionRemapping

(
    int32 MeshIndex,
    int32 LODIndex,
    int32 OriginalIndex,
    int32 UniqueIndex
)

Adding a mapping between the index for an original mesh section index and the mesh section it will be indexed to in the final mesh

Public function Const

bool

 

DoesAnyLODContainVertexColors()

Returns whether or not any raw mesh entry contains vertex colors for any LOD index

Public function Const

bool

 

DoesLODContainVertexColors

(
    int32 LODIndex
)

Returns whether or not any raw mesh entry contains vertex colors for the specified LOD index

Public function

bool

 

DoesMeshLODRequireUniqueUVs

(
    FMeshLODKey Key
)

Returns whether or not the raw mesh entry for the given MeshLOD key requires unique UVs for baking out its material(s)

Public function Const

bool

 

DoesUVChannelContainData

(
    int32 UVChannel,
    int32 LODIndex
)

Returns whether or not any raw mesh entry contains texture coordinates for the specified UV channel and LOD index

Public function Const

bool

 

DoesUVChannelContainData

(
    int32 UVChannel
)

Returns whether or not any raw mesh entry contains texture coordinates for the specified UV channel and any LOD index

Public function

FMeshDescrip...

 

FindRawMeshAndLODIndex

(
    int32 MeshIndex,
    int32& OutLODIndex
)

Tries to retrieve a FMeshDescription and returns the LOD index it found an entry for

Public function Const

int32

 

GetAvailableLightMapUVChannel()

Returns the first available UV channel across all raw mesh entries, which will be a good fit for the lightmap UV index in the final mesh

Public function Const

uint32

 

GetComponentToWedgeMappng

(
    int32 MeshIndex,
    int32 LODIndex
)

Public function Const

TConstRawMes...

 

GetConstRawMeshIterator()

Returns a const key/value iterator for the FMeshDescription entries

Public function Const

int32

 

GetLightMapDimension()

Returns the texture dimension required to distribute all of the lightmap pixels

Public function Const

TConstLODInd...

 

GetLODIndexIterator()

Iterates over LOD indices for mesh

Public function

void

 

GetMappingsForMeshLOD

(
    FMeshLODKey Key,
    TArray< SectionRemapPair >& InOutM...
)

Retrieves all section mappings for the MeshLOD key

Public function

UMaterialInt...

 

GetMaterialForSectionIndex

(
    int32 SectionIndex
)

Returns the material used by the unique section

Public function Const

FName

 

GetMaterialSlotName

(
    UMaterialInterface* MaterialIn...
)

Get the material slot name from a unique material instance.

Public function

void

 

GetMeshLODsMappedToUniqueSection

(
    int32 UniqueIndex,
    TArray< FMeshLODKey >& InOutMeshLO...
)

Retrieves the MeshLOD keys from which the original sections are mapped to the unique section index

Public function Const

int32

 

GetNumLODsForMergedMesh()

Retrieves number of LODs part of the final merged mesh

Public function

TRawMeshIter...

 

GetRawMeshIterator()

Returns a non-const key/value iterator for the FMeshDescription entries

Public function

FMeshDescrip...

 

GetRawMeshPtr

(
    FMeshLODKey Key
)

Retrieves Raw Mesh ptr for the given MeshLOD key

Public function

FMeshDescrip...

 

GetRawMeshPtr

(
    int32 MeshIndex,
    int32 LODIndex
)

Retrieves Raw Mesh ptr for the given mesh and LOD index

Public function Const

const FSecti...

 

GetSection

(
    int32 SectionIndex
)

Returns the unique section instance

Public function Const

int32

 

NumberOfUniqueSections()

Returns the number of unique sections

Public function

void

 

ProcessRawMeshes()

Looks at all available raw mesh data and processes it to populate some flags

Public function

void

 

RemoveRawMesh

(
    int32 MeshIndex,
    int32 LODIndex
)

Removes raw mesh entry for the given mesh and LOD index

Public function

FMeshDescrip...

 

TryFindRawMeshForLOD

(
    int32 MeshIndex,
    int32& InOutDesiredLODIndex
)

Tries to retrieve a FMeshDescription for the given mesh and LOD index, if it can't it will try to find an entry for each LOD levle below InOutDesiredLODIndex

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss