diff --git a/src/osgPlugins/ESRIShape/ESRIShapeParser.cpp b/src/osgPlugins/ESRIShape/ESRIShapeParser.cpp index 73e005d8b..dc33073a7 100644 --- a/src/osgPlugins/ESRIShape/ESRIShapeParser.cpp +++ b/src/osgPlugins/ESRIShape/ESRIShapeParser.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #if defined(_MSC_VER) #include @@ -314,6 +315,8 @@ void ESRIShapeParser::_process( const std::vector &polys ) osg::ref_ptr geometry = new osg::Geometry; geometry->setVertexArray(coords.get()); + + for( i = 0; i < p->numParts; i++ ) { int index = p->parts[i]; @@ -324,6 +327,15 @@ void ESRIShapeParser::_process( const std::vector &polys ) geometry->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::POLYGON, index, len)); } + + // Use osgUtil::Tesselator to handle concave polygons + osg::ref_ptr tscx=new osgUtil::Tesselator; + tscx->setTesselationType(osgUtil::Tesselator::TESS_TYPE_GEOMETRY); + tscx->setBoundaryOnly(false); + tscx->setWindingType( osgUtil::Tesselator::TESS_WINDING_ODD); + + tscx->retesselatePolygons(*(geometry.get())); + _geode->addDrawable( geometry.get() ); } }