From 38ab4c4643bae325a86ba90a8e4454c42d370af7 Mon Sep 17 00:00:00 2001 From: granzuglia Date: Fri, 19 Oct 2007 10:49:20 +0000 Subject: [PATCH] minor changes --- wrap/io_trimesh/export_idtf.h | 14 +++++----- wrap/io_trimesh/export_u3d.h | 51 ++++++++++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/wrap/io_trimesh/export_idtf.h b/wrap/io_trimesh/export_idtf.h index b93316a5..22da3255 100644 --- a/wrap/io_trimesh/export_idtf.h +++ b/wrap/io_trimesh/export_idtf.h @@ -121,7 +121,7 @@ public: idtf.write(4,"}"); idtf.write(3,"}"); idtf.write(3,"MESH_FACE_POSITION_LIST {"); - for(MyVCGMesh::ConstFaceIterator fit = m.face.begin();fit != m.face.end();++fit) + for(SaveMeshType::ConstFaceIterator fit = m.face.begin();fit != m.face.end();++fit) { idtf.write(4,TextUtility::nmbToStr(fit->V(0) - &(*m.vert.begin())) + " " + TextUtility::nmbToStr(fit->V(1) - &(*m.vert.begin())) + " " + @@ -131,7 +131,7 @@ public: idtf.write(3,"MESH_FACE_NORMAL_LIST {"); unsigned int nn = 0; - for(MyVCGMesh::ConstFaceIterator fit = m.face.begin();fit != m.face.end();++fit) + for(SaveMeshType::ConstFaceIterator fit = m.face.begin();fit != m.face.end();++fit) { idtf.write(4,TextUtility::nmbToStr(nn) + " " + TextUtility::nmbToStr(nn + 1) + " " + @@ -144,7 +144,7 @@ public: { idtf.write(3,"MESH_FACE_TEXTURE_COORD_LIST {"); unsigned int nn = 0; - for(MyVCGMesh::ConstFaceIterator fit = m.face.begin();fit != m.face.end();++fit) + for(SaveMeshType::ConstFaceIterator fit = m.face.begin();fit != m.face.end();++fit) { idtf.write(4,"FACE " + TextUtility::nmbToStr(nn) + "{"); idtf.write(5,"TEXTURE_LAYER 0 TEX_COORD: " + TextUtility::nmbToStr(nn) + " " + @@ -156,14 +156,14 @@ public: } idtf.write(3,"MESH_FACE_SHADING_LIST {"); - for(MyVCGMesh::ConstFaceIterator fit = m.face.begin();fit != m.face.end();++fit) + for(SaveMeshType::ConstFaceIterator fit = m.face.begin();fit != m.face.end();++fit) { idtf.write(4,TextUtility::nmbToStr(0)); } idtf.write(3,"}"); idtf.write(3,"MODEL_POSITION_LIST {"); - for(MyVCGMesh::ConstVertexIterator vit = m.vert.begin();vit != m.vert.end();++vit) + for(SaveMeshType::ConstVertexIterator vit = m.vert.begin();vit != m.vert.end();++vit) { idtf.write(4,TextUtility::nmbToStr(vit->P().X()) + " " + TextUtility::nmbToStr(vit->P().Y()) + " " + @@ -172,7 +172,7 @@ public: idtf.write(3,"}"); idtf.write(3,"MODEL_NORMAL_LIST {"); - for(MyVCGMesh::FaceIterator fitn = m.face.begin();fitn != m.face.end();++fitn) + for(SaveMeshType::FaceIterator fitn = m.face.begin();fitn != m.face.end();++fitn) { for(unsigned int ii = 0;ii < 3;++ii) { @@ -186,7 +186,7 @@ public: if (mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD) { idtf.write(3,"MODEL_TEXTURE_COORD_LIST {"); - for(MyVCGMesh::FaceIterator fitn = m.face.begin();fitn != m.face.end();++fitn) + for(SaveMeshType::FaceIterator fitn = m.face.begin();fitn != m.face.end();++fitn) { for(unsigned int ii = 0;ii < 3;++ii) { diff --git a/wrap/io_trimesh/export_u3d.h b/wrap/io_trimesh/export_u3d.h index df04f493..0911448c 100644 --- a/wrap/io_trimesh/export_u3d.h +++ b/wrap/io_trimesh/export_u3d.h @@ -35,8 +35,8 @@ private: static void InvokeConverter(const char* converter_path,const QString& input_idtf,const QString& output_u3d) { p.start(converter_path + "IDTFConverter.exe -input " + input_idtf + " -output " + output_u3d); - //wait for two minutes - bool t = p.waitForFinished(120000); + //wait for four minutes + bool t = p.waitForFinished(240000); p.close(); } @@ -47,7 +47,7 @@ private: { Output_File latex(file.toStdString() + ".tex"); QString u3df = file + ".u3d"; - latex.write(0,"\\\begin{document}"); + latex.write(0,"\\begin{document}"); latex.write(0,"\\includemovie["); latex.write(1,"poster,"); latex.write(1,"toolbar, %same as `controls\'"); @@ -61,19 +61,58 @@ private: public: - static void Save(SaveMeshType& m,const char* outputfile,const int mask,const char* converter_path) + static int Save(SaveMeshType& m,const char* outputfile,const int mask,const char* converter_path) { QString curr = QDir::currentPath(); QString tmp(QDir::tempPath()); - tmp = tmp + "/" + outputfile + ".idtf"; + QString pathout(outputfile); + QStringList pathlist = pathout.split('/'); + QString filename; + QString outputcom; + if (pathlist.size() != 0) + { + filename = pathlist.at(pathlist.size() - 1); + if (pathlist.size() > 1) + outputcom = pathout; + else + outputcom = curr + "/" + filename; + } + else return 1; + + tmp = tmp + "/" + filename + ".idtf"; + vcg::tri::io::ExporterIDTF::Save(m,qPrintable(tmp),mask); - InvokeConverter(converter_path,qPrintable(tmp),qPrintable(curr + "/" + outputfile)); + InvokeConverter(converter_path,qPrintable(tmp),qPrintable(outputcom)); QDir::setCurrent(curr); QString lat (outputfile); QStringList l = lat.split("."); SaveLatex(m,l[0]); QDir dir(QDir::tempPath()); dir.remove(tmp); + return 0; + } + + static int GetExportMaskCapability() + { + int capability = 0; + + //camera + //capability |= MeshModel::IOM_CAMERA; + + //vert + capability |= MeshModel::IOM_VERTNORMAL; + capability |= MeshModel::IOM_VERTTEXCOORD; + //capability |= MeshModel:: + ////face + ////capability |= MeshModel::IOM_FACEFLAGS; + ////capability |= MeshModel::IOM_FACECOLOR; + //capability |= MeshModel::IOM_FACENORMAL; + + ////wedg + capability |= MeshModel::IOM_WEDGTEXCOORD; + capability |= MeshModel::IOM_WEDGNORMAL; + + return capability; } };