Added TexEnv DECAL mode.

This commit is contained in:
Robert Osfield 2005-09-26 11:24:14 +00:00
parent 0fb2e7adc0
commit 07d7d39eb5

View File

@ -174,8 +174,16 @@ osg::Group* createOverlay(const osg::Vec3& center, float radius)
}
geom->setVertexArray(vertices);
osg::Vec4ubArray& color = *(new osg::Vec4ubArray(1));
color[0].set(0,0,0,255);
geom->setColorArray(&color);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINES,0,vertices->getNumElements()));
geom->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
group->addChild(geode);
@ -365,6 +373,8 @@ void build_world(osg::Group *root)
osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode;
overlayNode->getOrCreateStateSet()->setTextureAttribute(1, new osg::TexEnv(osg::TexEnv::DECAL));
const osg::BoundingSphere& bs = terrainGeode->getBound();
osg::Group* overlaySubgraph = createOverlay(bs.center(), bs.radius()*0.5f);