mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: add option to render poly's by group id
Useful for debugging static pathing data.
This commit is contained in:
parent
4134cd9f42
commit
94e2df9542
@ -403,6 +403,9 @@ void Editor_TileMesh::handleDebugMode()
|
||||
if (imguiCheck("Draw Poly Centers", (getNavMeshDrawFlags() & DU_DRAWNAVMESH_POLYCENTERS)))
|
||||
toggleNavMeshDrawFlag(DU_DRAWNAVMESH_POLYCENTERS);
|
||||
|
||||
if (imguiCheck("Draw Poly Groups", (getNavMeshDrawFlags() & DU_DRAWNAVMESH_POLYGROUPS)))
|
||||
toggleNavMeshDrawFlag(DU_DRAWNAVMESH_POLYGROUPS);
|
||||
|
||||
if (imguiCheck("Disable NavMesh Depth Mask", (getNavMeshDrawFlags() & DU_DRAWNAVMESH_NO_DEPTH_MASK)))
|
||||
toggleNavMeshDrawFlag(DU_DRAWNAVMESH_NO_DEPTH_MASK);
|
||||
|
||||
|
@ -32,8 +32,9 @@ enum DrawNavMeshFlags
|
||||
DU_DRAWNAVMESH_INNERBOUND = 1 << 4, // Render inner poly boundaries.
|
||||
DU_DRAWNAVMESH_OUTERBOUND = 1 << 5, // Render outer poly boundaries.
|
||||
DU_DRAWNAVMESH_POLYCENTERS = 1 << 6, // Render poly centers.
|
||||
DU_DRAWNAVMESH_NO_DEPTH_MASK = 1 << 7, // Disable render depth mask.
|
||||
DU_DRAWNAVMESH_NO_ALPHA = 1 << 8, // Disable navmesh transparency.
|
||||
DU_DRAWNAVMESH_POLYGROUPS = 1 << 7, // Render poly group by color.
|
||||
DU_DRAWNAVMESH_NO_DEPTH_MASK = 1 << 8, // Disable render depth mask.
|
||||
DU_DRAWNAVMESH_NO_ALPHA = 1 << 9, // Disable navmesh transparency.
|
||||
};
|
||||
|
||||
void duDebugDrawNavMesh(struct duDebugDraw* dd, const dtNavMesh& mesh, unsigned char flags);
|
||||
|
@ -136,14 +136,12 @@ static void drawPolyCenters(duDebugDraw* dd, const dtMeshTile* tile, const unsig
|
||||
static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery* query,
|
||||
const dtMeshTile* tile, unsigned int flags)
|
||||
{
|
||||
dtPolyRef base = mesh.getPolyRefBase(tile);
|
||||
int tileNum = mesh.decodePolyIdTile(base);
|
||||
|
||||
// If "No Alpha" flag is set, force the colour to be opaque instead of semi-transparent.
|
||||
const int tileAlpha = flags & DU_DRAWNAVMESH_NO_ALPHA ? 255 : 170;
|
||||
const unsigned int tileColor = duIntToCol(tileNum, tileAlpha);
|
||||
|
||||
const int tileAlpha = flags & DU_DRAWNAVMESH_NO_ALPHA ? 255 : 170;
|
||||
const bool disableDepthTest = flags & DU_DRAWNAVMESH_NO_DEPTH_MASK;
|
||||
|
||||
dtPolyRef base = mesh.getPolyRefBase(tile);
|
||||
|
||||
dd->depthMask(!disableDepthTest);
|
||||
|
||||
dd->begin(DU_DRAW_TRIS);
|
||||
@ -161,7 +159,9 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh
|
||||
else
|
||||
{
|
||||
if (flags & DU_DRAWNAVMESH_COLOR_TILES)
|
||||
col = tileColor;
|
||||
col = duIntToCol(mesh.decodePolyIdTile(base), tileAlpha);
|
||||
else if (flags & DU_DRAWNAVMESH_POLYGROUPS)
|
||||
col = duIntToCol(p->groupId, tileAlpha);
|
||||
else
|
||||
col = getPolySurfaceColor(p, dd, tileAlpha);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user