Added MeshAutoUV to GeometryProcessingInterface

* Required for future changes to improve the mesh merging capability to cope with missing/invalid UVs when trying to perform material baking.
#rb ryan.schmidt

[CL 26014245 by sebastien lussier in ue5-main branch]
This commit is contained in:
sebastien lussier
2023-06-15 10:37:22 -04:00
parent c596e74073
commit 320ff53c05
8 changed files with 228 additions and 14 deletions

View File

@@ -7,6 +7,7 @@
#include "GeometryProcessingInterfaces/ApproximateActors.h"
#include "GeometryProcessingInterfaces/CombineMeshInstances.h"
#include "GeometryProcessingInterfaces/MeshAutoUV.h"
IMPLEMENT_MODULE(FGeometryProcessingInterfacesModule, GeometryProcessingInterfaces);
@@ -17,37 +18,49 @@ void FGeometryProcessingInterfacesModule::StartupModule()
}
void FGeometryProcessingInterfacesModule::ShutdownModule()
{
ApproximateActors = nullptr;
CombineMeshInstances = nullptr;
MeshAutoUV = nullptr;
}
namespace
{
template <typename TModularFeatureInterface>
TModularFeatureInterface* GetModularFeatureImplementation()
{
TArray<TModularFeatureInterface*> AvailableImplementations =
IModularFeatures::Get().GetModularFeatureImplementations<TModularFeatureInterface>(TModularFeatureInterface::GetModularFeatureName());
return (AvailableImplementations.Num() > 0) ? AvailableImplementations[0] : nullptr;
}
}
IGeometryProcessing_ApproximateActors* FGeometryProcessingInterfacesModule::GetApproximateActorsImplementation()
{
if (ApproximateActors == nullptr)
{
TArray<IGeometryProcessing_ApproximateActors*> ApproximateActorsOptions =
IModularFeatures::Get().GetModularFeatureImplementations<IGeometryProcessing_ApproximateActors>(IGeometryProcessing_ApproximateActors::GetModularFeatureName());
ApproximateActors = (ApproximateActorsOptions.Num() > 0) ? ApproximateActorsOptions[0] : nullptr;
ApproximateActors = GetModularFeatureImplementation<IGeometryProcessing_ApproximateActors>();
}
return ApproximateActors;
}
IGeometryProcessing_CombineMeshInstances* FGeometryProcessingInterfacesModule::GetCombineMeshInstancesImplementation()
{
if (CombineMeshInstances == nullptr)
{
TArray<IGeometryProcessing_CombineMeshInstances*> CombineMeshInstancesOptions =
IModularFeatures::Get().GetModularFeatureImplementations<IGeometryProcessing_CombineMeshInstances>(IGeometryProcessing_CombineMeshInstances::GetModularFeatureName());
CombineMeshInstances = (CombineMeshInstancesOptions.Num() > 0) ? CombineMeshInstancesOptions[0] : nullptr;
CombineMeshInstances = GetModularFeatureImplementation<IGeometryProcessing_CombineMeshInstances>();
}
return CombineMeshInstances;
}
IGeometryProcessing_MeshAutoUV* FGeometryProcessingInterfacesModule::GetMeshAutoUVImplementation()
{
if (MeshAutoUV == nullptr)
{
MeshAutoUV = GetModularFeatureImplementation<IGeometryProcessing_MeshAutoUV>();
}
return MeshAutoUV;
}