OgrePage.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __Ogre_Page_H__
#define __Ogre_Page_H__
#include "OgrePagingPrerequisites.h"
#include "Threading/OgreThreadHeaders.h"
#include "OgreWorkQueue.h"
namespace Ogre
{
class _OgrePagingExport Page : public WorkQueue::RequestHandler,
public WorkQueue::ResponseHandler, public PageAlloc
{
public:
typedef vector<PageContentCollection*>::type ContentCollectionList;
protected:
PageID mID;
PagedWorldSection* mParent;
unsigned long mFrameLastHeld;
ContentCollectionList mContentCollections;
uint16 mWorkQueueChannel;
bool mDeferredProcessInProgress;
bool mModified;
SceneNode* mDebugNode;
void updateDebugDisplay();
struct PageData : public PageAlloc
{
ContentCollectionList collectionsToAdd;
};
struct PageRequest
{
Page* srcPage;
_OgrePagingExport friend std::ostream& operator<<(std::ostream& o, const PageRequest& r)
{ return o; }
PageRequest(Page* p): srcPage(p) {}
};
struct PageResponse
{
PageData* pageData;
_OgrePagingExport friend std::ostream& operator<<(std::ostream& o, const PageResponse& r)
{ return o; }
PageResponse() : pageData(0) {}
};
virtual bool prepareImpl(PageData* dataToPopulate);
virtual bool prepareImpl(StreamSerialiser& str, PageData* dataToPopulate);
virtual void loadImpl();
String generateFilename() const;
public:
static const uint32 CHUNK_ID;
static const uint16 CHUNK_VERSION;
static const uint32 CHUNK_CONTENTCOLLECTION_DECLARATION_ID;
Page(PageID pageID, PagedWorldSection* parent);
virtual ~Page();
PageManager* getManager() const;
SceneManager* getSceneManager() const;
bool isDeferredProcessInProgress() const { return mDeferredProcessInProgress; }
virtual PageID getID() const { return mID; }
virtual PagedWorldSection* getParentSection() const { return mParent; }
virtual unsigned long getFrameLastHeld() { return mFrameLastHeld; }
virtual void touch();
virtual void load(bool synchronous);
virtual void unload();
virtual bool isHeld() const;
virtual void save();
virtual void save(const String& filename);
virtual void save(StreamSerialiser& stream);
virtual void frameStart(Real timeSinceLastFrame);
virtual void frameEnd(Real timeElapsed);
virtual void notifyCamera(Camera* cam);
virtual PageContentCollection* createContentCollection(const String& typeName);
virtual void destroyContentCollection(PageContentCollection* coll);
virtual void destroyAllContentCollections();
virtual size_t getContentCollectionCount() const;
virtual PageContentCollection* getContentCollection(size_t index);
const ContentCollectionList& getContentCollectionList() const;
bool canHandleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ);
WorkQueue::Response* handleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ);
bool canHandleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
void handleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
void _notifyModified() { mModified = true; }
bool isModified() const { return mModified; }
static const uint16 WORKQUEUE_PREPARE_REQUEST;
static const uint16 WORKQUEUE_CHANGECOLLECTION_REQUEST;
_OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const Page& p );
};
}
#endif
Ogre::Page::mWorkQueueChannel
uint16 mWorkQueueChannel
Definition: OgrePage.h:59
OgreWorkQueue.h
_OgrePagingExport
#define _OgrePagingExport
Definition: OgrePagingPrerequisites.h:72
Ogre::Page::WORKQUEUE_CHANGECOLLECTION_REQUEST
static const uint16 WORKQUEUE_CHANGECOLLECTION_REQUEST
Definition: OgrePage.h:192
Ogre::Page::isDeferredProcessInProgress
bool isDeferredProcessInProgress() const
If true, it&#39;s not safe to access this Page at this time, contents may be changing.
Definition: OgrePage.h:110
Ogre::Page::mID
PageID mID
Definition: OgrePage.h:55
Ogre::Page::PageResponse::PageResponse
PageResponse()
Definition: OgrePage.h:86
Ogre::WorkQueue
Interface to a general purpose request / response style background work queue.
Definition: OgreWorkQueue.h:70
Ogre::Page
Page class.
Definition: OgrePage.h:49
Ogre::Page::mContentCollections
ContentCollectionList mContentCollections
Definition: OgrePage.h:58
Ogre::Page::mDeferredProcessInProgress
bool mDeferredProcessInProgress
Definition: OgrePage.h:60
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::Page::PageData::collectionsToAdd
ContentCollectionList collectionsToAdd
Definition: OgrePage.h:68
Ogre::Page::_notifyModified
void _notifyModified()
Tell the page that it is modified.
Definition: OgrePage.h:188
OgrePagingPrerequisites.h
Ogre::Page::mFrameLastHeld
unsigned long mFrameLastHeld
Definition: OgrePage.h:57
Ogre::PagedWorldSection
Represents a section of the PagedWorld which uses a given PageStrategy, and which is made up of a gen...
Definition: OgrePagedWorldSection.h:69
Ogre::SceneNode
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:58
Ogre::Page::getID
virtual PageID getID() const
Get the ID of this page, unique within the parent.
Definition: OgrePage.h:113
Ogre::Page::mDebugNode
SceneNode * mDebugNode
Definition: OgrePage.h:63
Ogre::Page::CHUNK_VERSION
static const uint16 CHUNK_VERSION
Definition: OgrePage.h:99
Ogre::Page::mParent
PagedWorldSection * mParent
Definition: OgrePage.h:56
Ogre::Page::WORKQUEUE_PREPARE_REQUEST
static const uint16 WORKQUEUE_PREPARE_REQUEST
Definition: OgrePage.h:191
Ogre::WorkQueue::Request
General purpose request structure.
Definition: OgreWorkQueue.h:83
Ogre::Page::getParentSection
virtual PagedWorldSection * getParentSection() const
Get the PagedWorldSection this page belongs to.
Definition: OgrePage.h:115
Ogre::Page::CHUNK_CONTENTCOLLECTION_DECLARATION_ID
static const uint32 CHUNK_CONTENTCOLLECTION_DECLARATION_ID
Definition: OgrePage.h:101
Ogre::WorkQueue::Response
General purpose response structure.
Definition: OgreWorkQueue.h:122
Ogre::operator<<
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:636
Ogre::PageManager
The PageManager is the entry point through which you load all PagedWorld instances, and the place where PageStrategy instances and factory classes are registered to customise the paging behaviour.
Definition: OgrePageManager.h:136
Ogre::Page::CHUNK_ID
static const uint32 CHUNK_ID
Definition: OgrePage.h:98
Ogre::PageContentCollection
Definition of the interface for a collection of PageContent instances.
Definition: OgrePageContentCollection.h:55
Ogre::Page::PageRequest::PageRequest
PageRequest(Page *p)
Definition: OgrePage.h:77
Ogre::Page::PageResponse::pageData
PageData * pageData
Definition: OgrePage.h:81
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::Page::PageResponse::operator<<
_OgrePagingExport friend std::ostream & operator<<(std::ostream &o, const PageResponse &r)
Definition: OgrePage.h:83
Ogre::StreamSerialiser
Utility class providing helper methods for reading / writing structured data held in a DataStream...
Definition: OgreStreamSerialiser.h:66
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
Ogre::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
OgreThreadHeaders.h
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::Page::ContentCollectionList
vector< PageContentCollection * >::type ContentCollectionList
Definition: OgrePage.h:53
Ogre::WorkQueue::ResponseHandler
Interface definition for a handler of responses.
Definition: OgreWorkQueue.h:196
Ogre::Page::PageResponse
Definition: OgrePage.h:79
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::Page::mModified
bool mModified
Definition: OgrePage.h:61
Ogre::Page::PageRequest::srcPage
Page * srcPage
Definition: OgrePage.h:73
Ogre::Page::PageRequest::operator<<
_OgrePagingExport friend std::ostream & operator<<(std::ostream &o, const PageRequest &r)
Definition: OgrePage.h:74
Ogre::Page::isModified
bool isModified() const
Definition: OgrePage.h:189
Ogre::SceneManager
Manages the organisation and rendering of a &#39;scene&#39; i.e.
Definition: OgreSceneManager.h:143
Ogre::WorkQueue::RequestHandler
Interface definition for a handler of requests.
Definition: OgreWorkQueue.h:161
Ogre::Page::PageData
Definition: OgrePage.h:66
Ogre::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
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::PageRequest
Structure for holding background page requests.
Definition: OgrePage.h:71

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