forked from mirror/openmw-tes3mp
Remove GridElement
This commit is contained in:
parent
596fe56bfd
commit
8aba74e6ee
2 changed files with 6 additions and 18 deletions
|
@ -63,12 +63,6 @@ TerrainGrid::~TerrainGrid()
|
|||
}
|
||||
}
|
||||
|
||||
class GridElement
|
||||
{
|
||||
public:
|
||||
osg::ref_ptr<osg::Node> mNode;
|
||||
};
|
||||
|
||||
osg::ref_ptr<osg::Node> TerrainGrid::buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter)
|
||||
{
|
||||
if (chunkSize * mNumSplits > 1.f)
|
||||
|
@ -208,11 +202,9 @@ void TerrainGrid::loadCell(int x, int y)
|
|||
if (!terrainNode)
|
||||
return; // no terrain defined
|
||||
|
||||
std::auto_ptr<GridElement> element (new GridElement);
|
||||
element->mNode = terrainNode;
|
||||
mTerrainRoot->addChild(element->mNode);
|
||||
mTerrainRoot->addChild(terrainNode);
|
||||
|
||||
mGrid[std::make_pair(x,y)] = element.release();
|
||||
mGrid[std::make_pair(x,y)] = terrainNode;
|
||||
}
|
||||
|
||||
void TerrainGrid::unloadCell(int x, int y)
|
||||
|
@ -221,13 +213,11 @@ void TerrainGrid::unloadCell(int x, int y)
|
|||
if (it == mGrid.end())
|
||||
return;
|
||||
|
||||
GridElement* element = it->second;
|
||||
mTerrainRoot->removeChild(element->mNode);
|
||||
osg::Node* terrainNode = it->second;
|
||||
mTerrainRoot->removeChild(terrainNode);
|
||||
|
||||
if (mUnrefQueue.get())
|
||||
mUnrefQueue->push(element->mNode);
|
||||
|
||||
delete element;
|
||||
mUnrefQueue->push(terrainNode);
|
||||
|
||||
mGrid.erase(it);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@ namespace SceneUtil
|
|||
namespace Terrain
|
||||
{
|
||||
|
||||
class GridElement;
|
||||
|
||||
/// @brief Simple terrain implementation that loads cells in a grid, with no LOD
|
||||
class TerrainGrid : public Terrain::World
|
||||
{
|
||||
|
@ -38,7 +36,7 @@ namespace Terrain
|
|||
typedef std::map<std::string, osg::ref_ptr<osg::Texture2D> > TextureCache;
|
||||
TextureCache mTextureCache;
|
||||
|
||||
typedef std::map<std::pair<int, int>, GridElement*> Grid;
|
||||
typedef std::map<std::pair<int, int>, osg::ref_ptr<osg::Node> > Grid;
|
||||
Grid mGrid;
|
||||
|
||||
osg::ref_ptr<SceneUtil::UnrefQueue> mUnrefQueue;
|
||||
|
|
Loading…
Reference in a new issue