Navigation
API > API/Runtime > API/Runtime/GeometryCore > API/Runtime/GeometryCore/DynamicMesh
Inheritance Hierarchy
- TDynamicMeshOverlay
- TDynamicMeshVectorOverlay
References
| Module | GeometryCore |
| Header | /Engine/Source/Runtime/GeometryCore/Public/DynamicMesh/DynamicMeshOverlay.h |
| Include | #include "DynamicMesh/DynamicMeshOverlay.h" |
Syntax
template<typename RealType, int ElementSize>
class TDynamicMeshOverlay
Remarks
TDynamicMeshOverlay is an add-on to a FDynamicMesh3 that allows for per-triangle storage of an "element" (eg like a per-triangle UV or normal). However the elements can be shared between triangles at shared vertices because the elements are stored in a separate indexable list.
Each element has one vertex in the parent mesh as its parent, whereas each vertex may be the parent of multiple elements in cases where neighboring triangles are not sharing a single element for that vertex. This means that there may be "seam" boundary edges in the overlay topology that are not mesh boundary edges in the associated/parent mesh, but the overlay topology will not connect triangles that were not connected in the parent mesh or create any topologically degenerate triangles, since the parent vids of the elements of a triangle will have to match up to the vids of the triangle.
A "seam" edge is one where at least one of the elements of the triangles on either side of the edge is not shared between the two triangles.
The FDynamicMesh3 mesh topology operations (eg split/flip/collapse edge, poke face, etc) can be mirrored to the overlay via OnSplitEdge(), etc.
Note that although this is a template, many of the functions are defined in the .cpp file. As a result you need to explicitly instantiate and export the instance of the template that you wish to use in the block at the top of DynamicMeshOverlay.cpp
Variables
| Type | Name | Description | |
|---|---|---|---|
| TDynamicVector< RealType > | Elements | List of element values | |
| FRefCountVector | ElementsRefCounts | Reference counts of element indices. Iterate over this to find out which elements are valid. | |
| TDynamicVector< int > | ElementTriangles | List of triangle element-index triplets [Elem0 Elem1 Elem2] | |
| FDynamicMesh3 * | ParentMesh | The parent mesh this overlay belongs to | |
| TDynamicVector< int > | ParentVertices | List of parent vertex indices, one per element |
Constructors
| Type | Name | Description | |
|---|---|---|---|
| Create an empty overlay | |||
TDynamicMeshOverlay
(
FDynamicMesh3* ParentMeshIn |
Create an overlay for the given parent mesh |
Functions
| Type | Name | Description | |
|---|---|---|---|
| int | AppendElement
(
RealType ConstantValue |
Allocate a new element with the given constant value | |
| int | AppendElement
(
const RealType* Value |
Allocate a new element with the given value | |
| bool | AreTrianglesConnected
(
int TriangleID0, |
||
| void | Support for inserting element at specific ID. | ||
| bool | CheckValidity
(
bool bAllowNonManifoldVertices, |
Checks that the overlay mesh is well-formed, ie all internal data structures are consistent | |
| void | Discard all elements. | ||
| void | ClearElements
(
const EnumerableIntType& Triangles |
Discard elements for given triangles. | |
| void | CompactCopy
(
const FCompactMaps& CompactMaps, |
Copy the Copy overlay to a compact rep, also updating parent references based on the CompactMaps | |
| void | CompactInPlace
(
const FCompactMaps& CompactMaps |
Compact overlay and update links to parent based on CompactMaps | |
| void | Copy
(
const TDynamicMeshOverlay< RealType, ElementSize >& Copy |
Set this overlay to contain the same arrays as the copy overlay | |
| int | CountVertexElements
(
int VertexID, |
Count the number of unique elements for a given parent-mesh vertex | |
| void | CreateFromPredicate
(
TFunctionRef< bool(int ParentVertexIdx, int TriIDA, int TriIDB)> TrisCanShareVertexPredicate, |
Build overlay topology from a predicate function, e.g. to build topology for sharp normals | |
| int | ElementCount () |
||
| element_iterator | |||
| void | Call after a set of unsafe InsertVertex() calls to rebuild free list | ||
| void | FreeUnusedElements
(
const TSet< int >* ElementsToCheck |
Goes through elements and frees any whose reference counts indicate that they are not being used. | |
| void | GetElement
(
int ElementID, |
Get the element at a given index | |
| void | GetElement
(
int ElementID, |
Accessors/QueriesGet the element at a given index | |
| void | GetElementAtVertex
(
int TriangleID, |
Get the Element value associated with a vertex of a triangle. | |
| int | GetElementIDAtVertex
(
int TriangleID, |
Find the element ID at a vertex of a triangle. | |
| void | GetElementTriangles
(
int ElementID, |
Find the triangles connected to an element | |
| FDynamicMesh3 * | |||
| const FDynamicMesh3 * | |||
| int | GetParentVertex
(
int ElementID |
Get the parent vertex id for the element at a given index | |
| FIndex3i | GetTriangle
(
int TriangleID |
Get the element index tuple for a triangle | |
| bool | GetTriangleIfValid
(
int TriangleID, |
If the triangle is set to valid element indices, return the indices in TriangleOut and return true, otherwise return false | |
| void | GetTriBaryInterpolate
(
int32 TriangleID, |
Compute interpolated parameter value inside triangle using barycentric coordinates | |
| void | GetVertexElements
(
int VertexID, |
Find the elements associated with a given parent-mesh vertex | |
| bool | |||
| void | InitializeNewTriangle
(
int TriangleID |
Set a triangle's element indices to InvalidID | |
| void | InitializeTriangles
(
int MaxTriangleID |
Initialize the triangle list to the given size, and set all triangles to InvalidID | |
| EMeshResult | InsertElement
(
int ElementID, |
Insert element at given index, assuming it is unused. | |
| void | InternalSetTriangle
(
int TriangleID, |
Updates the triangles array and optionally the element reference counts | |
| bool | IsBowtieInOverlay
(
int32 VertexID |
Determines whether the base-mesh vertex has "bowtie" topology in the Overlay. | |
| bool | IsCompact () |
||
| bool | IsElement
(
int vID |
||
| bool | IsSameAs
(
const TDynamicMeshOverlay< RealType, ElementSize >& Other, |
Returns true if this overlay is the same as Other. | |
| bool | IsSeamEdge
(
int EdgeID, |
Returns true if the parent-mesh edge is a "Seam" in this overlay. | |
| bool | IsSeamEndEdge
(
int EdgeID |
Returns true if the parent-mesh edge is a "Seam End" in this overlay, meaning the adjacent element triangles share one element, not two | |
| bool | IsSeamVertex
(
int VertexID, |
Returns true if the parent-mesh vertex is connected to any seam edges | |
| bool | IsSetTriangle
(
int TID |
||
| int | MaxElementID () |
||
| bool | MergeElement
(
int SourceElementID, |
Collapse SourceElementID into TargetElementID, resulting in connecting any containing triangles and reducing the total elements in the overlay. | |
| void | OnCollapseEdge
(
const DynamicMeshInfo::FEdgeCollapseInfo& CollapseInfo |
Update the overlay to reflect an edge collapse in the parent mesh | |
| void | OnFlipEdge
(
const DynamicMeshInfo::FEdgeFlipInfo& FlipInfo |
Update the overlay to reflect an edge flip in the parent mesh | |
| void | OnMergeEdges
(
const DynamicMeshInfo::FMergeEdgesInfo& MergeInfo |
Update the overlay to reflect an edge merge in the parent mesh | |
| void | OnPokeTriangle
(
const DynamicMeshInfo::FPokeTriangleInfo& PokeInfo |
Update the overlay to reflect a face poke in the parent mesh | |
| void | OnRemoveTriangle
(
int TriangleID |
Remove a triangle from the overlay | |
| void | OnReverseTriOrientation
(
int TriangleID |
Reverse the orientation of a triangle's elements | |
| void | OnSplitEdge
(
const DynamicMeshInfo::FEdgeSplitInfo& SplitInfo |
Update the overlay to reflect an edge split in the parent mesh | |
| void | OnSplitVertex
(
const DynamicMeshInfo::FVertexSplitInfo& SplitInfo, |
Update the overlay to reflect a vertex split in the parent mesh | |
| void | Serialize
(
FArchive& Ar, |
Serialize to and from an archive. | |
| void | SetElement
(
int ElementID, |
Set the element at a given index | |
| void | SetElement
(
int ElementID, |
Set the element at a given index | |
| void | SetElementFromBary
(
int SetElement, |
Set the value at an Element to be a barycentric interpolation of three other Elements | |
| void | SetElementFromLerp
(
int SetElement, |
Set the value at an Element to be a linear interpolation of two other Elements | |
| void | SetParentVertex
(
int ElementIndex, |
||
| EMeshResult | SetTriangle
(
int TriangleID, |
Set the triangle to the given Element index tuple, and increment element reference counts | |
| void | SplitBowties () |
Refine an existing overlay topology by splitting any bow ties | |
| void | SplitBowtiesAtVertex
(
int32 Vid, |
Split any bowties at given vertex. | |
| int | SplitElement
(
int ElementID, |
Create a new copy of ElementID, and update connected triangles in the TrianglesToUpdate array to reference the copy of ElementID where they used to reference ElementID (Note: This just calls "SplitElementWithNewParent" with the existing element's parent id.) | |
| int | SplitElementWithNewParent
(
int ElementID, |
Create a new copy of ElementID, and update connected triangles in the TrianglesToUpdate array to reference the copy of ElementID where they used to reference ElementID. | |
| void | SplitVerticesWithPredicate
(
TFunctionRef< bool(int ElementIdx, int TriID)> ShouldSplitOutVertex, |
Refine an existing overlay topology. | |
| bool | TriangleHasElement
(
int TriangleID, |
||
| void | UnsetTriangle
(
int TriangleID, |
Set the triangle to have InvalidID element IDs, decrementing element reference counts if needed. |
Typedefs
| Name | Description |
|---|---|
| element_iterator |