vcglib/apps/tetraviewer/main.cpp

65 lines
1.3 KiB
C++
Raw Normal View History

2004-10-04 20:01:36 +02:00
#include <qapplication.h>
#include "mainframe.h"
#include <wrap\io_tetramesh\import_ts.h>
#include <wrap\io_tetramesh\import_ply.h>
#include <vcg\complex\tetramesh\update\topology.h>
#include <vcg\complex\tetramesh\update\bounding.h>
#include <vcg\complex\tetramesh\update\normal.h>
//#include <tetrastats.h>
2004-10-04 20:45:48 +02:00
#include "myglwidget.h"
2004-10-04 20:01:36 +02:00
MyTetraMesh TM;
MyTetraMesh *tm;
TetraStats<MyTetraMesh> Stats;
2004-10-04 20:45:48 +02:00
typedef vcg::tetra::io::ImporterTS<MyTetraMesh> ImpTS;
typedef vcg::tetra::UpdateTetraTopology<MyTetraMesh::VertexContainer ,MyTetraMesh::TetraContainer > UT;
typedef vcg::tetra::UpdateNormals<MyTetraMesh> UN;
typedef vcg::tetra::UpdateBounding<MyTetraMesh> UB;
2004-10-04 20:01:36 +02:00
2004-10-06 18:23:14 +02:00
//MainFrame *wp;
2004-10-04 20:01:36 +02:00
void openTetraMesh(const char* filename)
{
//opening the tetrahedral mesh
QString path=QString(filename);
QString ext =path.right(3);
TM=MyTetraMesh();
if (ext==".ts")
2004-10-04 20:45:48 +02:00
ImpTS::Open(TM,filename);
2004-10-04 20:01:36 +02:00
else
vcg::tetra::io::ImporterPLY<MyTetraMesh> ::Open(TM,filename);
2004-10-04 20:45:48 +02:00
UT::TTTopology(TM.vert,TM.tetra);
UT::ClearVTTopology(TM.vert,TM.tetra);
UT::VTTopology(TM.vert,TM.tetra);
UN::PerVertex(TM);
UB::Box(TM);
2004-10-04 20:01:36 +02:00
tm=&TM;
Stats.SetTetraMesh(tm);
Stats.Update();
}
int main( int argc, char ** argv )
{
tm=0;
QApplication a( argc, argv );
MainFrame w;
2004-10-06 18:23:14 +02:00
// wp=&w;
w.show();
2004-10-04 20:01:36 +02:00
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
2004-10-06 18:23:14 +02:00
2004-10-04 20:01:36 +02:00
return a.exec();
}