5 #include "CoreMinimal.h" 16 TFunction<FVector(int32)> PositionAccessor, TFunction<FVector2D(int32)> UVAccessor, TFunction<int32(int32)> IndexAccessor,
17 TFunction<
void(int32)> OutIndicesSizeSetter, TFunction<int32()> OutIndicesSizeGetter, TFunction<
void(int32, int32)> OutIndicesWriter, TFunction<int32(int32)> OutIndicesReader);
29 Vertex(
const FVector& InPosition,
const FVector2D& InTexCoord)
30 : Position(InPosition), TexCoord(InTexCoord)
45 static FORCEINLINE uint32
HashValue(
const FVector& Vec)
47 return 31337 * GetTypeHash(Vec.X) + 13 * GetTypeHash(Vec.Y) + 3 * GetTypeHash(Vec.Z);
68 Edge(uint32 InIndexFrom, uint32 InIndexTo,
const Vertex& InVertexFrom,
const Vertex& InVertexTo)
69 : IndexFrom(InIndexFrom), IndexTo(InIndexTo), VertexFrom(InVertexFrom), VertexTo(InVertexTo)
106 return Edge(IndexTo, IndexFrom, VertexTo, VertexFrom);
138 Corner(uint32 InIndex, FVector2D InTexCoord)
139 : Index(InIndex), TexCoord(InTexCoord)
151 : Edge0(Index0, Index1, Vertex0, Vertex1)
152 , Edge1(Index1, Index2, Vertex1, Vertex2)
153 , Edge2(Index2, Index0, Vertex2, Vertex0)
158 return Edge0 < Other.
Edge0 || Edge1 < Other.
Edge1 || Edge2 < Other.
Edge2;
163 return ((
Edge*)&Edge0)[I];
167 return GetEdge(I).GetIndex(0);
177 TFunction<FVector(int32)> PositionAccessor, TFunction<FVector2D(int32)> UVAccessor, TFunction<int32(int32)> IndexAccessor,
178 TFunction<
void(int32)> OutIndicesSizeSetter, TFunction<int32()> OutIndicesSizeGetter, TFunction<
void(int32, int32)> OutIndicesWriter, TFunction<int32(int32)> OutIndicesReader,
181 static void ExpandIB(int32 NumVertices, int32 NumIndices,
182 TFunction<FVector(int32)> PositionAccessor, TFunction<FVector2D(int32)> UVAccessor, TFunction<int32(int32)> IndexAccessor,
183 TFunction<
void(int32)> OutIndicesSizeSetter, TFunction<int32()> OutIndicesSizeGetter, TFunction<
void(int32, int32)> OutIndicesWriter, TFunction<int32(int32)> OutIndicesReader,
static void CalculateTessellationIndices(int32 NumVertices, int32 NumIndices, TFunction< FVector(int32)> PositionAccessor, TFunction< FVector2D(int32)> UVAccessor, TFunction< int32(int32)> IndexAccessor, TFunction< void(int32)> OutIndicesSizeSetter, TFunction< int32()> OutIndicesSizeGetter, TFunction< void(int32, int32)> OutIndicesWriter, TFunction< int32(int32)> OutIndicesReader)
static void ReplacePlaceholderIndices(int32 NumVertices, int32 NumIndices, TFunction< FVector(int32)> PositionAccessor, TFunction< FVector2D(int32)> UVAccessor, TFunction< int32(int32)> IndexAccessor, TFunction< void(int32)> OutIndicesSizeSetter, TFunction< int32()> OutIndicesSizeGetter, TFunction< void(int32, int32)> OutIndicesWriter, TFunction< int32(int32)> OutIndicesReader, EdgeDictionary &EdgeDict, PositionDictionary &PosDict)
Vertex(const FVector &InPosition, const FVector2D &InTexCoord)
static FORCEINLINE uint32 HashValue(const FVector &Vec)
FORCEINLINE bool operator==(const Vertex &Other) const
friend FORCEINLINE uint32 GetTypeHash(const Edge &E)
FORCEINLINE bool operator<(const Vertex &Other) const
static FORCEINLINE uint32 HashValue(const Vertex &Vert)
Triangle(uint32 Index0, uint32 Index1, uint32 Index2, const Vertex &Vertex0, const Vertex &Vertex1, const Vertex &Vertex2)
TMap< Edge, Edge > EdgeDictionary
Vertex GetVertex(uint32 I) const
TMap< FVector, Corner > PositionDictionary
FORCEINLINE uint32 GetIndex(uint32 I)
Corner(uint32 InIndex, FVector2D InTexCoord)
FORCEINLINE bool operator<(const Triangle &Other) const
Edge(uint32 InIndexFrom, uint32 InIndexTo, const Vertex &InVertexFrom, const Vertex &InVertexTo)
FORCEINLINE bool operator<(const Edge &Other) const
FORCEINLINE bool operator==(const Edge &Other) const
static void AddIfLeastUV(PositionDictionary &PosDict, const Vertex &Vert, uint32 Index)
uint32 GetIndex(uint32 I) const
static void ExpandIB(int32 NumVertices, int32 NumIndices, TFunction< FVector(int32)> PositionAccessor, TFunction< FVector2D(int32)> UVAccessor, TFunction< int32(int32)> IndexAccessor, TFunction< void(int32)> OutIndicesSizeSetter, TFunction< int32()> OutIndicesSizeGetter, TFunction< void(int32, int32)> OutIndicesWriter, TFunction< int32(int32)> OutIndicesReader, EdgeDictionary &OutEdgeDict, PositionDictionary &OutPosDict)
FORCEINLINE const Edge & GetEdge(uint32 I)