mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 19:53:53 +00:00
Make tb work with distant terrain
This commit is contained in:
parent
f18d57429e
commit
414e6caafe
4 changed files with 14 additions and 16 deletions
|
@ -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)
|
void TerrainGrid::loadCell(int x, int y)
|
||||||
{
|
{
|
||||||
if (mGrid.find(std::make_pair(x, y)) != mGrid.end())
|
if (mGrid.find(std::make_pair(x, y)) != mGrid.end())
|
||||||
|
|
|
@ -27,7 +27,6 @@ namespace Terrain
|
||||||
|
|
||||||
View* createView();
|
View* createView();
|
||||||
|
|
||||||
virtual void setBordersVisible(bool visible) override;
|
|
||||||
private:
|
private:
|
||||||
osg::ref_ptr<osg::Node> buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter);
|
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;
|
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();
|
mCellBorder->destroyCellBorderGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,12 +83,16 @@ void World::loadCell(int x, int y)
|
||||||
{
|
{
|
||||||
if (mBorderVisible)
|
if (mBorderVisible)
|
||||||
mCellBorder->createCellBorderGeometry(x,y);
|
mCellBorder->createCellBorderGeometry(x,y);
|
||||||
|
|
||||||
|
mLoadedCells.insert(std::pair<int,int>(x,y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::unloadCell(int x, int y)
|
void World::unloadCell(int x, int y)
|
||||||
{
|
{
|
||||||
if (mBorderVisible)
|
if (mBorderVisible)
|
||||||
mCellBorder->destroyCellBorderGeometry(x,y);
|
mCellBorder->destroyCellBorderGeometry(x,y);
|
||||||
|
|
||||||
|
mLoadedCells.erase(std::pair<int,int>(x,y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setTargetFrameRate(float rate)
|
void World::setTargetFrameRate(float rate)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <osg/Vec3f>
|
#include <osg/Vec3f>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "defs.hpp"
|
#include "defs.hpp"
|
||||||
#include "cellborder.hpp"
|
#include "cellborder.hpp"
|
||||||
|
@ -118,6 +119,8 @@ namespace Terrain
|
||||||
std::unique_ptr<MWRender::CellBorder> mCellBorder;
|
std::unique_ptr<MWRender::CellBorder> mCellBorder;
|
||||||
|
|
||||||
bool mBorderVisible;
|
bool mBorderVisible;
|
||||||
|
|
||||||
|
std::set<std::pair<int,int>> mLoadedCells;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue