diff --git a/apps/sample/trimesh_optional/trimesh_simpdata_simp.cpp b/apps/sample/trimesh_optional/trimesh_simpdata_simp.cpp new file mode 100644 index 00000000..635d85e4 --- /dev/null +++ b/apps/sample/trimesh_optional/trimesh_simpdata_simp.cpp @@ -0,0 +1,40 @@ +#include + +#include +#include +#include +#include + +#include +#include + +#include + +class MyEdge; +class MyFace; + +class MyVertex: public vcg::VertexSimp2{}; +class MyFace: public vcg::FaceSimp2{}; + +class MyMesh: public vcg::tri::TriMesh< std::vector, std::vector > {}; + + +int main() +{ + MyMesh m; + vcg::tri::Tetrahedron(m); + vcg::SimpleTempData MyTempData(m.vert); + + MyTempData.Start(); // enable the user defined attribute (memory is allocated) + + MyMesh::VertexIterator vi; // declare the iterator over the vertices + for(vi = m.vert.begin(); vi != m.vert.end(); ++vi) + { + MyTempData[*vi] = 10; // assign the value for the 'short' attribute + MyTempData[vi] = 10; // you can pass the element or an iterator to it + } + + MyTempData.Stop(); // disable the user defined attribute (memory is freed) + + return 0; +} \ No newline at end of file