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:
90  TerrainPagedWorldSection(const String& name, PagedWorld* parent, SceneManager* sm);
91  virtual ~TerrainPagedWorldSection();
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 
139  virtual Grid2DPageStrategy* getGridStrategy() const;
141  virtual Grid2DPageStrategyData* getGridStrategyData() const;
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 
154  WorkQueue::Response* handleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ);
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 
187  void loadSubtypeData(StreamSerialiser& ser);
188  void saveSubtypeData(StreamSerialiser& ser);
189 
190  virtual void syncSettings();
191 
192  };
193 
194 
195 
196 
197 
200 }
201 
202 #endif
Ogre::int32
int int32
Definition: OgrePlatform.h:362
Ogre::TerrainGroup
Helper class to assist you in managing multiple terrain instances that are connected to each other.
Definition: OgreTerrainGroup.h:70
Ogre::WorkQueue
Interface to a general purpose request / response style background work queue.
Definition: OgreWorkQueue.h:70
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::WorkQueue::Request
General purpose request structure.
Definition: OgreWorkQueue.h:83
Ogre
Definition: OgreAndroidLogListener.h:34
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:231
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.
_OgreTerrainExport
#define _OgreTerrainExport
Definition: OgreTerrainPrerequisites.h:58
OGRE_DELETE
#define OGRE_DELETE
Definition: OgreMemoryAllocatorConfig.h:474
Ogre::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
Ogre::WorkQueue::Response
General purpose response structure.
Definition: OgreWorkQueue.h:122
Ogre::TerrainPagedWorldSection::mWorkQueueChannel
uint16 mWorkQueueChannel
Definition: OgreTerrainPagedWorldSection.h:182
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::TerrainPagedWorldSection::setDefiner
void setDefiner(TerrainDefiner *terrainDefiner)
Definition: OgreTerrainPagedWorldSection.h:170
OgreTerrainPrerequisites.h
Ogre::TerrainPagedWorldSection::TerrainDefiner::~TerrainDefiner
virtual ~TerrainDefiner()
Definition: OgreTerrainPagedWorldSection.h:167
Ogre::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre::SceneManager
Manages the organisation and rendering of a 'scene' i.e.
Definition: OgreSceneManager.h:143
Ogre::WorkQueue::ResponseHandler
Interface definition for a handler of responses.
Definition: OgreWorkQueue.h:196
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:57
Ogre::TerrainPagedWorldSection::TerrainDefiner::define
virtual void define(TerrainGroup *terrainGroup, long x, long y)
Definition: OgreTerrainPagedWorldSection.h:163
Ogre::TerrainPagedWorldSection
A world section which includes paged terrain.
Definition: OgreTerrainPagedWorldSection.h:81
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:69
Ogre::StreamSerialiser
Utility class providing helper methods for reading / writing structured data held in a DataStream.
Definition: OgreStreamSerialiser.h:66
OgreWorkQueue.h
Ogre::Grid2DPageStrategyData
Specialisation of PageStrategyData for Grid2DPageStrategy.
Definition: OgreGrid2DPageStrategy.h:120
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:161
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::TerrainPagedWorldSection::TerrainDefiner
Definition: OgreTerrainPagedWorldSection.h:160
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.
Last modified Tue Apr 13 2021 08:53:15