diff --git a/src/test/io/import_3ds.h b/src/meshlabplugins/meshio/import_3ds.h similarity index 88% rename from src/test/io/import_3ds.h rename to src/meshlabplugins/meshio/import_3ds.h index cabbb9e9e..5e6967dde 100644 --- a/src/test/io/import_3ds.h +++ b/src/meshlabplugins/meshio/import_3ds.h @@ -259,14 +259,17 @@ static int Open( OpenMeshType &m, const char * filename, Lib3dsFile *file, _3dsI textureIdx = (int)size; } - // TODO: questo nel caso di wedge texture coords, tuttavia le ccordinate - // di texture sembrano essere per vertice e non per wedge nei 3ds, sistemare - for (int i=0; i<3; ++i) + if ( info.mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD ) { - (*fi).WT(i).u() = mesh->texelL[f->points[i]][0]; - (*fi).WT(i).v() = mesh->texelL[f->points[i]][1]; + // TODO: questo nel caso di wedge texture coords, tuttavia le coordinate + // di texture sembrano essere per vertice e non per wedge nei 3ds, sistemare + for (int i=0; i<3; ++i) + { + (*fi).WT(i).u() = mesh->texelL[f->points[i]][0]; + (*fi).WT(i).v() = mesh->texelL[f->points[i]][1]; - (*fi).WT(i).n() = textureIdx; + (*fi).WT(i).n() = textureIdx; + } } } } @@ -275,26 +278,34 @@ static int Open( OpenMeshType &m, const char * filename, Lib3dsFile *file, _3dsI faceColor = Point4f(0.8, 0.8, 0.8, 1.0); } + if( info.mask & vcg::tri::io::Mask::IOM_FACECOLOR) + { + // assigning face color + // -------------------- + (*fi).C()[0] = faceColor[0]; + (*fi).C()[1] = faceColor[1]; + (*fi).C()[2] = faceColor[2]; + (*fi).C()[3] = faceColor[3]; + } - // assigning face color - // -------------------- - (*fi).C()[0] = faceColor[0]; - (*fi).C()[1] = faceColor[1]; - (*fi).C()[2] = faceColor[2]; - (*fi).C()[3] = faceColor[3]; - - - // assigning face normal - // --------------------- - // we do not have to multiply normal for current matrix (as we did for vertices) - // since translation operations do not affect normals - (*fi).N() = f->normal; + if ( info.mask & vcg::tri::io::Mask::IOM_FACENORMAL ) + { + // assigning face normal + // --------------------- + // we do not have to multiply normal for current matrix (as we did for vertices) + // since translation operations do not affect normals + (*fi).N() = f->normal; + } for (int i=0; i<3; ++i) { - // per wedge normal - (*fi).WN(i) = normalL[3*p+i]; - + if ( info.mask & vcg::tri::io::Mask::IOM_WEDGNORMAL ) + { + // assigning per wedge normal + // -------------------------- + (*fi).WN(i) = normalL[3*p+i]; + } + // assigning face vertices // ----------------------- (*fi).V(i) = &(m.vert[ (numVertices + f->points[i]) ]); @@ -335,11 +346,11 @@ static int Open( OpenMeshType &m, const char * filename, Lib3dsFile *file, _3dsI lib3ds_file_eval(file,0); } - bool bHasPerWedgeTexCoord = false; - bool bHasPerWedgeNormal = false; - bool bUsingMaterial = false; + bool bHasPerWedgeTexCoord = true; + bool bHasPerFacenormal = true; + bool bHasPerWedgeNormal = true; bool bHasPerVertexColor = false; - bool bHasPerFaceColor = false; + bool bHasPerFaceColor = true; int numVertices, numTriangles; @@ -354,6 +365,8 @@ static int Open( OpenMeshType &m, const char * filename, Lib3dsFile *file, _3dsI if (bHasPerWedgeTexCoord) info.mask |= vcg::tri::io::Mask::IOM_WEDGTEXCOORD; + if (bHasPerFacenormal) + info.mask |= vcg::tri::io::Mask::IOM_FACENORMAL; if (bHasPerWedgeNormal) info.mask |= vcg::tri::io::Mask::IOM_WEDGNORMAL; if (bHasPerVertexColor) diff --git a/src/test/io/import_obj.h b/src/meshlabplugins/meshio/import_obj.h similarity index 99% rename from src/test/io/import_obj.h rename to src/meshlabplugins/meshio/import_obj.h index 8ebe99643..2bfab34d6 100644 --- a/src/test/io/import_obj.h +++ b/src/meshlabplugins/meshio/import_obj.h @@ -25,6 +25,9 @@ History $Log$ +Revision 1.1 2006/01/29 17:14:20 buzzelli +files import_obj.h, import_3ds.h, io_3ds.h and io_obj.h have been moved from test/io to meshio + Revision 1.24 2006/01/27 01:07:40 buzzelli Added a better distinction beetween critical and non critical error messages diff --git a/src/test/io/io_3ds.h b/src/meshlabplugins/meshio/io_3ds.h similarity index 100% rename from src/test/io/io_3ds.h rename to src/meshlabplugins/meshio/io_3ds.h diff --git a/src/test/io/io_obj.h b/src/meshlabplugins/meshio/io_obj.h similarity index 100% rename from src/test/io/io_obj.h rename to src/meshlabplugins/meshio/io_obj.h diff --git a/src/meshlabplugins/meshio/meshio.cpp b/src/meshlabplugins/meshio/meshio.cpp index 14f1d61b1..e149e8852 100644 --- a/src/meshlabplugins/meshio/meshio.cpp +++ b/src/meshlabplugins/meshio/meshio.cpp @@ -24,6 +24,9 @@ History $Log$ + Revision 1.69 2006/01/29 17:14:20 buzzelli + files import_obj.h, import_3ds.h, io_3ds.h and io_obj.h have been moved from test/io to meshio + Revision 1.68 2006/01/29 17:07:16 buzzelli missing texture files warning has been added @@ -42,15 +45,6 @@ Revision 1.63 2006/01/26 22:51:57 fmazzant removed last links to the Exporter mask - Revision 1.62 2006/01/26 18:39:20 fmazzant - moved mask dialog exporter from mashio to meshlab - - Revision 1.61 2006/01/23 15:54:04 fmazzant - added m.mask = mask to show Mesh information - - Revision 1.60 2006/01/23 01:26:30 buzzelli - added handling of non critical errors which may occurr during obj file importing - *****************************************************************************/ #include #include @@ -58,11 +52,11 @@ #include "meshio.h" // temporaneamente prendo la versione corrente dalla cartella test -#include "../../test/io/import_obj.h" +#include "import_obj.h" #include "export_obj.h" #include -#include "../../test/io/import_3ds.h" +#include "import_3ds.h" #include "export_3ds.h" #include