using dynamic request_attribute method for the example
closes #2422 git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1242 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -51,9 +51,6 @@
|
|||||||
|
|
||||||
struct MyTraits : public OpenMesh::DefaultTraits
|
struct MyTraits : public OpenMesh::DefaultTraits
|
||||||
{
|
{
|
||||||
VertexAttributes(OpenMesh::Attributes::Status);
|
|
||||||
FaceAttributes(OpenMesh::Attributes::Status);
|
|
||||||
EdgeAttributes(OpenMesh::Attributes::Status);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -67,6 +64,11 @@ int main()
|
|||||||
{
|
{
|
||||||
MyMesh mesh;
|
MyMesh mesh;
|
||||||
|
|
||||||
|
// the request has to be called before a vertex/face/edge can be deleted. it grants access to the status attribute
|
||||||
|
mesh.request_face_status();
|
||||||
|
mesh.request_edge_status();
|
||||||
|
mesh.request_vertex_status();
|
||||||
|
|
||||||
// generate vertices
|
// generate vertices
|
||||||
|
|
||||||
MyMesh::VertexHandle vhandle[8];
|
MyMesh::VertexHandle vhandle[8];
|
||||||
|
|||||||
@@ -9,11 +9,14 @@ we have to extend the default traits for our mesh class.
|
|||||||
Vertices, faces and (half-)edges need the OpenMesh::Attributes::Status attribute
|
Vertices, faces and (half-)edges need the OpenMesh::Attributes::Status attribute
|
||||||
which is used to hold the flag "deleted" if an element is deleted.
|
which is used to hold the flag "deleted" if an element is deleted.
|
||||||
|
|
||||||
The struct which defines the mesh traits then looks like this:
|
Instead of defining the required attributes via traits on compile-time, it is possible to request
|
||||||
|
attributes dynamically on run-time by requesting them.
|
||||||
|
In this example, we want to delete faces, edges and vertices, therefore requesting the status attribute is required.
|
||||||
|
\note You have to request attributes before you use them, if you don't enable them via traits.
|
||||||
|
|
||||||
\dontinclude delete_geometry.cc
|
\dontinclude delete_geometry.cc
|
||||||
\skipline struct
|
\skipline // the request
|
||||||
\until };
|
\until mesh.request_vertex_status();
|
||||||
|
|
||||||
After having created the geometry of the cube one can delete faces and vertices
|
After having created the geometry of the cube one can delete faces and vertices
|
||||||
by simply calling delete_vertices() (delete_faces() or delete_edges() respectively).
|
by simply calling delete_vertices() (delete_faces() or delete_edges() respectively).
|
||||||
|
|||||||
@@ -609,9 +609,14 @@ TEST_F(OpenMeshTutorials, extending_the_mesh_using_traits) {
|
|||||||
EXPECT_TRUE(ok) << "Cannot write mesh to file 'smoothed_extended_output.off'";
|
EXPECT_TRUE(ok) << "Cannot write mesh to file 'smoothed_extended_output.off'";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
TEST_F(OpenMeshTutorials, deleting_geometry_elements) {
|
TEST_F(OpenMeshTutorials, deleting_geometry_elements) {
|
||||||
MyMeshWithStatus mesh;
|
Mesh mesh;
|
||||||
|
|
||||||
|
// the request has to be called before a vertex/face/edge can be deleted. it grants access to the status attribute
|
||||||
|
mesh.request_face_status();
|
||||||
|
mesh.request_edge_status();
|
||||||
|
mesh.request_vertex_status();
|
||||||
|
|
||||||
// generate vertices
|
// generate vertices
|
||||||
MyMeshWithStatus::VertexHandle vhandle[8];
|
MyMeshWithStatus::VertexHandle vhandle[8];
|
||||||
@@ -730,7 +735,7 @@ TEST_F(OpenMeshTutorials, deleting_geometry_elements) {
|
|||||||
|
|
||||||
EXPECT_TRUE(ok) << "Cannot write mesh to file 'deleted_output.off'";
|
EXPECT_TRUE(ok) << "Cannot write mesh to file 'deleted_output.off'";
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
TEST_F(OpenMeshTutorials, storing_custom_properties) {
|
TEST_F(OpenMeshTutorials, storing_custom_properties) {
|
||||||
MyMesh mesh;
|
MyMesh mesh;
|
||||||
|
|||||||
Reference in New Issue
Block a user