Added line connectivity code.

This commit is contained in:
Robert Osfield
2005-09-15 20:03:37 +00:00
parent b8ce046f88
commit d2f98ef56e
2 changed files with 552 additions and 20 deletions

View File

@@ -337,7 +337,24 @@ void build_world(osg::Group *root)
osgSim::SphereSegment::LineList lines = ss->computeIntersection(osg::Matrixd::identity(), terrainGeode.get());
if (!lines.empty())
{
osg::notify(osg::NOTICE)<<"We've found intersections!!!!"<<std::endl;
osg::notify(osg::NOTICE)<<"We've found intersections!!!!"<<std::endl;
osg::Geode* geode = new osg::Geode;
root->addChild(geode);
geode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
for(osgSim::SphereSegment::LineList::iterator itr=lines.begin();
itr!=lines.end();
++itr)
{
osg::Geometry* geom = new osg::Geometry;
geode->addDrawable(geom);
osg::Vec3Array* vertices = itr->get();
geom->setVertexArray(vertices);
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, vertices->getNumElements()));
}
}
else
{