fix bug in SmoothingVisitor tripped by bunny.ply

This commit is contained in:
Laurens Voerman 2016-10-06 14:21:07 +02:00 committed by Robert Osfield
parent 1f9725ea49
commit d2a0315e20

View File

@ -657,14 +657,16 @@ static void smooth_new(osg::Geometry& geom, double creaseAngle)
// fsef.listProblemVertices(); // fsef.listProblemVertices();
fsef.updateGeometry(); fsef.updateGeometry();
vertices = dynamic_cast<osg::Vec3Array*>(geom.getVertexArray());
normals = dynamic_cast<osg::Vec3Array*>(geom.getNormalArray());
osg::TriangleIndexFunctor<SmoothTriangleIndexFunctor> stif2; osg::TriangleIndexFunctor<SmoothTriangleIndexFunctor> stif2;
if (stif2.set(vertices, normals)) if (stif2.set(vertices, normals))
{ {
// accumulate all the normals // accumulate all the normals
geom.accept(stif); geom.accept(stif2);
// normalize the normals // normalize the normals
stif.normalize(); stif2.normalize();
} }
} }