You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Removed hardcoded element type arrays (Vertices, Edges, Triangles etc.). Mesh element types can now be arbitrarily added, with any number of channels. - Mesh element containers have a much leaner format; instead of sparse arrays, they are now represented by a simple bitarray, determining whether an index is used or not. Consequently, mesh topology is now entirely described with the attribute system, e.g. edge start and end vertices, triangle vertices, etc. - Support added for attributes of arbitrary dimensions, e.g. float[4] or int[2]. - Support added for attributes which index into another mesh element container. - Added FMeshElementIndexer: this is an efficient container for maintaining backward references from one element type to another; for example, edges have an attribute specifying which vertices are at each end (an attribute of type FVertexID[2]). With an indexer, it is possible to look up which edges contain a given vertex, even though this is not explicitly stored. Indexers are designed to do minimal allocations and update lazily and in batch when necessary. - Added support for preserving UV topology in static meshes. UVs are now a first-class element type which may be indexed directly from triangles. - Added the facility to access the underlying array in an attribute array directly. - Triangles now directly reference their vertex, edge and UV IDs. Vertex instances are to be deprecated. - Changed various systems to be triangle-centric rather than polygon-centric, as this is faster. Triangles are presumed to be the elementary face type in a MeshDescription, even if polygons are still supported. The concept of polygons will be somewhat shifted to mean a group of triangles which should be treated collectively for editing purposes. - Optimised normal/tangent generation and FBX import. - Deprecated EditableMesh, MeshEditor and StaticMeshEditorExtension plugins - these are to be removed, but they still have certain hooks in place which need removing. #rb [CL 13568702 by Richard TalbotWatkin in ue5-main branch]
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "MeshElementContainer.h"
|
|
#include "Algo/MaxElement.h"
|
|
|
|
|
|
void FMeshElementContainer::Compact(TSparseArray<int32>& OutIndexRemap)
|
|
{
|
|
const int32 NumElements = BitArray.Num() - NumHoles;
|
|
OutIndexRemap.Empty(BitArray.Num());
|
|
|
|
int32 NewIndex = 0;
|
|
for (TConstSetBitIterator<> It(BitArray); It; ++It)
|
|
{
|
|
OutIndexRemap.Insert(It.GetIndex(), NewIndex);
|
|
NewIndex++;
|
|
}
|
|
|
|
BitArray = TBitArray<>(true, NumElements);
|
|
NumHoles = 0;
|
|
|
|
Attributes.Remap(OutIndexRemap);
|
|
}
|
|
|
|
|
|
void FMeshElementContainer::Remap(const TSparseArray<int32>& IndexRemap)
|
|
{
|
|
check(IndexRemap.Num() == BitArray.Num() - NumHoles);
|
|
const int32 MaxNewIndex = *Algo::MaxElement(IndexRemap);
|
|
|
|
TBitArray<> NewBitArray(false, MaxNewIndex + 1);
|
|
for (TConstSetBitIterator<> It(BitArray); It; ++It)
|
|
{
|
|
const int32 OldIndex = It.GetIndex();
|
|
const int32 NewIndex = IndexRemap[OldIndex];
|
|
check(!NewBitArray[NewIndex]);
|
|
NewBitArray[NewIndex] = true;
|
|
}
|
|
|
|
BitArray = MoveTemp(NewBitArray);
|
|
NumHoles = BitArray.Num() - IndexRemap.Num();
|
|
|
|
Attributes.Remap(IndexRemap);
|
|
}
|