char HPolygonalUV::save(APolygonalUV * poly) { int nuv = poly->numCoords(); if(!hasNamedAttr(".nuv")) addIntAttr(".nuv"); writeIntAttr(".nuv", &nuv); int nind = poly->numIndices(); if(!hasNamedAttr(".nind")) addIntAttr(".nind"); writeIntAttr(".nind", &nind); if(!hasNamedData(".ucoord")) addFloatData(".ucoord", nuv); writeFloatData(".ucoord", nuv, (float *)poly->ucoord()); if(!hasNamedData(".vcoord")) addFloatData(".vcoord", nuv); writeFloatData(".vcoord", nuv, (float *)poly->vcoord()); if(!hasNamedData(".uvid")) addIntData(".uvid", nind); writeIntData(".uvid", nind, (int *)poly->indices()); return 1; }
char HMesh::save(BaseMesh * mesh) { mesh->verbose(); int nv = mesh->getNumVertices(); if(!hasNamedAttr(".nv")) addIntAttr(".nv"); writeIntAttr(".nv", &nv); int nf = mesh->getNumPolygons(); if(!hasNamedAttr(".nf")) addIntAttr(".nf"); writeIntAttr(".nf", &nf); int nfv = mesh->getNumPolygonFaceVertices(); if(!hasNamedAttr(".nfv")) addIntAttr(".nfv"); writeIntAttr(".nfv", &nfv); int nuv = mesh->getNumUVs(); if(!hasNamedAttr(".nuv")) addIntAttr(".nuv"); writeIntAttr(".nuv", &nuv); int nuvid = mesh->getNumUVIds(); if(!hasNamedAttr(".nuvid")) addIntAttr(".nuvid"); writeIntAttr(".nuvid", &nuvid); if(!hasNamedData(".p")) addVector3Data(".p", nv); writeVector3Data(".p", nv, mesh->getVertices()); if(!hasNamedData(".polyc")) addIntData(".polyc", nf); writeIntData(".polyc", nf, (int *)mesh->getPolygonCounts()); if(!hasNamedData(".polyv")) addIntData(".polyv", nfv); std::cout<<" polyv[0]"<<mesh->getPolygonIndices()[0]<<"\n"; std::cout<<" polyv["<<nfv<<"-1]"<<mesh->getPolygonIndices()[nfv - 1]<<"\n"; writeIntData(".polyv", nfv, (int *)mesh->getPolygonIndices()); if(!hasNamedData(".us")) addFloatData(".us", nuv); writeFloatData(".us", nuv, mesh->getUs()); if(!hasNamedData(".vs")) addFloatData(".vs", nuv); writeFloatData(".vs", nuv, mesh->getVs()); if(!hasNamedData(".uvids")) addIntData(".uvids", nuvid); writeIntData(".uvids", nuvid, (int *)mesh->getUvIds()); return 1; }