I didn't find anything in the archives which succinctly answered this,
so I thought I'd post my solution to getting two-sided lighting. It is
not pretty from an encapsulation standpoint, but it works:
void setLightingTwoSided(osgViewer::Viewer &viewer)
{
LightModel *lm = new LightModel;
lm->setTwoSided(true);
lm->setAmbientIntensity(osg::Vec4(0.1f,0.1f,0.1f,1.0f));
osg::StateSet *ss;
for (int i=0 ; i < 2 ; i++ ) {
ss = ((osgViewer::Renderer *)
viewer.getCamera()->getRenderer())->getSceneView(i)->getGlobalStateSet();
//ss->removeAttribute(ss->getAttribute(osg::StateAttribute::LIGHTMODEL));
ss->setAttributeAndModes(lm, osg::StateAttribute::ON);
}
}
I use it like this:
osg::Viewer viewer(arguments);
setLightingTwoSided(viewer);
If anyone has a better solution let me know.
Lee
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org