Terrain Clamping osg::Geodes using LocalGeometryNodes

classic Classic list List threaded Threaded
1 message Options
dranders dranders
Reply | Threaded
Open this post in threaded view
|

Terrain Clamping osg::Geodes using LocalGeometryNodes

Hello,

I just upgraded our application from osgEarth 2.4 to 2.8 (on Ubuntu 14.04).  Previously, we were using a LocalGeometryNode to render osg::Gedes draped over the osgEarth terrain surface.  Things like paths and colored quads.

However, with 2.8 this no longer seems to work.  My LocalGeometryNode renders at the elevation I assign during my call to "setPosition( GeoPoint& )".

Here's how I'm setting it up:
  Style rectStyle;
  rectStyle.getOrCreate<AltitudeSymbol>()->clamping() =
                                    AltitudeSymbol::CLAMP_TO_TERRAIN;
  rectStyle.getOrCreate<AltitudeSymbol>()->technique() =
                                     AltitudeSymbol::TECHNIQUE_GPU;

  const SpatialReference* geoSRS = imLayer->getProfile()->getSRS();
  osg::ref_ptr<LocalGeometryNode> redRectNode = new LocalGeometryNode(mapNode,
    createRectNode( osg::Vec3( -50.0, -50.0, 0.0 ),
                    osg::Vec3(  50.0,  50.0, 0.0 ),
                    osg::Vec4( 0.9, 0.0, 0.0, 1.0 ) ) );
  redRectNode->applyStyle( rectStyle );
  redRectNode->setPosition( GeoPoint( geoSRS, center ) );

Looking through the git history, it looks like LocalGeometryNode::initNode() does not contain a call to applyAltitudeSymbology like initGeometry() does.  (In 2.4, I think they both called applyGeneralSymbology which no longer exists).  Was this done for a particular reason?

Is there still a way to drape osg::Nodes?  Thanks,

Dean