diff --git a/wrap/io_trimesh/export_ply.h b/wrap/io_trimesh/export_ply.h index 4e0cbd9a..59988e1b 100644 --- a/wrap/io_trimesh/export_ply.h +++ b/wrap/io_trimesh/export_ply.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2004/05/12 14:43:36 cignoni +removed warning of unused variables + Revision 1.4 2004/05/12 10:19:30 ganovelli new line added at the end of file @@ -49,7 +52,7 @@ Initial commit #ifndef __VCGLIB_EXPORT_PLY #define __VCGLIB_EXPORT_PLY -#include +#include #include #include @@ -131,7 +134,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & ,h ); - if( pi.mask & PLYMask::PM_WEDGTEXCOORD ) + if( pi.mask & ply::PLYMask::PM_WEDGTEXCOORD ) { //const char * TFILE = "TextureFile"; @@ -180,14 +183,14 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & ); - if( pi.mask & PLYMask::PM_VERTFLAGS ) + if( pi.mask & ply::PLYMask::PM_VERTFLAGS ) { fprintf(fpout, "property int flags\n" ); } - if( m.HasPerVertexColor() && (pi.mask & PLYMask::PM_VERTCOLOR) ) + if( m.HasPerVertexColor() && (pi.mask & ply::PLYMask::PM_VERTCOLOR) ) { fprintf(fpout, "property uchar red\n" @@ -197,7 +200,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & ); } - if( m.HasPerVertexQuality() && (pi.mask & PLYMask::PM_VERTQUALITY) ) + if( m.HasPerVertexQuality() && (pi.mask & ply::PLYMask::PM_VERTQUALITY) ) { fprintf(fpout, "property float quality\n" @@ -213,7 +216,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & ,m.fn ); - if( pi.mask & PLYMask::PM_FACEFLAGS ) + if( pi.mask & ply::PLYMask::PM_FACEFLAGS ) { fprintf(fpout, "property int flags\n" @@ -232,7 +235,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & ); } - if( m.HasPerFaceColor() && (pi.mask & PLYMask::PM_FACECOLOR) ) + if( m.HasPerFaceColor() && (pi.mask & ply::PLYMask::PM_FACECOLOR) ) { fprintf(fpout, "property uchar red\n" @@ -242,14 +245,14 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & ); } - if ( m.HasPerWedgeColor() && (pi.mask & PLYMask::PM_WEDGCOLOR) ) + if ( m.HasPerWedgeColor() && (pi.mask & ply::PLYMask::PM_WEDGCOLOR) ) { fprintf(fpout, "property list uchar float color\n" ); } - if( m.HasPerFaceQuality() && (pi.mask & PLYMask::PM_FACEQUALITY) ) + if( m.HasPerFaceQuality() && (pi.mask & ply::PLYMask::PM_FACEQUALITY) ) { fprintf(fpout, "property float quality\n" @@ -262,7 +265,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & fprintf(fpout, "end_header\n" ); // Salvataggio camera - //if( (pi.mask & PLYMask::PM_CAMERA) && camera.IsValid() ) + //if( (pi.mask & ply::PLYMask::PM_CAMERA) && camera.IsValid() ) //{ //if(binary) //{ @@ -344,13 +347,13 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & t = float(vp->UberP()[1]); fwrite(&t,sizeof(float),1,fpout); t = float(vp->UberP()[2]); fwrite(&t,sizeof(float),1,fpout); - if( pi.mask & PLYMask::PM_VERTFLAGS ) + if( pi.mask & ply::PLYMask::PM_VERTFLAGS ) fwrite(&(vp->UberFlags()),sizeof(int),1,fpout); - if( m.HasPerVertexColor() && (pi.mask & PLYMask::PM_VERTCOLOR) ) + if( m.HasPerVertexColor() && (pi.mask & ply::PLYMask::PM_VERTCOLOR) ) fwrite(&( vp->C() ),sizeof(char),4,fpout); - if( m.HasPerVertexQuality() && (pi.mask & PLYMask::PM_VERTQUALITY) ) + if( m.HasPerVertexQuality() && (pi.mask & ply::PLYMask::PM_VERTQUALITY) ) fwrite(&( vp->Q() ),sizeof(float),1,fpout); @@ -373,13 +376,13 @@ 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]); - if( pi.mask & PLYMask::PM_VERTFLAGS ) + if( pi.mask & ply::PLYMask::PM_VERTFLAGS ) fprintf(fpout,"%d ",vp->UberFlags()); - if( m.HasPerVertexColor() && (pi.mask & PLYMask::PM_VERTCOLOR) ) + if( m.HasPerVertexColor() && (pi.mask & ply::PLYMask::PM_VERTCOLOR) ) fprintf(fpout,"%d %d %d %d ",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] ); - if( m.HasPerVertexQuality() && (pi.mask & PLYMask::PM_VERTQUALITY) ) + if( m.HasPerVertexQuality() && (pi.mask & ply::PLYMask::PM_VERTQUALITY) ) fprintf(fpout,"%g ",vp->Q()); for(i=0;iFlags()),sizeof(int),1,fpout); - if( m.HasPerVertexTexture() && (pi.mask & PLYMask::PM_VERTTEXCOORD) ) + if( m.HasPerVertexTexture() && (pi.mask & ply::PLYMask::PM_VERTTEXCOORD) ) { fwrite(&b6,sizeof(char),1,fpout); float t[6]; @@ -441,7 +444,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & } fwrite(t,sizeof(float),6,fpout); } - else if( m.HasPerWedgeTexture() && (pi.mask & PLYMask::PM_WEDGTEXCOORD) ) + else if( m.HasPerWedgeTexture() && (pi.mask & ply::PLYMask::PM_WEDGTEXCOORD) ) { fwrite(&b6,sizeof(char),1,fpout); float t[6]; @@ -459,11 +462,11 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & fwrite(&t,sizeof(int),1,fpout); } - if( m.HasPerFaceColor() && (pi.mask & PLYMask::PM_FACECOLOR) ) + if( m.HasPerFaceColor() && (pi.mask & ply::PLYMask::PM_FACECOLOR) ) fwrite(&( fp->C() ),sizeof(char),4,fpout); - if( m.HasPerWedgeColor() && (pi.mask & PLYMask::PM_WEDGCOLOR) ) + if( m.HasPerWedgeColor() && (pi.mask & ply::PLYMask::PM_WEDGCOLOR) ) { fwrite(&b9,sizeof(char),1,fpout); float t[3]; @@ -476,7 +479,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & } } - if( m.HasPerFaceQuality() && (pi.mask & PLYMask::PM_FACEQUALITY) ) + if( m.HasPerFaceQuality() && (pi.mask & ply::PLYMask::PM_FACEQUALITY) ) fwrite( &(fp->Q()),sizeof(float),1,fpout); @@ -499,10 +502,10 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & fprintf(fpout,"3 %d %d %d ", fp->cV(0)->UberFlags(), fp->cV(1)->UberFlags(), fp->cV(2)->UberFlags() ); - if( pi.mask & PLYMask::PM_FACEFLAGS ) + if( pi.mask & ply::PLYMask::PM_FACEFLAGS ) fprintf(fpout,"%d ",fp->Flags()); - if( m.HasPerVertexTexture() && (pi.mask & PLYMask::PM_VERTTEXCOORD) ) + if( m.HasPerVertexTexture() && (pi.mask & ply::PLYMask::PM_VERTTEXCOORD) ) { fprintf(fpout,"6 "); for(int k=0;k<3;++k) @@ -511,7 +514,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & ,fp->V(k)->T().v() ); } - else if( m.HasPerWedgeTexture() && (pi.mask & PLYMask::PM_WEDGTEXCOORD) ) + else if( m.HasPerWedgeTexture() && (pi.mask & ply::PLYMask::PM_WEDGTEXCOORD) ) { fprintf(fpout,"6 "); for(int k=0;k<3;++k) @@ -526,7 +529,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & fprintf(fpout,"%d ",fp->WT(0).n()); } - if( m.HasPerFaceColor() && (pi.mask & PLYMask::PM_FACECOLOR) ) + if( m.HasPerFaceColor() && (pi.mask & ply::PLYMask::PM_FACECOLOR) ) { float t[3]; t[0] = float(fp->C()[0])/255; @@ -537,7 +540,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & 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 & PLYMask::PM_WEDGCOLOR) ) + else if( m.HasPerWedgeColor() && (pi.mask & ply::PLYMask::PM_WEDGCOLOR) ) { fprintf(fpout,"9 "); for(int z=0;z<3;++z) @@ -548,7 +551,7 @@ static bool Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo & ); } - if( m.HasPerFaceQuality() && (pi.mask & PLYMask::PM_FACEQUALITY) ) + if( m.HasPerFaceQuality() && (pi.mask & ply::PLYMask::PM_FACEQUALITY) ) fprintf(fpout,"%g ",fp->Q()); for(i=0;i #include -#include +#include #include #include @@ -296,7 +299,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) break; } } - if(found) pi.mask |= PLYMask::PM_CAMERA; + if(found) pi.mask |= ply::PLYMask::PM_CAMERA; } // Descrittori dati standard (vertex coord e faces) @@ -310,13 +313,13 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) // Descrittori facoltativi dei flags if( pf.AddToRead(VertDesc(3))!=-1 ) - pi.mask |= PLYMask::PM_VERTFLAGS; + pi.mask |= ply::PLYMask::PM_VERTFLAGS; if( VertexType::HasQuality() ) { if( pf.AddToRead(VertDesc(4))!=-1 || pf.AddToRead(VertDesc(8))!=-1 ) - pi.mask |= PLYMask::PM_VERTQUALITY; + pi.mask |= ply::PLYMask::PM_VERTQUALITY; } if( VertexType::HasColor() ) @@ -325,18 +328,18 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) { pf.AddToRead(VertDesc(6)); pf.AddToRead(VertDesc(7)); - pi.mask |= PLYMask::PM_VERTCOLOR; + pi.mask |= ply::PLYMask::PM_VERTCOLOR; } } // se ci sono i flag per vertice ci devono essere anche i flag per faccia if( pf.AddToRead(FaceDesc(1))!=-1 ) - pi.mask |= PLYMask::PM_FACEFLAGS; + pi.mask |= ply::PLYMask::PM_FACEFLAGS; if( FaceType::HasFaceQuality()) { if( pf.AddToRead(FaceDesc(2))!=-1 ) - pi.mask |= PLYMask::PM_FACEQUALITY; + pi.mask |= ply::PLYMask::PM_FACEQUALITY; } if( FaceType::HasFaceColor() ) @@ -345,7 +348,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) { pf.AddToRead(FaceDesc(7)); pf.AddToRead(FaceDesc(8)); - pi.mask |= PLYMask::PM_FACECOLOR; + pi.mask |= ply::PLYMask::PM_FACECOLOR; } } @@ -356,9 +359,9 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) { if(pf.AddToRead(FaceDesc(5))==0) { multit=true; // try to read also the multi texture indicies - pi.mask |= PLYMask::PM_WEDGTEXMULTI; + pi.mask |= ply::PLYMask::PM_WEDGTEXMULTI; } - pi.mask |= PLYMask::PM_WEDGTEXCOORD; + pi.mask |= ply::PLYMask::PM_WEDGTEXCOORD; } } @@ -366,7 +369,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) { if( pf.AddToRead(FaceDesc(4))!=-1 ) { - pi.mask |= PLYMask::PM_WEDGCOLOR; + pi.mask |= ply::PLYMask::PM_WEDGCOLOR; } } @@ -471,13 +474,13 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) (*vi).P()[1] = va.p[1]; (*vi).P()[2] = va.p[2]; - if( pi.mask & PLYMask::PM_VERTFLAGS ) + if( pi.mask & ply::PLYMask::PM_VERTFLAGS ) (*vi).UberFlags() = va.flags; - if( pi.mask & PLYMask::PM_VERTQUALITY ) + if( pi.mask & ply::PLYMask::PM_VERTQUALITY ) (*vi).Q() = va.q; - if( pi.mask & PLYMask::PM_VERTCOLOR ) + if( pi.mask & ply::PLYMask::PM_VERTCOLOR ) { (*vi).C()[0] = va.r; (*vi).C()[1] = va.g; @@ -530,17 +533,17 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) (*fi).V(k) = index[ fa.v[k] ]; } - if( pi.mask & PLYMask::PM_FACEFLAGS ) + if( pi.mask & ply::PLYMask::PM_FACEFLAGS ) { (*fi).UberFlags() = fa.flags; } - if( pi.mask & PLYMask::PM_FACEQUALITY ) + if( pi.mask & ply::PLYMask::PM_FACEQUALITY ) { (*fi).Q() = fa.q; } - if( pi.mask & PLYMask::PM_FACECOLOR ) + if( pi.mask & ply::PLYMask::PM_FACECOLOR ) { (*fi).C()[0] = fa.r; (*fi).C()[1] = fa.g; @@ -548,7 +551,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) (*fi).C()[3] = 255; } - if( pi.mask & PLYMask::PM_WEDGTEXCOORD ) + if( pi.mask & ply::PLYMask::PM_WEDGTEXCOORD ) { for(int k=0;k<3;++k) { @@ -558,7 +561,7 @@ static int Open( OpenMeshType &m, const char * filename, PlyInfo &pi ) } } - if( pi.mask & PLYMask::PM_WEDGCOLOR ) + if( pi.mask & ply::PLYMask::PM_WEDGCOLOR ) { if(FaceType::HasWedgeColor()){ for(int k=0;k<3;++k) @@ -780,25 +783,25 @@ bool LoadMask(const char * filename, int &mask) if( pf.AddToRead(VertDesc(0))!=-1 && pf.AddToRead(VertDesc(1))!=-1 && - pf.AddToRead(VertDesc(2))!=-1 ) mask |= PLYMask::PM_VERTCOORD; + pf.AddToRead(VertDesc(2))!=-1 ) mask |= ply::PLYMask::PM_VERTCOORD; - if( pf.AddToRead(VertDesc(3))!=-1 ) mask |= PLYMask::PM_VERTFLAGS; - if( pf.AddToRead(VertDesc(4))!=-1 ) mask |= PLYMask::PM_VERTQUALITY; - if( pf.AddToRead(VertDesc(8))!=-1 ) mask |= PLYMask::PM_VERTQUALITY; + if( pf.AddToRead(VertDesc(3))!=-1 ) mask |= ply::PLYMask::PM_VERTFLAGS; + if( pf.AddToRead(VertDesc(4))!=-1 ) mask |= ply::PLYMask::PM_VERTQUALITY; + if( pf.AddToRead(VertDesc(8))!=-1 ) mask |= ply::PLYMask::PM_VERTQUALITY; if( ( pf.AddToRead(VertDesc(5))!=-1 ) && ( pf.AddToRead(VertDesc(6))!=-1 ) && - ( pf.AddToRead(VertDesc(7))!=-1 ) ) mask |= PLYMask::PM_VERTCOLOR; + ( pf.AddToRead(VertDesc(7))!=-1 ) ) mask |= ply::PLYMask::PM_VERTCOLOR; - if( pf.AddToRead(FaceDesc(0))!=-1 ) mask |= PLYMask::PM_FACEINDEX; - if( pf.AddToRead(FaceDesc(1))!=-1 ) mask |= PLYMask::PM_FACEFLAGS; + if( pf.AddToRead(FaceDesc(0))!=-1 ) mask |= ply::PLYMask::PM_FACEINDEX; + if( pf.AddToRead(FaceDesc(1))!=-1 ) mask |= ply::PLYMask::PM_FACEFLAGS; - if( pf.AddToRead(FaceDesc(2))!=-1 ) mask |= PLYMask::PM_FACEQUALITY; - if( pf.AddToRead(FaceDesc(3))!=-1 ) mask |= PLYMask::PM_WEDGTEXCOORD; - if( pf.AddToRead(FaceDesc(5))!=-1 ) mask |= PLYMask::PM_WEDGTEXMULTI; - if( pf.AddToRead(FaceDesc(4))!=-1 ) mask |= PLYMask::PM_WEDGCOLOR; + if( pf.AddToRead(FaceDesc(2))!=-1 ) mask |= ply::PLYMask::PM_FACEQUALITY; + if( pf.AddToRead(FaceDesc(3))!=-1 ) mask |= ply::PLYMask::PM_WEDGTEXCOORD; + if( pf.AddToRead(FaceDesc(5))!=-1 ) mask |= ply::PLYMask::PM_WEDGTEXMULTI; + if( pf.AddToRead(FaceDesc(4))!=-1 ) mask |= ply::PLYMask::PM_WEDGCOLOR; if( ( pf.AddToRead(FaceDesc(6))!=-1 ) && ( pf.AddToRead(FaceDesc(7))!=-1 ) && - ( pf.AddToRead(FaceDesc(8))!=-1 ) ) mask |= PLYMask::PM_FACECOLOR; + ( pf.AddToRead(FaceDesc(8))!=-1 ) ) mask |= ply::PLYMask::PM_FACECOLOR; return true;