@ -291,6 +291,13 @@ void CSVRender::Cell::reloadAssets()
iter->second->reloadAssets();
}
if (mTerrain)
{
mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY());
mTerrain->clearCache();
mTerrain->loadCell(mCoordinates.getX(), mCoordinates.getY());
mCellWater->reloadAssets();
@ -231,4 +231,16 @@ namespace Terrain
return buffer;
void BufferCache::clearCache()
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mIndexBufferMutex);
mIndexBufferMap.clear();
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mUvBufferMutex);
mUvBufferMap.clear();
@ -22,6 +22,8 @@ namespace Terrain
/// @note Thread safe.
osg::ref_ptr<osg::Vec2Array> getUVBuffer(unsigned int numVerts);
void clearCache();
// TODO: add releaseGLObjects() for our vertex/element buffer objects
private:
@ -55,6 +55,13 @@ void ChunkManager::reportStats(unsigned int frameNumber, osg::Stats *stats) cons
stats->setAttribute(frameNumber, "Terrain Chunk", mCache->getCacheSize());
void ChunkManager::clearCache()
ResourceManager::clearCache();
mBufferCache.clearCache();
void ChunkManager::setCullingActive(bool active)
mCullingActive = active;
@ -34,6 +34,8 @@ namespace Terrain
virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const;
virtual void clearCache();
void setCullingActive(bool active);
@ -70,6 +70,12 @@ float World::getHeightAt(const osg::Vec3f &worldPos)
return mStorage->getHeightAt(worldPos);
void World::clearCache()
mTextureManager->clearCache();
mChunkManager->clearCache();
void World::updateTextureFiltering()
mTextureManager->updateTextureFiltering();
@ -67,6 +67,9 @@ namespace Terrain
virtual void cacheCell(View* view, int x, int y) {}
/// Clears cached texture and chunk data.
/// Load the cell into the scene graph.
/// @note Not thread safe.
/// @note May be ignored by derived implementations that don't organize the terrain into cells.