diff --git a/src/osgTerrain/GeometryTechnique.cpp b/src/osgTerrain/GeometryTechnique.cpp index d386e1aa5..0b326b865 100644 --- a/src/osgTerrain/GeometryTechnique.cpp +++ b/src/osgTerrain/GeometryTechnique.cpp @@ -903,7 +903,7 @@ void GeometryTechnique::generateGeometry(BufferData& buffer, Locator* masterLoca _neighbours.clear(); - bool updateNeighboursImmediately = true; + bool updateNeighboursImmediately = false; if (left_tile.valid()) addNeighbour(left_tile.get()); if (right_tile.valid()) addNeighbour(right_tile.get()); diff --git a/src/osgTerrain/Terrain.cpp b/src/osgTerrain/Terrain.cpp index f5ae4257b..a0f0d0919 100644 --- a/src/osgTerrain/Terrain.cpp +++ b/src/osgTerrain/Terrain.cpp @@ -84,15 +84,21 @@ void Terrain::traverse(osg::NodeVisitor& nv) osgUtil::UpdateVisitor* uv = dynamic_cast(&nv); if (uv) { - OpenThreads::ScopedLock lock(_mutex); - for(TerrainTileSet::iterator itr = _updateTerrainTileSet.begin(); - itr != _updateTerrainTileSet.end(); + typedef std::list< osg::ref_ptr > TerrainTileList; + TerrainTileList tiles; + { + OpenThreads::ScopedLock lock(_mutex); + std::copy(_updateTerrainTileSet.begin(), _updateTerrainTileSet.end(), std::back_inserter(tiles)); + _updateTerrainTileSet.clear(); + } + + for(TerrainTileList::iterator itr = tiles.begin(); + itr != tiles.end(); ++itr) { TerrainTile* tile = *itr; tile->traverse(nv); } - _updateTerrainTileSet.clear(); } }