Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Public/NavMesh/RecastInternalDebugData.cpp
aurel cordonnier a6e741e007 Merge from Release-Engine-Staging @ 17915896 to Release-Engine-Test
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035

[CL 17918595 by aurel cordonnier in ue5-release-engine-test branch]
2021-10-25 20:05:28 -04:00

56 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "NavMesh/RecastInternalDebugData.h"
#include "DebugUtils/DebugDraw.h"
void FRecastInternalDebugData::vertex(const FVector::FReal x, const FVector::FReal y, const FVector::FReal z, unsigned int color, const FVector::FReal u, const FVector::FReal v)
{
FVector::FReal RecastPos[3] = { x,y,z };
const FVector Pos = Recast2UnrealPoint(RecastPos);
const FColor Color = Recast2UnrealColor(color);
switch(CurrentPrim)
{
case DU_DRAW_POINTS:
PointVertices.Push(Pos);
PointColors.Push(Color);
break;
case DU_DRAW_LINES:
LineVertices.Push(Pos);
LineColors.Push(Color);
break;
case DU_DRAW_TRIS:
// Fallthrough
case DU_DRAW_QUADS:
TriangleVertices.Push(Pos);
TriangleColors.Push(Color);
break;
}
}
void FRecastInternalDebugData::end()
{
if (CurrentPrim == DU_DRAW_QUADS)
{
// Turns quads to triangles
for (int32 i = FirstVertexIndex; i < TriangleVertices.Num(); i += 4)
{
ensure(i + 3 < TriangleVertices.Num());
TriangleIndices.Push(i + 0);
TriangleIndices.Push(i + 1);
TriangleIndices.Push(i + 3);
TriangleIndices.Push(i + 3);
TriangleIndices.Push(i + 1);
TriangleIndices.Push(i + 2);
}
}
else if (CurrentPrim == DU_DRAW_TRIS)
{
// Add indices for triangles.
for (int32 i = FirstVertexIndex; i < TriangleVertices.Num(); i++)
{
TriangleIndices.Push(i);
}
}
}