From b2c838033d816e999696ce7dbf47ff57403c44a4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 28 Jun 2013 12:45:39 +0000 Subject: [PATCH] Added handling of an odd number rows in the capsule rendering and primitive calculation. --- src/osg/ShapeDrawable.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osg/ShapeDrawable.cpp b/src/osg/ShapeDrawable.cpp index cbaffa722..186e949ab 100644 --- a/src/osg/ShapeDrawable.cpp +++ b/src/osg/ShapeDrawable.cpp @@ -826,6 +826,9 @@ void DrawShapeVisitor::apply(const Capsule& capsule) numRows = MIN_NUM_ROWS; } + // if numRows is odd the top and bottom halves of sphere won't match, so bump up to the next event numRows + if ((numRows%2)!=0) ++numRows; + // capsule cylindrical body if (createBody) @@ -1818,6 +1821,9 @@ void PrimitiveShapeVisitor::apply(const Capsule& capsule) numSegments = MIN_NUM_SEGMENTS; } + // if numRows is odd the top and bottom halves of sphere won't match, so bump up to the next event numRows + if ((numRows%2)!=0) ++numRows; + // capsule body if (createBody) createCylinderBody(numSegments, capsule.getRadius(), capsule.getHeight(), matrix);