diff --git a/apps/sample/aabb_binary_tree/aabb_binary_tree.cpp b/apps/sample/aabb_binary_tree/aabb_binary_tree.cpp index b242f0b6..56d6c1ee 100644 --- a/apps/sample/aabb_binary_tree/aabb_binary_tree.cpp +++ b/apps/sample/aabb_binary_tree/aabb_binary_tree.cpp @@ -5,8 +5,12 @@ #include // vcg headers -#include -#include +//#include +//#include +#include +#include +#include + #include #include #include @@ -19,10 +23,16 @@ typedef float AScalarType; +using namespace vcg; + class AEdge; class AFace; -class AVertex : public vcg::Vertex< AScalarType, AEdge, AFace > { }; -class AFace : public vcg::FaceRTFMFN< AVertex, AEdge, AFace > { }; +class AVertex : public VertexSimp2< AVertex, AEdge, AFace, vert::Normal3f, vert::Coord3f >{}; +class AFace : public FaceSimp2< AVertex, AEdge, AFace, face::VertexRef, face::Normal3f, face::RTInfo, face::BitFlags> {}; + +//class AVertex : public vcg::Vertex< AScalarType, AEdge, AFace > { }; +//class AFace : public vcg::FaceRTFMFN< AVertex, AEdge, AFace > { }; + class AMesh : public vcg::tri::TriMesh< std::vector, std::vector > { }; typedef vcg::AABBBinaryTreeIndex AIndex; diff --git a/apps/sample/trimesh_isosurface/trimesh_isosurface.cpp b/apps/sample/trimesh_isosurface/trimesh_isosurface.cpp index 69076ff3..c89c6b24 100644 --- a/apps/sample/trimesh_isosurface/trimesh_isosurface.cpp +++ b/apps/sample/trimesh_isosurface/trimesh_isosurface.cpp @@ -10,8 +10,8 @@ using namespace std; using namespace vcg; -#include -#include +#include +#include #include #include @@ -19,8 +19,13 @@ typedef float ScalarType; class MyEdge; class MyFace; -class MyVertex : public vcg::Vertex< ScalarType, MyEdge, MyFace > {}; -class MyFace : public vcg::Face< MyVertex, MyEdge, MyFace> {}; + +class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vert::Coord3f>{}; +class MyFace : public FaceSimp2< MyVertex, MyEdge, MyFace, face::VertexRef, face::BitFlags> {}; + +//class MyVertex : public vcg::Vertex< ScalarType, MyEdge, MyFace > {}; +//class MyFace : public vcg::Face< MyVertex, MyEdge, MyFace> {}; + class MyMesh : public vcg::tri::TriMesh< std::vector< MyVertex>, std::vector< MyFace > > {}; template @@ -118,7 +123,7 @@ public: typedef Volume MyVolume; -int main(int argc, char *argv[]) +int main(int /*argc*/ , char /**argv[]*/) { MyVolume volume; @@ -132,7 +137,7 @@ int main(int argc, char *argv[]) for(int i=0;i<64;i++) for(int j=0;j<64;j++) for(int k=0;k<64;k++) - volume.Val(i,j,k)=(j-32)*(j-32)+(k-32)*(k-32) + i*10*math::Perlin::Noise(i*.2,j*.2,k*.2); + volume.Val(i,j,k)=(j-32)*(j-32)+(k-32)*(k-32) + i*10*(float)math::Perlin::Noise(i*.2,j*.2,k*.2); // MARCHING CUBES diff --git a/apps/sample/trimesh_join/trimesh_join.cpp b/apps/sample/trimesh_join/trimesh_join.cpp index 74913bd5..cc1331b5 100644 --- a/apps/sample/trimesh_join/trimesh_join.cpp +++ b/apps/sample/trimesh_join/trimesh_join.cpp @@ -59,8 +59,8 @@ int main(int argc,char **argv ) printf("Error in parsing bbox option"); exit(0); } - ClipBB.min[0]=atof(argv[i+1]); ClipBB.min[1]=atof(argv[i+2]); ClipBB.min[2]=atof(argv[i+3]); - ClipBB.max[0]=atof(argv[i+4]); ClipBB.max[1]=atof(argv[i+5]); ClipBB.max[2]=atof(argv[i+6]); + ClipBB.min=Point3f::Construct(atof(argv[i+1]),atof(argv[i+2]),atof(argv[i+3])); + ClipBB.max=Point3f::Construct(atof(argv[i+4]),atof(argv[i+5]),atof(argv[i+6])); i+=6; printf("Clipping incoming meshes with box:\n (%7.4f %7.4f %7.4f) - (%7.4f %7.4f %7.4f)\n", ClipBB.min[0],ClipBB.min[1],ClipBB.min[2], diff --git a/apps/sample/trimesh_smooth/trimesh_smooth.cpp b/apps/sample/trimesh_smooth/trimesh_smooth.cpp index 9f6f389a..fc5771bd 100644 --- a/apps/sample/trimesh_smooth/trimesh_smooth.cpp +++ b/apps/sample/trimesh_smooth/trimesh_smooth.cpp @@ -29,16 +29,9 @@ class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vert::VFAdj, ver class MyFace : public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VFAdj, face::Normal3f, face::VertexRef, face::BitFlags > {}; class MyMesh : public vcg::tri::TriMesh, vector > {}; -//class MyFace; -//class MyEdge; -//class MyVertex:public Vertex{}; -//class MyFace :public FaceFN{}; -//class MyMesh: public tri::TriMesh< std::vector, std::vector >{}; -// - int main(int argc,char ** argv) { -if(argc<3) +if(argc<4) { printf("Usage: trimesh_smooth \n"); return 0; @@ -48,18 +41,19 @@ if(argc<3) //open a mesh int err = tri::io::Importer::Open(m,argv[1]); - if(err) { - printf("Error in reading %s: '%s'\n",argv[1],tri::io::Importer::ErrorMsg(err)); + if(err) { // all the importers return 0 in case of success + printf("Error in reading %s: '%s'\n",argv[1], tri::io::Importer::ErrorMsg(err)); exit(-1); } + // some cleaning to get rid of bad file formats like stl that duplicate vertexes.. int dup = tri::Clean::RemoveDuplicateVertex(m); int unref = tri::Clean::RemoveUnreferencedVertex(m); printf("Removed %i duplicate and %i unreferenced vertices from mesh %s\n",dup,unref,argv[1]); int Step= atoi(argv[2]); + tri::UpdateTopology::VertexFace(m); - tri::UpdateNormals::PerFaceNormalized(m); - + for(int i=0;i::PerFaceNormalized(m); diff --git a/apps/sample/trimesh_topology/trimesh_topology.cpp b/apps/sample/trimesh_topology/trimesh_topology.cpp index 272c4cb5..f1165d3c 100644 --- a/apps/sample/trimesh_topology/trimesh_topology.cpp +++ b/apps/sample/trimesh_topology/trimesh_topology.cpp @@ -1,7 +1,7 @@ #include -#include -#include +#include +#include #include #include #include @@ -16,10 +16,17 @@ using namespace vcg; +class MyEdge; // dummy prototype never used class MyFace; -class MyEdge; -class MyVertex:public Vertex{}; -class MyFace : public FaceAFFM{}; +class MyVertex; + +class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vert::Coord3f, vert::BitFlags >{}; +class MyFace : public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,face::FFAdj, face::Mark, face::BitFlags > {}; + + +//class MyVertex:public Vertex{}; +//class MyFace : public FaceAFFM{}; + class MyMesh : public tri::TriMesh< std::vector, std::vector >{};