Allow showing yellow (2d) / green (3d) quads in track debug
This commit is contained in:
parent
9d41f4b429
commit
262eb40dfe
@ -1,4 +1,3 @@
|
||||
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2009-2015 Joerg Henrichs
|
||||
|
@ -78,15 +78,11 @@ void GraphStructure::createDebugMesh()
|
||||
createMesh(/*show_invisible*/true,
|
||||
/*enable_transparency*/true);
|
||||
|
||||
// Now colour the quads red/blue/red ...
|
||||
video::SColor c( 128, 255, 0, 0);
|
||||
video::S3DVertex *v = (video::S3DVertex*)m_mesh_buffer->getVertices();
|
||||
for (unsigned int i = 0; i < m_mesh_buffer->getVertexCount(); i++)
|
||||
{
|
||||
// Swap the colours from red to blue and back
|
||||
c.setRed ((i%2) ? 255 : 0);
|
||||
c.setBlue((i%2) ? 0 : 255);
|
||||
v[i].Color = c;
|
||||
// Swap the alpha and back
|
||||
v[i].Color.setAlpha((i%2) ? 64 : 255);
|
||||
}
|
||||
m_node = irr_driver->addMesh(m_mesh, "track-debug-mesh");
|
||||
#ifdef DEBUG
|
||||
@ -154,7 +150,9 @@ void GraphStructure::createMesh(bool show_invisible,
|
||||
// Transfer the 4 points of the current quad to the list of vertices
|
||||
set3DVerticesOfGraph(count, new_v+4*i, (different_color ?
|
||||
(nc == COLOR_RED ? video::SColor(255, 255, 0, 0) :
|
||||
video::SColor(255, 0, 0, 255)) : c));
|
||||
nc == COLOR_GREEN ? video::SColor(255, 0, 255, 0) :
|
||||
nc == COLOR_BLUE ? video::SColor(255, 0, 0, 255) :
|
||||
video::SColor(255, 255, 255, 0)) : c));
|
||||
|
||||
// Set up the indices for the triangles
|
||||
// (note, afaik with opengl we could use quads directly, but the code
|
||||
|
@ -46,11 +46,14 @@ class GraphStructure : public NoCopy
|
||||
{
|
||||
protected:
|
||||
|
||||
/** Used by soccer field with navmesh to draw goal line. */
|
||||
/** Used by soccer field with navmesh to draw goal line,
|
||||
* or to determine 2d/3d nodes in driveline graph. */
|
||||
enum NodeColor
|
||||
{
|
||||
COLOR_BLUE,
|
||||
COLOR_RED
|
||||
COLOR_GREEN,
|
||||
COLOR_RED,
|
||||
COLOR_YELLOW
|
||||
};
|
||||
|
||||
void cleanupDebugMesh();
|
||||
|
@ -908,3 +908,17 @@ float QuadGraph::getDistanceFromStart(int j) const
|
||||
{
|
||||
return m_all_nodes[j]->getDistanceFromStart();
|
||||
} // getDistanceFromStart
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const bool QuadGraph::differentNodeColor(int n, NodeColor* c) const
|
||||
{
|
||||
if (UserConfigParams::m_track_debug)
|
||||
{
|
||||
if (dynamic_cast<Node3D*>(m_all_nodes[n]) != NULL)
|
||||
*c = COLOR_GREEN;
|
||||
else
|
||||
*c = COLOR_YELLOW;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} // differentNodeColor
|
||||
|
@ -92,8 +92,7 @@ private:
|
||||
virtual const bool hasLapLine() const
|
||||
{ return true; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual const bool differentNodeColor(int n, NodeColor* c) const
|
||||
{ return false; }
|
||||
virtual const bool differentNodeColor(int n, NodeColor* c) const;
|
||||
|
||||
public:
|
||||
static const int UNKNOWN_SECTOR;
|
||||
|
Loading…
Reference in New Issue
Block a user