Files
UnrealEngineUWP/Engine/Source/Developer/MeshBuilder/Private/MeshDescriptionHelper.h
Krzysztof Narkowicz 3da3a205fb Added FMeshBuilder::BuildMeshVertexPositions. It replaces FMeshBuilder::BuildMesh(bool bBuildOnlyPosition = true) and does the minimal work which is required to extract vertex positions from a mesh descriptor.
This is later used to build static mesh derived data in cases where Nanite coarse mesh representation replaces original static mesh data and we can't depend on it. In extreme cases it lowers main thread derived data build time from ~7.5s to ~0.1s.

#rb Richard.TalbotWatkin

[CL 14578414 by Krzysztof Narkowicz in ue5-main branch]
2020-10-26 13:09:34 -04:00

60 lines
1.7 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "CoreTypes.h"
#include "Logging/LogMacros.h"
#include "OverlappingCorners.h"
DECLARE_LOG_CATEGORY_EXTERN(LogMeshBuilder, Log, All);
class UObject;
struct FMeshDescription;
struct FMeshBuildSettings;
struct FVertexInstanceID;
struct FMeshReductionSettings;
class FMeshDescriptionHelper
{
public:
FMeshDescriptionHelper(FMeshBuildSettings* InBuildSettings);
//Build a render mesh description with the BuildSettings. This will update the RenderMeshDescription in place
void SetupRenderMeshDescription(UObject* Owner, FMeshDescription& RenderMeshDescription);
void ReduceLOD(const FMeshDescription& BaseMesh, FMeshDescription& DestMesh, const struct FMeshReductionSettings& ReductionSettings, const FOverlappingCorners& InOverlappingCorners, float &OutMaxDeviation);
void FindOverlappingCorners(const FMeshDescription& MeshDescription, float ComparisonThreshold);
const FOverlappingCorners& GetOverlappingCorners() const { return OverlappingCorners; }
private:
//////////////////////////////////////////////////////////////////////////
//PRIVATE function declarations
//////////////////////////////////////////////////////////////////////////
//PRIVATE class members
FMeshBuildSettings* BuildSettings;
FOverlappingCorners OverlappingCorners;
//////////////////////////////////////////////////////////////////////////
//INLINE small helper use to optimize search and compare
/**
* Smoothing group interpretation helper structure.
*/
struct FFanFace
{
int32 FaceIndex;
int32 LinkedVertexIndex;
bool bFilled;
bool bBlendTangents;
bool bBlendNormals;
};
};