Make RecastDemo colors more meaningful (#254)

Implement a SampleDebugDraw which will color area types meaningfully, for example
color water as blue, grass as green and so on.
This commit is contained in:
Domenico Albani
2017-02-02 20:27:43 +01:00
committed by Jakob Botsch Nielsen
parent 16a7a30ada
commit 03eb2f92f3
13 changed files with 121 additions and 96 deletions

View File

@@ -29,6 +29,7 @@
#include "DebugDraw.h"
#include "RecastDebugDraw.h"
#include "DetourNavMesh.h"
#include "Sample.h"
static bool intersectSegmentTriangle(const float* sp, const float* sq,
const float* a, const float* b, const float* c,
@@ -555,7 +556,7 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, bool /*hilight*/)
for (int i = 0; i < m_volumeCount; ++i)
{
const ConvexVolume* vol = &m_volumes[i];
unsigned int col = duIntToCol(vol->area, 32);
unsigned int col = duTransCol(dd->areaToCol(vol->area), 32);
for (int j = 0, k = vol->nverts-1; j < vol->nverts; k = j++)
{
const float* va = &vol->verts[k*3];
@@ -581,7 +582,7 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, bool /*hilight*/)
for (int i = 0; i < m_volumeCount; ++i)
{
const ConvexVolume* vol = &m_volumes[i];
unsigned int col = duIntToCol(vol->area, 220);
unsigned int col = duTransCol(dd->areaToCol(vol->area), 220);
for (int j = 0, k = vol->nverts-1; j < vol->nverts; k = j++)
{
const float* va = &vol->verts[k*3];
@@ -600,7 +601,7 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, bool /*hilight*/)
for (int i = 0; i < m_volumeCount; ++i)
{
const ConvexVolume* vol = &m_volumes[i];
unsigned int col = duDarkenCol(duIntToCol(vol->area, 255));
unsigned int col = duDarkenCol(duTransCol(dd->areaToCol(vol->area), 220));
for (int j = 0; j < vol->nverts; ++j)
{
dd->vertex(vol->verts[j*3+0],vol->verts[j*3+1]+0.1f,vol->verts[j*3+2], col);