void RecastMapRenderer::DrawObstacles(duDebugDraw* dd, const dtTileCache* tc) { for (int i = 0; i < tc->getObstacleCount(); ++i) { const dtTileCacheObstacle* ob = tc->getObstacle(i); if (ob->state == DT_OBSTACLE_EMPTY) continue; float bmin[3], bmax[3]; tc->getObstacleBounds(ob, bmin,bmax); unsigned int col = 0; if (ob->state == DT_OBSTACLE_PROCESSING) col = duRGBA(255,255,0,128); else if (ob->state == DT_OBSTACLE_PROCESSED) col = duRGBA(255,192,0,192); else if (ob->state == DT_OBSTACLE_REMOVING) col = duRGBA(220,0,0,128); duDebugDrawCylinder(dd, bmin[0],bmin[1],bmin[2], bmax[0],bmax[1],bmax[2], col); duDebugDrawCylinderWire(dd, bmin[0],bmin[1],bmin[2], bmax[0],bmax[1],bmax[2], duDarkenCol(col), 2); } }
void NavMeshTesterTool::drawAgent(const float* pos, float r, float h, float c, const unsigned int col) { DebugDrawGL dd; dd.depthMask(false); // Agent dimensions. duDebugDrawCylinderWire(&dd, pos[0]-r, pos[1]+0.02f, pos[2]-r, pos[0]+r, pos[1]+h, pos[2]+r, col, 2.0f); duDebugDrawCircle(&dd, pos[0],pos[1]+c,pos[2],r,duRGBA(0,0,0,64),1.0f); unsigned int colb = duRGBA(0,0,0,196); dd.begin(DU_DRAW_LINES); dd.vertex(pos[0], pos[1]-c, pos[2], colb); dd.vertex(pos[0], pos[1]+c, pos[2], colb); dd.vertex(pos[0]-r/2, pos[1]+0.02f, pos[2], colb); dd.vertex(pos[0]+r/2, pos[1]+0.02f, pos[2], colb); dd.vertex(pos[0], pos[1]+0.02f, pos[2]-r/2, colb); dd.vertex(pos[0], pos[1]+0.02f, pos[2]+r/2, colb); dd.end(); dd.depthMask(true); }
void cocos2d::NavMesh::drawObstacles() { // Draw obstacles for (auto iter : _obstacleList) { if (iter){ const dtTileCacheObstacle* ob = _tileCache->getObstacleByRef(iter->_obstacleID); if (ob->state == DT_OBSTACLE_EMPTY) continue; float bmin[3], bmax[3]; _tileCache->getObstacleBounds(ob, bmin, bmax); unsigned int col = 0; if (ob->state == DT_OBSTACLE_PROCESSING) col = duRGBA(255, 255, 0, 128); else if (ob->state == DT_OBSTACLE_PROCESSED) col = duRGBA(255, 192, 0, 192); else if (ob->state == DT_OBSTACLE_REMOVING) col = duRGBA(220, 0, 0, 128); duDebugDrawCylinder(&_debugDraw, bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2], col); duDebugDrawCylinderWire(&_debugDraw, bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2], duDarkenCol(col), 2); } } }