OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
world.hpp
Go to the documentation of this file.
1 #ifndef COMPONENTS_TERRAIN_WORLD_H
2 #define COMPONENTS_TERRAIN_WORLD_H
3 
4 #include <osg/ref_ptr>
5 
6 #include "defs.hpp"
7 #include "buffercache.hpp"
8 
9 namespace osg
10 {
11  class Group;
12 }
13 
14 namespace osgUtil
15 {
16  class IncrementalCompileOperation;
17 }
18 
19 namespace Resource
20 {
21  class ResourceSystem;
22 }
23 
24 namespace Terrain
25 {
26  class Storage;
27 
32  class World
33  {
34  public:
38  World(osg::Group* parent, Resource::ResourceSystem* resourceSystem, osgUtil::IncrementalCompileOperation* ico,
39  Storage* storage, int nodeMask);
40  virtual ~World();
41 
42  virtual void updateTextureFiltering() {}
43 
44  virtual void updateCache() {}
45 
46  float getHeightAt (const osg::Vec3f& worldPos);
47 
48  virtual osg::ref_ptr<osg::Node> cacheCell(int x, int y) {return NULL;}
49 
50  // This is only a hint and may be ignored by the implementation.
51  virtual void loadCell(int x, int y) {}
52  virtual void unloadCell(int x, int y) {}
53 
54  Storage* getStorage() { return mStorage; }
55 
56  protected:
58 
59  osg::ref_ptr<osg::Group> mParent;
60  osg::ref_ptr<osg::Group> mTerrainRoot;
61 
63 
64  osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
65  };
66 
67 }
68 
69 #endif
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:24
The basic interface for a terrain world. How the terrain chunks are paged and displayed is up to the ...
Definition: world.hpp:32
World(osg::Group *parent, Resource::ResourceSystem *resourceSystem, osgUtil::IncrementalCompileOperation *ico, Storage *storage, int nodeMask)
Definition: world.cpp:11
osg::ref_ptr< osgUtil::IncrementalCompileOperation > mIncrementalCompileOperation
Definition: world.hpp:64
Storage * mStorage
Definition: world.hpp:57
virtual void loadCell(int x, int y)
Definition: world.hpp:51
We keep storage of terrain data abstract here since we need different implementations for game and ed...
Definition: storage.hpp:21
virtual ~World()
Definition: world.cpp:25
osg::ref_ptr< osg::Group > mTerrainRoot
Definition: world.hpp:60
virtual void updateTextureFiltering()
Definition: world.hpp:42
virtual void updateCache()
Definition: world.hpp:44
Resource::ResourceSystem * mResourceSystem
Definition: world.hpp:62
virtual void unloadCell(int x, int y)
Definition: world.hpp:52
Storage * getStorage()
Definition: world.hpp:54
virtual osg::ref_ptr< osg::Node > cacheCell(int x, int y)
Definition: world.hpp:48
float getHeightAt(const osg::Vec3f &worldPos)
Definition: world.cpp:32
osg::ref_ptr< osg::Group > mParent
Definition: world.hpp:59