OgreGrid3DPageStrategy.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_Grid3DPageStrategy_H__
#define __Ogre_Grid3DPageStrategy_H__
#include "OgrePagingPrerequisites.h"
#include "OgrePageStrategy.h"
#include "OgreVector3.h"
namespace Ogre
{
class _OgrePagingExport Grid3DPageStrategyData : public PageStrategyData
{
protected:
Vector3 mWorldOrigin;
Vector3 mOrigin;
Vector3 mCellSize;
Real mLoadRadius;
Real mHoldRadius;
int32 mMinCellX;
int32 mMinCellY;
int32 mMinCellZ;
int32 mMaxCellX;
int32 mMaxCellY;
int32 mMaxCellZ;
public:
static const uint32 CHUNK_ID;
static const uint16 CHUNK_VERSION;
Grid3DPageStrategyData();
~Grid3DPageStrategyData();
virtual void setOrigin(const Vector3& worldOrigin);
virtual const Vector3& getOrigin(const Vector3& worldOrigin) { return mWorldOrigin; }
virtual void setCellSize(const Vector3& sz);
virtual Vector3 getCellSize() const { return mCellSize; }
virtual void setLoadRadius(Real sz);
virtual Real getLoadRadius() const { return mLoadRadius; }
virtual void setHoldRadius(Real sz);
virtual Real getHoldRadius() const { return mHoldRadius; }
virtual void setCellRange(int32 minX, int32 minY, int32 minZ, int32 maxX, int32 maxY, int32 maxZ);
virtual void setCellRangeMinX(int32 minX);
virtual void setCellRangeMinY(int32 minY);
virtual void setCellRangeMinZ(int32 minZ);
virtual void setCellRangeMaxX(int32 maxX);
virtual void setCellRangeMaxY(int32 maxY);
virtual void setCellRangeMaxZ(int32 maxZ);
virtual int32 getCellRangeMinX() const { return mMinCellX; }
virtual int32 getCellRangeMinY() const { return mMinCellY; }
virtual int32 getCellRangeMinZ() const { return mMinCellZ; }
virtual int32 getCellRangeMaxX() const { return mMaxCellX; }
virtual int32 getCellRangeMaxY() const { return mMaxCellY; }
virtual int32 getCellRangeMaxZ() const { return mMaxCellZ; }
bool load(StreamSerialiser& stream);
void save(StreamSerialiser& stream);
virtual void getMidPointGridSpace(int32 x, int32 y, int32 z, Vector3& mid);
virtual void getBottomLeftGridSpace(int32 x, int32 y, int z, Vector3& bl);
virtual void getCornersGridSpace(int32 x, int32 y, int32 z, Vector3* pEightPoints);
void determineGridLocation(const Vector3& gridpos, int32* x, int32* y, int32* z);
PageID calculatePageID(int32 x, int32 y, int32 z);
void calculateCell(PageID inPageID, int32* x, int32* y, int32* z);
};
class _OgrePagingExport Grid3DPageStrategy : public PageStrategy
{
public:
Grid3DPageStrategy(PageManager* manager);
~Grid3DPageStrategy();
// Overridden members
void notifyCamera(Camera* cam, PagedWorldSection* section);
PageStrategyData* createData();
void destroyData(PageStrategyData* d);
void updateDebugDisplay(Page* p, SceneNode* sn);
PageID getPageID(const Vector3& worldPos, PagedWorldSection* section);
};
}
#endif
Ogre::Grid3DPageStrategyData::mMaxCellX
int32 mMaxCellX
Definition: OgreGrid3DPageStrategy.h:120
_OgrePagingExport
#define _OgrePagingExport
Definition: OgrePagingPrerequisites.h:72
Ogre::Grid3DPageStrategyData::mMaxCellY
int32 mMaxCellY
Definition: OgreGrid3DPageStrategy.h:121
Ogre::Grid3DPageStrategyData::CHUNK_ID
static const uint32 CHUNK_ID
Definition: OgreGrid3DPageStrategy.h:125
Ogre::Grid3DPageStrategyData::getCellSize
virtual Vector3 getCellSize() const
Get the size of the cells in the grid.
Definition: OgreGrid3DPageStrategy.h:138
OgreVector3.h
Ogre::Grid3DPageStrategy
Page strategy which loads new pages based on a regular 3D grid.
Definition: OgreGrid3DPageStrategy.h:203
Ogre::Page
Page class.
Definition: OgrePage.h:49
Ogre::Grid3DPageStrategyData::mMinCellZ
int32 mMinCellZ
Definition: OgreGrid3DPageStrategy.h:119
Ogre::Grid3DPageStrategyData::mWorldOrigin
Vector3 mWorldOrigin
Origin (world space)
Definition: OgreGrid3DPageStrategy.h:108
Ogre::Grid3DPageStrategyData::getHoldRadius
virtual Real getHoldRadius() const
Get the Holding radius.
Definition: OgreGrid3DPageStrategy.h:146
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::Grid3DPageStrategyData::mCellSize
Vector3 mCellSize
Grid cell (page) size.
Definition: OgreGrid3DPageStrategy.h:112
OgrePagingPrerequisites.h
Ogre::Grid3DPageStrategyData::mMaxCellZ
int32 mMaxCellZ
Definition: OgreGrid3DPageStrategy.h:122
Ogre::Grid3DPageStrategyData::mHoldRadius
Real mHoldRadius
Hold radius.
Definition: OgreGrid3DPageStrategy.h:116
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::SceneNode
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:58
Ogre::Grid3DPageStrategyData::getCellRangeMaxY
virtual int32 getCellRangeMaxY() const
get the index range of all cells (values outside this will be ignored)
Definition: OgreGrid3DPageStrategy.h:171
OgrePageStrategy.h
Ogre::Grid3DPageStrategyData::getOrigin
virtual const Vector3 & getOrigin(const Vector3 &worldOrigin)
Get the origin of the grid in world space.
Definition: OgreGrid3DPageStrategy.h:134
Ogre::Vector3
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Ogre::Grid3DPageStrategyData::getLoadRadius
virtual Real getLoadRadius() const
Get the loading radius.
Definition: OgreGrid3DPageStrategy.h:142
Ogre::PageStrategyData
Abstract marker class representing the data held against the PagedWorldSection which is specifically ...
Definition: OgrePageStrategy.h:49
Ogre::Grid3DPageStrategyData::mMinCellY
int32 mMinCellY
Definition: OgreGrid3DPageStrategy.h:118
Ogre::Grid3DPageStrategyData::getCellRangeMinY
virtual int32 getCellRangeMinY() const
get the index range of all cells (values outside this will be ignored)
Definition: OgreGrid3DPageStrategy.h:165
Ogre::PageManager
The PageManager is the entry point through which you load all PagedWorld instances, and the place where PageStrategy instances and factory classes are registered to customise the paging behaviour.
Definition: OgrePageManager.h:136
Ogre::Grid3DPageStrategyData
Specialisation of PageStrategyData for Grid3DPageStrategy.
Definition: OgreGrid3DPageStrategy.h:104
Ogre::Grid3DPageStrategyData::mLoadRadius
Real mLoadRadius
Load radius.
Definition: OgreGrid3DPageStrategy.h:114
Ogre::StreamSerialiser
Utility class providing helper methods for reading / writing structured data held in a DataStream...
Definition: OgreStreamSerialiser.h:66
Ogre::int32
int int32
Definition: OgrePlatform.h:362
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
Ogre::Grid3DPageStrategyData::getCellRangeMaxX
virtual int32 getCellRangeMaxX() const
get the index range of all cells (values outside this will be ignored)
Definition: OgreGrid3DPageStrategy.h:169
Ogre::PageID
uint32 PageID
Identifier for a page.
Definition: OgrePagingPrerequisites.h:58
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::Grid3DPageStrategyData::getCellRangeMinZ
virtual int32 getCellRangeMinZ() const
get the index range of all cells (values outside this will be ignored)
Definition: OgreGrid3DPageStrategy.h:167
Ogre::Grid3DPageStrategyData::mOrigin
Vector3 mOrigin
Origin (grid-aligned world space)
Definition: OgreGrid3DPageStrategy.h:110
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::Grid3DPageStrategyData::mMinCellX
int32 mMinCellX
Definition: OgreGrid3DPageStrategy.h:117
Ogre::Grid3DPageStrategyData::getCellRangeMinX
virtual int32 getCellRangeMinX() const
get the index range of all cells (values outside this will be ignored)
Definition: OgreGrid3DPageStrategy.h:163
Ogre::Grid3DPageStrategyData::CHUNK_VERSION
static const uint16 CHUNK_VERSION
Definition: OgreGrid3DPageStrategy.h:126
Ogre::Grid3DPageStrategyData::getCellRangeMaxZ
virtual int32 getCellRangeMaxZ() const
get the index range of all cells (values outside this will be ignored)
Definition: OgreGrid3DPageStrategy.h:173
Ogre::uint16
unsigned short uint16
Definition: OgrePlatform.h:360
Ogre::PageStrategy
Defines the interface to a strategy class which is responsible for deciding when Page instances are r...
Definition: OgrePageStrategy.h:73

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