Files
UnrealEngineUWP/Engine/Plugins/Runtime/GeometryProcessing/Source/DynamicMesh/Public/Operations/PolyEditingUVUtil.h
ryan schmidt 153ef493fb GeometryProcessing: OffsetMeshRegion improvements
Refactor core of FDynamicMeshEditor::DisconnectTriangles into an overload that takes precomputed triangle TSet and BoundaryLoops array, as some call sites already have computed this info
Refactor new-polygroup computation out of OffsetMeshRegion into UE::Geometry::ComputeNewGroupIDsAlongEdgeLoop util function in PolyEditingEdgeUtil.h/cpp
Add new function UE::Geometry::ComputeAverageUVScaleRatioAlongVertexPath in PolyEditingUVUtil.h/cpp

Introduce new type FQuadGridPatch, this is a book-keeping data structure for keeping track of "grid of quads" subregion of a triangle mesh, that provides easy access to vertex and quad/trainagle rows/columns
Add util functions ComputeNormalsForQuadPatch() and ComputeUVIslandForQuadPatch() in QuadGridPatchUtil.h

Add new version of OffsetMeshRegion geometric operation, inside FOffsetMeshRegion class. EVersion parameter determines which version of operation to run. Code for the "Legacy" version has not been modified, so back-compat is maintained. New implementation supports variable number of subdivisions along the Offset (via .NumSubdivisions), and computes normal/UV-islands "per group" in extrusion region, instead of per-quad. New version also splits bowties in extrude region before any additional processing, which simplifies some of the book-keeping/etc.

FExtrudeOp currently hardcoded to use use the FOffsetMeshRegion implementation

#rb none
#preflight 639762350a67152550ee9a18

[CL 23481550 by ryan schmidt in ue5-main branch]
2022-12-12 15:09:02 -05:00

52 lines
1.9 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "MathUtil.h"
#include "VectorTypes.h"
#include "IntVectorTypes.h"
#include "GeometryTypes.h"
#include "DynamicMesh/DynamicMeshAttributeSet.h"
class FProgressCancel;
namespace UE
{
namespace Geometry
{
/**
* Create a new single UV island for the provided TriangleSet in the given Mesh/UVOverlay,
* by computing an ExpMap parameterization based on an automatically-detected midpoint of the triangle patch.
* The UV scale is determined automatically based on the UV/3D area ratio of triangles adjacent
* to the TriangleSet (using a ratio of 1 if the triangles have no neighbours).
*
* @param TriangleSet a list of triangles, must be a single connected component
*/
DYNAMICMESH_API void ComputeArbitraryTrianglePatchUVs(
FDynamicMesh3& Mesh,
FDynamicMeshUVOverlay& UVOverlay,
const TArray<int32>& TriangleSet );
/**
* Compute the total UVLength/MeshLength ratio along the given VertexPath.
* Other 3D lengths can then be scaled to comparable UV-space lengths by multiplying by this value.
* Edges must exist between the vertices along the path, and loops are not considered.
* Each UV edge for a 3D edge is considered, ie if a 3D edge corresponds to 2 UV edges, both are counted,
* and if the 3D edge has no UV edges, it is skipped.
* @param VertexPath list of vertices which are connected by edges
* @param PathLengthOut optional output param for sum of 3D edge lengths along path (arc length)
* @param UVPathLengthOut optional output param for sum of UV edge lengths along path
* @return UVPathLength / PathLength, or 1.0 if no valid UV edges along the path existed
*/
DYNAMICMESH_API double ComputeAverageUVScaleRatioAlongVertexPath(
const FDynamicMesh3& Mesh,
const FDynamicMeshUVOverlay& UVOverlay,
const TArray<int32>& VertexPath,
double* PathLengthOut = nullptr,
double* UVPathLengthOut = nullptr );
} // end namespace UE::Geometry
} // end namespace UE