You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035 [CL 17918595 by aurel cordonnier in ue5-release-engine-test branch]
56 lines
1.4 KiB
C++
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);
|
|
}
|
|
}
|
|
}
|