1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Do not store Viewer reference in the ViewData

This commit is contained in:
bzzt 2019-02-20 13:37:00 +00:00 committed by Andrei Kortunov
parent 886c77bced
commit c8d2107b80
2 changed files with 1 additions and 7 deletions

View file

@ -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++);

View file

@ -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;