I am trying to draw large extruded polygons, like ones that could cover an entire country. When my polygons are this large, the lines properly tessellate between vertices but it doesn't look like the top of the polygon does. It looks like it's cutting through the Earth.
Here's the code where I setup the style and geometry for the feature.
// Fill Symbol
osgEarth::Symbology::PolygonSymbol* fillSymbol = shapeStyle.getOrCreate<osgEarth::Symbology::PolygonSymbol>();
fillSymbol->fill()->color() = osgEarth::Symbology::Color::White;
// Line Symbol
osgEarth::Symbology::LineSymbol* lineSymbol = shapeStyle.getOrCreate<osgEarth::Symbology::LineSymbol>();
lineSymbol->stroke()->color() = osgEarth::Symbology::Color::Black;
lineSymbol->stroke()->width() = 2.0f;
lineSymbol->tessellation() = 20;
// Render Symbol
osgEarth::Symbology::RenderSymbol* renderSymbol = shapeStyle.getOrCreate<osgEarth::Symbology::RenderSymbol>();
renderSymbol->lighting() = false;
// Altitude Symbol
osgEarth::Symbology::AltitudeSymbol* altSymbol = shapeStyle.getOrCreate<osgEarth::Symbology::AltitudeSymbol>();
altSymbol->clamping() = osgEarth::Symbology::AltitudeSymbol::CLAMP_RELATIVE_TO_TERRAIN;
mpPolygon3D = new osgEarth::Symbology::Polygon();
updatePoints(); // Copy the points into the polygon
osgEarth::Features::Feature* feature = new osgEarth::Features::Feature(mpPolygon3D, scene.mapSrs(), shapeStyle);
// Feature Node
mpNode3D = new osgEarth::Annotation::FeatureNode(scene.mapNode(), feature);
And this is what it looks like.
Also, I can't seem to get the polygon to ignore the scene's lighting. I thought that's what the lighting property of the RenderSymbol would do but setting it to true or false doesn't seem to make any difference. I need to be able to see the polygons regardless of the lighting on the globe.
I forgot, elsewhere I'm adding an ExtrusionSymbol to the style and I was setting the flatten property to true. I removed that property from the ExtrusionSymbol and it looks better. The top of the polygon is obviously curving with the terrain now, but the terrain still appears to jut through the polygon when it's very large.
It's the same problem you originally saw (with flatten = true) -- the triangles making up the "roof" are so large they are passing though the earth.
This is a limitation of the ExtrusionSymbol. A workaround would be to draw the "wall" as one feature (extruded line string), and the "roof" as a separate polygon feature with an altitude offset (AltitudeSymbol::verticalOffset).