Updated many importer to do not use anymore the useless, deprecated, removed, etc etc <uber>
This commit is contained in:
parent
049c996846
commit
bc3fd845e1
|
@ -319,19 +319,19 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
|
||||||
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
{
|
{
|
||||||
vp=&(*vi);
|
vp=&(*vi);
|
||||||
FlagV.push_back(vp->UberFlags()); // Salva in ogni caso flag del vertice
|
FlagV.push_back(vp->Flags()); // Salva in ogni caso flag del vertice
|
||||||
if( ! vp->IsD() )
|
if( ! vp->IsD() )
|
||||||
{
|
{
|
||||||
if(binary)
|
if(binary)
|
||||||
{
|
{
|
||||||
float t;
|
float t;
|
||||||
|
|
||||||
t = float(vp->UberP()[0]); fwrite(&t,sizeof(float),1,fpout);
|
t = float(vp->P()[0]); fwrite(&t,sizeof(float),1,fpout);
|
||||||
t = float(vp->UberP()[1]); fwrite(&t,sizeof(float),1,fpout);
|
t = float(vp->P()[1]); fwrite(&t,sizeof(float),1,fpout);
|
||||||
t = float(vp->UberP()[2]); fwrite(&t,sizeof(float),1,fpout);
|
t = float(vp->P()[2]); fwrite(&t,sizeof(float),1,fpout);
|
||||||
|
|
||||||
if( pi.mask & ply::PLYMask::PM_VERTFLAGS )
|
if( pi.mask & ply::PLYMask::PM_VERTFLAGS )
|
||||||
fwrite(&(vp->UberFlags()),sizeof(int),1,fpout);
|
fwrite(&(vp->Flags()),sizeof(int),1,fpout);
|
||||||
|
|
||||||
if( HasPerVertexColor(m) && (pi.mask & ply::PLYMask::PM_VERTCOLOR) )
|
if( HasPerVertexColor(m) && (pi.mask & ply::PLYMask::PM_VERTCOLOR) )
|
||||||
fwrite(&( vp->C() ),sizeof(char),4,fpout);
|
fwrite(&( vp->C() ),sizeof(char),4,fpout);
|
||||||
|
@ -360,7 +360,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
|
||||||
fprintf(fpout,"%g %g %g " ,vp->P()[0],vp->P()[1],vp->P()[2]);
|
fprintf(fpout,"%g %g %g " ,vp->P()[0],vp->P()[1],vp->P()[2]);
|
||||||
|
|
||||||
if( pi.mask & ply::PLYMask::PM_VERTFLAGS )
|
if( pi.mask & ply::PLYMask::PM_VERTFLAGS )
|
||||||
fprintf(fpout,"%d ",vp->UberFlags());
|
fprintf(fpout,"%d ",vp->Flags());
|
||||||
|
|
||||||
if( HasPerVertexColor(m) && (pi.mask & ply::PLYMask::PM_VERTCOLOR) )
|
if( HasPerVertexColor(m) && (pi.mask & ply::PLYMask::PM_VERTCOLOR) )
|
||||||
fprintf(fpout,"%d %d %d %d ",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] );
|
fprintf(fpout,"%d %d %d %d ",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] );
|
||||||
|
@ -387,7 +387,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
|
||||||
fprintf(fpout,"\n");
|
fprintf(fpout,"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
vp->UberFlags()=j; // Trucco! Nascondi nei flags l'indice del vertice non deletato!
|
vp->Flags()=j; // Trucco! Nascondi nei flags l'indice del vertice non deletato!
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,10 +407,10 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
|
||||||
{ fcnt++;
|
{ fcnt++;
|
||||||
if(binary)
|
if(binary)
|
||||||
{
|
{
|
||||||
vv[0]=fp->cV(0)->UberFlags();
|
vv[0]=fp->cV(0)->Flags();
|
||||||
vv[1]=fp->cV(1)->UberFlags();
|
vv[1]=fp->cV(1)->Flags();
|
||||||
vv[2]=fp->cV(2)->UberFlags();
|
vv[2]=fp->cV(2)->Flags();
|
||||||
vv[3]=fp->cV(2)->UberFlags();
|
vv[3]=fp->cV(2)->Flags();
|
||||||
fwrite(&c,1,1,fpout);
|
fwrite(&c,1,1,fpout);
|
||||||
fwrite(vv,sizeof(int),4,fpout);
|
fwrite(vv,sizeof(int),4,fpout);
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
|
||||||
else // ***** ASCII *****
|
else // ***** ASCII *****
|
||||||
{
|
{
|
||||||
fprintf(fpout,"3 %d %d %d ",
|
fprintf(fpout,"3 %d %d %d ",
|
||||||
fp->cV(0)->UberFlags(), fp->cV(1)->UberFlags(), fp->cV(2)->UberFlags() );
|
fp->cV(0)->Flags(), fp->cV(1)->Flags(), fp->cV(2)->Flags() );
|
||||||
|
|
||||||
if( pi.mask & ply::PLYMask::PM_TETRAFLAGS )
|
if( pi.mask & ply::PLYMask::PM_TETRAFLAGS )
|
||||||
fprintf(fpout,"%d ",fp->Flags());
|
fprintf(fpout,"%d ",fp->Flags());
|
||||||
|
@ -563,7 +563,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
|
||||||
|
|
||||||
// Recupera i flag originali
|
// Recupera i flag originali
|
||||||
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
(*vi).UberFlags()=FlagV[j++];
|
(*vi).Flags()=FlagV[j++];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,28 +244,11 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
|
||||||
LoadPly_VertAux<ScalarType> va;
|
LoadPly_VertAux<ScalarType> va;
|
||||||
|
|
||||||
pi.mask = 0;
|
pi.mask = 0;
|
||||||
bool multit = false; // true if texture has a per face int spec the texture index
|
|
||||||
|
|
||||||
va.flags = 42;
|
va.flags = 42;
|
||||||
|
|
||||||
pi.status = ::vcg::ply::E_NOERROR;
|
pi.status = ::vcg::ply::E_NOERROR;
|
||||||
|
|
||||||
// init defaults
|
|
||||||
VertexType tv;
|
|
||||||
tv.UberFlags() = 0;
|
|
||||||
if( VertexType::HasQuality() ) tv.Q()=1.0;
|
|
||||||
if( VertexType::HasColor() ) tv.C()=Color4b(Color4b::White);
|
|
||||||
|
|
||||||
TetraType tf;
|
|
||||||
tf.UberFlags() = 0;
|
|
||||||
//if( FaceType::HasFaceQuality() ) tf.Q()=1.0;
|
|
||||||
//if( FaceType::HasWedgeColor() ) tf.WC(0)=tf.WC(1)=tf.WC(2)=Color4b(Color4b::White);
|
|
||||||
//if( FaceType::HasFaceColor() ) tf.C()=Color4b(Color4b::White);
|
|
||||||
// Descrittori delle strutture
|
|
||||||
|
|
||||||
//bool isvflags = false; // Il file contiene i flags
|
|
||||||
|
|
||||||
|
|
||||||
// The main descriptor of the ply file
|
// The main descriptor of the ply file
|
||||||
vcg::ply::PlyFile pf;
|
vcg::ply::PlyFile pf;
|
||||||
|
|
||||||
|
@ -442,7 +425,6 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
|
||||||
for(j=0;j<n;++j)
|
for(j=0;j<n;++j)
|
||||||
{
|
{
|
||||||
if(pi.cb && (j%1000)==0) pi.cb(j*50/n,"Vertex Loading");
|
if(pi.cb && (j%1000)==0) pi.cb(j*50/n,"Vertex Loading");
|
||||||
(*vi).UberFlags()=0;
|
|
||||||
if( pf.Read( (void *)&(va) )==-1 )
|
if( pf.Read( (void *)&(va) )==-1 )
|
||||||
{
|
{
|
||||||
pi.status = PlyInfo::E_SHORTFILE;
|
pi.status = PlyInfo::E_SHORTFILE;
|
||||||
|
@ -454,7 +436,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
|
||||||
(*vi).P()[2] = va.p[2];
|
(*vi).P()[2] = va.p[2];
|
||||||
|
|
||||||
if( pi.mask & ply::PLYMask::PM_VERTFLAGS )
|
if( pi.mask & ply::PLYMask::PM_VERTFLAGS )
|
||||||
(*vi).UberFlags() = va.flags;
|
(*vi).Flags() = va.flags;
|
||||||
|
|
||||||
if( pi.mask & ply::PLYMask::PM_VERTQUALITY )
|
if( pi.mask & ply::PLYMask::PM_VERTQUALITY )
|
||||||
(*vi).Q() = va.q;
|
(*vi).Q() = va.q;
|
||||||
|
@ -514,7 +496,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
|
||||||
|
|
||||||
if( pi.mask & ply::PLYMask::PM_TETRAFLAGS )
|
if( pi.mask & ply::PLYMask::PM_TETRAFLAGS )
|
||||||
{
|
{
|
||||||
(*fi).UberFlags() = fa.flags;
|
(*fi).Flags() = fa.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pi.mask & ply::PLYMask::PM_TETRAQUALITY )
|
if( pi.mask & ply::PLYMask::PM_TETRAQUALITY )
|
||||||
|
|
|
@ -94,7 +94,7 @@ static int Open( Tetramesh & m, const char * filename )
|
||||||
m.tetra.back().V(1) = &m.vert[tp1];
|
m.tetra.back().V(1) = &m.vert[tp1];
|
||||||
m.tetra.back().V(2) = &m.vert[tp2];
|
m.tetra.back().V(2) = &m.vert[tp2];
|
||||||
m.tetra.back().V(3) = &m.vert[tp3];
|
m.tetra.back().V(3) = &m.vert[tp3];
|
||||||
m.tetra.back().UberFlags() = 0;
|
m.tetra.back().Flags() = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.vn = nvertex;
|
m.vn = nvertex;
|
||||||
|
@ -103,7 +103,7 @@ static int Open( Tetramesh & m, const char * filename )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};// end class
|
};// end class
|
||||||
};// end of io
|
}// end of io
|
||||||
};// end of tetra
|
}// end of tetra
|
||||||
};// end of vcg
|
}// end of vcg
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -69,10 +69,10 @@ namespace vcg {
|
||||||
for(j=0,vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
|
for(j=0,vi=m.vert.begin(); vi!=m.vert.end(); ++vi)
|
||||||
{
|
{
|
||||||
vp = &(*vi);
|
vp = &(*vi);
|
||||||
FlagV.push_back(vp->UberFlags());
|
FlagV.push_back(vp->Flags());
|
||||||
if (!vp->IsD())
|
if (!vp->IsD())
|
||||||
{
|
{
|
||||||
vp->UberFlags() = j;
|
vp->Flags() = j;
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,8 +94,8 @@ namespace vcg {
|
||||||
{
|
{
|
||||||
for (int k=0; k<3; ++k)
|
for (int k=0; k<3; ++k)
|
||||||
{
|
{
|
||||||
int a = fp->cV(k)->UberFlags();
|
int a = fp->cV(k)->Flags();
|
||||||
int b = fp->cV((k+1)%3)->UberFlags();
|
int b = fp->cV((k+1)%3)->Flags();
|
||||||
if (a>b)
|
if (a>b)
|
||||||
std::swap(a,b);
|
std::swap(a,b);
|
||||||
Edge e(a,b);
|
Edge e(a,b);
|
||||||
|
@ -132,8 +132,8 @@ namespace vcg {
|
||||||
{
|
{
|
||||||
for (int k=0; k<3; ++k)
|
for (int k=0; k<3; ++k)
|
||||||
{
|
{
|
||||||
int a = fp->cV(k)->UberFlags();
|
int a = fp->cV(k)->Flags();
|
||||||
int b = fp->cV((k+1)%3)->UberFlags();
|
int b = fp->cV((k+1)%3)->Flags();
|
||||||
if (a>b)
|
if (a>b)
|
||||||
std::swap(a,b);
|
std::swap(a,b);
|
||||||
Edge e(a,b);
|
Edge e(a,b);
|
||||||
|
@ -154,8 +154,8 @@ namespace vcg {
|
||||||
{
|
{
|
||||||
for (int k=0; k<3; ++k)
|
for (int k=0; k<3; ++k)
|
||||||
{
|
{
|
||||||
int a = fp->cV(k)->UberFlags();
|
int a = fp->cV(k)->Flags();
|
||||||
int b = fp->cV((k+1)%3)->UberFlags();
|
int b = fp->cV((k+1)%3)->Flags();
|
||||||
if (a>b)
|
if (a>b)
|
||||||
std::swap(a,b);
|
std::swap(a,b);
|
||||||
Edge e(a,b);
|
Edge e(a,b);
|
||||||
|
@ -171,7 +171,7 @@ namespace vcg {
|
||||||
|
|
||||||
// Recupera i flag originali
|
// Recupera i flag originali
|
||||||
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
(*vi).UberFlags()=FlagV[j++];
|
(*vi).Flags()=FlagV[j++];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace vcg {
|
||||||
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(j=0,vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
{
|
{
|
||||||
vp=&(*vi);
|
vp=&(*vi);
|
||||||
FlagV.push_back(vp->UberFlags()); // Save vertex flags
|
FlagV.push_back(vp->Flags()); // Save vertex flags
|
||||||
if( ! vp->IsD() )
|
if( ! vp->IsD() )
|
||||||
{ // ***** ASCII *****
|
{ // ***** ASCII *****
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ namespace vcg {
|
||||||
fprintf(fpout,"\n");
|
fprintf(fpout,"\n");
|
||||||
|
|
||||||
|
|
||||||
vp->UberFlags()=j; // Trucco! Nascondi nei flags l'indice del vertice non deletato!
|
vp->Flags()=j; // Trucco! Nascondi nei flags l'indice del vertice non deletato!
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ namespace vcg {
|
||||||
if(!polygon.empty())
|
if(!polygon.empty())
|
||||||
{
|
{
|
||||||
fprintf(fpout,"%d ", int(polygon.size()) );
|
fprintf(fpout,"%d ", int(polygon.size()) );
|
||||||
for (size_t i=0; i<polygon.size(); i++) fprintf(fpout,"%d ", polygon[i]->UberFlags() );
|
for (size_t i=0; i<polygon.size(); i++) fprintf(fpout,"%d ", polygon[i]->Flags() );
|
||||||
fprintf(fpout,"\n");
|
fprintf(fpout,"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ namespace vcg {
|
||||||
FacePointer fp=&(*fi);
|
FacePointer fp=&(*fi);
|
||||||
if( ! fp->IsD() )
|
if( ! fp->IsD() )
|
||||||
{ fprintf(fpout,"3 %d %d %d\n",
|
{ fprintf(fpout,"3 %d %d %d\n",
|
||||||
fp->cV(0)->UberFlags(), fp->cV(1)->UberFlags(), fp->cV(2)->UberFlags() );
|
fp->cV(0)->Flags(), fp->cV(1)->Flags(), fp->cV(2)->Flags() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ namespace vcg {
|
||||||
// Recupera i flag originali
|
// Recupera i flag originali
|
||||||
j=0;
|
j=0;
|
||||||
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
|
for(vi=m.vert.begin();vi!=m.vert.end();++vi)
|
||||||
(*vi).UberFlags()=FlagV[j++];
|
(*vi).Flags()=FlagV[j++];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,7 +466,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
|
||||||
t = float(vp->N()[2]); fwrite(&t,sizeof(float),1,fpout);
|
t = float(vp->N()[2]); fwrite(&t,sizeof(float),1,fpout);
|
||||||
}
|
}
|
||||||
if( HasPerVertexFlags(m) && (pi.mask & Mask::IOM_VERTFLAGS) )
|
if( HasPerVertexFlags(m) && (pi.mask & Mask::IOM_VERTFLAGS) )
|
||||||
fwrite(&(vp->UberFlags()),sizeof(int),1,fpout);
|
fwrite(&(vp->Flags()),sizeof(int),1,fpout);
|
||||||
|
|
||||||
if( HasPerVertexColor(m) && (pi.mask & Mask::IOM_VERTCOLOR) )
|
if( HasPerVertexColor(m) && (pi.mask & Mask::IOM_VERTCOLOR) )
|
||||||
fwrite(&( vp->C() ),sizeof(char),4,fpout);
|
fwrite(&( vp->C() ),sizeof(char),4,fpout);
|
||||||
|
@ -506,7 +506,7 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
|
||||||
fprintf(fpout,"%g %g %g " ,double(vp->N()[0]),double(vp->N()[1]),double(vp->N()[2]));
|
fprintf(fpout,"%g %g %g " ,double(vp->N()[0]),double(vp->N()[1]),double(vp->N()[2]));
|
||||||
|
|
||||||
if( HasPerVertexFlags(m) && (pi.mask & Mask::IOM_VERTFLAGS))
|
if( HasPerVertexFlags(m) && (pi.mask & Mask::IOM_VERTFLAGS))
|
||||||
fprintf(fpout,"%d ",vp->UberFlags());
|
fprintf(fpout,"%d ",vp->Flags());
|
||||||
|
|
||||||
if( HasPerVertexColor(m) && (pi.mask & Mask::IOM_VERTCOLOR) )
|
if( HasPerVertexColor(m) && (pi.mask & Mask::IOM_VERTCOLOR) )
|
||||||
fprintf(fpout,"%d %d %d %d ",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] );
|
fprintf(fpout,"%d %d %d %d ",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] );
|
||||||
|
|
|
@ -640,7 +640,6 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
|
||||||
for(j=0;j<n;++j)
|
for(j=0;j<n;++j)
|
||||||
{
|
{
|
||||||
if(pi.cb && (j%1000)==0) pi.cb(j*50/n,"Vertex Loading");
|
if(pi.cb && (j%1000)==0) pi.cb(j*50/n,"Vertex Loading");
|
||||||
//(*vi).UberFlags()=0; // No more necessary, since 9/2005 flags are set to zero in the constuctor.
|
|
||||||
if( pf.Read( (void *)&(va) )==-1 )
|
if( pf.Read( (void *)&(va) )==-1 )
|
||||||
{
|
{
|
||||||
pi.status = PlyInfo::E_SHORTFILE;
|
pi.status = PlyInfo::E_SHORTFILE;
|
||||||
|
@ -652,7 +651,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
|
||||||
(*vi).P()[2] = va.p[2];
|
(*vi).P()[2] = va.p[2];
|
||||||
|
|
||||||
if( HasPerVertexFlags(m) && (pi.mask & Mask::IOM_VERTFLAGS) )
|
if( HasPerVertexFlags(m) && (pi.mask & Mask::IOM_VERTFLAGS) )
|
||||||
(*vi).UberFlags() = va.flags;
|
(*vi).Flags() = va.flags;
|
||||||
|
|
||||||
if( pi.mask & Mask::IOM_VERTQUALITY )
|
if( pi.mask & Mask::IOM_VERTQUALITY )
|
||||||
(*vi).Q() = (typename OpenMeshType::VertexType::QualityType)va.q;
|
(*vi).Q() = (typename OpenMeshType::VertexType::QualityType)va.q;
|
||||||
|
@ -750,7 +749,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
|
||||||
|
|
||||||
if(HasPerFaceFlags(m) &&( pi.mask & Mask::IOM_FACEFLAGS) )
|
if(HasPerFaceFlags(m) &&( pi.mask & Mask::IOM_FACEFLAGS) )
|
||||||
{
|
{
|
||||||
(*fi).UberFlags() = fa.flags;
|
(*fi).Flags() = fa.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pi.mask & Mask::IOM_FACEQUALITY )
|
if( pi.mask & Mask::IOM_FACEQUALITY )
|
||||||
|
|
|
@ -112,7 +112,7 @@ public :
|
||||||
CoordType & P() { assert(0); return CoordType(); }
|
CoordType & P() { assert(0); return CoordType(); }
|
||||||
const CoordType & P() const { assert(0); return CoordType(); }
|
const CoordType & P() const { assert(0); return CoordType(); }
|
||||||
const CoordType & cP() const { assert(0); return CoordType(); }
|
const CoordType & cP() const { assert(0); return CoordType(); }
|
||||||
CoordType & UberP() { assert(0); return CoordType(); }
|
CoordType & P() { assert(0); return CoordType(); }
|
||||||
static bool HasCoord() { return false; }
|
static bool HasCoord() { return false; }
|
||||||
static void Name( std::vector< std::string > & name ) { T::Name(name); }
|
static void Name( std::vector< std::string > & name ) { T::Name(name); }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue