void RoutePlanner::activateDebugDraw(bool activate) { if (activate) { debugGraphicObject = GraphicEngine::getInstance()->createObject(getId()); std::list<RouteNode*> nodes = map.getItems(); for (std::list<RouteNode*>::iterator i = nodes.begin(); i != nodes.end(); i++) { //Draw node RouteNode* node = *i; GraphicObject* object = debugGraphicObject->createChild(WasVec3d(node->position.x, 0, -node->position.y)); object->scale(WasVec3d(0.5, 0.5, 0.5)); Entity* entity = object->createEntity(PT_CUBE); entity->setColor(ColourValue::BLUE); //Draw paths Vertex v1 = {node->position.x, 0, -node->position.y}; for (std::map<int, int>::iterator j = node->routeMap.begin(); j != node->routeMap.end(); j++) { if (j->first == j->second) { MeshPrototype prototype(WASABI_LINES); Face face; Vertex v2 = {getNode(j->first)->position.x, 0, - getNode(j->first)->position.y}; face.addVertex(v1); face.addVertex(v2); prototype.addFace(face); Entity* entity = debugGraphicObject->createEntity(prototype); entity->setColor(ColourValue::BLUE); } } } } else if (debugGraphicObject != NULL) { GraphicEngine::getInstance()->destroyObject(debugGraphicObject); } debugDraw = activate; }