void RigidBody::CreateList() { m_RigidBodyList = glGenLists(1); glNewList(m_RigidBodyList, GL_COMPILE); // glColor3f(1.0,1.0,0.0); typedef map<FaceId, Face> FaceMap; FaceMap faces = m_Geom.GetFaces(); FaceMap::const_iterator itFaceEnd = faces.end(); for (FaceMap::const_iterator itFace = faces.begin(); itFace != itFaceEnd; ++itFace) { // glBegin(GL_POLYGON); glBegin(GL_LINE_LOOP); vector<VertexId> vertexIds = (*itFace).second.GetVertexIds(); vector<VertexId>::iterator vItEnd = vertexIds.end(); for(vector<VertexId>::iterator vIt = vertexIds.begin() ; vIt != vItEnd ; vIt++) { Vertex vertex = m_Geom.GetVertex((*vIt)); glPushMatrix(); glVertex3f(vertex.GetPos().GetX(), vertex.GetPos().GetY(), vertex.GetPos().GetZ()); glPopMatrix(); } glEnd(); } glEndList(); }
/** * @function GetPath */ std::vector< std::vector<Pos> > HP2D::GetPath( Pos _p ) { std::vector<int> iv; Vertex* current; int minIndex; int minDist; std::vector< std::vector<Pos> > paths; iv = mG->GetVertices( _p ); for( unsigned int i = 0; i < iv.size(); ++i ) { current = mV[ iv[i] ]; std::vector<Pos> path; while( current->GetIndex() != 0 ) { std::vector<int> a; a = current->GetAdjacent(); if( a.size() == 0 ) { printf("--(!) Uh-oh, error here. No Adjacents! GetPath Function \n"); } minDist = 1000; minIndex = -1; for( unsigned int j = 0; j < a.size(); ++ j ) { if( mV[ a[j] ]->GetDist() < minDist ) { minDist = mV[ a[j] ]->GetDist(); minIndex = mV[ a[j] ]->GetIndex(); } } path.push_back( current->GetPos() ); current = mV[minIndex]; } path.push_back( mV[0]->GetPos() ); paths.push_back( path ); } return paths; }