added "only to selection" for depth smoothing

This commit is contained in:
Marco Callieri 2018-06-04 14:15:55 +02:00
parent 0fb50ae0a7
commit 2d0e455712
1 changed files with 9 additions and 8 deletions

View File

@ -912,7 +912,7 @@ So if
static void VertexCoordViewDepth(MeshType &m, static void VertexCoordViewDepth(MeshType &m,
const CoordType &viewpoint, const CoordType &viewpoint,
const ScalarType alpha, const ScalarType alpha,
int step, bool SmoothBorder = false) int step, bool SmoothSelected, bool SmoothBorder = false)
{ {
LaplacianInfo lpz; LaplacianInfo lpz;
lpz.sum = CoordType(0, 0, 0); lpz.sum = CoordType(0, 0, 0);
@ -961,13 +961,14 @@ So if
for (vi = m.vert.begin(); vi != m.vert.end(); ++vi) for (vi = m.vert.begin(); vi != m.vert.end(); ++vi)
if (!(*vi).IsD() && TD[*vi].cnt > 0) if (!(*vi).IsD() && TD[*vi].cnt > 0)
{ if (!SmoothSelected || (*vi).IsS())
CoordType np = TD[*vi].sum / TD[*vi].cnt; {
CoordType d = (*vi).cP() - viewpoint; CoordType np = TD[*vi].sum / TD[*vi].cnt;
d.Normalize(); CoordType d = (*vi).cP() - viewpoint;
ScalarType s = d.dot(np - (*vi).cP()); d.Normalize();
(*vi).P() += d * (s * alpha); ScalarType s = d.dot(np - (*vi).cP());
} (*vi).P() += d * (s * alpha);
}
} }
} }