|
|
|
@ -112,14 +112,13 @@ bool ViewData::Entry::set(QuadTreeNode *node, bool visible)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ViewData *ViewDataMap::getViewData(osg::Object *viewer, bool ref)
|
|
|
|
|
ViewData *ViewDataMap::getViewData(osg::Object *viewer)
|
|
|
|
|
{
|
|
|
|
|
Map::const_iterator found = mViews.find(viewer);
|
|
|
|
|
if (found == mViews.end())
|
|
|
|
|
{
|
|
|
|
|
ViewData* vd = createOrReuseView();
|
|
|
|
|
if (ref)
|
|
|
|
|
vd->setViewer(viewer);
|
|
|
|
|
vd->setViewer(viewer);
|
|
|
|
|
mViews[viewer] = vd;
|
|
|
|
|
return vd;
|
|
|
|
|
}
|
|
|
|
@ -147,8 +146,7 @@ void ViewDataMap::clearUnusedViews(unsigned int frame)
|
|
|
|
|
for (Map::iterator it = mViews.begin(); it != mViews.end(); )
|
|
|
|
|
{
|
|
|
|
|
ViewData* vd = it->second;
|
|
|
|
|
if ((!vd->getViewer() // if no ref was held, always need to clear to avoid holding a dangling ref.
|
|
|
|
|
|| vd->getFrameLastUsed() + 2 < frame))
|
|
|
|
|
if (vd->getFrameLastUsed() + 2 < frame)
|
|
|
|
|
{
|
|
|
|
|
vd->setViewer(NULL);
|
|
|
|
|
vd->clear();
|
|
|
|
@ -174,7 +172,7 @@ void ViewDataMap::setDefaultViewer(osg::Object *viewer)
|
|
|
|
|
|
|
|
|
|
ViewData* ViewDataMap::getDefaultView()
|
|
|
|
|
{
|
|
|
|
|
return getViewData(mDefaultViewer, true);
|
|
|
|
|
return getViewData(mDefaultViewer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|