Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Public/NavMesh/RecastInternalDebugData.cpp
aris theophanidis 5a8f8161a6 Experimental navmesh debug tools (first pass)
Allow to display internal debug data at different navmesh generation steps for a selected tile
Ignore height filtering while displaying the navmesh around camera position
[REVIEW] [at]Mieszko.Zielinski [at]Mikko.Mononen
#rb Mikko.Mononen
#jira UE-86730


#ROBOMERGE-SOURCE: CL 11285125 via CL 11285129 via CL 11285132
#ROBOMERGE-BOT: (v647-11244347)

[CL 11285135 by aris theophanidis in Main branch]
2020-02-06 14:37:16 -05:00

47 lines
1002 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "NavMesh/RecastInternalDebugData.h"
#include "DebugUtils/DebugDraw.h"
void FRecastInternalDebugData::vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v)
{
float pos[3] = { x,y,z };
Vertices.Push(Recast2UnrealPoint(pos));
VertexColors.Push(color);
}
void FRecastInternalDebugData::end()
{
if (ensure(Commands.Num() > 0))
{
Command& Cmd = Commands.Last();
const int FirstVertex = Cmd.Offset;
Cmd.Offset = Indices.Num();
// Turns quads to triangles
if (Cmd.Prim == DU_DRAW_QUADS)
{
Cmd.Prim = DU_DRAW_TRIS;
for (int i = FirstVertex; i < Vertices.Num(); i += 4)
{
ensure(i + 3 < Vertices.Num());
Indices.Push(i + 0);
Indices.Push(i + 1);
Indices.Push(i + 3);
Indices.Push(i + 3);
Indices.Push(i + 1);
Indices.Push(i + 2);
}
}
else
{
for (int i = FirstVertex; i < Vertices.Num(); i++)
{
Indices.Push(i);
}
}
}
}