OgrePage.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __Ogre_Page_H__
30 #define __Ogre_Page_H__
31 
34 #include "OgreWorkQueue.h"
35 
36 
37 namespace Ogre
38 {
51  {
52  public:
54  protected:
57  unsigned long mFrameLastHeld;
61  bool mModified;
62 
65 
66  struct PageData : public PageAlloc
67  {
69  };
71  struct PageRequest
72  {
74  _OgrePagingExport friend std::ostream& operator<<(std::ostream& o, const PageRequest& r)
75  { return o; }
76 
77  PageRequest(Page* p): srcPage(p) {}
78  };
79  struct PageResponse
80  {
82 
83  _OgrePagingExport friend std::ostream& operator<<(std::ostream& o, const PageResponse& r)
84  { return o; }
85 
86  PageResponse() : pageData(0) {}
87  };
88 
89 
90 
91  virtual bool prepareImpl(PageData* dataToPopulate);
92  virtual bool prepareImpl(StreamSerialiser& str, PageData* dataToPopulate);
93  virtual void loadImpl();
94 
96 
97  public:
98  static const uint32 CHUNK_ID;
99  static const uint16 CHUNK_VERSION;
100 
102 
103  Page(PageID pageID, PagedWorldSection* parent);
104  virtual ~Page();
105 
108 
110  bool isDeferredProcessInProgress() const { return mDeferredProcessInProgress; }
111 
113  virtual PageID getID() const { return mID; }
115  virtual PagedWorldSection* getParentSection() const { return mParent; }
121  virtual unsigned long getFrameLastHeld() { return mFrameLastHeld; }
123  virtual void touch();
124 
128  virtual void load(bool synchronous);
131  virtual void unload();
132 
133 
139  virtual bool isHeld() const;
140 
142  virtual void save();
144  virtual void save(const String& filename);
146  virtual void save(StreamSerialiser& stream);
147 
149  virtual void frameStart(Real timeSinceLastFrame);
151  virtual void frameEnd(Real timeElapsed);
153  virtual void notifyCamera(Camera* cam);
154 
161 
171  virtual size_t getContentCollectionCount() const;
176 
178  bool canHandleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ);
182  bool canHandleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
184  void handleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
185 
186 
188  void _notifyModified() { mModified = true; }
189  bool isModified() const { return mModified; }
190 
193 
196  _OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const Page& p );
197 
198 
199 
200  };
201 
204 }
205 
206 #endif
Ogre::Page::isDeferredProcessInProgress
bool isDeferredProcessInProgress() const
If true, it's not safe to access this Page at this time, contents may be changing.
Definition: OgrePage.h:110
Ogre::Page::getParentSection
virtual PagedWorldSection * getParentSection() const
Get the PagedWorldSection this page belongs to.
Definition: OgrePage.h:115
Ogre::Page::getManager
PageManager * getManager() const
Ogre::Page::destroyAllContentCollections
virtual void destroyAllContentCollections()
Destroy all PageContentCollections within this page.
Ogre::WorkQueue
Interface to a general purpose request / response style background work queue.
Definition: OgreWorkQueue.h:71
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:59
Ogre::WorkQueue::Request
General purpose request structure.
Definition: OgreWorkQueue.h:84
Ogre
Definition: OgreAndroidLogListener.h:35
Ogre::Page::isModified
bool isModified() const
Definition: OgrePage.h:189
Ogre::Page::handleRequest
WorkQueue::Response * handleRequest(const WorkQueue::Request *req, const WorkQueue *srcQ)
WorkQueue::RequestHandler override.
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
Ogre::Page::prepareImpl
virtual bool prepareImpl(PageData *dataToPopulate)
Ogre::Page::mDebugNode
SceneNode * mDebugNode
Definition: OgrePage.h:63
Ogre::Page::getFrameLastHeld
virtual unsigned long getFrameLastHeld()
Get the frame number in which this Page was last loaded or held.
Definition: OgrePage.h:121
Ogre::Page::loadImpl
virtual void loadImpl()
OgrePagingPrerequisites.h
Ogre::Page::getID
virtual PageID getID() const
Get the ID of this page, unique within the parent.
Definition: OgrePage.h:113
Ogre::Page::touch
virtual void touch()
'Touch' the page to let it know it's being used
Ogre::Page::canHandleRequest
bool canHandleRequest(const WorkQueue::Request *req, const WorkQueue *srcQ)
WorkQueue::RequestHandler override.
Ogre::Page::generateFilename
String generateFilename() const
Ogre::Page::WORKQUEUE_PREPARE_REQUEST
static const uint16 WORKQUEUE_PREPARE_REQUEST
Definition: OgrePage.h:191
Ogre::Page::getContentCollectionCount
virtual size_t getContentCollectionCount() const
Get the number of content collections.
Ogre::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
Ogre::Page::mFrameLastHeld
unsigned long mFrameLastHeld
Definition: OgrePage.h:57
Ogre::PageManager
The PageManager is the entry point through which you load all PagedWorld instances,...
Definition: OgrePageManager.h:137
Ogre::WorkQueue::Response
General purpose response structure.
Definition: OgreWorkQueue.h:123
Ogre::Page::prepareImpl
virtual bool prepareImpl(StreamSerialiser &str, PageData *dataToPopulate)
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::Page::load
virtual void load(bool synchronous)
Load this page.
Ogre::Page::PageData::collectionsToAdd
ContentCollectionList collectionsToAdd
Definition: OgrePage.h:68
Ogre::Page::~Page
virtual ~Page()
Ogre::SceneNode
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:59
Ogre::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre::Page::mModified
bool mModified
Definition: OgrePage.h:61
Ogre::Page::PageResponse
Definition: OgrePage.h:80
Ogre::Page::PageResponse::pageData
PageData * pageData
Definition: OgrePage.h:81
Ogre::operator<<
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:636
Ogre::Page::getSceneManager
SceneManager * getSceneManager() const
Ogre::Page::save
virtual void save(const String &filename)
Save page data to a file.
Ogre::SceneManager
Manages the organisation and rendering of a 'scene' i.e.
Definition: OgreSceneManager.h:144
Ogre::Page::getContentCollection
virtual PageContentCollection * getContentCollection(size_t index)
Get a content collection.
Ogre::PageContentCollection
Definition of the interface for a collection of PageContent instances.
Definition: OgrePageContentCollection.h:56
Ogre::WorkQueue::ResponseHandler
Interface definition for a handler of responses.
Definition: OgreWorkQueue.h:197
Ogre::Page::save
virtual void save()
Save page data to an automatically generated file name.
OgreThreadHeaders.h
Ogre::Page
Page class.
Definition: OgrePage.h:51
Ogre::Page::createContentCollection
virtual PageContentCollection * createContentCollection(const String &typeName)
Create a new PageContentCollection within this page.
Ogre::Page::_notifyModified
void _notifyModified()
Tell the page that it is modified.
Definition: OgrePage.h:188
Ogre::Page::PageData
Definition: OgrePage.h:67
Ogre::Page::CHUNK_ID
static const uint32 CHUNK_ID
Definition: OgrePage.h:98
Ogre::Page::CHUNK_CONTENTCOLLECTION_DECLARATION_ID
static const uint32 CHUNK_CONTENTCOLLECTION_DECLARATION_ID
Definition: OgrePage.h:101
Ogre::Page::PageRequest::PageRequest
PageRequest(Page *p)
Definition: OgrePage.h:77
Ogre::Page::canHandleResponse
bool canHandleResponse(const WorkQueue::Response *res, const WorkQueue *srcQ)
WorkQueue::ResponseHandler override.
Ogre::Page::PageResponse::operator<<
_OgrePagingExport friend std::ostream & operator<<(std::ostream &o, const PageResponse &r)
Definition: OgrePage.h:83
Ogre::PagedWorldSection
Represents a section of the PagedWorld which uses a given PageStrategy, and which is made up of a gen...
Definition: OgrePagedWorldSection.h:70
Ogre::Page::notifyCamera
virtual void notifyCamera(Camera *cam)
Notify a section of the current camera.
Ogre::Page::mDeferredProcessInProgress
bool mDeferredProcessInProgress
Definition: OgrePage.h:60
Ogre::Page::handleResponse
void handleResponse(const WorkQueue::Response *res, const WorkQueue *srcQ)
WorkQueue::ResponseHandler override.
Ogre::StreamSerialiser
Utility class providing helper methods for reading / writing structured data held in a DataStream.
Definition: OgreStreamSerialiser.h:67
OgreWorkQueue.h
Ogre::Page::PageRequest
Structure for holding background page requests.
Definition: OgrePage.h:72
Ogre::Page::mID
PageID mID
Definition: OgrePage.h:55
Ogre::Page::updateDebugDisplay
void updateDebugDisplay()
Ogre::Page::Page
Page(PageID pageID, PagedWorldSection *parent)
Ogre::Page::unload
virtual void unload()
Unload this page.
Ogre::Page::isHeld
virtual bool isHeld() const
Returns whether this page was 'held' in the last frame, that is was it either directly needed,...
Ogre::Page::CHUNK_VERSION
static const uint16 CHUNK_VERSION
Definition: OgrePage.h:99
Ogre::WorkQueue::RequestHandler
Interface definition for a handler of requests.
Definition: OgreWorkQueue.h:162
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::Page::destroyContentCollection
virtual void destroyContentCollection(PageContentCollection *coll)
Destroy a PageContentCollection within this page.
Ogre::Page::ContentCollectionList
vector< PageContentCollection * >::type ContentCollectionList
Definition: OgrePage.h:53
Ogre::Page::mParent
PagedWorldSection * mParent
Definition: OgrePage.h:56
Ogre::Page::PageRequest::operator<<
_OgrePagingExport friend std::ostream & operator<<(std::ostream &o, const PageRequest &r)
Definition: OgrePage.h:74
Ogre::Page::frameEnd
virtual void frameEnd(Real timeElapsed)
Called when the frame ends.
Ogre::Page::save
virtual void save(StreamSerialiser &stream)
Save page data to a serialiser.
Ogre::vector
Definition: OgrePrerequisites.h:492
Ogre::Page::PageRequest::srcPage
Page * srcPage
Definition: OgrePage.h:73
Ogre::Page::frameStart
virtual void frameStart(Real timeSinceLastFrame)
Called when the frame starts.
Ogre::Page::getContentCollectionList
const ContentCollectionList & getContentCollectionList() const
Get the list of content collections.
Ogre::Page::mWorkQueueChannel
uint16 mWorkQueueChannel
Definition: OgrePage.h:59
Ogre::Page::WORKQUEUE_CHANGECOLLECTION_REQUEST
static const uint16 WORKQUEUE_CHANGECOLLECTION_REQUEST
Definition: OgrePage.h:192
Ogre::Page::mContentCollections
ContentCollectionList mContentCollections
Definition: OgrePage.h:58
Ogre::Page::PageResponse::PageResponse
PageResponse()
Definition: OgrePage.h:86
_OgrePagingExport
#define _OgrePagingExport
Definition: OgrePagingPrerequisites.h:72

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