/usr/include/OGRE/Paging/OgrePagedWorld.h is in libogre-dev 1.7.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2011 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_PagedWorld_H__
#define __Ogre_PagedWorld_H__
#include "OgrePagingPrerequisites.h"
#include "OgreString.h"
#include "OgreDataStream.h"
#include "OgreCommon.h"
namespace Ogre
{
class PageManager;
/** \addtogroup Optional Components
* @{
*/
/** \addtogroup Paging
* Some details on paging component
* @{
*/
/** This class represents a collection of pages which make up a world.
@remarks
It's important to bear in mind that the PagedWorld only delineates the
world and knows how to find out about the contents of it. It does not,
by design, contain all elements of the world, in memory, at once.
*/
class _OgrePagingExport PagedWorld : public PageAlloc
{
protected:
String mName;
PageManager* mManager;
PageProvider* mPageProvider;
public:
static const uint32 CHUNK_ID;
static const uint16 CHUNK_VERSION;
static const uint32 CHUNK_SECTIONDECLARATION_ID;
/** Constructor.
@param name The name of the world, which must be enough to identify the
place where data for it can be loaded from (doesn't have to be a filename
necessarily).
@param manager The PageManager that is in charge of providing this world with
services such as related object factories.
*/
PagedWorld(const String& name, PageManager* manager);
virtual ~PagedWorld();
const String& getName() const { return mName; }
/// Get the manager of this world
PageManager* getManager() const { return mManager; }
/// Load world data from a file
void load(const String& filename);
/// Load world data from a stream
void load(const DataStreamPtr& stream);
/// Load world data from a serialiser (returns true if successful)
bool load(StreamSerialiser& stream);
/** Save world data to a file
@param filename The name of the file to create; this can either be an
absolute filename or
*/
void save(const String& filename);
/// Save world data to a stream
void save(const DataStreamPtr& stream);
/// Save world data to a serialiser
void save(StreamSerialiser& stream);
/** Create a new section of the world based on a specialised type.
@remarks
World sections are areas of the world that use a particular
PageStrategy, with a certain set of parameters specific to that
strategy, and potentially some other rules.
So you would have more than one section in a world only
if you needed different simultaneous paging strategies, or you
wanted the same strategy but parameterised differently.
@param sceneMgr The SceneManager to use for this section.
@param typeName The type of section to use (must be registered
with PageManager), or blank to use the default type (simple grid)
@param sectionName An optional name to give the section (if none is
provided, one will be generated)
*/
PagedWorldSection* createSection(SceneManager* sceneMgr,
const String& typeName,
const String& sectionName = StringUtil::BLANK);
/** Create a new manually defined section of the world.
@remarks
World sections are areas of the world that use a particular
PageStrategy, with a certain set of parameters specific to that
strategy. So you would have more than one section in a world only
if you needed different simultaneous paging strategies, or you
wanted the same strategy but parameterised differently.
@param strategyName The name of the strategy to use (must be registered
with PageManager)
@param sceneMgr The SceneManager to use for this section
@param sectionName An optional name to give the section (if none is
provided, one will be generated)
*/
PagedWorldSection* createSection(const String& strategyName, SceneManager* sceneMgr,
const String& sectionName = StringUtil::BLANK);
/** Create a manually defined new section of the world.
@remarks
World sections are areas of the world that use a particular
PageStrategy, with a certain set of parameters specific to that
strategy. So you would have more than one section in a world only
if you needed different simultaneous paging strategies, or you
wanted the same strategy but parameterised differently.
@param strategy The strategy to use
@param sceneMgr The SceneManager to use for this section
@param sectionName An optional name to give the section (if none is
provided, one will be generated)
*/
PagedWorldSection* createSection(PageStrategy* strategy, SceneManager* sceneMgr,
const String& sectionName = StringUtil::BLANK);
/** Destroy a section of world. */
void destroySection(const String& name);
/** Destroy a section of world. */
void destroySection(PagedWorldSection* sec);
/** Destroy all world sections */
void destroyAllSections();
/** Get the number of sections this world has. */
size_t getSectionCount() const { return mSections.size(); }
/** Retrieve a section of the world. */
PagedWorldSection* getSection(const String& name);
typedef map<String, PagedWorldSection*>::type SectionMap;
/// Retrieve a const reference to all the sections in this world
const SectionMap& getSections() const { return mSections; }
/** Set the PageProvider which can provide streams for Pages in this world.
@remarks
This is the top-level way that you can direct how Page data is loaded.
When data for a Page is requested for a PagedWorldSection, the following
sequence of classes will be checked to see if they have a provider willing
to supply the stream: PagedWorldSection, PagedWorld, PageManager.
If none of these do, then the default behaviour is to look for a file
called worldname_sectionname_pageID.page.
@note
The caller remains responsible for the destruction of the provider.
*/
void setPageProvider(PageProvider* provider) { mPageProvider = provider; }
/** Get the PageProvider which can provide streams for Pages in this world. */
PageProvider* getPageProvider() const { return mPageProvider; }
/** Give a world the opportunity to prepare page content procedurally.
@remarks
You should not call this method directly. This call may well happen in
a separate thread so it should not access GPU resources, use _loadProceduralPage
for that
@returns true if the page was populated, false otherwise
*/
virtual bool _prepareProceduralPage(Page* page, PagedWorldSection* section);
/** Give a world the opportunity to prepare page content procedurally.
@remarks
You should not call this method directly. This call will happen in
the main render thread so it can access GPU resources. Use _prepareProceduralPage
for background preparation.
@returns true if the page was populated, false otherwise
*/
virtual bool _loadProceduralPage(Page* page, PagedWorldSection* section);
/** Give a world the opportunity to unload page content procedurally.
@remarks
You should not call this method directly. This call will happen in
the main render thread so it can access GPU resources. Use _unprepareProceduralPage
for background preparation.
@returns true if the page was populated, false otherwise
*/
virtual bool _unloadProceduralPage(Page* page, PagedWorldSection* section);
/** Give a world the opportunity to unprepare page content procedurally.
@remarks
You should not call this method directly. This call may well happen in
a separate thread so it should not access GPU resources, use _unloadProceduralPage
for that
@returns true if the page was unpopulated, false otherwise
*/
virtual bool _unprepareProceduralPage(Page* page, PagedWorldSection* section);
/** Get a serialiser set up to read Page data for the given PageID.
@param pageID The ID of the page being requested
@param section The parent section to which this page will belong
@remarks
The StreamSerialiser returned is the responsibility of the caller to
delete.
*/
StreamSerialiser* _readPageStream(PageID pageID, PagedWorldSection* section);
/** Get a serialiser set up to read Page data for the given PageID.
@param pageID The ID of the page being requested
@param section The parent section to which this page will belong
@remarks
The StreamSerialiser returned is the responsibility of the caller to
delete.
*/
StreamSerialiser* _writePageStream(PageID pageID, PagedWorldSection* section);
/// Called when the frame starts
virtual void frameStart(Real timeSinceLastFrame);
/// Called when the frame ends
virtual void frameEnd(Real timeElapsed);
/// Notify a world of the current camera
virtual void notifyCamera(Camera* cam);
/** Function for writing to a stream.
*/
_OgrePagingExport friend std::ostream& operator <<( std::ostream& o, const PagedWorld& p );
protected:
SectionMap mSections;
NameGenerator mSectionNameGenerator;
};
/** @} */
/** @} */
}
#endif
|