OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
chunkmanager.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_TERRAIN_CHUNKMANAGER_H
2 #define OPENMW_COMPONENTS_TERRAIN_CHUNKMANAGER_H
3 
5 
6 #include "buffercache.hpp"
7 
8 namespace osg
9 {
10  class Group;
11  class Texture2D;
12 }
13 
14 namespace Resource
15 {
16  class SceneManager;
17 }
18 
19 namespace Terrain
20 {
21 
22  class TextureManager;
23  class CompositeMapRenderer;
24  class Storage;
25  class CompositeMap;
26 
29  {
30  public:
31  ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager, CompositeMapRenderer* renderer);
32 
33  osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& center, int lod, unsigned int lodFlags);
34 
35  void reportStats(unsigned int frameNumber, osg::Stats* stats) const override;
36 
37  void clearCache() override;
38 
39  void releaseGLObjects(osg::State* state) override;
40 
41  void setCullingActive(bool active);
42 
43  private:
44  osg::ref_ptr<osg::Node> createChunk(float size, const osg::Vec2f& center, int lod, unsigned int lodFlags);
45 
46  osg::ref_ptr<osg::Texture2D> createCompositeMapRTT();
47 
48  void createCompositeMapGeometry(float chunkSize, const osg::Vec2f& chunkCenter, const osg::Vec4f& texCoords, CompositeMap& map);
49 
50  std::vector<osg::ref_ptr<osg::StateSet> > createPasses(float chunkSize, const osg::Vec2f& chunkCenter, bool forCompositeMap);
51 
57 
58  unsigned int mCompositeMapSize;
59 
61  };
62 
63 }
64 
65 #endif
void reportStats(unsigned int frameNumber, osg::Stats *stats) const override
Definition: chunkmanager.cpp:53
Handles loading and caching of scenes, e.g. .nif files or .osg files.
Definition: scenemanager.hpp:44
Definition: texturemanager.hpp:21
osg::ref_ptr< osg::Node > createChunk(float size, const osg::Vec2f &center, int lod, unsigned int lodFlags)
Definition: chunkmanager.cpp:171
Implements creation and caching of vertex buffers for terrain chunks.
Definition: buffercache.hpp:14
ChunkManager(Storage *storage, Resource::SceneManager *sceneMgr, TextureManager *textureManager, CompositeMapRenderer *renderer)
Definition: chunkmanager.cpp:24
Handles loading and caching of terrain chunks.
Definition: chunkmanager.hpp:28
bool mCullingActive
Definition: chunkmanager.hpp:60
Definition: compositemaprenderer.hpp:20
osg::ref_ptr< osg::Texture2D > createCompositeMapRTT()
Definition: chunkmanager.cpp:76
osg::ref_ptr< osg::Node > getChunk(float size, const osg::Vec2f &center, int lod, unsigned int lodFlags)
Definition: chunkmanager.cpp:36
Terrain::Storage * mStorage
Definition: chunkmanager.hpp:52
Definition: storage.hpp:22
void clearCache() override
Clear all cache entries.
Definition: chunkmanager.cpp:58
void releaseGLObjects(osg::State *state) override
Definition: chunkmanager.cpp:65
void createCompositeMapGeometry(float chunkSize, const osg::Vec2f &chunkCenter, const osg::Vec4f &texCoords, CompositeMap &map)
Definition: chunkmanager.cpp:90
unsigned int mCompositeMapSize
Definition: chunkmanager.hpp:58
State
Definition: state.hpp:6
Resource::SceneManager * mSceneManager
Definition: chunkmanager.hpp:53
BufferCache mBufferCache
Definition: chunkmanager.hpp:56
The CompositeMapRenderer is responsible for updating composite map textures in a blocking or non-bloc...
Definition: compositemaprenderer.hpp:33
void setCullingActive(bool active)
Definition: chunkmanager.cpp:71
Base class for managers that require a virtual file system and object cache.
Definition: resourcemanager.hpp:23
CompositeMapRenderer * mCompositeMapRenderer
Definition: chunkmanager.hpp:55
std::vector< osg::ref_ptr< osg::StateSet > > createPasses(float chunkSize, const osg::Vec2f &chunkCenter, bool forCompositeMap)
Definition: chunkmanager.cpp:121
TextureManager * mTextureManager
Definition: chunkmanager.hpp:54