From f4f2c70cc98c68a13cc977434a20dc4cc3440d42 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 27 Mar 2006 07:17:49 +0000 Subject: [PATCH] Added generic LoadMask --- wrap/io_trimesh/import.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/wrap/io_trimesh/import.h b/wrap/io_trimesh/import.h index cd1eae11..72318925 100644 --- a/wrap/io_trimesh/import.h +++ b/wrap/io_trimesh/import.h @@ -25,6 +25,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.8 2006/03/07 13:19:29 cignoni +First Release with OBJ import support + Revision 1.7 2006/02/28 14:50:00 corsini Fix comments @@ -140,6 +143,37 @@ static const char *ErrorMsg(int error) return "Unknown type"; } +static bool LoadMask(const char * filename, int &mask) +{ + bool err; + if(FileExtension(filename,"ply")) + { + err = ImporterPLY::LoadMask(filename, mask); + LastType()=KT_PLY; + } + else if(FileExtension(filename,"stl")) + { + mask = Mask::IOM_VERTCOORD | Mask::IOM_FACEINDEX; + LastType()=KT_STL; + } + else if(FileExtension(filename,"off")) + { + mask = Mask::IOM_VERTCOORD | Mask::IOM_FACEINDEX; + //err = ImporterOFF::Open(m, filename, loadmask, cb); + LastType()=KT_OFF; + } + else if(FileExtension(filename,"obj")) + { + err = ImporterOBJ::LoadMask(filename, mask); + LastType()=KT_OBJ; + } + else { + err=false; + LastType()=KT_UNKNOWN; + } + + return err; +} }; // end class } // end Namespace tri } // end Namespace io