From 1fa331034ccc738b86a22adabf6f7aa8d76e62fe Mon Sep 17 00:00:00 2001 From: Don BURNS Date: Tue, 22 Aug 2006 19:10:48 +0000 Subject: [PATCH] Added osgUtil::Tesselator for SHapeType Polygon to handle concave polygons. --- src/osgPlugins/ESRIShape/ESRIShapeParser.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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() ); } }