Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes
Forests::GeometryPageManager Class Reference

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.

Definition at line 1116 of file PagedGeometry.h.

Public Types

typedef std::list< GeometryPage * > TPGeometryPages
 

Public Member Functions

 GeometryPageManager (PagedGeometry *mainGeom)
 
 ~GeometryPageManager ()
 
void setNearRange (Ogre::Real nearRange)
 
void setFarRange (Ogre::Real farRange)
 
Ogre::Real getNearRange () const
 
Ogre::Real getFarRange () const
 
void setCacheSpeed (unsigned long maxCacheInterval=200, unsigned long inactivePageLife=2000)
 
void setTransition (Ogre::Real transitionLength)
 
Ogre::Real getTransition () const
 
TPGeometryPages getLoadedPages () const
 
template<class PageType >
void initPages (const TBounds &bounds, const Ogre::Any &data=Ogre::Any())
 
void update (unsigned long deltaTime, Ogre::Vector3 &camPos, Ogre::Vector3 &camSpeed, bool &enableCache, GeometryPageManager *prevManager)
 
void reloadGeometry ()
 
void reloadGeometryPage (const Ogre::Vector3 &point)
 
void reloadGeometryPages (const Ogre::Vector3 &center, Ogre::Real radius)
 
void reloadGeometryPages (const TBounds &area)
 
void preloadGeometry (const TBounds &area)
 
void resetPreloadedGeometry ()
 

Private Member Functions

GeometryPage * _getGridPage (const int x, const int z)
 
void _setGridPage (const int x, const int z, GeometryPage *page)
 
void _loadPage (GeometryPage *page)
 
void _unloadPage (GeometryPage *page)
 
void _unloadPageDelayed (GeometryPage *page)
 
void _scrollGridPages (int shiftX, int shiftZ)
 

Private Attributes

PagedGeometry * mainGeom
 
GeometryPage ** geomGrid
 
GeometryPage ** scrollBuffer
 
int geomGridX
 
int geomGridZ
 
TBounds gridBounds
 
Ogre::Real fadeLength
 
Ogre::Real fadeLengthSq
 
bool fadeEnabled
 
unsigned long cacheTimer
 
TPGeometryPages pendingList
 
TPGeometryPages loadedList
 
unsigned long maxCacheInterval
 
unsigned long inactivePageLife
 
Ogre::Real nearDist
 
Ogre::Real nearDistSq
 
Ogre::Real farDist
 
Ogre::Real farDistSq
 
Ogre::Real farTransDist
 
Ogre::Real farTransDistSq
 

Member Typedef Documentation

◆ TPGeometryPages

A std::list of pointers to geometry pages.

Definition at line 1120 of file PagedGeometry.h.

Constructor & Destructor Documentation

◆ GeometryPageManager()

Forests::GeometryPageManager::GeometryPageManager ( PagedGeometry *  mainGeom)

Internal function - DO NOT USE.

Definition at line 306 of file PagedGeometry.cpp.

◆ ~GeometryPageManager()

Forests::GeometryPageManager::~GeometryPageManager ( )

Internal function - DO NOT USE.

Definition at line 321 of file PagedGeometry.cpp.

Member Function Documentation

◆ _getGridPage()

GeometryPage * Forests::GeometryPageManager::_getGridPage ( const int  x,
const int  z 
)
inlineprivate

Definition at line 1276 of file PagedGeometry.h.

◆ _loadPage()

void Forests::GeometryPageManager::_loadPage ( GeometryPage *  page)
private

Definition at line 743 of file PagedGeometry.cpp.

◆ _scrollGridPages()

void Forests::GeometryPageManager::_scrollGridPages ( int  shiftX,
int  shiftZ 
)
private

Definition at line 818 of file PagedGeometry.cpp.

◆ _setGridPage()

void Forests::GeometryPageManager::_setGridPage ( const int  x,
const int  z,
GeometryPage *  page 
)
inlineprivate

Definition at line 1287 of file PagedGeometry.h.

◆ _unloadPage()

void Forests::GeometryPageManager::_unloadPage ( GeometryPage *  page)
private

Definition at line 782 of file PagedGeometry.cpp.

◆ _unloadPageDelayed()

void Forests::GeometryPageManager::_unloadPageDelayed ( GeometryPage *  page)
private

Definition at line 810 of file PagedGeometry.cpp.

◆ getFarRange()

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.

Definition at line 1176 of file PagedGeometry.h.

◆ getLoadedPages()

TPGeometryPages Forests::GeometryPageManager::getLoadedPages ( ) const
inline

Internal function - DO NOT USE.

Definition at line 1236 of file PagedGeometry.h.

◆ getNearRange()

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.

Definition at line 1165 of file PagedGeometry.h.

◆ getTransition()

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

Definition at line 1229 of file PagedGeometry.h.

◆ initPages()

template<class PageType >
void Forests::GeometryPageManager::initPages ( const TBounds &  bounds,
const Ogre::Any &  data = Ogre::Any() 
)
inline

Internal function - DO NOT USE.

Definition at line 1347 of file PagedGeometry.h.

