PagedGeometry  1.2.0
Forests::GeometryPageManager Class Reference

Manages the rendering of geometry for a detail level type. More...

#include <PagedGeometry.h>

Public Types

typedef std::list< GeometryPage * > TPGeometryPages
 A std::list of pointers to geometry pages.
 

Public Member Functions

 GeometryPageManager (PagedGeometry *mainGeom)
 Internal function - DO NOT USE.
 
 ~GeometryPageManager ()
 Internal function - DO NOT USE.
 
void setNearRange (Ogre::Real nearRange)
 Sets the near viewing range of this page manager. More...
 
void setFarRange (Ogre::Real farRange)
 Sets the far viewing range of this page manager. More...
 
Ogre::Real getNearRange () const
 Gets the near viewing range of this page manager. More...
 
Ogre::Real getFarRange () const
 Gets the far viewing range of this page manager. More...
 
void setCacheSpeed (unsigned long maxCacheInterval=200, unsigned long inactivePageLife=2000)
 Customizes the cache behaviour (advanced). More...
 
void setTransition (Ogre::Real transitionLength)
 
Ogre::Real getTransition () const
 
TPGeometryPages getLoadedPages () const
 Internal function - DO NOT USE.
 
template<class PageType >
void initPages (const TBounds &bounds, const Ogre::Any &data=Ogre::Any(), Ogre::uint32 queryFlag=0)
 Internal function - DO NOT USE.
 
void update (unsigned long deltaTime, Ogre::Vector3 &camPos, Ogre::Vector3 &camSpeed, bool &enableCache, GeometryPageManager *prevManager)
 Internal function - DO NOT USE.
 
void reloadGeometry ()
 Internal function - DO NOT USE.
 
void reloadGeometryPage (const Ogre::Vector3 &point)
 Internal function - DO NOT USE.
 
void reloadGeometryPages (const Ogre::Vector3 &center, Ogre::Real radius)
 Internal function - DO NOT USE.
 
void reloadGeometryPages (const TBounds &area)
 Internal function - DO NOT USE.
 
void preloadGeometry (const TBounds &area)
 Internal function - DO NOT USE.
 
void resetPreloadedGeometry ()
 Internal function - DO NOT USE.
 

Detailed Description

Manages the rendering of geometry for a detail level type.

Warning
This class is used internally by PagedGeometry, and in most cases you should ignore it completely. However, this does provide some advanced capabilities such as modifying the near and far view ranges, which may come in handy.

This class manages pages of geometry, cacheing, deleting, etc. them as necessary. It analyzes the motion of the camera to determine how fast pages need to be cached, and deletes obsolete pages which have been invisible for a certain amount of time.

When you call PagedGeometry::addDetailLevel(), a GeometryPageManager is created to manage the new detail level. addDetailLevel() returns a pointer to this page manager, allowing you access to some useful functions, documented below.

Note
Some functions (marked by "DO NOT USE" in the documentation) should never be called by you. Only the internal processes of PagedGeometry can safely use these functions, so be careful. Using these functions will cause unpredictable results.

Member Function Documentation

void Forests::GeometryPageManager::setNearRange ( Ogre::Real  nearRange)
inline

Sets the near viewing range of this page manager.

Parameters
nearRangeThe distance where this page manager starts displaying geometry.

All geometry displayed by this page manager is confined within a certain radius gap from the camera. This function sets the closest distance geometry is allowed near the camera.

Referenced by Forests::PagedGeometry::resetPreloadedGeometry().

void Forests::GeometryPageManager::setFarRange ( Ogre::Real  farRange)
inline

Sets the far viewing range of this page manager.

Parameters
farRangeThe distance where this page manager stops displaying geometry.

All geometry displayed by this page manager is confined within a certain radius gap from the camera. This function sets the farthest distance geometry is allowed from the camera.

Referenced by Forests::PagedGeometry::resetPreloadedGeometry().

Ogre::Real Forests::GeometryPageManager::getNearRange ( ) const
inline

Gets the near viewing range of this page manager.

Returns
The near viewing range of this page manager.
See also
setNearRange() for more info about the near viewing range.
Ogre::Real Forests::GeometryPageManager::getFarRange ( ) const
inline

Gets the far viewing range of this page manager.

Returns
The far viewing range of this page manager.
See also
setFarRange() for more info about the near viewing range.

Referenced by Forests::PagedGeometry::resetPreloadedGeometry().

void Forests::GeometryPageManager::setCacheSpeed ( unsigned long  maxCacheInterval = 200,
unsigned long  inactivePageLife = 2000 
)
inline

Customizes the cache behaviour (advanced).

Parameters
maxCacheIntervalThe maximum period of time (milliseconds) before another page is loaded.
inactivePageLifeThe maximum period of time (milliseconds) a inactive (invisible) page is allowed to stay loaded.

The GeometryPageManager automatically determines how fast pages should be cached to keep everything running as smooth as possible, but there are a few options that are adjustable. This function allows you to adjust these variables to fine-tune cache performance.

The maxCacheInterval is basically a minimum rate at which pages are cached. Normally, a stopped camera would cause the cache rate prediction algorithm to say 0 pages-per-second must be cached. However, this is not optimal, since idle time should be taken advantage of to finish loading. By adjusting this value, you can set how much caching you want going on when the camera is stopped or moving very slowly.

The inactivePageLife allows you to set how long inactive pages remain in memory. An inactive page is one that is out of the cache range and may not be immediately needed. By allowing these pages to remain in memory for a short period of time, the camera can return to it's previous position with no need to reload anything.

Note
Even with large inactivePageLife values, pages may be unloaded if the camera moves far enough from them, so setting extremely high inactivePageLife values won't result in massive memory usage.

Referenced by GeometryPageManager().