Changed ply::PlyMask to io::Mask

This commit is contained in:
Paolo Cignoni 2006-01-10 13:20:42 +00:00
parent edc2f8532d
commit 6dca4be1ab
7 changed files with 148 additions and 119 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.17 2005/10/02 23:11:00 cignoni
Version 4.06, Added possibility of using three different search structures UG Hash and AABB
Revision 1.16 2005/09/16 11:52:14 cignoni Revision 1.16 2005/09/16 11:52:14 cignoni
removed wrong %v in vertex number printing removed wrong %v in vertex number printing
@ -326,7 +329,8 @@ int main(int argc, char**argv)
if(flags & SamplingFlags::SAVE_ERROR) if(flags & SamplingFlags::SAVE_ERROR)
{ {
vcg::tri::io::PlyInfo p; vcg::tri::io::PlyInfo p;
p.mask|=vcg::ply::PLYMask::PM_VERTCOLOR|vcg::ply::PLYMask::PM_VERTQUALITY; p.mask|=vcg::tri::io::Mask::IOM_VERTCOLOR | vcg::tri::io::Mask::IOM_VERTQUALITY /* | vcg::ply::PLYMask::PM_VERTQUALITY*/ ;
//p.mask|=vcg::ply::PLYMask::PM_VERTCOLOR|vcg::ply::PLYMask::PM_VERTQUALITY;
if(ColorMax!=0 || ColorMin != 0){ if(ColorMax!=0 || ColorMin != 0){
vcg::tri::UpdateColor<CMesh>::VertexQuality(S1,ColorMin,ColorMax); vcg::tri::UpdateColor<CMesh>::VertexQuality(S1,ColorMin,ColorMax);
vcg::tri::UpdateColor<CMesh>::VertexQuality(S2,ColorMin,ColorMax); vcg::tri::UpdateColor<CMesh>::VertexQuality(S2,ColorMin,ColorMax);

View File

@ -24,6 +24,10 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.10 2005/11/12 06:48:47 cignoni
Version 1.0
Added management of point set, correct bug in printing on the screen,
Revision 1.9 2005/01/03 13:59:54 cignoni Revision 1.9 2005/01/03 13:59:54 cignoni
Resolved min/max macro conflict Resolved min/max macro conflict
@ -396,7 +400,7 @@ void ViewKey(unsigned char key, int , int )
case 'S' : case 'S' :
{ {
vcg::tri::io::PlyInfo p; vcg::tri::io::PlyInfo p;
p.mask|=vcg::ply::PLYMask::PM_VERTCOLOR /* | vcg::ply::PLYMask::PM_VERTQUALITY*/ ; p.mask|=vcg::tri::io::Mask::IOM_VERTCOLOR /* | vcg::ply::PLYMask::PM_VERTQUALITY*/ ;
tri::io::ExporterPLY<AMesh>::Save(m,OutNameMsh.c_str(),false,p); tri::io::ExporterPLY<AMesh>::Save(m,OutNameMsh.c_str(),false,p);
} }
break; break;

View File

@ -29,9 +29,9 @@
#ifndef __VCGLIB_EXPORT_OFF #ifndef __VCGLIB_EXPORT_OFF
#define __VCGLIB_EXPORT_OFF #define __VCGLIB_EXPORT_OFF
#include<wrap/ply/io_mask.h>
#include <stdio.h> #include <stdio.h>
#include <wrap/io_trimesh/io_mask.h>
namespace vcg { namespace vcg {
namespace tri { namespace tri {

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.11 2005/11/23 15:48:25 pietroni
changed shot::similarity to shot::Similarity() and shot::camera to shot::Camera()
Revision 1.10 2004/10/28 00:52:45 cignoni Revision 1.10 2004/10/28 00:52:45 cignoni
Better Doxygen documentation Better Doxygen documentation
@ -67,7 +70,8 @@ Initial commit
#ifndef __VCGLIB_EXPORT_PLY #ifndef __VCGLIB_EXPORT_PLY
#define __VCGLIB_EXPORT_PLY #define __VCGLIB_EXPORT_PLY
#include<wrap/ply/io_mask.h> //#include<wrap/ply/io_mask.h>
#include<wrap/io_trimesh/io_mask.h>
#include<wrap/io_trimesh/io_ply.h> #include<wrap/io_trimesh/io_ply.h>
#include <stdio.h> #include <stdio.h>
@ -149,7 +153,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
,h ,h
); );
if( pi.mask & ply::PLYMask::PM_WEDGTEXCOORD ) if( pi.mask & Mask::IOM_WEDGTEXCOORD )
{ {
//const char * TFILE = "TextureFile"; //const char * TFILE = "TextureFile";
@ -159,7 +163,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
//if(textures.size()>1 && (HasPerWedgeTexture() || HasPerVertexTexture())) multit = true; //if(textures.size()>1 && (HasPerWedgeTexture() || HasPerVertexTexture())) multit = true;
} }
if( (pi.mask & ply::PLYMask::PM_CAMERA) && m.shot.IsValid()) if( (pi.mask & Mask::IOM_CAMERA) && m.shot.IsValid())
{ {
fprintf(fpout, fprintf(fpout,
"element camera 1\n" "element camera 1\n"
@ -198,14 +202,14 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
); );
if( pi.mask & ply::PLYMask::PM_VERTFLAGS ) if( pi.mask & Mask::IOM_VERTFLAGS )
{ {
fprintf(fpout, fprintf(fpout,
"property int flags\n" "property int flags\n"
); );
} }
if( m.HasPerVertexColor() && (pi.mask & ply::PLYMask::PM_VERTCOLOR) ) if( m.HasPerVertexColor() && (pi.mask & Mask::IOM_VERTCOLOR) )
{ {
fprintf(fpout, fprintf(fpout,
"property uchar red\n" "property uchar red\n"
@ -215,7 +219,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
); );
} }
if( m.HasPerVertexQuality() && (pi.mask & ply::PLYMask::PM_VERTQUALITY) ) if( m.HasPerVertexQuality() && (pi.mask & Mask::IOM_VERTQUALITY) )
{ {
fprintf(fpout, fprintf(fpout,
"property float quality\n" "property float quality\n"
@ -231,7 +235,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
,m.fn ,m.fn
); );
if( pi.mask & ply::PLYMask::PM_FACEFLAGS ) if( pi.mask & Mask::IOM_FACEFLAGS )
{ {
fprintf(fpout, fprintf(fpout,
"property int flags\n" "property int flags\n"
@ -250,7 +254,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
); );
} }
if( m.HasPerFaceColor() && (pi.mask & ply::PLYMask::PM_FACECOLOR) ) if( m.HasPerFaceColor() && (pi.mask & Mask::IOM_FACECOLOR) )
{ {
fprintf(fpout, fprintf(fpout,
"property uchar red\n" "property uchar red\n"
@ -260,14 +264,14 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
); );
} }
if ( m.HasPerWedgeColor() && (pi.mask & ply::PLYMask::PM_WEDGCOLOR) ) if ( m.HasPerWedgeColor() && (pi.mask & Mask::IOM_WEDGCOLOR) )
{ {
fprintf(fpout, fprintf(fpout,
"property list uchar float color\n" "property list uchar float color\n"
); );
} }
if( m.HasPerFaceQuality() && (pi.mask & ply::PLYMask::PM_FACEQUALITY) ) if( m.HasPerFaceQuality() && (pi.mask & Mask::IOM_FACEQUALITY) )
{ {
fprintf(fpout, fprintf(fpout,
"property float quality\n" "property float quality\n"
@ -280,7 +284,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &
fprintf(fpout, "end_header\n" ); fprintf(fpout, "end_header\n" );
// Salvataggio camera // Salvataggio camera
if( (pi.mask & ply::PLYMask::PM_CAMERA) && m.shot.IsValid() ) if( (pi.mask & Mask::IOM_CAMERA) && m.shot.IsValid() )
{ {
if(binary) if(binary)
{ {
@ -362,13 +366,13 @@ std::vector<int> FlagV;
t = float(vp->UberP()[1]); fwrite(&t,sizeof(float),1,fpout); t = float(vp->UberP()[1]); fwrite(&t,sizeof(float),1,fpout);
t = float(vp->UberP()[2]); fwrite(&t,sizeof(float),1,fpout); t = float(vp->UberP()[2]); fwrite(&t,sizeof(float),1,fpout);
if( pi.mask & ply::PLYMask::PM_VERTFLAGS ) if( pi.mask & Mask::IOM_VERTFLAGS )
fwrite(&(vp->UberFlags()),sizeof(int),1,fpout); fwrite(&(vp->UberFlags()),sizeof(int),1,fpout);
if( m.HasPerVertexColor() && (pi.mask & ply::PLYMask::PM_VERTCOLOR) ) if( m.HasPerVertexColor() && (pi.mask & Mask::IOM_VERTCOLOR) )
fwrite(&( vp->C() ),sizeof(char),4,fpout); fwrite(&( vp->C() ),sizeof(char),4,fpout);
if( m.HasPerVertexQuality() && (pi.mask & ply::PLYMask::PM_VERTQUALITY) ) if( m.HasPerVertexQuality() && (pi.mask & Mask::IOM_VERTQUALITY) )
fwrite(&( vp->Q() ),sizeof(float),1,fpout); fwrite(&( vp->Q() ),sizeof(float),1,fpout);
@ -391,13 +395,13 @@ std::vector<int> FlagV;
{ {
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 & Mask::IOM_VERTFLAGS )
fprintf(fpout,"%d ",vp->UberFlags()); fprintf(fpout,"%d ",vp->UberFlags());
if( m.HasPerVertexColor() && (pi.mask & ply::PLYMask::PM_VERTCOLOR) ) if( m.HasPerVertexColor() && (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] );
if( m.HasPerVertexQuality() && (pi.mask & ply::PLYMask::PM_VERTQUALITY) ) if( m.HasPerVertexQuality() && (pi.mask & Mask::IOM_VERTQUALITY) )
fprintf(fpout,"%g ",vp->Q()); fprintf(fpout,"%g ",vp->Q());
for(i=0;i<pi.vdn;i++) for(i=0;i<pi.vdn;i++)
@ -445,10 +449,10 @@ std::vector<int> FlagV;
fwrite(&c,1,1,fpout); fwrite(&c,1,1,fpout);
fwrite(vv,sizeof(int),3,fpout); fwrite(vv,sizeof(int),3,fpout);
if( pi.mask & ply::PLYMask::PM_FACEFLAGS ) if( pi.mask & Mask::IOM_FACEFLAGS )
fwrite(&(fp->Flags()),sizeof(int),1,fpout); fwrite(&(fp->Flags()),sizeof(int),1,fpout);
if( m.HasPerVertexTexture() && (pi.mask & ply::PLYMask::PM_VERTTEXCOORD) ) if( m.HasPerVertexTexture() && (pi.mask & Mask::IOM_VERTTEXCOORD) )
{ {
fwrite(&b6,sizeof(char),1,fpout); fwrite(&b6,sizeof(char),1,fpout);
float t[6]; float t[6];
@ -459,7 +463,7 @@ std::vector<int> FlagV;
} }
fwrite(t,sizeof(float),6,fpout); fwrite(t,sizeof(float),6,fpout);
} }
else if( m.HasPerWedgeTexture() && (pi.mask & ply::PLYMask::PM_WEDGTEXCOORD) ) else if( m.HasPerWedgeTexture() && (pi.mask & Mask::IOM_WEDGTEXCOORD) )
{ {
fwrite(&b6,sizeof(char),1,fpout); fwrite(&b6,sizeof(char),1,fpout);
float t[6]; float t[6];
@ -477,11 +481,11 @@ std::vector<int> FlagV;
fwrite(&t,sizeof(int),1,fpout); fwrite(&t,sizeof(int),1,fpout);
} }
if( m.HasPerFaceColor() && (pi.mask & ply::PLYMask::PM_FACECOLOR) ) if( m.HasPerFaceColor() && (pi.mask & Mask::IOM_FACECOLOR) )
fwrite(&( fp->C() ),sizeof(char),4,fpout); fwrite(&( fp->C() ),sizeof(char),4,fpout);
if( m.HasPerWedgeColor() && (pi.mask & ply::PLYMask::PM_WEDGCOLOR) ) if( m.HasPerWedgeColor() && (pi.mask & Mask::IOM_WEDGCOLOR) )
{ {
fwrite(&b9,sizeof(char),1,fpout); fwrite(&b9,sizeof(char),1,fpout);
float t[3]; float t[3];
@ -494,7 +498,7 @@ std::vector<int> FlagV;
} }
} }
if( m.HasPerFaceQuality() && (pi.mask & ply::PLYMask::PM_FACEQUALITY) ) if( m.HasPerFaceQuality() && (pi.mask & Mask::IOM_FACEQUALITY) )
fwrite( &(fp->Q()),sizeof(float),1,fpout); fwrite( &(fp->Q()),sizeof(float),1,fpout);
@ -517,10 +521,10 @@ std::vector<int> FlagV;
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)->UberFlags(), fp->cV(1)->UberFlags(), fp->cV(2)->UberFlags() );
if( pi.mask & ply::PLYMask::PM_FACEFLAGS ) if( pi.mask & Mask::IOM_FACEFLAGS )
fprintf(fpout,"%d ",fp->Flags()); fprintf(fpout,"%d ",fp->Flags());
if( m.HasPerVertexTexture() && (pi.mask & ply::PLYMask::PM_VERTTEXCOORD) ) if( m.HasPerVertexTexture() && (pi.mask & Mask::IOM_VERTTEXCOORD) )
{ {
fprintf(fpout,"6 "); fprintf(fpout,"6 ");
for(int k=0;k<3;++k) for(int k=0;k<3;++k)
@ -529,7 +533,7 @@ std::vector<int> FlagV;
,fp->V(k)->T().v() ,fp->V(k)->T().v()
); );
} }
else if( m.HasPerWedgeTexture() && (pi.mask & ply::PLYMask::PM_WEDGTEXCOORD) ) else if( m.HasPerWedgeTexture() && (pi.mask & Mask::IOM_WEDGTEXCOORD) )
{ {
fprintf(fpout,"6 "); fprintf(fpout,"6 ");
for(int k=0;k<3;++k) for(int k=0;k<3;++k)
@ -544,7 +548,7 @@ std::vector<int> FlagV;
fprintf(fpout,"%d ",fp->WT(0).n()); fprintf(fpout,"%d ",fp->WT(0).n());
} }
if( m.HasPerFaceColor() && (pi.mask & ply::PLYMask::PM_FACECOLOR) ) if( m.HasPerFaceColor() && (pi.mask & Mask::IOM_FACECOLOR) )
{ {
float t[3]; float t[3];
t[0] = float(fp->C()[0])/255; t[0] = float(fp->C()[0])/255;
@ -555,7 +559,7 @@ std::vector<int> FlagV;
fprintf(fpout,"%g %g %g ",t[0],t[1],t[2]); fprintf(fpout,"%g %g %g ",t[0],t[1],t[2]);
fprintf(fpout,"%g %g %g ",t[0],t[1],t[2]); fprintf(fpout,"%g %g %g ",t[0],t[1],t[2]);
} }
else if( m.HasPerWedgeColor() && (pi.mask & ply::PLYMask::PM_WEDGCOLOR) ) else if( m.HasPerWedgeColor() && (pi.mask & Mask::IOM_WEDGCOLOR) )
{ {
fprintf(fpout,"9 "); fprintf(fpout,"9 ");
for(int z=0;z<3;++z) for(int z=0;z<3;++z)
@ -566,7 +570,7 @@ std::vector<int> FlagV;
); );
} }
if( m.HasPerFaceQuality() && (pi.mask & ply::PLYMask::PM_FACEQUALITY) ) if( m.HasPerFaceQuality() && (pi.mask & Mask::IOM_FACEQUALITY) )
fprintf(fpout,"%g ",fp->Q()); fprintf(fpout,"%g ",fp->Q());
for(i=0;i<pi.fdn;i++) for(i=0;i<pi.fdn;i++)

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.9 2005/12/01 00:58:56 cignoni
Added and removed typenames for gcc compiling...
Revision 1.8 2005/11/12 18:12:16 cignoni Revision 1.8 2005/11/12 18:12:16 cignoni
Added casts and changed integral types to remove warnings Added casts and changed integral types to remove warnings
@ -99,13 +102,19 @@ namespace vcg
return error_msg[message_code]; return error_msg[message_code];
}; };
static int Open(MESH_TYPE &mesh, const char *filename, CallBackPos *cb=0)
{
int loadmask;
return Open(mesh,filename,loadmask,cb);
}
/*! /*!
* Standard call for reading a mesh * Standard call for reading a mesh
* \param mesh the destination mesh * \param mesh the destination mesh
* \param filename the name of the file to read from * \param filename the name of the file to read from
* \return the operation result * \return the operation result
*/ */
static int Open(MESH_TYPE &mesh, const char *filename) static int Open(MESH_TYPE &mesh, const char *filename, int &loadmask, CallBackPos *cb=0)
{ {
mesh.Clear(); mesh.Clear();
@ -166,6 +175,8 @@ namespace vcg
if (stream.fail()) if (stream.fail())
return UnexpectedEOF; return UnexpectedEOF;
if(cb && (i%1000)==0) cb(i*50/nVertices,"Vertex Loading");
TokenizeNextLine(stream, tokens); TokenizeNextLine(stream, tokens);
if(tokens.size() ==3) if(tokens.size() ==3)
{ {
@ -203,6 +214,7 @@ namespace vcg
if (stream.fail()) if (stream.fail())
return UnexpectedEOF; return UnexpectedEOF;
if(cb && (f%1000)==0) cb(50+f*50/nFaces,"Vertex Loading");
TokenizeNextLine(stream, tokens); TokenizeNextLine(stream, tokens);
int vert_per_face = atoi(tokens[0].c_str()); int vert_per_face = atoi(tokens[0].c_str());
@ -321,8 +333,8 @@ namespace vcg
} // end Open } // end Open
protected: enum OFFCodes {NoError=0, CantOpen, UnexpectedEOF};
enum OFFCodes {NoError, CantOpen, UnexpectedEOF}; protected:
/*! /*!
* Read the next valid line and parses it into "tokens", allowing the tokens to be read one at a time. * Read the next valid line and parses it into "tokens", allowing the tokens to be read one at a time.

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.23 2006/01/04 16:17:03 cignoni
Corrected use of mask and callback in function Open(m,filename,mask,callback);
Revision 1.22 2005/12/30 22:30:43 cignoni Revision 1.22 2005/12/30 22:30:43 cignoni
Added support for per vertex color stored as 'diffuse_xxx' property Added support for per vertex color stored as 'diffuse_xxx' property
@ -99,7 +102,7 @@ Initial commit
#include<wrap/callback.h> #include<wrap/callback.h>
#include<wrap/ply/plylib.h> #include<wrap/ply/plylib.h>
#include<wrap/ply/io_mask.h> #include<wrap/io_trimesh/io_mask.h>
#include<wrap/io_trimesh/io_ply.h> #include<wrap/io_trimesh/io_ply.h>
#include<vcg/complex/trimesh/allocate.h> #include<vcg/complex/trimesh/allocate.h>
#include<vcg/space/color4.h> #include<vcg/space/color4.h>
@ -398,7 +401,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
break; break;
} }
} }
if(found) pi.mask |= ply::PLYMask::PM_CAMERA; if(found) pi.mask |= Mask::IOM_CAMERA;
} }
// Descrittori dati standard (vertex coord e faces) // Descrittori dati standard (vertex coord e faces)
@ -415,13 +418,13 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
// Descrittori facoltativi dei flags // Descrittori facoltativi dei flags
if(VertexType::HasFlags() && (pf.AddToRead(VertDesc(3))!=-1 ) ) if(VertexType::HasFlags() && (pf.AddToRead(VertDesc(3))!=-1 ) )
pi.mask |= ply::PLYMask::PM_VERTFLAGS; pi.mask |= Mask::IOM_VERTFLAGS;
if( VertexType::HasQuality() ) if( VertexType::HasQuality() )
{ {
if( pf.AddToRead(VertDesc(4))!=-1 || if( pf.AddToRead(VertDesc(4))!=-1 ||
pf.AddToRead(VertDesc(8))!=-1 ) pf.AddToRead(VertDesc(8))!=-1 )
pi.mask |= ply::PLYMask::PM_VERTQUALITY; pi.mask |= Mask::IOM_VERTQUALITY;
} }
if( VertexType::HasColor() ) if( VertexType::HasColor() )
@ -430,25 +433,25 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
{ {
pf.AddToRead(VertDesc(6)); pf.AddToRead(VertDesc(6));
pf.AddToRead(VertDesc(7)); pf.AddToRead(VertDesc(7));
pi.mask |= ply::PLYMask::PM_VERTCOLOR; pi.mask |= Mask::IOM_VERTCOLOR;
} }
if( pf.AddToRead(VertDesc(8))!=-1 ) if( pf.AddToRead(VertDesc(8))!=-1 )
{ {
pf.AddToRead(VertDesc(9)); pf.AddToRead(VertDesc(9));
pf.AddToRead(VertDesc(10)); pf.AddToRead(VertDesc(10));
pi.mask |= ply::PLYMask::PM_VERTCOLOR; pi.mask |= Mask::IOM_VERTCOLOR;
} }
} }
// se ci sono i flag per vertice ci devono essere anche i flag per faccia // se ci sono i flag per vertice ci devono essere anche i flag per faccia
if( pf.AddToRead(FaceDesc(1))!=-1 ) if( pf.AddToRead(FaceDesc(1))!=-1 )
pi.mask |= ply::PLYMask::PM_FACEFLAGS; pi.mask |= Mask::IOM_FACEFLAGS;
if( FaceType::HasFaceQuality()) if( FaceType::HasFaceQuality())
{ {
if( pf.AddToRead(FaceDesc(2))!=-1 ) if( pf.AddToRead(FaceDesc(2))!=-1 )
pi.mask |= ply::PLYMask::PM_FACEQUALITY; pi.mask |= Mask::IOM_FACEQUALITY;
} }
if( FaceType::HasFaceColor() ) if( FaceType::HasFaceColor() )
@ -457,7 +460,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
{ {
pf.AddToRead(FaceDesc(7)); pf.AddToRead(FaceDesc(7));
pf.AddToRead(FaceDesc(8)); pf.AddToRead(FaceDesc(8));
pi.mask |= ply::PLYMask::PM_FACECOLOR; pi.mask |= Mask::IOM_FACECOLOR;
} }
} }
@ -468,9 +471,9 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
{ {
if(pf.AddToRead(FaceDesc(5))==0) { if(pf.AddToRead(FaceDesc(5))==0) {
multit=true; // try to read also the multi texture indicies multit=true; // try to read also the multi texture indicies
pi.mask |= ply::PLYMask::PM_WEDGTEXMULTI; pi.mask |= Mask::IOM_WEDGTEXMULTI;
} }
pi.mask |= ply::PLYMask::PM_WEDGTEXCOORD; pi.mask |= Mask::IOM_WEDGTEXCOORD;
} }
} }
@ -478,7 +481,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
{ {
if( pf.AddToRead(FaceDesc(4))!=-1 ) if( pf.AddToRead(FaceDesc(4))!=-1 )
{ {
pi.mask |= ply::PLYMask::PM_WEDGCOLOR; pi.mask |= Mask::IOM_WEDGCOLOR;
} }
} }
@ -594,13 +597,13 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
(*vi).P()[1] = va.p[1]; (*vi).P()[1] = va.p[1];
(*vi).P()[2] = va.p[2]; (*vi).P()[2] = va.p[2];
if( pi.mask & ply::PLYMask::PM_VERTFLAGS ) if( pi.mask & Mask::IOM_VERTFLAGS )
(*vi).UberFlags() = va.flags; (*vi).UberFlags() = va.flags;
if( pi.mask & ply::PLYMask::PM_VERTQUALITY ) if( pi.mask & Mask::IOM_VERTQUALITY )
(*vi).Q() = va.q; (*vi).Q() = va.q;
if( pi.mask & ply::PLYMask::PM_VERTCOLOR ) if( pi.mask & Mask::IOM_VERTCOLOR )
{ {
(*vi).C()[0] = va.r; (*vi).C()[0] = va.r;
(*vi).C()[1] = va.g; (*vi).C()[1] = va.g;
@ -639,24 +642,24 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
} }
if(fa.size!=3) if(fa.size!=3)
{ // Non triangular face are manageable ONLY if there are no Per Wedge attributes { // Non triangular face are manageable ONLY if there are no Per Wedge attributes
if( ( pi.mask & ply::PLYMask::PM_WEDGCOLOR ) || ( pi.mask & ply::PLYMask::PM_WEDGTEXCOORD ) ) if( ( pi.mask & Mask::IOM_WEDGCOLOR ) || ( pi.mask & Mask::IOM_WEDGTEXCOORD ) )
{ {
pi.status = PlyInfo::E_NO_3VERTINFACE; pi.status = PlyInfo::E_NO_3VERTINFACE;
return pi.status; return pi.status;
} }
} }
if( pi.mask & ply::PLYMask::PM_FACEFLAGS ) if( pi.mask & Mask::IOM_FACEFLAGS )
{ {
(*fi).UberFlags() = fa.flags; (*fi).UberFlags() = fa.flags;
} }
if( pi.mask & ply::PLYMask::PM_FACEQUALITY ) if( pi.mask & Mask::IOM_FACEQUALITY )
{ {
(*fi).Q() = fa.q; (*fi).Q() = fa.q;
} }
if( pi.mask & ply::PLYMask::PM_FACECOLOR ) if( pi.mask & Mask::IOM_FACECOLOR )
{ {
(*fi).C()[0] = fa.r; (*fi).C()[0] = fa.r;
(*fi).C()[1] = fa.g; (*fi).C()[1] = fa.g;
@ -664,7 +667,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
(*fi).C()[3] = 255; (*fi).C()[3] = 255;
} }
if( pi.mask & ply::PLYMask::PM_WEDGTEXCOORD ) if( pi.mask & Mask::IOM_WEDGTEXCOORD )
{ {
for(int k=0;k<3;++k) for(int k=0;k<3;++k)
{ {
@ -675,7 +678,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi )
} }
} }
if( pi.mask & ply::PLYMask::PM_WEDGCOLOR ) if( pi.mask & Mask::IOM_WEDGCOLOR )
{ {
if(FaceType::HasWedgeColor()){ if(FaceType::HasWedgeColor()){
for(int k=0;k<3;++k) for(int k=0;k<3;++k)
@ -941,25 +944,25 @@ static bool LoadMask(const char * filename, int &mask, PlyInfo &pi)
if( pf.AddToRead(VertDesc(0))!=-1 && if( pf.AddToRead(VertDesc(0))!=-1 &&
pf.AddToRead(VertDesc(1))!=-1 && pf.AddToRead(VertDesc(1))!=-1 &&
pf.AddToRead(VertDesc(2))!=-1 ) mask |= ply::PLYMask::PM_VERTCOORD; pf.AddToRead(VertDesc(2))!=-1 ) mask |= Mask::IOM_VERTCOORD;
if( pf.AddToRead(VertDesc(3))!=-1 ) mask |= ply::PLYMask::PM_VERTFLAGS; if( pf.AddToRead(VertDesc(3))!=-1 ) mask |= Mask::IOM_VERTFLAGS;
if( pf.AddToRead(VertDesc(4))!=-1 ) mask |= ply::PLYMask::PM_VERTQUALITY; if( pf.AddToRead(VertDesc(4))!=-1 ) mask |= Mask::IOM_VERTQUALITY;
if( pf.AddToRead(VertDesc(8))!=-1 ) mask |= ply::PLYMask::PM_VERTQUALITY; if( pf.AddToRead(VertDesc(8))!=-1 ) mask |= Mask::IOM_VERTQUALITY;
if( ( pf.AddToRead(VertDesc(5))!=-1 ) && if( ( pf.AddToRead(VertDesc(5))!=-1 ) &&
( pf.AddToRead(VertDesc(6))!=-1 ) && ( pf.AddToRead(VertDesc(6))!=-1 ) &&
( pf.AddToRead(VertDesc(7))!=-1 ) ) mask |= ply::PLYMask::PM_VERTCOLOR; ( pf.AddToRead(VertDesc(7))!=-1 ) ) mask |= Mask::IOM_VERTCOLOR;
if( pf.AddToRead(FaceDesc(0))!=-1 ) mask |= ply::PLYMask::PM_FACEINDEX; if( pf.AddToRead(FaceDesc(0))!=-1 ) mask |= Mask::IOM_FACEINDEX;
if( pf.AddToRead(FaceDesc(1))!=-1 ) mask |= ply::PLYMask::PM_FACEFLAGS; if( pf.AddToRead(FaceDesc(1))!=-1 ) mask |= Mask::IOM_FACEFLAGS;
if( pf.AddToRead(FaceDesc(2))!=-1 ) mask |= ply::PLYMask::PM_FACEQUALITY; if( pf.AddToRead(FaceDesc(2))!=-1 ) mask |= Mask::IOM_FACEQUALITY;
if( pf.AddToRead(FaceDesc(3))!=-1 ) mask |= ply::PLYMask::PM_WEDGTEXCOORD; if( pf.AddToRead(FaceDesc(3))!=-1 ) mask |= Mask::IOM_WEDGTEXCOORD;
if( pf.AddToRead(FaceDesc(5))!=-1 ) mask |= ply::PLYMask::PM_WEDGTEXMULTI; if( pf.AddToRead(FaceDesc(5))!=-1 ) mask |= Mask::IOM_WEDGTEXMULTI;
if( pf.AddToRead(FaceDesc(4))!=-1 ) mask |= ply::PLYMask::PM_WEDGCOLOR; if( pf.AddToRead(FaceDesc(4))!=-1 ) mask |= Mask::IOM_WEDGCOLOR;
if( ( pf.AddToRead(FaceDesc(6))!=-1 ) && if( ( pf.AddToRead(FaceDesc(6))!=-1 ) &&
( pf.AddToRead(FaceDesc(7))!=-1 ) && ( pf.AddToRead(FaceDesc(7))!=-1 ) &&
( pf.AddToRead(FaceDesc(8))!=-1 ) ) mask |= ply::PLYMask::PM_FACECOLOR; ( pf.AddToRead(FaceDesc(8))!=-1 ) ) mask |= Mask::IOM_FACECOLOR;
return true; return true;

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.4 2004/10/28 00:52:45 cignoni
Better Doxygen documentation
Revision 1.3 2004/05/12 10:19:30 ganovelli Revision 1.3 2004/05/12 10:19:30 ganovelli
new line added at the end of file new line added at the end of file
@ -37,8 +40,7 @@ Initial commit
#ifndef __VCGLIB_IOTRIMESH_IO_MASK #ifndef __VCGLIB_IOTRIMESH_IO_MASK
#define __VCGLIB_IOTRIMESH_IO_MASK #define __VCGLIB_IOTRIMESH_IO_MASK
#include<wrap/callback.h> //#include<wrap/callback.h>
#include<wrap/ply/plylib.h>
namespace vcg { namespace vcg {
namespace tri { namespace tri {
@ -49,7 +51,7 @@ namespace io {
*/ */
//@{ //@{
class PLYMask class Mask
{ {
public: public:
@ -58,57 +60,57 @@ public:
*/ */
enum { enum {
PM_NONE = 0x0000, IOM_NONE = 0x0000,
PM_VERTCOORD = 0x0001, IOM_VERTCOORD = 0x0001,
PM_VERTFLAGS = 0x0002, IOM_VERTFLAGS = 0x0002,
PM_VERTCOLOR = 0x0004, IOM_VERTCOLOR = 0x0004,
PM_VERTQUALITY = 0x0008, IOM_VERTQUALITY = 0x0008,
PM_VERTNORMAL = 0x0010, IOM_VERTNORMAL = 0x0010,
PM_VERTTEXCOORD = 0x0020, IOM_VERTTEXCOORD = 0x0020,
PM_FACEINDEX = 0x0040, IOM_FACEINDEX = 0x0040,
PM_FACEFLAGS = 0x0080, IOM_FACEFLAGS = 0x0080,
PM_FACECOLOR = 0x0100, IOM_FACECOLOR = 0x0100,
PM_FACEQUALITY = 0x0200, IOM_FACEQUALITY = 0x0200,
PM_FACENORMAL = 0x0400, IOM_FACENORMAL = 0x0400,
PM_WEDGCOLOR = 0x0800, IOM_WEDGCOLOR = 0x0800,
PM_WEDGTEXCOORD = 0x1000, IOM_WEDGTEXCOORD = 0x1000,
PM_WEDGTEXMULTI = 0x2000, // Se ha anche l'indice di texture esplicito IOM_WEDGTEXMULTI = 0x2000, // Se ha anche l'indice di texture esplicito
PM_WEDGNORMAL = 0x4000, IOM_WEDGNORMAL = 0x4000,
PM_CAMERA = 0x8000, IOM_CAMERA = 0x8000,
PM_FLAGS = PM_VERTFLAGS + PM_FACEFLAGS, IOM_FLAGS = IOM_VERTFLAGS + IOM_FACEFLAGS,
PM_ALL = 0xFFFF IOM_ALL = 0xFFFF
}; };
//
//
static void SMFlags2String( int mask, char str[] ) //static void IOMask2String( int mask, char str[] )
{ //{
str[0] = 0; // str[0] = 0;
//
strcat(str,"V:"); // strcat(str,"V:");
if( mask & PM_VERTFLAGS ) strcat(str,"flag,"); // if( mask & IOM_VERTFLAGS ) strcat(str,"flag,");
if( mask & PM_VERTCOLOR ) strcat(str,"color,"); // if( mask & IOM_VERTCOLOR ) strcat(str,"color,");
if( mask & PM_VERTQUALITY ) strcat(str,"quality,"); // if( mask & IOM_VERTQUALITY ) strcat(str,"quality,");
if( mask & PM_VERTTEXCOORD ) strcat(str,"tcoord,"); // if( mask & IOM_VERTTEXCOORD ) strcat(str,"tcoord,");
if( mask & PM_VERTNORMAL ) strcat(str,"normal,"); // if( mask & IOM_VERTNORMAL ) strcat(str,"normal,");
//
strcat(str," F:"); // strcat(str," F:");
if( mask & PM_FACEFLAGS ) strcat(str,"mask,"); // if( mask & IOM_FACEFLAGS ) strcat(str,"mask,");
if( mask & PM_FACECOLOR ) strcat(str,"color,"); // if( mask & IOM_FACECOLOR ) strcat(str,"color,");
if( mask & PM_FACEQUALITY ) strcat(str,"quality,"); // if( mask & IOM_FACEQUALITY ) strcat(str,"quality,");
if( mask & PM_FACENORMAL ) strcat(str,"normal,"); // if( mask & IOM_FACENORMAL ) strcat(str,"normal,");
//
strcat(str," W:"); // strcat(str," W:");
if( mask & PM_WEDGCOLOR ) strcat(str,"color,"); // if( mask & IOM_WEDGCOLOR ) strcat(str,"color,");
if( mask & PM_WEDGTEXCOORD ) strcat(str,"tcoord,"); // if( mask & IOM_WEDGTEXCOORD ) strcat(str,"tcoord,");
if( mask & PM_WEDGNORMAL ) strcat(str,"normal,"); // if( mask & IOM_WEDGNORMAL ) strcat(str,"normal,");
//
if( mask & PM_CAMERA ) strcat(str," camera"); // if( mask & IOM_CAMERA ) strcat(str," camera");
} //}
}; // end class }; // end class
//@} //@}