Files
UnrealEngineUWP/Engine/Source/Runtime/ClothingSystemRuntimeCommon/Public/ClothTetherData.h
kriss gossart cc62b91a3e Chaos Cloth - Significantly reduce the cloth initialization hitch by caching the Long Range Attachment tether calculations. Move the tether code to its own files inside the cloth common runtime module.
Cloth - Tidy up ClothingAsset and ClothPhysicalMeshData to allow for more cloth data caching.

#rb Benn.Gallagher, Cedric.Caillaud, Michael.Forot
#preflight 16823444


#ROBOMERGE-SOURCE: CL 16882246
#ROBOMERGE-BOT: (v836-16769935)

[CL 16913004 by kriss gossart in ue5-main branch]
2021-07-21 14:52:47 -04:00

43 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/ContainersFwd.h"
#include "ClothTetherData.generated.h"
/**
* Long range attachment tether pathfinding based on Dijkstra's algorithm.
* For more information about the long range attachment, see:
* https://matthias-research.github.io/pages/publications/sca2012cloth.pdf
*/
USTRUCT()
struct FClothTetherData
{
GENERATED_BODY()
/** Long range attachment tether start/end/length, sorted in sequential batches of independant tethers. */
TArray<TArray<TTuple<int32, int32, float>>> Tethers;
/**
* Generate the tethers by following the triangle mesh network from the closest kinematic to each dynamic point.
* Inside array items can be processed concurrently, but the outside array must be iterated on sequentially.
*/
void GenerateTethers(
const TConstArrayView<FVector3f>& Points, // Reference pose
const TConstArrayView<uint32>& Indices, // Triangle mesh
const TConstArrayView<float>& MaxDistances, // Mask for sorting the kinematic from the dynamic points
bool bUseGeodesicDistance); // Whether to use geodesic (walking along the sruface) or euclidean (beeline) distances to find the tethers.
/** Custom serializer, since neiher an array of array nor a tuple can be set as a UPROPERTY. */
bool Serialize(FArchive& Ar);
};
template<>
struct TStructOpsTypeTraits<FClothTetherData> : public TStructOpsTypeTraitsBase2<FClothTetherData>
{
enum
{
WithSerializer = true,
};
};