void BaseMesh::verbose() const { std::cout<<"mesh status:\n"; std::cout<<" num vertices "<<getNumVertices()<<"\n"; std::cout<<" num polygons "<<getNumPolygons()<<"\n"; std::map<unsigned, unsigned> faceCountList; for(unsigned i = 0; i < getNumPolygons(); i++) { if(faceCountList.find(m_polygonCounts[i]) == faceCountList.end()) faceCountList[m_polygonCounts[i]] = 1; else faceCountList[m_polygonCounts[i]] += 1; } std::map<unsigned, unsigned>::const_iterator it = faceCountList.begin(); for(; it != faceCountList.end(); ++it) { std::clog<<" "<<(*it).second<<" "<<(*it).first<<"-sided faces\n"; } std::cout<<" num polygon face vertices "<<getNumPolygonFaceVertices()<<"\n"; std::cout<<" num triangles "<<getNumTriangles()<<"\n"; std::cout<<" num quads "<<numQuads()<<"\n"; std::cout<<" num uvs "<<getNumUVs()<<"\n"; std::cout<<" num uvs indices "<<getNumUVIds()<<"\n"; }
void GFXVertexList::GetPolys( GFXVertex **vert, int *numpolys, int *numtris ) { if (numVertices == 0) { *numpolys = 0; *numtris = 0; *vert = 0; return; } this->Map( true, false ); void (*vtxcpy)( GFXVertexList *thus, GFXVertex *dst, int offset, int howmany ); vtxcpy = (changed&HAS_COLOR) ? ( (changed&HAS_INDEX) ? ColIndVtxCopy : ColVtxCopy ) : ( (changed&HAS_INDEX) ? IndVtxCopy : VtxCopy ); //int offst = (changed&HAS_COLOR)?sizeof(GFXColorVertex):sizeof(GFXVertex); int i; int cur = 0; GFXVertex *res; *numtris = numTris(); *numpolys = *numtris+numQuads(); int curtri = 0; int curquad = 3*(*numtris); res = (GFXVertex*) malloc( ( (*numtris)*3+4*( *numpolys-(*numtris) ) )*sizeof (GFXVertex) ); *vert = res; for (i = 0; i < numlists; i++) { int j; switch (mode[i]) { case GFXTRI: (*vtxcpy)(this, &res[curtri], cur, offsets[i]); curtri += offsets[i]; break; case GFXTRIFAN: case GFXPOLY: for (j = 1; j < offsets[i]-1; j++) { (*vtxcpy)(this, &res[curtri++], cur, 1); (*vtxcpy)(this, &res[curtri++], (cur+j), 1); (*vtxcpy)(this, &res[curtri++], (cur+j+1), 1); } break; case GFXTRISTRIP: for (j = 2; j < offsets[i]; j += 2) { (*vtxcpy)(this, &res[curtri++], (cur+j-2), 1); (*vtxcpy)(this, &res[curtri++], (cur+j-1), 1); (*vtxcpy)(this, &res[curtri++], (cur+j), 1); if (j+1 < offsets[i]) { //copy reverse (*vtxcpy)(this, &res[curtri++], (cur+j), 1); (*vtxcpy)(this, &res[curtri++], (cur+j-1), 1); (*vtxcpy)(this, &res[curtri++], (cur+j+1), 1); } } break; case GFXQUAD: (*vtxcpy)(this, &res[curquad], (cur), offsets[i]); curquad += offsets[i]; break; case GFXQUADSTRIP: for (j = 2; j < offsets[i]-1; j += 2) { (*vtxcpy)(this, &res[curquad++], (cur+j-2), 1); (*vtxcpy)(this, &res[curquad++], (cur+j-1), 1); (*vtxcpy)(this, &res[curquad++], (cur+j+1), 1); (*vtxcpy)(this, &res[curquad++], (cur+j), 1); } break; default: break; } cur += offsets[i]; } this->UnMap(); }