Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00032 #include<vcg/complex/complex.h>
00033 #include<wrap/io_trimesh/import_off.h>
00034 #include<vcg/complex/algorithms/update/topology.h>
00035 #include<vcg/complex/algorithms/update/normal.h>
00036
00037 class MyVertex; class MyEdge; class MyFace;
00038 struct MyUsedTypes : public vcg::UsedTypes<vcg::Use<MyVertex> ::AsVertexType,
00039 vcg::Use<MyEdge> ::AsEdgeType,
00040 vcg::Use<MyFace> ::AsFaceType>{};
00041
00042 class MyVertex : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
00043 class MyFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::VertexRef, vcg::face::BitFlags > {};
00044 class MyEdge : public vcg::Edge< MyUsedTypes> {};
00045
00046 class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
00047
00048 class MyVertex0 : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::BitFlags >{};
00049 class MyVertex1 : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
00050 class MyVertex2 : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Color4b, vcg::vertex::CurvatureDirf,
00051 vcg::vertex::Qualityf, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
00052
00053
00054 int main( int argc, char **argv )
00055 {
00056 if(argc<2)
00057 {
00058 printf("Usage trimesh_base <meshfilename.obj>\n");
00059 return -1;
00060 }
00063 MyMesh m;
00064
00065 if(vcg::tri::io::ImporterOFF<MyMesh>::Open(m,argv[1])!=vcg::tri::io::ImporterOFF<MyMesh>::NoError)
00066 {
00067 printf("Error reading file %s\n",argv[1]);
00068 exit(0);
00069 }
00070
00071 vcg::tri::RequirePerVertexNormal(m);
00072 vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalized(m);
00073 printf("Input mesh vn:%i fn:%i\n",m.VN(),m.FN());
00074 printf( "Mesh has %i vert and %i faces\n", m.VN(), m.FN() );
00075
00076 return 0;
00077 }