OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
terraingrid.hpp
Go to the documentation of this file.
1 #ifndef COMPONENTS_TERRAIN_TERRAINGRID_H
2 #define COMPONENTS_TERRAIN_TERRAINGRID_H
3 
4 #include <map>
5 
6 #include <osg/Vec2f>
7 
8 #include "world.hpp"
9 
10 namespace Terrain
11 {
12 
14  class TerrainGrid : public Terrain::World
15  {
16  public:
17  TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage, int nodeMask, int preCompileMask=~0, int borderMask=0);
18  ~TerrainGrid();
19 
20  virtual void cacheCell(View* view, int x, int y);
21 
23  virtual void loadCell(int x, int y);
24 
26  virtual void unloadCell(int x, int y);
27 
28  View* createView();
29 
30  private:
31  osg::ref_ptr<osg::Node> buildTerrain (osg::Group* parent, float chunkSize, const osg::Vec2f& chunkCenter);
32 
33  // split each ESM::Cell into mNumSplits*mNumSplits terrain chunks
34  unsigned int mNumSplits;
35 
37  };
38 }
39 
40 #endif
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:30
Simple terrain implementation that loads cells in a grid, with no LOD. Only requested cells are loade...
Definition: terraingrid.hpp:14
The basic interface for a terrain world. How the terrain chunks are paged and displayed is up to the ...
Definition: world.hpp:52
unsigned int mNumSplits
Definition: terraingrid.hpp:34
osg::ref_ptr< osg::Node > buildTerrain(osg::Group *parent, float chunkSize, const osg::Vec2f &chunkCenter)
Definition: terraingrid.cpp:40
std::map< std::pair< int, int >, osg::ref_ptr< osg::Node > > CellGrid
Definition: cellborder.hpp:20
Definition: storage.hpp:22
virtual void cacheCell(View *view, int x, int y)
Definition: terraingrid.cpp:34
virtual void loadCell(int x, int y)
Definition: terraingrid.cpp:68
A View is a collection of rendering objects that are visible from a given camera/intersection. The base View class is part of the interface for usage in conjunction with preload feature.
Definition: world.hpp:39
~TerrainGrid()
Definition: terraingrid.cpp:26
TerrainGrid(osg::Group *parent, osg::Group *compileRoot, Resource::ResourceSystem *resourceSystem, Storage *storage, int nodeMask, int preCompileMask=~0, int borderMask=0)
Definition: terraingrid.cpp:20
virtual void unloadCell(int x, int y)
Definition: terraingrid.cpp:85
View * createView()
Definition: terraingrid.cpp:99
MWRender::CellBorder::CellGrid mGrid
Definition: terraingrid.hpp:36