refactoring
This commit is contained in:
parent
3770720fb8
commit
86495cdb6f
|
@ -974,8 +974,8 @@ public:
|
|||
countE++;
|
||||
else
|
||||
{
|
||||
vertVisited[fi->V0(i)] = true;
|
||||
vertVisited[fi->V1(i)] = true;
|
||||
vertVisited[fi->V(i)] = true;
|
||||
vertVisited[fi->V(i)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
Pos(FaceType * fp, int zp, VertexType * vp)
|
||||
{
|
||||
f=fp; z=zp; v=vp;
|
||||
assert((vp==fp->V0(zp))||(vp==fp->V1(zp)));
|
||||
assert((vp == fp->V(zp)) || (vp == fp->V(zp)));
|
||||
}
|
||||
Pos(FaceType * fp, int zp){f=fp; z=zp; v=f->V(zp);}
|
||||
Pos(FaceType * fp, VertexType * vp)
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
typedef typename SaveMeshType::ScalarType ScalarType;
|
||||
typedef typename SaveMeshType::VertexType VertexType;
|
||||
typedef typename SaveMeshType::FaceType FaceType;
|
||||
typedef typename SaveMeshType::ConstFacePointer FacePointer;
|
||||
typedef typename SaveMeshType::FacePointer FacePointer;
|
||||
typedef typename SaveMeshType::ConstVertexIterator VertexIterator;
|
||||
typedef typename SaveMeshType::ConstFaceIterator FaceIterator;
|
||||
typedef typename SaveMeshType::ConstEdgeIterator EdgeIterator;
|
||||
|
@ -86,14 +86,22 @@ public:
|
|||
return Save(m, filename, binary, pi);
|
||||
}
|
||||
|
||||
static int Save(const SaveMeshType &m, const char * filename, int savemask, bool binary = true, CallBackPos *cb=0 )
|
||||
static int Save(const SaveMeshType &m,
|
||||
const char *filename,
|
||||
int savemask,
|
||||
bool binary = true,
|
||||
CallBackPos *cb = 0)
|
||||
{
|
||||
PlyInfo pi;
|
||||
pi.mask = savemask;
|
||||
return Save(m, filename, binary, pi, cb);
|
||||
}
|
||||
|
||||
static int Save(const SaveMeshType &m, const char * filename, bool binary, const PlyInfo &pi, CallBackPos *cb=0) // V1.0
|
||||
static int Save(const SaveMeshType &m,
|
||||
const char *filename,
|
||||
bool binary,
|
||||
const PlyInfo &pi,
|
||||
CallBackPos *cb = 0) // V1.0
|
||||
{
|
||||
FILE *fpout;
|
||||
const char * hbin = "binary_little_endian";
|
||||
|
@ -635,21 +643,19 @@ public:
|
|||
unsigned char b3char = 3;
|
||||
unsigned char b9char = 9;
|
||||
unsigned char b6char = 6;
|
||||
FacePointer fp;
|
||||
int vv[3];
|
||||
FaceIterator fi;
|
||||
int fcnt = 0;
|
||||
for(j=0,fi=m.face.begin();fi!=m.face.end();++fi)
|
||||
{
|
||||
j = 0;
|
||||
for (fi = m.face.begin(); fi != m.face.end(); ++fi) {
|
||||
//((m.vn+m.fn) != 0) all vertices and faces have been marked as deleted but the are still in the vert/face vectors
|
||||
if (cb && ((j % 1000) == 0) && ((m.vn + m.fn) != 0))
|
||||
(*cb)(100 * (m.vn + j) / (m.vn + m.fn), "Saving Vertices");
|
||||
|
||||
fp=&(*fi);
|
||||
if( ! fp->IsD() )
|
||||
{ fcnt++;
|
||||
if(binary)
|
||||
{
|
||||
auto fp = &(*fi);
|
||||
if (!fp->IsD()) {
|
||||
fcnt++;
|
||||
if (binary) {
|
||||
vv[0] = indices[fp->cV(0)];
|
||||
vv[1]=indices[fp->cV(1)];
|
||||
vv[2]=indices[fp->cV(2)];
|
||||
|
@ -769,8 +775,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // ***** ASCII *****
|
||||
} else // ***** ASCII *****
|
||||
{
|
||||
fprintf(fpout, "%d ", fp->VN());
|
||||
for(int k=0;k<fp->VN();++k)
|
||||
|
@ -861,7 +866,8 @@ public:
|
|||
case ply::T_SHORT : ti=*( (short *) (((char *)fp)+pi.FaceDescriptorVec[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
||||
case ply::T_CHAR : ti=*( (char *) (((char *)fp)+pi.FaceDescriptorVec[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
||||
case ply::T_UCHAR : ti=*( (unsigned char *) (((char *)fp)+pi.FaceDescriptorVec[i].offset1)); fprintf(fpout,"%i ",ti); break;
|
||||
default : assert(0);
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -872,13 +878,10 @@ public:
|
|||
}
|
||||
assert(fcnt == m.fn);
|
||||
int eauxvv[2];
|
||||
if( pi.mask & Mask::IOM_EDGEINDEX )
|
||||
{
|
||||
if (pi.mask & Mask::IOM_EDGEINDEX) {
|
||||
int ecnt = 0;
|
||||
for(EdgeIterator ei=m.edge.begin();ei!=m.edge.end();++ei)
|
||||
{
|
||||
if( ! ei->IsD() )
|
||||
{
|
||||
for (EdgeIterator ei = m.edge.begin(); ei != m.edge.end(); ++ei) {
|
||||
if (!ei->IsD()) {
|
||||
++ecnt;
|
||||
if(binary)
|
||||
{
|
||||
|
@ -893,7 +896,8 @@ public:
|
|||
assert(ecnt == m.en);
|
||||
}
|
||||
int result = 0;
|
||||
if (ferror(fpout)) result = ply::E_STREAMERROR;
|
||||
if (ferror(fpout))
|
||||
result = ply::E_STREAMERROR;
|
||||
fclose(fpout);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue