- decimater (incremental & mc) doesn't require normals anymore
- mod normalFlipping & normalDeviation computes normals, if mesh hasn't normals - add 2 decimater unittest (decimating with normalFlipping and initialize all modules) git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1049 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -81,7 +81,6 @@ McDecimaterT<Mesh>::McDecimaterT(Mesh& _mesh) :
|
||||
mesh_.request_halfedge_status();
|
||||
mesh_.request_edge_status();
|
||||
mesh_.request_face_status();
|
||||
mesh_.request_face_normals();
|
||||
|
||||
}
|
||||
|
||||
@@ -94,7 +93,6 @@ McDecimaterT<Mesh>::~McDecimaterT() {
|
||||
mesh_.release_edge_status();
|
||||
mesh_.release_halfedge_status();
|
||||
mesh_.release_face_status();
|
||||
mesh_.release_face_normals();
|
||||
|
||||
}
|
||||
|
||||
@@ -118,6 +116,8 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) {
|
||||
RandomNumberGenerator randGen(mesh_.n_halfedges());
|
||||
#endif
|
||||
|
||||
const bool update_normals = mesh_.has_face_normals();
|
||||
|
||||
while ( n_collapses < _n_collapses) {
|
||||
|
||||
if (noCollapses > 20) {
|
||||
@@ -187,10 +187,13 @@ size_t McDecimaterT<Mesh>::decimate(size_t _n_collapses) {
|
||||
collapsesUnchanged = false;
|
||||
|
||||
// update triangle normals
|
||||
typename Mesh::VertexFaceIter vf_it = mesh_.vf_iter(ci.v1);
|
||||
for (; vf_it.is_valid(); ++vf_it)
|
||||
if (!mesh_.status(*vf_it).deleted())
|
||||
mesh_.set_normal(*vf_it, mesh_.calc_face_normal(*vf_it));
|
||||
if (update_normals)
|
||||
{
|
||||
typename Mesh::VertexFaceIter vf_it = mesh_.vf_iter(ci.v1);
|
||||
for (; vf_it.is_valid(); ++vf_it)
|
||||
if (!mesh_.status(*vf_it).deleted())
|
||||
mesh_.set_normal(*vf_it, mesh_.calc_face_normal(*vf_it));
|
||||
}
|
||||
|
||||
// post-process collapse
|
||||
this->postprocess_collapse(ci);
|
||||
@@ -240,6 +243,8 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
|
||||
RandomNumberGenerator randGen(mesh_.n_halfedges());
|
||||
#endif
|
||||
|
||||
const bool update_normals = mesh_.has_face_normals();
|
||||
|
||||
while ((_nv < nv) && (_nf < nf)) {
|
||||
|
||||
if (noCollapses > 20) {
|
||||
@@ -320,11 +325,14 @@ size_t McDecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf) {
|
||||
noCollapses = 0;
|
||||
collapsesUnchanged = false;
|
||||
|
||||
// update triangle normals
|
||||
typename Mesh::VertexFaceIter vf_it = mesh_.vf_iter(ci.v1);
|
||||
for (; vf_it.is_valid(); ++vf_it)
|
||||
if (!mesh_.status(*vf_it).deleted())
|
||||
mesh_.set_normal(*vf_it, mesh_.calc_face_normal(*vf_it));
|
||||
if (update_normals)
|
||||
{
|
||||
// update triangle normals
|
||||
typename Mesh::VertexFaceIter vf_it = mesh_.vf_iter(ci.v1);
|
||||
for (; vf_it.is_valid(); ++vf_it)
|
||||
if (!mesh_.status(*vf_it).deleted())
|
||||
mesh_.set_normal(*vf_it, mesh_.calc_face_normal(*vf_it));
|
||||
}
|
||||
|
||||
// post-process collapse
|
||||
this->postprocess_collapse(ci);
|
||||
|
||||
Reference in New Issue
Block a user