From df5210f7292b9d436509afebd472708d51d85a2e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 12 Dec 2010 08:56:58 +0000 Subject: [PATCH] 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. " --- src/osgUtil/SmoothingVisitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgUtil/SmoothingVisitor.cpp b/src/osgUtil/SmoothingVisitor.cpp index 742658917..eb6c506d5 100644 --- a/src/osgUtil/SmoothingVisitor.cpp +++ b/src/osgUtil/SmoothingVisitor.cpp @@ -620,7 +620,7 @@ static void smooth_new(osg::Geometry& geom, double creaseAngle) if (!vertices) return; osg::Vec3Array* normals = dynamic_cast(geom.getNormalArray()); - if (!normals) + if (!normals || (normals && normals->size() != vertices->size())) { normals = new osg::Vec3Array(vertices->size()); geom.setNormalArray(normals);