Improving Doxygen Documentation
This commit is contained in:
parent
8380ea37a0
commit
fa8690e457
|
@ -26,7 +26,7 @@
|
||||||
\brief the minimal example of using the attributes
|
\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.
|
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<vcg/complex/complex.h>
|
#include<vcg/complex/complex.h>
|
||||||
|
@ -44,25 +44,29 @@ class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFa
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
MyMesh m;
|
MyMesh m;
|
||||||
|
//! [Adding an attribute]
|
||||||
// add a per-vertex attribute with type float named "Irradiance"
|
// add a per-vertex attribute with type float named "Irradiance"
|
||||||
MyMesh::PerVertexAttributeHandle<float> named_hv = vcg::tri::Allocator<MyMesh>:: GetPerVertexAttribute<float> (m,std::string("Irradiance"));
|
MyMesh::PerVertexAttributeHandle<float> named_hv = vcg::tri::Allocator<MyMesh>:: GetPerVertexAttribute<float> (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<MyMesh>:: GetPerVertexAttribute<float> (m,std::string("Radiosity"));
|
vcg::tri::Allocator<MyMesh>:: GetPerVertexAttribute<float> (m,std::string("Radiosity"));
|
||||||
|
|
||||||
// add a per-vertex attribute with type bool and no name specified
|
// add a per-vertex attribute with type bool and no name specified
|
||||||
MyMesh::PerVertexAttributeHandle<bool> anon_hv = vcg::tri::Allocator<MyMesh>:: GetPerVertexAttribute<bool> (m);
|
MyMesh::PerVertexAttributeHandle<bool> anon_hv = vcg::tri::Allocator<MyMesh>:: GetPerVertexAttribute<bool> (m);
|
||||||
|
|
||||||
// add a per-face attribute with type bool and no name specified
|
// add a per-face attribute with type bool and no name specified
|
||||||
MyMesh::PerFaceAttributeHandle<bool> anon_hf = vcg::tri::Allocator<MyMesh>:: GetPerFaceAttribute<bool> (m);
|
MyMesh::PerFaceAttributeHandle<bool> anon_hf = vcg::tri::Allocator<MyMesh>:: GetPerFaceAttribute<bool> (m);
|
||||||
|
|
||||||
MyMesh::VertexIterator vi; int i = 0;
|
//! [Using an attribute]
|
||||||
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi,++i){
|
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; // [] operator takes a iterator
|
||||||
named_hv[*vi] = 1.0f; // or a MyMesh::VertexType object
|
named_hv[*vi] = 1.0f; // or a MyMesh::VertexType object
|
||||||
named_hv[&*vi]= 1.0f; // or a pointer to it
|
named_hv[&*vi]= 1.0f; // or a pointer to it
|
||||||
named_hv[i] = 1.0f; // or an integer index
|
named_hv[i] = 1.0f; // or an integer index
|
||||||
}
|
}
|
||||||
|
//! [Using an attribute]
|
||||||
|
|
||||||
vcg::tri::Allocator<MyMesh>::ClearPerVertexAttribute<float>(m,named_hv);
|
vcg::tri::Allocator<MyMesh>::ClearPerVertexAttribute<float>(m,named_hv);
|
||||||
|
|
||||||
|
@ -72,17 +76,20 @@ int main()
|
||||||
// obtain another handle of a previously attribute
|
// obtain another handle of a previously attribute
|
||||||
MyMesh::PerVertexAttributeHandle<float> ret_hv = vcg::tri::Allocator<MyMesh>:: FindPerVertexAttribute<float>(m,"Radiosity");
|
MyMesh::PerVertexAttributeHandle<float> ret_hv = vcg::tri::Allocator<MyMesh>:: FindPerVertexAttribute<float>(m,"Radiosity");
|
||||||
|
|
||||||
|
//! [Per Mesh attribute]
|
||||||
// you can also have PerMesh attributes
|
// you can also have PerMesh attributes
|
||||||
MyMesh::PerMeshAttributeHandle<int> hm = vcg::tri::Allocator<MyMesh>:: GetPerMeshAttribute<int> (m,std::string("ADummyIntegerAttribute"));
|
MyMesh::PerMeshAttributeHandle<int> hm = vcg::tri::Allocator<MyMesh>:: GetPerMeshAttribute<int> (m,std::string("ADummyIntegerAttribute"));
|
||||||
|
|
||||||
// PerMesh attributes are accessed directly using the handle itself
|
// PerMesh attributes are accessed directly using the handle itself
|
||||||
hm() = 10;
|
hm() = 10;
|
||||||
|
//! [Per Mesh attribute]
|
||||||
|
|
||||||
|
//! [Deleting an attribute]
|
||||||
// delete an attribute by name
|
// delete an attribute by name
|
||||||
vcg::tri::Allocator<MyMesh>::DeletePerVertexAttribute(m,"Radiosity");
|
vcg::tri::Allocator<MyMesh>::DeletePerVertexAttribute(m, "Radiosity");
|
||||||
|
|
||||||
// delete an attribute by handle
|
// delete an attribute by handle
|
||||||
vcg::tri::Allocator<MyMesh>::DeletePerVertexAttribute(m,anon_hv);
|
vcg::tri::Allocator<MyMesh>::DeletePerVertexAttribute(m, anon_hv);
|
||||||
|
//! [Deleting an attribute]
|
||||||
|
|
||||||
bool res;
|
bool res;
|
||||||
res = vcg::tri::Allocator<MyMesh>::IsValidHandle(m,named_hv); printf("Is Valid: %s\n",res?"Yes":"No");
|
res = vcg::tri::Allocator<MyMesh>::IsValidHandle(m,named_hv); printf("Is Valid: %s\n",res?"Yes":"No");
|
||||||
|
|
Loading…
Reference in New Issue