From Jean-Sebastien Guay, fix for handling texture unit >= 8 and negative LigthNum.

This commit is contained in:
Robert Osfield 2011-11-25 09:24:50 +00:00
parent 92ed903a7f
commit 2b2c1b5671

View File

@ -1052,7 +1052,14 @@ void ViewDependentShadowMap::cull(osgUtil::CullVisitor& cv)
// pass on shadow data to ShadowDataList
sd->_textureUnit = textureUnit;
if (textureUnit >= 8)
{
OSG_NOTICE<<"Shadow texture unit is invalid for texgen, will not be used."<<std::endl;
}
else
{
sdl.push_back(sd);
}
// increment counters.
++textureUnit;
@ -1095,7 +1102,7 @@ bool ViewDependentShadowMap::selectActiveLights(osgUtil::CullVisitor* cv, ViewDe
++itr)
{
const osg::Light* light = dynamic_cast<const osg::Light*>(itr->first.get());
if (light)
if (light && light->getLightNum() >= 0)
{
// is LightNum matched to that defined in settings
if (settings && settings->getLightNum()>=0 && light->getLightNum()!=settings->getLightNum()) continue;