From 6ba9867dca5638d3405af6eb987f324c93b8cf25 Mon Sep 17 00:00:00 2001 From: granzuglia Date: Wed, 17 Oct 2007 07:57:04 +0000 Subject: [PATCH] u3d exporter first version --- wrap/io_trimesh/export_u3d.h | 70 ++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 wrap/io_trimesh/export_u3d.h diff --git a/wrap/io_trimesh/export_u3d.h b/wrap/io_trimesh/export_u3d.h new file mode 100644 index 00000000..108a33cb --- /dev/null +++ b/wrap/io_trimesh/export_u3d.h @@ -0,0 +1,70 @@ +#ifndef __VCGLIB_EXPORTERU3D +#define __VCGLIB_EXPORTERU3D + +#include + +namespace vcg { +namespace tri { +namespace io { + +template +class ExporterU3D +{ +private: + +#ifdef WIN32 + static void CreateDir() + { + system("mkdir __tmp_dir"); + } + + static void RemoveDir() + { + system("rmdir /S /Q __tmp_dir"); + } + + static void InvokeConverter(const char* converter_path,const char* idtf_file,const char* u3d_file) + { + std::string com(converter_path); + system(("cd " + com).c_str()); + com = std::string("IDTFConverter.exe -input ") + idtf_file + " -output " + u3d_file; + system(com.c_str()); + } + +#else + #ifdef LINUX + static void CreateDir() + { + system("echo off mkdir __tmp_dir"); + } + + static void RemoveDir() + { + system("echo off rmdir -ignore-fail-on-non-empty __tmp_dir"); + } + + static void InvokeConverter(const char* converter_path,const char* idtf_file,const char* u3d_file) + { + + } + #endif +#endif + +public: + + static void Save(SaveMeshType& m,const char* outputfile,const int mask) + { + CreateDir(); + std::string tmp(outputfile); + tmp = "tmp_dir/" + tmp + ".idtf"; + vcg::tri::io::ExporterIDTF::Save(m,tmp.c_str(),mask); + InvokeConverter("../../code/lib/U3D/Bin/Win32/Release",tmp.c_str() ,outputfile); + RemoveDir(); + } +}; + +} +} +} + +#endif \ No newline at end of file