mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Terrain: remove ref argument that is now always true
This commit is contained in:
parent
ac78d01b2b
commit
3e03a0d7bd
3 changed files with 7 additions and 9 deletions
|
@ -132,14 +132,14 @@ ViewData* QuadTreeNode::getView(osg::NodeVisitor &nv)
|
||||||
if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
|
if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
|
||||||
{
|
{
|
||||||
osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>(&nv);
|
osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>(&nv);
|
||||||
ViewData* vd = mViewDataMap->getViewData(cv->getCurrentCamera(), true);
|
ViewData* vd = mViewDataMap->getViewData(cv->getCurrentCamera());
|
||||||
vd->setEyePoint(nv.getEyePoint());
|
vd->setEyePoint(nv.getEyePoint());
|
||||||
return vd;
|
return vd;
|
||||||
}
|
}
|
||||||
else // INTERSECTION_VISITOR
|
else // INTERSECTION_VISITOR
|
||||||
{
|
{
|
||||||
static osg::ref_ptr<osg::Object> dummyObj = new osg::DummyObject;
|
static osg::ref_ptr<osg::Object> dummyObj = new osg::DummyObject;
|
||||||
ViewData* vd = mViewDataMap->getViewData(dummyObj.get(), true);
|
ViewData* vd = mViewDataMap->getViewData(dummyObj.get());
|
||||||
ViewData* defaultView = mViewDataMap->getDefaultView();
|
ViewData* defaultView = mViewDataMap->getDefaultView();
|
||||||
if (defaultView->hasEyePoint())
|
if (defaultView->hasEyePoint())
|
||||||
vd->setEyePoint(defaultView->getEyePoint());
|
vd->setEyePoint(defaultView->getEyePoint());
|
||||||
|
|
|
@ -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);
|
Map::const_iterator found = mViews.find(viewer);
|
||||||
if (found == mViews.end())
|
if (found == mViews.end())
|
||||||
{
|
{
|
||||||
ViewData* vd = createOrReuseView();
|
ViewData* vd = createOrReuseView();
|
||||||
if (ref)
|
vd->setViewer(viewer);
|
||||||
vd->setViewer(viewer);
|
|
||||||
mViews[viewer] = vd;
|
mViews[viewer] = vd;
|
||||||
return vd;
|
return vd;
|
||||||
}
|
}
|
||||||
|
@ -147,8 +146,7 @@ void ViewDataMap::clearUnusedViews(unsigned int frame)
|
||||||
for (Map::iterator it = mViews.begin(); it != mViews.end(); )
|
for (Map::iterator it = mViews.begin(); it != mViews.end(); )
|
||||||
{
|
{
|
||||||
ViewData* vd = it->second;
|
ViewData* vd = it->second;
|
||||||
if ((!vd->getViewer() // if no ref was held, always need to clear to avoid holding a dangling ref.
|
if (vd->getFrameLastUsed() + 2 < frame)
|
||||||
|| vd->getFrameLastUsed() + 2 < frame))
|
|
||||||
{
|
{
|
||||||
vd->setViewer(NULL);
|
vd->setViewer(NULL);
|
||||||
vd->clear();
|
vd->clear();
|
||||||
|
@ -174,7 +172,7 @@ void ViewDataMap::setDefaultViewer(osg::Object *viewer)
|
||||||
|
|
||||||
ViewData* ViewDataMap::getDefaultView()
|
ViewData* ViewDataMap::getDefaultView()
|
||||||
{
|
{
|
||||||
return getViewData(mDefaultViewer, true);
|
return getViewData(mDefaultViewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace Terrain
|
||||||
class ViewDataMap : public osg::Referenced
|
class ViewDataMap : public osg::Referenced
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ViewData* getViewData(osg::Object* viewer, bool ref);
|
ViewData* getViewData(osg::Object* viewer);
|
||||||
|
|
||||||
ViewData* createOrReuseView();
|
ViewData* createOrReuseView();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue