davmesh debug draw membervar cleanup

This commit is contained in:
Azaezel 2018-03-14 15:13:44 -05:00
parent 789979d58a
commit d0e47ee1ee
2 changed files with 20 additions and 20 deletions

View file

@ -1232,10 +1232,10 @@ bool NavMesh::createCoverPoints()
float segs[MAX_SEGS*6]; float segs[MAX_SEGS*6];
int nsegs = 0; int nsegs = 0;
query->getPolyWallSegments(ref, &f, segs, NULL, &nsegs, MAX_SEGS); query->getPolyWallSegments(ref, &f, segs, NULL, &nsegs, MAX_SEGS);
for(int j = 0; j < nsegs; ++j) for(int segIDx = 0; segIDx < nsegs; ++segIDx)
{ {
const float* sa = &segs[j*6]; const float* sa = &segs[segIDx *6];
const float* sb = &segs[j*6+3]; const float* sb = &segs[segIDx *6+3];
Point3F a = RCtoDTS(sa), b = RCtoDTS(sb); Point3F a = RCtoDTS(sa), b = RCtoDTS(sb);
F32 len = (b - a).len(); F32 len = (b - a).len();
if(len < mWalkableRadius * 2) if(len < mWalkableRadius * 2)
@ -1244,7 +1244,7 @@ bool NavMesh::createCoverPoints()
edge.normalize(); edge.normalize();
// Number of points to try placing - for now, one at each end. // Number of points to try placing - for now, one at each end.
U32 pointCount = (len > mWalkableRadius * 4) ? 2 : 1; U32 pointCount = (len > mWalkableRadius * 4) ? 2 : 1;
for(U32 i = 0; i < pointCount; i++) for(U32 pointIDx = 0; pointIDx < pointCount; pointIDx++)
{ {
MatrixF mat; MatrixF mat;
Point3F pos; Point3F pos;
@ -1254,10 +1254,10 @@ bool NavMesh::createCoverPoints()
// Otherwise, stand off from edge ends. // Otherwise, stand off from edge ends.
else else
{ {
if(i % 2) if(pointIDx % 2)
pos = a + edge * (i/2+1) * mWalkableRadius; pos = a + edge * (pointIDx /2+1) * mWalkableRadius;
else else
pos = b - edge * (i/2+1) * mWalkableRadius; pos = b - edge * (pointIDx /2+1) * mWalkableRadius;
} }
CoverPointData data; CoverPointData data;
if(testEdgeCover(pos, edge, data)) if(testEdgeCover(pos, edge, data))
@ -1332,7 +1332,7 @@ bool NavMesh::testEdgeCover(const Point3F &pos, const VectorF &dir, CoverPointDa
void NavMesh::renderToDrawer() void NavMesh::renderToDrawer()
{ {
dd.clear(); mDbgDraw.clear();
// Recast debug draw // Recast debug draw
NetObject *no = getServerObject(); NetObject *no = getServerObject();
if(no) if(no)
@ -1341,12 +1341,12 @@ void NavMesh::renderToDrawer()
if(n->nm) if(n->nm)
{ {
dd.beginGroup(0); mDbgDraw.beginGroup(0);
duDebugDrawNavMesh (&dd, *n->nm, 0); duDebugDrawNavMesh (&mDbgDraw, *n->nm, 0);
dd.beginGroup(1); mDbgDraw.beginGroup(1);
duDebugDrawNavMeshPortals(&dd, *n->nm); duDebugDrawNavMeshPortals(&mDbgDraw, *n->nm);
dd.beginGroup(2); mDbgDraw.beginGroup(2);
duDebugDrawNavMeshBVTree (&dd, *n->nm); duDebugDrawNavMeshBVTree (&mDbgDraw, *n->nm);
} }
} }
} }
@ -1398,16 +1398,16 @@ void NavMesh::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInsta
int alpha = 80; int alpha = 80;
if(!n->isSelected() || !Con::getBoolVariable("$Nav::EditorOpen")) if(!n->isSelected() || !Con::getBoolVariable("$Nav::EditorOpen"))
alpha = 20; alpha = 20;
dd.overrideColor(duRGBA(255, 0, 0, alpha)); mDbgDraw.overrideColor(duRGBA(255, 0, 0, alpha));
} }
else else
{ {
dd.cancelOverride(); mDbgDraw.cancelOverride();
} }
if((!gEditingMission && n->mAlwaysRender) || (gEditingMission && Con::getBoolVariable("$Nav::Editor::renderMesh", 1))) dd.renderGroup(0); if((!gEditingMission && n->mAlwaysRender) || (gEditingMission && Con::getBoolVariable("$Nav::Editor::renderMesh", 1))) mDbgDraw.renderGroup(0);
if(Con::getBoolVariable("$Nav::Editor::renderPortals")) dd.renderGroup(1); if(Con::getBoolVariable("$Nav::Editor::renderPortals")) mDbgDraw.renderGroup(1);
if(Con::getBoolVariable("$Nav::Editor::renderBVTree")) dd.renderGroup(2); if(Con::getBoolVariable("$Nav::Editor::renderBVTree")) mDbgDraw.renderGroup(2);
} }
} }

View file

@ -407,7 +407,7 @@ private:
/// @name Rendering /// @name Rendering
/// @{ /// @{
duDebugDrawTorque dd; duDebugDrawTorque mDbgDraw;
void renderToDrawer(); void renderToDrawer();