00001 #include <vector> 00002 00003 #include <vcg/simplex/vertex/base.h> 00004 #include <vcg/simplex/vertex/component.h> 00005 #include <vcg/simplex/face/base.h> 00006 #include <vcg/simplex/face/component.h> 00007 00008 #include <vcg/complex/trimesh/base.h> 00009 #include<vcg/container/simple_temporary_data.h> 00010 00011 #include<vcg/complex/trimesh/create/platonic.h> 00012 00013 class MyEdge; 00014 class MyFace; 00015 00016 class MyVertex: public vcg::VertexSimp2<MyVertex,MyEdge,MyFace, vcg::vert::Coord3d, vcg::vert::Normal3f>{}; 00017 class MyFace: public vcg::FaceSimp2<MyVertex,MyEdge,MyFace, vcg::face::VertexRef>{}; 00018 00019 class MyMesh: public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {}; 00020 00021 00022 int main() 00023 { 00024 MyMesh m; 00025 vcg::tri::Tetrahedron(m); 00026 vcg::SimpleTempData<MyMesh::VertContainer, short> MyTempData(m.vert); 00027 00028 MyTempData.Start(); // enable the user defined attribute (memory is allocated) 00029 00030 MyMesh::VertexIterator vi; // declare the iterator over the vertices 00031 for(vi = m.vert.begin(); vi != m.vert.end(); ++vi) 00032 { 00033 MyTempData[*vi] = 10; // assign the value for the 'short' attribute 00034 MyTempData[vi] = 10; // you can pass the element or an iterator to it 00035 } 00036 00037 MyTempData.Stop(); // disable the user defined attribute (memory is freed) 00038 00039 return 0; 00040 }