OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Terrain::TerrainGrid Class Reference

Simple terrain implementation that loads cells in a grid, with no LOD. More...

#include <terraingrid.hpp>

Inheritance diagram for Terrain::TerrainGrid:
Collaboration diagram for Terrain::TerrainGrid:

Public Member Functions

 TerrainGrid (osg::Group *parent, Resource::ResourceSystem *resourceSystem, osgUtil::IncrementalCompileOperation *ico, Storage *storage, int nodeMask, Shader::ShaderManager *shaderManager=NULL, SceneUtil::UnrefQueue *unrefQueue=NULL)
 
 ~TerrainGrid ()
 
virtual osg::ref_ptr< osg::Node > cacheCell (int x, int y)
 
virtual void loadCell (int x, int y)
 
virtual void unloadCell (int x, int y)
 
void updateCache ()
 
void updateTextureFiltering ()
 
- Public Member Functions inherited from Terrain::World
 World (osg::Group *parent, Resource::ResourceSystem *resourceSystem, osgUtil::IncrementalCompileOperation *ico, Storage *storage, int nodeMask)
 
virtual ~World ()
 
float getHeightAt (const osg::Vec3f &worldPos)
 
StoragegetStorage ()
 

Private Types

typedef std::map< std::string,
osg::ref_ptr< osg::Texture2D > > 
TextureCache
 
typedef std::map< std::pair
< int, int >, osg::ref_ptr
< osg::Node > > 
Grid
 

Private Member Functions

osg::ref_ptr< osg::Node > buildTerrain (osg::Group *parent, float chunkSize, const osg::Vec2f &chunkCenter)
 

Private Attributes

unsigned int mNumSplits
 
TextureCache mTextureCache
 
OpenThreads::Mutex mTextureCacheMutex
 
Grid mGrid
 
Grid mGridCache
 
OpenThreads::Mutex mGridCacheMutex
 
BufferCache mCache
 
osg::ref_ptr
< SceneUtil::UnrefQueue
mUnrefQueue
 
Shader::ShaderManagermShaderManager
 

Additional Inherited Members

- Protected Attributes inherited from Terrain::World
StoragemStorage
 
osg::ref_ptr< osg::Group > mParent
 
osg::ref_ptr< osg::Group > mTerrainRoot
 
Resource::ResourceSystemmResourceSystem
 
osg::ref_ptr
< osgUtil::IncrementalCompileOperation > 
mIncrementalCompileOperation
 

Detailed Description

Simple terrain implementation that loads cells in a grid, with no LOD.

Member Typedef Documentation

typedef std::map<std::pair<int, int>, osg::ref_ptr<osg::Node> > Terrain::TerrainGrid::Grid
private
typedef std::map<std::string, osg::ref_ptr<osg::Texture2D> > Terrain::TerrainGrid::TextureCache
private

Constructor & Destructor Documentation

Terrain::TerrainGrid::TerrainGrid ( osg::Group *  parent,
Resource::ResourceSystem resourceSystem,
osgUtil::IncrementalCompileOperation *  ico,
Storage storage,
int  nodeMask,
Shader::ShaderManager shaderManager = NULL,
SceneUtil::UnrefQueue unrefQueue = NULL 
)
Terrain::TerrainGrid::~TerrainGrid ( )

Here is the call graph for this function:

Member Function Documentation

osg::ref_ptr< osg::Node > Terrain::TerrainGrid::buildTerrain ( osg::Group *  parent,
float  chunkSize,
const osg::Vec2f &  chunkCenter 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

osg::ref_ptr< osg::Node > Terrain::TerrainGrid::cacheCell ( int  x,
int  y 
)
virtual

Load a terrain cell and store it in cache for later use.

Note
The returned ref_ptr should be kept by the caller to ensure that the terrain stays in cache for as long as needed.
Thread safe.

Reimplemented from Terrain::World.

Here is the call graph for this function:

void Terrain::TerrainGrid::loadCell ( int  x,
int  y 
)
virtual
Note
Not thread safe.

Reimplemented from Terrain::World.

Here is the call graph for this function:

void Terrain::TerrainGrid::unloadCell ( int  x,
int  y 
)
virtual
Note
Not thread safe.

Reimplemented from Terrain::World.

Here is the caller graph for this function:

void Terrain::TerrainGrid::updateCache ( )
virtual

Clear cached objects that are no longer referenced

Note
Thread safe.

Reimplemented from Terrain::World.

void Terrain::TerrainGrid::updateTextureFiltering ( )
virtual

Apply the scene manager's texture filtering settings to all cached textures.

Note
Thread safe.

Reimplemented from Terrain::World.

Here is the call graph for this function:

Member Data Documentation

BufferCache Terrain::TerrainGrid::mCache
private
Grid Terrain::TerrainGrid::mGrid
private
Grid Terrain::TerrainGrid::mGridCache
private
OpenThreads::Mutex Terrain::TerrainGrid::mGridCacheMutex
private
unsigned int Terrain::TerrainGrid::mNumSplits
private
Shader::ShaderManager* Terrain::TerrainGrid::mShaderManager
private
TextureCache Terrain::TerrainGrid::mTextureCache
private
OpenThreads::Mutex Terrain::TerrainGrid::mTextureCacheMutex
private
osg::ref_ptr<SceneUtil::UnrefQueue> Terrain::TerrainGrid::mUnrefQueue
private

The documentation for this class was generated from the following files: