From fa8690e4573c1f2604ac9803c37d385c16b9fb04 Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 4 Nov 2014 10:01:48 +0000 Subject: [PATCH] Improving Doxygen Documentation --- .../trimesh_attribute/trimesh_attribute.cpp | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/apps/sample/trimesh_attribute/trimesh_attribute.cpp b/apps/sample/trimesh_attribute/trimesh_attribute.cpp index 9543a28a..a8734899 100644 --- a/apps/sample/trimesh_attribute/trimesh_attribute.cpp +++ b/apps/sample/trimesh_attribute/trimesh_attribute.cpp @@ -26,7 +26,7 @@ \brief the minimal example of using the attributes Attributes are a simple mechanism to associate user-defined 'attributes' to the simplicies and to the mesh. -\ref attributes for more Details +See the page '\ref attributes' for more details. */ #include @@ -44,25 +44,29 @@ class MyMesh : public vcg::tri::TriMesh< std::vector, std::vector named_hv = vcg::tri::Allocator:: GetPerVertexAttribute (m,std::string("Irradiance")); + //! [Adding an attribute] - // add a per-vertex attribute with type float named "Radiosity" + // add a per-vertex attribute with type float named "Radiosity" vcg::tri::Allocator:: GetPerVertexAttribute (m,std::string("Radiosity")); - + // add a per-vertex attribute with type bool and no name specified MyMesh::PerVertexAttributeHandle anon_hv = vcg::tri::Allocator:: GetPerVertexAttribute (m); - + // add a per-face attribute with type bool and no name specified MyMesh::PerFaceAttributeHandle anon_hf = vcg::tri::Allocator:: GetPerFaceAttribute (m); - MyMesh::VertexIterator vi; int i = 0; - for(vi = m.vert.begin(); vi != m.vert.end(); ++vi,++i){ + //! [Using an attribute] + MyMesh::VertexIterator vi; int i; + for(i=0, vi = m.vert.begin(); vi != m.vert.end(); ++vi,++i){ named_hv[vi] = 1.0f; // [] operator takes a iterator named_hv[*vi] = 1.0f; // or a MyMesh::VertexType object named_hv[&*vi]= 1.0f; // or a pointer to it named_hv[i] = 1.0f; // or an integer index } + //! [Using an attribute] vcg::tri::Allocator::ClearPerVertexAttribute(m,named_hv); @@ -72,17 +76,20 @@ int main() // obtain another handle of a previously attribute MyMesh::PerVertexAttributeHandle ret_hv = vcg::tri::Allocator:: FindPerVertexAttribute(m,"Radiosity"); + //! [Per Mesh attribute] // you can also have PerMesh attributes MyMesh::PerMeshAttributeHandle hm = vcg::tri::Allocator:: GetPerMeshAttribute (m,std::string("ADummyIntegerAttribute")); - // PerMesh attributes are accessed directly using the handle itself hm() = 10; + //! [Per Mesh attribute] + //! [Deleting an attribute] // delete an attribute by name - vcg::tri::Allocator::DeletePerVertexAttribute(m,"Radiosity"); + vcg::tri::Allocator::DeletePerVertexAttribute(m, "Radiosity"); // delete an attribute by handle - vcg::tri::Allocator::DeletePerVertexAttribute(m,anon_hv); + vcg::tri::Allocator::DeletePerVertexAttribute(m, anon_hv); + //! [Deleting an attribute] bool res; res = vcg::tri::Allocator::IsValidHandle(m,named_hv); printf("Is Valid: %s\n",res?"Yes":"No");