Navigation
API > API/Runtime > API/Runtime/MeshConversion
Class used to convert a mesh with attributes (e.g. normals, uvs etc) to a FDynamicMesh3
The Source Mesh has to implement this interface
struct FSrcMeshInterface { // ID types: must be castable to int32 typedef SrcVertIDType VertIDType; typedef SrcTriIDType TriIDType; typedef SrcUVIDType UVIDType; typedef SrcNormalIDType NormalIDType; typedef SrcColorIDType ColorIDType typedef SrcWedgeIDType WedgeIDType;
// accounting. int32 NumTris() const; int32 NumVerts() const; int32 NumUVLayers() const;
// "Vertex Buffer" info const Iterable_VertIDType& GetVertIDs() const; const FVector3d GetPosition(const VertIDType VtxID) const;
// "Index Buffer" info const Iterable_TriIDType& GetTriIDs() const // return false if this TriID is not contained in mesh. bool GetTri(const TriIDType TriID, VertIDType& VID0, VertIDType& VID1, VertIDType& VID2) const;
bool HasNormals() const; bool HasTangents() cosnt; bool HasBiTangents() const;
// Each triangle corner is a wedge void GetWedgeID(const TriIDType& TriID, WedgeIDType& WID0, WedgeIDType& WID1, WedgeIDType& WID2) const;
// attribute access per-wedge // NB: ToDynamicMesh will attempt to weld identical attributes that are associated with the same vertex FVector2f GetWedgeUV(int32 UVLayerIndex, WedgeIDType WID) const; FVector3f GetWedgeNormal(WedgeIDType WID) const; FVector3f GetWedgeTangent(WedgeIDType WID) const; FVector3f GetWedgeBiTangent(WedgeIDType WID) const; FVector4f GetWedgeColor(WedgeIDType WID) const;
// attribute access that exploits shared attributes. // each group of shared attributes presents itself as a mesh with its own attribute vertex buffer. // NB: If the mesh has no shared Attr attributes, then Get{Attr}IDs() should return an empty array. // NB: Get{Attr}Tri() functions should return false if the triangle is not set in the attribute mesh.
const TArray
const TArray
const TArray
const TArray
// weight maps information int32 NumWeightMapLayers() const; float GetVertexWeight(int32 WeightMapIndex, int32 SrcVertID) const; FName GetWeightMapName(int32 WeightMapIndex) const;
// skin weight attributes information int32 NumSkinWeightAttributes() const; UE::AnimationCore::FBoneWeights GetVertexSkinWeight(int32 SkinWeightAttributeIndex, VertIDType VtxID) const; FName GetSkinWeightAttributeName(int32 SkinWeightAttributeIndex) const;
// bone attributes information int32 GetNumBones() const; FName GetBoneName(int32 BoneIdx) const; int32 GetBoneParentIndex(int32 BoneIdx) const; FTransform GetBonePose(int32 BoneIdx) const; FVector4f GetBoneColor(int32 BoneIdx) const; };
| Name | TToDynamicMesh |
| Type | class |
| Header File | /Engine/Source/Runtime/MeshConversion/Public/ToDynamicMesh.h |
| Include Path | #include "ToDynamicMesh.h" |
Syntax
template<typename SrcMeshType>
class TToDynamicMesh : public UE::Geometry::TToDynamicMeshBase< SrcMeshType >
Inheritance Hierarchy
- TToDynamicMeshBase → TToDynamicMesh
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TToDynamicMesh() |
ToDynamicMesh.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| MyBase | TToDynamicMeshBase< SrcMeshType > | ToDynamicMesh.h | |
| SrcColorIDType | typename SrcMeshType::ColorIDType | ToDynamicMesh.h | |
| SrcNormalIDType | typename SrcMeshType::NormalIDType | ToDynamicMesh.h | |
| SrcTriIDType | typename MyBase::SrcTriIDType | ToDynamicMesh.h | |
| SrcUVIDType | typename SrcMeshType::UVIDType | ToDynamicMesh.h | |
| SrcVertIDType | typename MyBase::SrcVertIDType | ToDynamicMesh.h | |
| SrcWedgeIDType | typename SrcMeshType::WedgeIDType | ToDynamicMesh.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Convert
(
FDynamicMesh3& MeshOut, |
Convert To FDynamicMesh. Will Copy GroupID to the mesh, and will create overlays with UVs, Normal, MaterialID (additionally Tangents and BiTangents if requested) | ToDynamicMesh.h | |
void ConvertWOAttributes
(
FDynamicMesh3& MeshOut, |
Convert To FDynamicMesh w/o attributes. | ToDynamicMesh.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void PopulateOverlay
(
typename TOverlayTraits< AttrType >::OverlayType* Overlay, |
ToDynamicMesh.h | ||
void PopulateOverlayFromSharedAttr
(
typename TOverlayTraits< AttrType >::OverlayType* Overlay, |
ToDynamicMesh.h | ||
void PopulateOverlayFromWedgeAttr
(
typename TOverlayTraits< AttrType >::OverlayType* Overlay, |
Access the attributes in the Source Mesh on a per-wedge granularity (each corner of each triangle is a wedge), and weld them based on strict equality when creating the overlay. | ToDynamicMesh.h | |
void PopulateOverlays
(
FDynamicMesh3& MeshOut, |
Populates overlays for UVs, Normal, Color, Material ID. | ToDynamicMesh.h |