OgreTerrainPagedWorldSection.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_TerrainPagedWorldSection_H__
30 #define __Ogre_TerrainPagedWorldSection_H__
31 
33 #include "OgrePagedWorldSection.h"
34 #include "OgrePageManager.h"
35 #include "OgreWorkQueue.h"
36 #include "OgreTerrainGroup.h"
37 
38 
39 namespace Ogre
40 {
41  class Grid2DPageStrategy;
42  class Grid2DPageStrategyData;
43  class TerrainGroup;
44 
83  {
84  public:
92 
102  virtual void init(TerrainGroup* grp);
103 
109  virtual TerrainGroup* getTerrainGroup() { return mTerrainGroup; }
110 
112  virtual void setLoadRadius(Real sz);
114  virtual Real getLoadRadius() const;
116  virtual void setHoldRadius(Real sz);
118  virtual Real getHoldRadius();
120  virtual void setPageRange(int32 minX, int32 minY, int32 maxX, int32 maxY);
122  virtual void setPageRangeMinX(int32 minX);
124  virtual void setPageRangeMinY(int32 minY);
126  virtual void setPageRangeMaxX(int32 maxX);
128  virtual void setPageRangeMaxY(int32 maxY);
130  virtual int32 getPageRangeMinX() const;
132  virtual int32 getPageRangeMinY() const;
134  virtual int32 getPageRangeMaxX() const;
136  virtual int32 getPageRangeMaxY() const;
137 
142 
144  virtual void setLoadingIntervalMs(uint32 loadingIntervalMs);
146  virtual uint32 getLoadingIntervalMs() const;
147 
149  void loadPage(PageID pageID, bool forceSynchronous = false);
151  void unloadPage(PageID pageID, bool forceSynchronous = false);
152 
156  void handleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
157 
159 
161  {
162  public:
163  virtual void define(TerrainGroup* terrainGroup, long x, long y)
164  {
165  terrainGroup->defineTerrain(x,y);
166  }
167  virtual ~TerrainDefiner() {}
168  };
169 
170  void setDefiner(TerrainDefiner* terrainDefiner)
171  {
172  if(mTerrainDefiner)
173  OGRE_DELETE mTerrainDefiner;
174  mTerrainDefiner = terrainDefiner;
175  }
176 
177  protected:
180  std::list<PageID> mPagesInLoading;
183  unsigned long mNextLoadingTime;
185 
189 
190  virtual void syncSettings();
191 
192  };
193 
194 
195 
196 
197 
200 }
201 
202 #endif
Ogre::TerrainPagedWorldSection::getPageRangeMinY
virtual int32 getPageRangeMinY() const
get the index range of all Pages (values outside this will be ignored)
Ogre::TerrainPagedWorldSection::setPageRange
virtual void setPageRange(int32 minX, int32 minY, int32 maxX, int32 maxY)
Set the index range of all Pages (values outside this will be ignored)
Ogre::TerrainPagedWorldSection::init
virtual void init(TerrainGroup *grp)
Initialise this section from an existing TerrainGroup instance.
Ogre::TerrainPagedWorldSection::setLoadRadius
virtual void setLoadRadius(Real sz)
Set the loading radius.
Ogre::TerrainPagedWorldSection::getGridStrategy
virtual Grid2DPageStrategy * getGridStrategy() const
Convenience method - this section always uses a grid strategy.
Ogre::TerrainPagedWorldSection::setHoldRadius
virtual void setHoldRadius(Real sz)
Set the Holding radius.
Ogre::int32
int int32
Definition: OgrePlatform.h:362
Ogre::TerrainPagedWorldSection::~TerrainPagedWorldSection
virtual ~TerrainPagedWorldSection()
Ogre::TerrainGroup
Helper class to assist you in managing multiple terrain instances that are connected to each other.
Definition: OgreTerrainGroup.h:72
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::TerrainPagedWorldSection::mPagesInLoading
std::list< PageID > mPagesInLoading
Definition: OgreTerrainPagedWorldSection.h:180
Ogre::Grid2DPageStrategy
Page strategy which loads new pages based on a regular 2D grid.
Definition: OgreGrid2DPageStrategy.h:232
Ogre::TerrainGroup::defineTerrain
virtual void defineTerrain(long x, long y)
Define a 'slot' in the terrain grid - in this case to be loaded from a generated file name.
Ogre::TerrainPagedWorldSection::getLoadRadius
virtual Real getLoadRadius() const
Get the loading radius.
_OgreTerrainExport
#define _OgreTerrainExport
Definition: OgreTerrainPrerequisites.h:58
OGRE_DELETE
#define OGRE_DELETE
Definition: OgreMemoryAllocatorConfig.h:474
Ogre::TerrainPagedWorldSection::unloadPage
void unloadPage(PageID pageID, bool forceSynchronous=false)
Overridden from PagedWorldSection.
Ogre::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
Ogre::WorkQueue::Response
General purpose response structure.
Definition: OgreWorkQueue.h:123
Ogre::TerrainPagedWorldSection::mWorkQueueChannel
uint16 mWorkQueueChannel
Definition: OgreTerrainPagedWorldSection.h:182
Ogre::TerrainPagedWorldSection::TerrainPagedWorldSection
TerrainPagedWorldSection(const String &name, PagedWorld *parent, SceneManager *sm)
Constructor.
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::TerrainPagedWorldSection::setPageRangeMinY
virtual void setPageRangeMinY(int32 minY)
Set the index range of all Pages (values outside this will be ignored)
Ogre::TerrainPagedWorldSection::setDefiner
void setDefiner(TerrainDefiner *terrainDefiner)
Definition: OgreTerrainPagedWorldSection.h:170
OgreTerrainPrerequisites.h
Ogre::TerrainPagedWorldSection::setPageRangeMinX
virtual void setPageRangeMinX(int32 minX)
Set the index range of all Pages (values outside this will be ignored)
Ogre::TerrainPagedWorldSection::setLoadingIntervalMs
virtual void setLoadingIntervalMs(uint32 loadingIntervalMs)
Set the interval between the loading of single pages in milliseconds (ms)
Ogre::TerrainPagedWorldSection::TerrainDefiner::~TerrainDefiner
virtual ~TerrainDefiner()
Definition: OgreTerrainPagedWorldSection.h:167
Ogre::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre::TerrainPagedWorldSection::getLoadingIntervalMs
virtual uint32 getLoadingIntervalMs() const
Get the interval between the loading of single pages in milliseconds (ms)
Ogre::TerrainPagedWorldSection::getPageRangeMaxY
virtual int32 getPageRangeMaxY() const
get the index range of all Pages (values outside this will be ignored)
Ogre::SceneManager
Manages the organisation and rendering of a 'scene' i.e.
Definition: OgreSceneManager.h:144
Ogre::TerrainPagedWorldSection::loadPage
void loadPage(PageID pageID, bool forceSynchronous=false)
Overridden from PagedWorldSection.
Ogre::TerrainPagedWorldSection::getGridStrategyData
virtual Grid2DPageStrategyData * getGridStrategyData() const
Convenience method - this section always uses a grid strategy.
Ogre::WorkQueue::ResponseHandler
Interface definition for a handler of responses.
Definition: OgreWorkQueue.h:197
Ogre::TerrainPagedWorldSection::mLoadingIntervalMs
uint32 mLoadingIntervalMs
Definition: OgreTerrainPagedWorldSection.h:184
Ogre::TerrainPagedWorldSection::mNextLoadingTime
unsigned long mNextLoadingTime
Definition: OgreTerrainPagedWorldSection.h:183
Ogre::PagedWorld
This class represents a collection of pages which make up a world.
Definition: OgrePagedWorld.h:58
Ogre::TerrainPagedWorldSection::TerrainDefiner::define
virtual void define(TerrainGroup *terrainGroup, long x, long y)
Definition: OgreTerrainPagedWorldSection.h:163
Ogre::TerrainPagedWorldSection::saveSubtypeData
void saveSubtypeData(StreamSerialiser &ser)
Ogre::TerrainPagedWorldSection
A world section which includes paged terrain.
Definition: OgreTerrainPagedWorldSection.h:83
OgreTerrainGroup.h
OgrePageManager.h
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::TerrainPagedWorldSection::setPageRangeMaxX
virtual void setPageRangeMaxX(int32 maxX)
Set the index range of all Pages (values outside this will be ignored)
Ogre::TerrainPagedWorldSection::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::TerrainPagedWorldSection::syncSettings
virtual void syncSettings()
Ogre::Grid2DPageStrategyData
Specialisation of PageStrategyData for Grid2DPageStrategy.
Definition: OgreGrid2DPageStrategy.h:121
Ogre::TerrainPagedWorldSection::setPageRangeMaxY
virtual void setPageRangeMaxY(int32 maxY)
Set the index range of all Pages (values outside this will be ignored)
Ogre::TerrainPagedWorldSection::handleRequest
WorkQueue::Response * handleRequest(const WorkQueue::Request *req, const WorkQueue *srcQ)
WorkQueue::RequestHandler override.
Ogre::TerrainPagedWorldSection::mHasRunningTasks
bool mHasRunningTasks
Definition: OgreTerrainPagedWorldSection.h:181
Ogre::TerrainPagedWorldSection::mTerrainGroup
TerrainGroup * mTerrainGroup
Definition: OgreTerrainPagedWorldSection.h:178
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::TerrainPagedWorldSection::loadSubtypeData
void loadSubtypeData(StreamSerialiser &ser)
Overridden from PagedWorldSection.
Ogre::TerrainPagedWorldSection::getPageRangeMaxX
virtual int32 getPageRangeMaxX() const
get the index range of all Pages (values outside this will be ignored)
Ogre::TerrainPagedWorldSection::getPageRangeMinX
virtual int32 getPageRangeMinX() const
get the index range of all Pages (values outside this will be ignored)
Ogre::TerrainPagedWorldSection::getHoldRadius
virtual Real getHoldRadius()
Get the Holding radius.
Ogre::TerrainPagedWorldSection::TerrainDefiner
Definition: OgreTerrainPagedWorldSection.h:161
OgrePagedWorldSection.h
Ogre::TerrainPagedWorldSection::getTerrainGroup
virtual TerrainGroup * getTerrainGroup()
Get the TerrainGroup which this world section is using.
Definition: OgreTerrainPagedWorldSection.h:109
Ogre::TerrainPagedWorldSection::WORKQUEUE_LOAD_TERRAIN_PAGE_REQUEST
static const uint16 WORKQUEUE_LOAD_TERRAIN_PAGE_REQUEST
Definition: OgreTerrainPagedWorldSection.h:158
Ogre::TerrainPagedWorldSection::mTerrainDefiner
TerrainDefiner * mTerrainDefiner
Definition: OgreTerrainPagedWorldSection.h:179

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