OgreGrid3DPageStrategy.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_Grid3DPageStrategy_H__
30 #define __Ogre_Grid3DPageStrategy_H__
31 
33 #include "OgrePageStrategy.h"
34 #include "OgreVector3.h"
35 
36 namespace Ogre
37 {
45 
46 
105  {
106  protected:
123 
124  public:
125  static const uint32 CHUNK_ID;
126  static const uint16 CHUNK_VERSION;
127 
130 
132  virtual void setOrigin(const Vector3& worldOrigin);
134  virtual const Vector3& getOrigin(const Vector3& worldOrigin) { return mWorldOrigin; }
136  virtual void setCellSize(const Vector3& sz);
138  virtual Vector3 getCellSize() const { return mCellSize; }
140  virtual void setLoadRadius(Real sz);
142  virtual Real getLoadRadius() const { return mLoadRadius; }
144  virtual void setHoldRadius(Real sz);
146  virtual Real getHoldRadius() const { return mHoldRadius; }
147 
149  virtual void setCellRange(int32 minX, int32 minY, int32 minZ, int32 maxX, int32 maxY, int32 maxZ);
151  virtual void setCellRangeMinX(int32 minX);
153  virtual void setCellRangeMinY(int32 minY);
155  virtual void setCellRangeMinZ(int32 minZ);
157  virtual void setCellRangeMaxX(int32 maxX);
159  virtual void setCellRangeMaxY(int32 maxY);
161  virtual void setCellRangeMaxZ(int32 maxZ);
163  virtual int32 getCellRangeMinX() const { return mMinCellX; }
165  virtual int32 getCellRangeMinY() const { return mMinCellY; }
167  virtual int32 getCellRangeMinZ() const { return mMinCellZ; }
169  virtual int32 getCellRangeMaxX() const { return mMaxCellX; }
171  virtual int32 getCellRangeMaxY() const { return mMaxCellY; }
173  virtual int32 getCellRangeMaxZ() const { return mMaxCellZ; }
174 
176  bool load(StreamSerialiser& stream);
178  void save(StreamSerialiser& stream);
179 
180  virtual void getMidPointGridSpace(int32 x, int32 y, int32 z, Vector3& mid);
182  virtual void getBottomLeftGridSpace(int32 x, int32 y, int z, Vector3& bl);
187  virtual void getCornersGridSpace(int32 x, int32 y, int32 z, Vector3* pEightPoints);
188 
190  void determineGridLocation(const Vector3& gridpos, int32* x, int32* y, int32* z);
191 
193  void calculateCell(PageID inPageID, int32* x, int32* y, int32* z);
194  };
195 
196 
204  {
205  public:
207 
209 
210  // Overridden members
211  void notifyCamera(Camera* cam, PagedWorldSection* section);
215  PageID getPageID(const Vector3& worldPos, PagedWorldSection* section);
216  };
217 
220 }
221 
222 #endif
#define _OgrePagingExport
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
Specialisation of PageStrategyData for Grid3DPageStrategy.
Page strategy which loads new pages based on a regular 3D grid.
The PageManager is the entry point through which you load all PagedWorld instances,...
Abstract marker class representing the data held against the PagedWorldSection which is specifically ...
Defines the interface to a strategy class which is responsible for deciding when Page instances are r...
Page class.
Definition: OgrePage.h:51
Represents a section of the PagedWorld which uses a given PageStrategy, and which is made up of a gen...
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:59
Utility class providing helper methods for reading / writing structured data held in a DataStream.
Standard 3-dimensional vector.
Definition: OgreVector3.h:52
virtual void setCellRangeMaxY(int32 maxY)
Set the index range of all cells (values outside this will be ignored)
virtual void setCellRangeMinZ(int32 minZ)
Set the index range of all cells (values outside this will be ignored)
void calculateCell(PageID inPageID, int32 *x, int32 *y, int32 *z)
virtual void setHoldRadius(Real sz)
Set the Holding radius.
virtual int32 getCellRangeMaxX() const
get the index range of all cells (values outside this will be ignored)
virtual void getMidPointGridSpace(int32 x, int32 y, int32 z, Vector3 &mid)
PageID getPageID(const Vector3 &worldPos, PagedWorldSection *section)
Get the page ID for a given world position.
void updateDebugDisplay(Page *p, SceneNode *sn)
Update the contents of the passed in SceneNode to reflect the debug display of a given page.
virtual void setLoadRadius(Real sz)
Set the loading radius.
virtual int32 getCellRangeMaxZ() const
get the index range of all cells (values outside this will be ignored)
Vector3 mOrigin
Origin (grid-aligned world space)
virtual int32 getCellRangeMinZ() const
get the index range of all cells (values outside this will be ignored)
virtual void setOrigin(const Vector3 &worldOrigin)
Set the origin of the grid in world space.
Vector3 mWorldOrigin
Origin (world space)
virtual int32 getCellRangeMinX() const
get the index range of all cells (values outside this will be ignored)
virtual Real getHoldRadius() const
Get the Holding radius.
void notifyCamera(Camera *cam, PagedWorldSection *section)
Called when a camera is used for any kind of rendering.
PageStrategyData * createData()
Create a PageStrategyData instance containing the data specific to this PageStrategy.
virtual void setCellRange(int32 minX, int32 minY, int32 minZ, int32 maxX, int32 maxY, int32 maxZ)
Set the index range of all cells (values outside this will be ignored)
virtual void getCornersGridSpace(int32 x, int32 y, int32 z, Vector3 *pEightPoints)
Get the (grid space) corners of a cell.
Vector3 mCellSize
Grid cell (page) size.
virtual void setCellRangeMaxZ(int32 maxZ)
get the index range of all cells (values outside this will be ignored)
virtual int32 getCellRangeMinY() const
get the index range of all cells (values outside this will be ignored)
virtual Vector3 getCellSize() const
Get the size of the cells in the grid.
bool load(StreamSerialiser &stream)
Load this data from a stream (returns true if successful)
virtual int32 getCellRangeMaxY() const
get the index range of all cells (values outside this will be ignored)
void determineGridLocation(const Vector3 &gridpos, int32 *x, int32 *y, int32 *z)
Convert a grid position into a row and column index.
void destroyData(PageStrategyData *d)
Destroy a PageStrategyData instance containing the data specific to this PageStrategy.
virtual const Vector3 & getOrigin(const Vector3 &worldOrigin)
Get the origin of the grid in world space.
PageID calculatePageID(int32 x, int32 y, int32 z)
virtual void getBottomLeftGridSpace(int32 x, int32 y, int z, Vector3 &bl)
Get the (grid space) bottom-left of a cell.
virtual void setCellSize(const Vector3 &sz)
Set the size of the cells in the grid.
virtual void setCellRangeMinX(int32 minX)
Set the index range of all cells (values outside this will be ignored)
Grid3DPageStrategy(PageManager *manager)
virtual Real getLoadRadius() const
Get the loading radius.
virtual void setCellRangeMinY(int32 minY)
Set the index range of all cells (values outside this will be ignored)
virtual void setCellRangeMaxX(int32 maxX)
Set the index range of all cells (values outside this will be ignored)
void save(StreamSerialiser &stream)
Save this data to a stream.
int int32
Definition: OgrePlatform.h:362
uint32 PageID
Identifier for a page.
float Real
Software floating point type.
unsigned short uint16
Definition: OgrePlatform.h:360
unsigned int uint32
Definition: OgrePlatform.h:359

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