From b32218acdc1423bc9860ee1751a6bc7e0b35ce0e Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 30 Jan 2006 13:43:59 +0000 Subject: [PATCH] Added GetExportMaskCapability --- wrap/io_trimesh/export_off.h | 22 +++++++++++++++------- wrap/io_trimesh/export_ply.h | 23 +++++++++++++++++++++++ wrap/io_trimesh/export_stl.h | 15 +++++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/wrap/io_trimesh/export_off.h b/wrap/io_trimesh/export_off.h index 2607d242..9403535c 100644 --- a/wrap/io_trimesh/export_off.h +++ b/wrap/io_trimesh/export_off.h @@ -49,7 +49,7 @@ namespace vcg { typedef typename SaveMeshType::VertexIterator VertexIterator; typedef typename SaveMeshType::FaceIterator FaceIterator; - static int Save(SaveMeshType &m, const char * filename ) + static int Save(SaveMeshType &m, const char * filename, int mask=0 ) { vcg::face::Pos he; vcg::face::Pos hei; @@ -58,12 +58,9 @@ namespace vcg { - if( m.HasPerVertexNormal()) - fprintf(fpout,"N"); - if( m.HasPerVertexColor()) - fprintf(fpout,"C"); - if( m.HasPerVertexTexture()) - fprintf(fpout,"ST"); + if( m.HasPerVertexNormal() && (mask & io::Mask::IOM_VERTNORMAL)) fprintf(fpout,"N"); + if( m.HasPerVertexColor() && (mask & io::Mask::IOM_VERTCOLOR)) fprintf(fpout,"C"); + if( m.HasPerVertexTexture() && (mask & io::Mask::IOM_VERTTEXCOORD)) fprintf(fpout,"ST"); fprintf(fpout,"OFF\n"); fprintf(fpout,"%d %d ", m.vn, m.fn); @@ -181,6 +178,17 @@ namespace vcg { if(error>1 || error<0) return "Unknown error"; else return off_error_msg[error].c_str(); } + /* + returns mask of capability one define with what are the saveable information of the format. + */ + static int GetExportMaskCapability() + { + int capability = 0; + capability |= vcg::tri::io::Mask::IOM_VERTCOORD; + capability |= vcg::tri::io::Mask::IOM_VERTCOLOR; + capability |= vcg::tri::io::Mask::IOM_FACEINDEX; + return capability; + } }; // end class } // end namespace tri diff --git a/wrap/io_trimesh/export_ply.h b/wrap/io_trimesh/export_ply.h index d3c87dbb..904a474b 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.14 2006/01/27 09:11:48 corsini +fix signed/unsigned mismatch + Revision 1.13 2006/01/13 15:47:43 cignoni Uniformed return type to the style of Open. Now every export function returns 0 in case of success. @@ -643,6 +646,26 @@ static const char *ErrorMsg(int error) else return ply_error_msg[error].c_str(); }; + static int GetExportMaskCapability() + { + int capability = 0; + capability |= vcg::tri::io::Mask::IOM_VERTCOORD ; + capability |= vcg::tri::io::Mask::IOM_VERTFLAGS ; + capability |= vcg::tri::io::Mask::IOM_VERTCOLOR ; + capability |= vcg::tri::io::Mask::IOM_VERTQUALITY ; + capability |= vcg::tri::io::Mask::IOM_VERTNORMAL ; + capability |= vcg::tri::io::Mask::IOM_VERTTEXCOORD ; + capability |= vcg::tri::io::Mask::IOM_FACEINDEX ; + capability |= vcg::tri::io::Mask::IOM_FACEFLAGS ; + capability |= vcg::tri::io::Mask::IOM_FACECOLOR ; + capability |= vcg::tri::io::Mask::IOM_FACEQUALITY ; + capability |= vcg::tri::io::Mask::IOM_FACENORMAL ; + capability |= vcg::tri::io::Mask::IOM_WEDGCOLOR ; + capability |= vcg::tri::io::Mask::IOM_WEDGTEXCOORD ; + capability |= vcg::tri::io::Mask::IOM_WEDGTEXMULTI ; + capability |= vcg::tri::io::Mask::IOM_WEDGNORMAL ; + return capability; + } }; // end class diff --git a/wrap/io_trimesh/export_stl.h b/wrap/io_trimesh/export_stl.h index acb92ecc..0e489812 100644 --- a/wrap/io_trimesh/export_stl.h +++ b/wrap/io_trimesh/export_stl.h @@ -25,6 +25,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.6 2006/01/13 15:47:43 cignoni +Uniformed return type to the style of Open. Now every export function returns 0 in case of success. + Revision 1.5 2005/12/01 00:58:56 cignoni Added and removed typenames for gcc compiling... @@ -136,6 +139,18 @@ static const char *ErrorMsg(int error) else return stl_error_msg[error].c_str(); }; +/* + returns mask of capability one define with what are the saveable information of the format. +*/ +static int GetExportMaskCapability() +{ + int capability = 0; + capability |= vcg::tri::io::Mask::IOM_VERTCOORD; + capability |= vcg::tri::io::Mask::IOM_FACEINDEX; + return capability; +} + + }; // end class } // end Namespace tri