Make tb work with distant terrain

0.6.3
Miloslav Číž 7 years ago
parent f18d57429e
commit 414e6caafe

@ -65,19 +65,6 @@ osg::ref_ptr<osg::Node> TerrainGrid::buildTerrain (osg::Group* parent, float chu
}
}
void TerrainGrid::setBordersVisible(bool visible)
{
mBorderVisible = visible;
if (visible)
{
for (MWRender::CellBorder::CellGrid::iterator it = mGrid.begin(); it != mGrid.end(); ++it)
mCellBorder->createCellBorderGeometry(it->first.first,it->first.second);
}
else
mCellBorder->destroyCellBorderGeometry();
}
void TerrainGrid::loadCell(int x, int y)
{
if (mGrid.find(std::make_pair(x, y)) != mGrid.end())

@ -27,7 +27,6 @@ namespace Terrain
View* createView();
virtual void setBordersVisible(bool visible) override;
private:
osg::ref_ptr<osg::Node> buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter);

@ -70,7 +70,12 @@ void World::setBordersVisible(bool visible)
{
mBorderVisible = visible;
if (!visible)
if (visible)
{
for (std::set<std::pair<int,int>>::iterator it = mLoadedCells.begin(); it != mLoadedCells.end(); ++it)
mCellBorder->createCellBorderGeometry(it->first,it->second);
}
else
mCellBorder->destroyCellBorderGeometry();
}
@ -78,12 +83,16 @@ void World::loadCell(int x, int y)
{
if (mBorderVisible)
mCellBorder->createCellBorderGeometry(x,y);
mLoadedCells.insert(std::pair<int,int>(x,y));
}
void World::unloadCell(int x, int y)
{
if (mBorderVisible)
mCellBorder->destroyCellBorderGeometry(x,y);
mLoadedCells.erase(std::pair<int,int>(x,y));
}
void World::setTargetFrameRate(float rate)

@ -6,6 +6,7 @@
#include <osg/Vec3f>
#include <memory>
#include <set>
#include "defs.hpp"
#include "cellborder.hpp"
@ -117,7 +118,9 @@ namespace Terrain
std::unique_ptr<MWRender::CellBorder> mCellBorder;
bool mBorderVisible;
bool mBorderVisible;
std::set<std::pair<int,int>> mLoadedCells;
};
}

Loading…
Cancel
Save