避免重复构建DF阴影,并且只在需要时保留网格的顶点数据

This commit is contained in:
FishOrBear 2021-07-01 11:02:18 +08:00
parent 55fe2a8d29
commit 96824b4629
2 changed files with 4 additions and 1 deletions

View File

@ -57,6 +57,9 @@ static FAutoConsoleVariableRef CVarAOAsyncBuildQueue(
//构建距离场 //构建距离场
void BuildMeshDistanceField(UStaticMesh* StaticMesh) void BuildMeshDistanceField(UStaticMesh* StaticMesh)
{ {
GDistanceFieldAsyncQueue2->CancelBuild(StaticMesh);
GCardRepresentationAsyncQueue2->CancelBuild(StaticMesh);
//ref:StaticMesh.cpp 2782 //ref:StaticMesh.cpp 2782
auto RenderData = StaticMesh->GetRenderData(); auto RenderData = StaticMesh->GetRenderData();
if (RenderData->LODResources.IsValidIndex(0)) if (RenderData->LODResources.IsValidIndex(0))

View File

@ -29,7 +29,7 @@ void RTGUtils::UpdateStaticMeshFromDynamicMesh(
UStaticMesh::FBuildMeshDescriptionsParams Params; UStaticMesh::FBuildMeshDescriptionsParams Params;
Params.bFastBuild = true; Params.bFastBuild = true;
StaticMesh->BuildFromMeshDescriptions(MeshDescriptionPtrs,Params); StaticMesh->BuildFromMeshDescriptions(MeshDescriptionPtrs, Params, true);
//在编辑器模式下,也使用自定义的距离场构建和MeshCard构建 //在编辑器模式下,也使用自定义的距离场构建和MeshCard构建
BuildMeshDistanceField(StaticMesh); BuildMeshDistanceField(StaticMesh);