Merge pull request #2191 from akortunov/viewer

Do not store Viewer reference in the ViewData
pull/541/head
Andrei Kortunov 6 years ago committed by GitHub
commit 368d1f9d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -118,7 +118,6 @@ ViewData *ViewDataMap::getViewData(osg::Object *viewer)
if (found == mViews.end())
{
ViewData* vd = createOrReuseView();
vd->setViewer(viewer);
mViews[viewer] = vd;
return vd;
}
@ -148,7 +147,6 @@ void ViewDataMap::clearUnusedViews(unsigned int frame)
ViewData* vd = it->second;
if (vd->getFrameLastUsed() + 2 < frame)
{
vd->setViewer(nullptr);
vd->clear();
mUnusedViews.push_back(vd);
mViews.erase(it++);

@ -44,9 +44,6 @@ namespace Terrain
Entry& getEntry(unsigned int i);
osg::Object* getViewer() const { return mViewer.get(); }
void setViewer(osg::Object* viewer) { mViewer = viewer; }
unsigned int getFrameLastUsed() const { return mFrameLastUsed; }
/// @return Have any nodes changed since the last frame
@ -62,7 +59,6 @@ namespace Terrain
unsigned int mNumEntries;
unsigned int mFrameLastUsed;
bool mChanged;
osg::ref_ptr<osg::Object> mViewer;
osg::Vec3f mEyePoint;
bool mHasEyePoint;
};
@ -85,7 +81,7 @@ namespace Terrain
private:
std::list<ViewData> mViewVector;
typedef std::map<osg::Object*, ViewData*> Map;
typedef std::map<osg::ref_ptr<osg::Object>, ViewData*> Map;
Map mViews;
std::deque<ViewData*> mUnusedViews;

Loading…
Cancel
Save