Files
UnrealEngineUWP/Engine/Source/Runtime/MeshUtilitiesCommon/Public/OverlappingCorners.h
Bryan sefcik b4a6e947d8 Ran IWYU on Public headers under Engine/Source/Runtime/...
Headers are updated to contain any missing #includes needed to compile and #includes are sorted.  Nothing is removed.

#ushell-cherrypick of 21065896 by bryan.sefcik
#preflight 62d4b1a5a6141b6adfb0c892
#jira

#ROBOMERGE-OWNER: Bryan.sefcik
#ROBOMERGE-AUTHOR: bryan.sefcik
#ROBOMERGE-SOURCE: CL 21150156 via CL 21151754 via CL 21154719
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)
#ROBOMERGE-CONFLICT from-shelf

[CL 21181076 by Bryan sefcik in ue5-main branch]
2022-07-20 11:31:36 -04:00

51 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/Array.h"
#include "Containers/Set.h"
#include "CoreMinimal.h"
#include "LayoutUV.h"
#include "Math/UnrealMathSSE.h"
#include "Misc/AssertionMacros.h"
/**
* Container to hold overlapping corners. For a vertex, lists all the overlapping vertices
*/
struct MESHUTILITIESCOMMON_API FOverlappingCorners
{
FOverlappingCorners() {}
FOverlappingCorners(const TArray<FVector3f>& InVertices, const TArray<uint32>& InIndices, float ComparisonThreshold);
FOverlappingCorners(const FLayoutUV::IMeshView& MeshView, float ComparisonThreshold);
/* Resets, pre-allocates memory, marks all indices as not overlapping in preperation for calls to Add() */
void Init(int32 NumIndices);
/* Add overlapping indices pair */
void Add(int32 Key, int32 Value);
/* Sorts arrays, converts sets to arrays for sorting and to allow simple iterating code, prevents additional adding */
void FinishAdding();
/* Estimate memory allocated */
uint32 GetAllocatedSize(void) const;
/**
* @return array of sorted overlapping indices including input 'Key', empty array for indices that have no overlaps.
*/
const TArray<int32>& FindIfOverlapping(int32 Key) const
{
check(bFinishedAdding);
int32 ContainerIndex = IndexBelongsTo[Key];
return (ContainerIndex != INDEX_NONE) ? Arrays[ContainerIndex] : EmptyArray;
}
private:
TArray<int32> IndexBelongsTo;
TArray< TArray<int32> > Arrays;
TArray< TSet<int32> > Sets;
TArray<int32> EmptyArray;
bool bFinishedAdding = false;
};