Update BooleanCutTool.cpp
This commit is contained in:
@@ -125,7 +125,26 @@ TArray<UProceduralMeshComponent*> UBooleanCutTool::CutProceduralMesh(UProcedural
|
|||||||
TArray<FColor> VertexColors;
|
TArray<FColor> VertexColors;
|
||||||
TArray<FProcMeshTangent> Tangents;
|
TArray<FProcMeshTangent> Tangents;
|
||||||
|
|
||||||
TargetMesh->GetSectionMeshData(0, Vertices, Triangles, Normals, UVs, VertexColors, Tangents);
|
// 在 UE5.5.4 中,GetSectionMeshData 方法已不存在,改为使用 GetProcMeshSection 方法
|
||||||
|
FProcMeshSection* MeshSection = TargetMesh->GetProcMeshSection(0);
|
||||||
|
if (MeshSection)
|
||||||
|
{
|
||||||
|
// 从 MeshSection 中提取数据
|
||||||
|
for (const FProcMeshVertex& Vertex : MeshSection->ProcVertexBuffer)
|
||||||
|
{
|
||||||
|
Vertices.Add(Vertex.Position);
|
||||||
|
Normals.Add(Vertex.Normal);
|
||||||
|
UVs.Add(Vertex.UV0);
|
||||||
|
VertexColors.Add(Vertex.Color);
|
||||||
|
Tangents.Add(Vertex.Tangent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换索引
|
||||||
|
for (uint32 Index : MeshSection->ProcIndexBuffer)
|
||||||
|
{
|
||||||
|
Triangles.Add(static_cast<int32>(Index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate intersection points between cut plane and mesh
|
// Calculate intersection points between cut plane and mesh
|
||||||
TArray<FVector> IntersectionPoints = CalculateIntersectionPoints(Vertices, Triangles, CutPlane);
|
TArray<FVector> IntersectionPoints = CalculateIntersectionPoints(Vertices, Triangles, CutPlane);
|
||||||
|
Reference in New Issue
Block a user