From Wang Rui, "I've found a possible bug in the new SmoothingVisitor implementation

(with a great 'crease angle' feature), which will crash if the normal
array is already set but without BIND_PER_VERTEX. I just believe that
we should reallocate the normal array in these cases, as the old
implementation does.
"
This commit is contained in:
Robert Osfield 2010-12-12 08:56:58 +00:00
parent 08d21d8777
commit df5210f729

View File

@ -620,7 +620,7 @@ static void smooth_new(osg::Geometry& geom, double creaseAngle)
if (!vertices) return;
osg::Vec3Array* normals = dynamic_cast<osg::Vec3Array*>(geom.getNormalArray());
if (!normals)
if (!normals || (normals && normals->size() != vertices->size()))
{
normals = new osg::Vec3Array(vertices->size());
geom.setNormalArray(normals);