Navigation
API > API/Runtime > API/Runtime/MeshDescription
References
| Module | MeshDescription |
| Header | /Engine/Source/Runtime/MeshDescription/Public/MeshElementIndexer.h |
| Include | #include "MeshElementIndexer.h" |
Syntax
class FMeshElementIndexer
Remarks
This is an efficient container for holding back references to mesh elements from attributes. Typically this will be a one-to-many relationship, where a given key has many different references.
Naively this would be implemented as an array of arrays, but we want to minimise allocations and fragmentation as much as possible. This is achieved in two ways:
1) Arrays representing the list of references are consolidated into chunks of a user-specified size. This reduces the number of individual allocations which need to be made. By default, 256 keys are consolidated into a single chunk.
2) The arrays are lazily updated. The most expensive aspect of consolidating adjacent keys' values into a single chunk of data is having to insert new space into the middle of the chunk. If a new value can't be immediately added into a chunk without inserting, the key is marked as stale and the referencer is remembered. If a stale key is queried, the indexer will be updated first, building all stale keys by getting back references from the remembered referencers.
There is also a way to fully rebuild an indexer, which will perform optimally few allocations, and collect all back references at once. It may sometimes be desirable to suspend an indexer, build a mesh description with indexing suspended, and then perform an indexer rebuild for additional speed and allocation efficiency.
Some element relationships don't lend themselves to chunking, for example polygon groups to triangles. In this case, there are generally few polygon groups compared to many triangles. Chunking can be turned off for such indexers, resulting in a more simple array representation which can be arbitrarily grown without requiring elements to be inserted.
Constructors
| Type | Name | Description | |
|---|---|---|---|
FMeshElementIndexer
(
const FMeshElementIndexer& |
Copying not allowed as they reference elements of a MeshDescription of which they are normally a part. | ||
| Moving OK. | |||
FMeshElementIndexer
(
const FMeshElementChannels* Key, |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddReferenceToKey
(
int32 KeyIndex, |
Add a reference to a key. | |
| void | Build () |
Build any stale indices | |
| TArrayView< const ElementIDType > | Find
(
int32 KeyIndex, |
||
| TArrayView< const int32 > | Find
(
int32 KeyIndex, |
Retrieve all referencer indices whose named attribute refers to KeyIndex. | |
| void | ForceRebuild () |
Force the indexer to be completely rebuilt. | |
| void | RemoveKey
(
int32 KeyIndex, |
Remove the specified key from the indexer | |
| void | RemoveReferenceFromKey
(
int32 KeyIndex, |
Remove reference from key. This will take immediate effect. | |
| void | Reset () |
Resets the indexer | |
| void | Resume () |
Resume indexing and mark indexer as stale, but do not force an immediate rebuild | |
| void | Set
(
const FMeshElementChannels* Key, |
Set the parameters of this mesh element indexer | |
| void | SetChunkSize
(
int InChunkSize |
Sets the chunk size for the indexer, for optimization purposes. The default chunk size is 256. | |
| void | SetInitialNumReferences
(
int InInitialSize |
Sets the initial/expected number of references per key | |
| void | SetUnchunked () |
Configures the indexer not to use chunks. | |
| void | Suspend () |
Suspend indexing until the next rebuild |
Operators
| Type | Name | Description | |
|---|---|---|---|
| FMeshElementIndexer & | operator=
(
FMeshElementIndexer&& |
||
| FMeshElementIndexer & | operator=
(
const FMeshElementIndexer& |