diff --git a/src/osgUtil/RenderBin.cpp b/src/osgUtil/RenderBin.cpp index 1515bf1e6..1c9c830a1 100644 --- a/src/osgUtil/RenderBin.cpp +++ b/src/osgUtil/RenderBin.cpp @@ -317,6 +317,8 @@ void RenderBin::copyLeavesFromStateGraphListToRenderLeafList() _renderLeafList.reserve(totalsize); + bool detectedNaN = false; + // first copy all the leaves from the render graphs into the leaf list. for(itr=_stateGraphList.begin(); itr!=_stateGraphList.end(); @@ -326,10 +328,19 @@ void RenderBin::copyLeavesFromStateGraphListToRenderLeafList() dw_itr != (*itr)->_leaves.end(); ++dw_itr) { - _renderLeafList.push_back(dw_itr->get()); + if (!osg::isNaN((*dw_itr)->_depth)) + { + _renderLeafList.push_back(dw_itr->get()); + } + else + { + detectedNaN = true; + } } } + osg::notify(osg::NOTICE)<<"Warning: RenderBin::copyLeavesFromStateGraphListToRenderLeafList() detected NaN depth values, database may be corrupted."<