Reputation: 11
Using OsgEarth 2.10 can a kml have the property "clamp to terrain" and therefore follow the height of the terrain?
osg::ref_ptr<osg::Node> kmlLowNode = kmlLowNode = osgEarth::Drivers::KML::load(osgEarth::URI(subArr->get(0).toString()), mapNode, kmlOption);
kmlLowNode->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, true);
kmlLowNode->getOrCreateStateSet()->setDefine(OE_LIGHTING_DEFINE, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED);
osgEarth::Symbology::Style* kmlStyle = new osgEarth::Symbology::Style;
kmlStyle->getOrCreate<osgEarth::Features::AltitudeSymbol>()->clamping() = osgEarth::Features::AltitudeSymbol::CLAMP_TO_TERRAIN;
osg::ref_ptr<osgEarth::Annotation::ModelNode> modelLow = new osgEarth::Annotation::ModelNode(cfg, 0L);
modelLow->setStyle(*kmlStyle);
modelLow->addChild(kmlLowNode);
mapNode->addChild(modelLow);
The provided code correctly loads a kml whose Altitude property is "clampToGround", but osgEarth puts it at the fixed height of the model, so whether or not a DEM is enabled, it does not adapt to the varied height.
Upvotes: 0
Views: 58