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
Specialisation of PageStrategyData for Grid2DPageStrategy.
#define OGRE_DELETE
Interface to a general purpose request / response style background work queue.
Definition: OgreWorkQueue.h:70
A world section which includes paged terrain.
float Real
Software floating point type.
Represents a section of the PagedWorld which uses a given PageStrategy, and which is made up of a gen...
General purpose request structure.
Definition: OgreWorkQueue.h:83
Helper class to assist you in managing multiple terrain instances that are connected to each other...
General purpose response structure.
virtual void defineTerrain(long x, long y)
Define a &#39;slot&#39; in the terrain grid - in this case to be loaded from a generated file name...
#define _OgreTerrainExport
_StringBase String
This class represents a collection of pages which make up a world.
Utility class providing helper methods for reading / writing structured data held in a DataStream...
void setDefiner(TerrainDefiner *terrainDefiner)
int int32
Definition: OgrePlatform.h:362
virtual TerrainGroup * getTerrainGroup()
Get the TerrainGroup which this world section is using.
Page strategy which loads new pages based on a regular 2D grid.
uint32 PageID
Identifier for a page.
unsigned int uint32
Definition: OgrePlatform.h:359
Interface definition for a handler of responses.
This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info...
virtual void define(TerrainGroup *terrainGroup, long x, long y)
Manages the organisation and rendering of a &#39;scene&#39; i.e.
Interface definition for a handler of requests.
unsigned short uint16
Definition: OgrePlatform.h:360
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...

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 Sun Oct 22 2017 04:04:15