OgrePagedWorldSection.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28
29#ifndef __Ogre_PagedWorldSection_H__
30#define __Ogre_PagedWorldSection_H__
31
33#include "OgreAxisAlignedBox.h"
34
35namespace Ogre
36{
70 {
71 public:
73 protected:
82
84 virtual void loadSubtypeData(StreamSerialiser& ser) {}
85 virtual void saveSubtypeData(StreamSerialiser& ser) {}
86
87
88 public:
89 static const uint32 CHUNK_ID;
90 static const uint16 CHUNK_VERSION;
91
93 PagedWorldSection(const String& name, PagedWorld* parent, SceneManager* sm);
95
97
99 virtual const String& getName() const { return mName; }
101 virtual PageStrategy* getStrategy() const { return mStrategy; }
107 virtual void setStrategy(PageStrategy* strat);
113 virtual void setStrategy(const String& stratName);
114
120 virtual void setSceneManager(SceneManager* sm);
121
128 virtual void setSceneManager(const String& smName);
130 virtual SceneManager* getSceneManager() const { return mSceneMgr; }
131
133 virtual PagedWorld* getWorld() const { return mParent; }
135 virtual PageStrategyData* getStrategyData() const { return mStrategyData; }
137 virtual void setBoundingBox(const AxisAlignedBox& box);
139 virtual const AxisAlignedBox& getBoundingBox() const;
140
141
143 virtual bool load(StreamSerialiser& stream);
145 virtual void save(StreamSerialiser& stream);
146
147
149 virtual void frameStart(Real timeSinceLastFrame);
151 virtual void frameEnd(Real timeElapsed);
153 virtual void notifyCamera(Camera* cam);
154
162 virtual Page* loadOrCreatePage(const Vector3& worldPos);
163
165 virtual PageID getPageID(const Vector3& worldPos);
166
167
178 virtual void loadPage(PageID pageID, bool forceSynchronous = false);
179
187 virtual void unloadPage(PageID pageID, bool forceSynchronous = false);
195 virtual void unloadPage(Page* p, bool forceSynchronous = false);
203 virtual bool _prepareProceduralPage(Page* page);
211 virtual bool _loadProceduralPage(Page* page);
219 virtual bool _unloadProceduralPage(Page* page);
227 virtual bool _unprepareProceduralPage(Page* page);
228
242 virtual void holdPage(PageID pageID);
243
249 virtual Page* getPage(PageID pageID);
250
255 virtual void removeAllPages();
256
268 virtual void setPageProvider(PageProvider* provider) { mPageProvider = provider; }
269
271 virtual PageProvider* getPageProvider() const { return mPageProvider; }
272
280
288
291 _OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const PagedWorldSection& p );
292
294 virtual const String& getType();
295
296 };
297
298
302 {
303 public:
305 virtual const String& getName() const = 0;
306 virtual PagedWorldSection* createInstance(const String& name, PagedWorld* parent, SceneManager* sm) = 0;
308
309
310 };
311
314}
315
316#endif
#define _OgrePagingExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
A 3D box aligned with the x/y/z axes.
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
The PageManager is the entry point through which you load all PagedWorld instances,...
Abstract class that can be implemented by the user application to provide a way to retrieve or genera...
Abstract marker class representing the data held against the PagedWorldSection which is specifically ...
Defines the interface to a strategy class which is responsible for deciding when Page instances are r...
Page class.
Definition: OgrePage.h:51
A factory class for creating types of world section.
virtual void destroyInstance(PagedWorldSection *)=0
virtual PagedWorldSection * createInstance(const String &name, PagedWorld *parent, SceneManager *sm)=0
virtual const String & getName() const =0
Represents a section of the PagedWorld which uses a given PageStrategy, and which is made up of a gen...
virtual const AxisAlignedBox & getBoundingBox() const
Get the bounds of this section.
virtual void loadPage(PageID pageID, bool forceSynchronous=false)
Ask for a page to be loaded with the given (section-relative) PageID.
virtual void setStrategy(PageStrategy *strat)
Change the page strategy.
static const uint32 CHUNK_ID
virtual void loadSubtypeData(StreamSerialiser &ser)
Load data specific to a subtype of this class (if any)
virtual void removeAllPages()
Remove all pages immediately.
PagedWorldSection(const String &name, PagedWorld *parent, SceneManager *sm)
Construct a new instance, specifying the parent and scene manager.
virtual void setBoundingBox(const AxisAlignedBox &box)
Set the bounds of this section.
virtual PageID getPageID(const Vector3 &worldPos)
Get the page ID for a given world position.
virtual bool _prepareProceduralPage(Page *page)
Give a section the opportunity to prepare page content procedurally.
virtual Page * loadOrCreatePage(const Vector3 &worldPos)
Load or create a page against this section covering the given world space position.
virtual void setPageProvider(PageProvider *provider)
Set the PageProvider which can provide streams Pages in this section.
virtual void setStrategy(const String &stratName)
Change the page strategy.
virtual void notifyCamera(Camera *cam)
Notify a section of the current camera.
virtual void saveSubtypeData(StreamSerialiser &ser)
virtual SceneManager * getSceneManager() const
Get the current SceneManager.
virtual void unloadPage(PageID pageID, bool forceSynchronous=false)
Ask for a page to be unloaded with the given (section-relative) PageID.
map< PageID, Page * >::type PageMap
PageStrategyData * mStrategyData
virtual bool _unloadProceduralPage(Page *page)
Give a section the opportunity to unload page content procedurally.
static const uint16 CHUNK_VERSION
virtual void holdPage(PageID pageID)
Ask for a page to be kept in memory if it's loaded.
virtual PagedWorld * getWorld() const
Get the parent world.
virtual void save(StreamSerialiser &stream)
Save this section to a stream.
virtual bool _unprepareProceduralPage(Page *page)
Give a section the opportunity to unprepare page content procedurally.
virtual const String & getType()
Get the type name of this section.
virtual bool load(StreamSerialiser &stream)
Load this section from a stream (returns true if successful)
virtual PageProvider * getPageProvider() const
Get the PageProvider which can provide streams for Pages in this section.
virtual bool _loadProceduralPage(Page *page)
Give a section the opportunity to prepare page content procedurally.
PageManager * getManager() const
virtual PageStrategyData * getStrategyData() const
Get the data required by the PageStrategy which is specific to this world section.
virtual void setSceneManager(const String &smName)
Change the SceneManager.
virtual void frameStart(Real timeSinceLastFrame)
Called when the frame starts.
virtual void unloadPage(Page *p, bool forceSynchronous=false)
Ask for a page to be unloaded with the given (section-relative) PageID.
virtual StreamSerialiser * _readPageStream(PageID pageID)
Get a serialiser set up to read Page data for the given PageID.
virtual void frameEnd(Real timeElapsed)
Called when the frame ends.
virtual StreamSerialiser * _writePageStream(PageID pageID)
Get a serialiser set up to write Page data for the given PageID.
virtual PageStrategy * getStrategy() const
Get the page strategy which this section is using.
virtual void setSceneManager(SceneManager *sm)
Change the SceneManager.
virtual Page * getPage(PageID pageID)
Retrieves a Page.
virtual const String & getName() const
Get the name of this section.
This class represents a collection of pages which make up a world.
Manages the organisation and rendering of a 'scene' i.e.
Utility class providing helper methods for reading / writing structured data held in a DataStream.
Standard 3-dimensional vector.
Definition: OgreVector3.h:52
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:636
uint32 PageID
Identifier for a page.
float Real
Software floating point type.
unsigned short uint16
Definition: OgrePlatform.h:360
unsigned int uint32
Definition: OgrePlatform.h:359
_StringBase String

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.