Files
UnrealEngineUWP/Engine/Source/Runtime/MeshDescription/Public/MeshElementRemappings.h
Richard TalbotWatkin 4884bf9d9a First pass of MeshDescription API and format refactor.
- 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]
2020-05-28 10:56:57 -04:00

64 lines
2.1 KiB
C

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "MeshTypes.h"
/**
* This is a structure which holds the ID remappings returned by a Compact operation, or passed to a Remap operation.
*/
struct FElementIDRemappings
{
TSparseArray<int32> NewVertexIndexLookup;
TSparseArray<int32> NewVertexInstanceIndexLookup;
TSparseArray<int32> NewEdgeIndexLookup;
TSparseArray<int32> NewTriangleIndexLookup;
TSparseArray<int32> NewUVIndexLookup;
TSparseArray<int32> NewPolygonIndexLookup;
TSparseArray<int32> NewPolygonGroupIndexLookup;
FVertexID GetRemappedVertexID( FVertexID VertexID ) const
{
checkSlow( NewVertexIndexLookup.IsAllocated( VertexID.GetValue() ) );
return FVertexID( NewVertexIndexLookup[ VertexID.GetValue() ] );
}
FVertexInstanceID GetRemappedVertexInstanceID( FVertexInstanceID VertexInstanceID ) const
{
checkSlow( NewVertexInstanceIndexLookup.IsAllocated( VertexInstanceID.GetValue() ) );
return FVertexInstanceID( NewVertexInstanceIndexLookup[ VertexInstanceID.GetValue() ] );
}
FEdgeID GetRemappedEdgeID( FEdgeID EdgeID ) const
{
checkSlow( NewEdgeIndexLookup.IsAllocated( EdgeID.GetValue() ) );
return FEdgeID( NewEdgeIndexLookup[ EdgeID.GetValue() ] );
}
FUVID GetRemappedUVID( FUVID UVID ) const
{
checkSlow( NewUVIndexLookup.IsAllocated( UVID.GetValue() ) );
return FUVID( NewUVIndexLookup[ UVID.GetValue() ] );
}
FTriangleID GetRemappedTriangleID( FTriangleID TriangleID ) const
{
checkSlow( NewTriangleIndexLookup.IsAllocated( TriangleID.GetValue() ) );
return FTriangleID( NewTriangleIndexLookup[ TriangleID.GetValue() ] );
}
FPolygonID GetRemappedPolygonID( FPolygonID PolygonID ) const
{
checkSlow( NewPolygonIndexLookup.IsAllocated( PolygonID.GetValue() ) );
return FPolygonID( NewPolygonIndexLookup[ PolygonID.GetValue() ] );
}
FPolygonGroupID GetRemappedPolygonGroupID( FPolygonGroupID PolygonGroupID ) const
{
checkSlow( NewPolygonGroupIndexLookup.IsAllocated( PolygonGroupID.GetValue() ) );
return FPolygonGroupID( NewPolygonGroupIndexLookup[ PolygonGroupID.GetValue() ] );
}
};