OgreTerrainPagedWorldSection.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_TerrainPagedWorldSection_H__
#define __Ogre_TerrainPagedWorldSection_H__
#include "OgreTerrainPrerequisites.h"
#include "OgrePagedWorldSection.h"
#include "OgrePageManager.h"
#include "OgreWorkQueue.h"
#include "OgreTerrainGroup.h"
namespace Ogre
{
class Grid2DPageStrategy;
class Grid2DPageStrategyData;
class TerrainGroup;
class _OgreTerrainExport TerrainPagedWorldSection : public PagedWorldSection,
public WorkQueue::RequestHandler, public WorkQueue::ResponseHandler
{
public:
TerrainPagedWorldSection(const String& name, PagedWorld* parent, SceneManager* sm);
virtual ~TerrainPagedWorldSection();
virtual void init(TerrainGroup* grp);
virtual TerrainGroup* getTerrainGroup() { return mTerrainGroup; }
virtual void setLoadRadius(Real sz);
virtual Real getLoadRadius() const;
virtual void setHoldRadius(Real sz);
virtual Real getHoldRadius();
virtual void setPageRange(int32 minX, int32 minY, int32 maxX, int32 maxY);
virtual void setPageRangeMinX(int32 minX);
virtual void setPageRangeMinY(int32 minY);
virtual void setPageRangeMaxX(int32 maxX);
virtual void setPageRangeMaxY(int32 maxY);
virtual int32 getPageRangeMinX() const;
virtual int32 getPageRangeMinY() const;
virtual int32 getPageRangeMaxX() const;
virtual int32 getPageRangeMaxY() const;
virtual Grid2DPageStrategy* getGridStrategy() const;
virtual Grid2DPageStrategyData* getGridStrategyData() const;
virtual void setLoadingIntervalMs(uint32 loadingIntervalMs);
virtual uint32 getLoadingIntervalMs() const;
void loadPage(PageID pageID, bool forceSynchronous = false);
void unloadPage(PageID pageID, bool forceSynchronous = false);
WorkQueue::Response* handleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ);
void handleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
static const uint16 WORKQUEUE_LOAD_TERRAIN_PAGE_REQUEST;
class TerrainDefiner : public TerrainAlloc
{
public:
virtual void define(TerrainGroup* terrainGroup, long x, long y)
{
terrainGroup->defineTerrain(x,y);
}
virtual ~TerrainDefiner() {}
};
void setDefiner(TerrainDefiner* terrainDefiner)
{
if(mTerrainDefiner)
OGRE_DELETE mTerrainDefiner;
mTerrainDefiner = terrainDefiner;
}
protected:
TerrainGroup* mTerrainGroup;
TerrainDefiner* mTerrainDefiner;
std::list<PageID> mPagesInLoading;
bool mHasRunningTasks;
uint16 mWorkQueueChannel;
unsigned long mNextLoadingTime;
uint32 mLoadingIntervalMs;
void loadSubtypeData(StreamSerialiser& ser);
void saveSubtypeData(StreamSerialiser& ser);
virtual void syncSettings();
};
}
#endif
OgreWorkQueue.h
Ogre::TerrainPagedWorldSection::mTerrainGroup
TerrainGroup * mTerrainGroup
Definition: OgreTerrainPagedWorldSection.h:178
Ogre::Grid2DPageStrategyData
Specialisation of PageStrategyData for Grid2DPageStrategy.
Definition: OgreGrid2DPageStrategy.h:120
OgreTerrainGroup.h
OGRE_DELETE
#define OGRE_DELETE
Definition: OgreMemoryAllocatorConfig.h:474
Ogre::WorkQueue
Interface to a general purpose request / response style background work queue.
Definition: OgreWorkQueue.h:70
Ogre::TerrainPagedWorldSection
A world section which includes paged terrain.
Definition: OgreTerrainPagedWorldSection.h:81
Ogre::TerrainPagedWorldSection::mTerrainDefiner
TerrainDefiner * mTerrainDefiner
Definition: OgreTerrainPagedWorldSection.h:179
Ogre::TerrainPagedWorldSection::mLoadingIntervalMs
uint32 mLoadingIntervalMs
Definition: OgreTerrainPagedWorldSection.h:184
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
OgrePagedWorldSection.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::TerrainPagedWorldSection::WORKQUEUE_LOAD_TERRAIN_PAGE_REQUEST
static const uint16 WORKQUEUE_LOAD_TERRAIN_PAGE_REQUEST
Definition: OgreTerrainPagedWorldSection.h:158
Ogre::TerrainPagedWorldSection::mPagesInLoading
std::list< PageID > mPagesInLoading
Definition: OgreTerrainPagedWorldSection.h:180
Ogre::TerrainPagedWorldSection::mWorkQueueChannel
uint16 mWorkQueueChannel
Definition: OgreTerrainPagedWorldSection.h:182
OgrePageManager.h
Ogre::TerrainPagedWorldSection::TerrainDefiner
Definition: OgreTerrainPagedWorldSection.h:160
Ogre::WorkQueue::Request
General purpose request structure.
Definition: OgreWorkQueue.h:83
Ogre::TerrainGroup
Helper class to assist you in managing multiple terrain instances that are connected to each other...
Definition: OgreTerrainGroup.h:70
Ogre::WorkQueue::Response
General purpose response structure.
Definition: OgreWorkQueue.h:122
Ogre::TerrainGroup::defineTerrain
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...
_OgreTerrainExport
#define _OgreTerrainExport
Definition: OgreTerrainPrerequisites.h:58
Ogre::TerrainPagedWorldSection::mHasRunningTasks
bool mHasRunningTasks
Definition: OgreTerrainPagedWorldSection.h:181
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::PagedWorld
This class represents a collection of pages which make up a world.
Definition: OgrePagedWorld.h:57
Ogre::StreamSerialiser
Utility class providing helper methods for reading / writing structured data held in a DataStream...
Definition: OgreStreamSerialiser.h:66
Ogre::TerrainPagedWorldSection::setDefiner
void setDefiner(TerrainDefiner *terrainDefiner)
Definition: OgreTerrainPagedWorldSection.h:170
Ogre::int32
int int32
Definition: OgrePlatform.h:362
Ogre::TerrainPagedWorldSection::getTerrainGroup
virtual TerrainGroup * getTerrainGroup()
Get the TerrainGroup which this world section is using.
Definition: OgreTerrainPagedWorldSection.h:109
Ogre::Grid2DPageStrategy
Page strategy which loads new pages based on a regular 2D grid.
Definition: OgreGrid2DPageStrategy.h:231
Ogre::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::TerrainPagedWorldSection::mNextLoadingTime
unsigned long mNextLoadingTime
Definition: OgreTerrainPagedWorldSection.h:183
Ogre::WorkQueue::ResponseHandler
Interface definition for a handler of responses.
Definition: OgreWorkQueue.h:196
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::TerrainPagedWorldSection::TerrainDefiner::define
virtual void define(TerrainGroup *terrainGroup, long x, long y)
Definition: OgreTerrainPagedWorldSection.h:163
OgreTerrainPrerequisites.h
Ogre::TerrainPagedWorldSection::TerrainDefiner::~TerrainDefiner
virtual ~TerrainDefiner()
Definition: OgreTerrainPagedWorldSection.h:167
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::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

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