◆ preloadGeometry()

void Forests::GeometryPageManager::preloadGeometry ( const TBounds &  area)

Internal function - DO NOT USE.

Definition at line 684 of file PagedGeometry.cpp.

◆ reloadGeometry()

void Forests::GeometryPageManager::reloadGeometry ( )

Internal function - DO NOT USE.

Definition at line 590 of file PagedGeometry.cpp.

◆ reloadGeometryPage()

void Forests::GeometryPageManager::reloadGeometryPage ( const Ogre::Vector3 &  point)

Internal function - DO NOT USE.

Definition at line 602 of file PagedGeometry.cpp.

◆ reloadGeometryPages() [1/2]

void Forests::GeometryPageManager::reloadGeometryPages ( const Ogre::Vector3 &  center,
Ogre::Real  radius 
)

Internal function - DO NOT USE.

◆ reloadGeometryPages() [2/2]

void Forests::GeometryPageManager::reloadGeometryPages ( const TBounds &  area)

Internal function - DO NOT USE.

Definition at line 655 of file PagedGeometry.cpp.

◆ resetPreloadedGeometry()

void Forests::GeometryPageManager::resetPreloadedGeometry ( )

Internal function - DO NOT USE.

Definition at line 729 of file PagedGeometry.cpp.

◆ setCacheSpeed()

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.

Definition at line 1205 of file PagedGeometry.h.

◆ setFarRange()

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.

Definition at line 1150 of file PagedGeometry.h.

◆ setNearRange()

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.

Definition at line 1136 of file PagedGeometry.h.

◆ setTransition()

void Forests::GeometryPageManager::setTransition ( Ogre::Real  transitionLength)
inline

Definition at line 1211 of file PagedGeometry.h.

◆ update()

void Forests::GeometryPageManager::update ( unsigned long  deltaTime,
Ogre::Vector3 &  camPos,
Ogre::Vector3 &  camSpeed,
bool &  enableCache,
GeometryPageManager *  prevManager 
)

Internal function - DO NOT USE.

Definition at line 335 of file PagedGeometry.cpp.

Field Documentation

◆ cacheTimer

unsigned long Forests::GeometryPageManager::cacheTimer
private

Definition at line 1309 of file PagedGeometry.h.

◆ fadeEnabled

bool Forests::GeometryPageManager::fadeEnabled
private

Definition at line 1273 of file PagedGeometry.h.

◆ fadeLength

Ogre::Real Forests::GeometryPageManager::fadeLength
private

Definition at line 1272 of file PagedGeometry.h.

◆ fadeLengthSq

Ogre::Real Forests::GeometryPageManager::fadeLengthSq
private

Definition at line 1272 of file PagedGeometry.h.

◆ farDist

Ogre::Real Forests::GeometryPageManager::farDist
private

Definition at line 1320 of file PagedGeometry.h.

◆ farDistSq

Ogre::Real Forests::GeometryPageManager::farDistSq
private

Definition at line 1320 of file PagedGeometry.h.

◆ farTransDist

Ogre::Real Forests::GeometryPageManager::farTransDist
private

Definition at line 1321 of file PagedGeometry.h.

◆ farTransDistSq

Ogre::Real Forests::GeometryPageManager::farTransDistSq
private

Definition at line 1321 of file PagedGeometry.h.

◆ geomGrid

GeometryPage** Forests::GeometryPageManager::geomGrid
private

Definition at line 1266 of file PagedGeometry.h.

◆ geomGridX

int Forests::GeometryPageManager::geomGridX
private

Definition at line 1268 of file PagedGeometry.h.

◆ geomGridZ

int Forests::GeometryPageManager::geomGridZ
private

Definition at line 1268 of file PagedGeometry.h.

◆ gridBounds

TBounds Forests::GeometryPageManager::gridBounds
private

Definition at line 1269 of file PagedGeometry.h.

◆ inactivePageLife

unsigned long Forests::GeometryPageManager::inactivePageLife
private

Definition at line 1316 of file PagedGeometry.h.

◆ loadedList

TPGeometryPages Forests::GeometryPageManager::loadedList
private

Definition at line 1312 of file PagedGeometry.h.

◆ mainGeom

PagedGeometry* Forests::GeometryPageManager::mainGeom
private

Definition at line 1263 of file PagedGeometry.h.

◆ maxCacheInterval

unsigned long Forests::GeometryPageManager::maxCacheInterval
private

Definition at line 1315 of file PagedGeometry.h.

◆ nearDist

Ogre::Real Forests::GeometryPageManager::nearDist
private

Definition at line 1319 of file PagedGeometry.h.

◆ nearDistSq

Ogre::Real Forests::GeometryPageManager::nearDistSq
private

Definition at line 1319 of file PagedGeometry.h.

◆ pendingList

TPGeometryPages Forests::GeometryPageManager::pendingList
private

Definition at line 1311 of file PagedGeometry.h.

◆ scrollBuffer

GeometryPage** Forests::GeometryPageManager::scrollBuffer
private

Definition at line 1267 of file PagedGeometry.h.


The documentation for this class was generated from the following files: