Wrap-around class that contains multiple ArrayMemoryManager, one per render queue.
More...
#include <OgreObjectMemoryManager.h>
|
| ObjectMemoryManager () |
|
virtual | ~ObjectMemoryManager () |
|
SceneNode * | _getDummyNode () const |
| Returns the pointer to the dummy node (useful when detaching)
|
|
size_t | _getTotalRenderQueues () const |
|
void | _setTwin (SceneMemoryMgrTypes memoryManagerType, ObjectMemoryManager *twinMemoryManager) |
| @See mMemoryManagerType
|
|
virtual void | applyRebase (uint16 level, const MemoryPoolVec &newBasePtrs, const ArrayMemoryManager::PtrdiffVec &diffsList) |
| Called when the manager already grew it's memory pool to honour more node requests.
|
|
virtual void | buildDiffList (uint16 level, const MemoryPoolVec &basePtrs, ArrayMemoryManager::PtrdiffVec &outDiffsList) |
| Called when the manager needs to grow it's memory pool to honour more node requests.
|
|
size_t | calculateTotalNumObjectDataIncludingFragmentedSlots () const |
| This is the opposite of getTotalNumObjects.
|
|
void | defragment (void) |
| Triggers on demand a defragmentation of the pools, so that all slots become contiguous in memory.
|
|
size_t | getFirstObjectData (ObjectData &outObjectData, size_t renderQueue) |
| Retrieves a ObjectData pointing to the first MovableObject in the given render queue.
|
|
SceneMemoryMgrTypes | getMemoryManagerType () const |
|
size_t | getNumRenderQueues () const |
| Retrieves the number of render queues that have been created.
|
|
size_t | getTotalNumObjects () const |
| Retrieves the sum of the number of objects in all render queues.
|
|
ObjectMemoryManager * | getTwin () const |
| Note the return value can be null.
|
|
void | migrateTo (ObjectData &inOutTransform, size_t renderQueue, ObjectMemoryManager *dstObjectMemoryManager) |
| Releases memory belonging to us, not before copying it into another manager.
|
|
void | objectCreated (ObjectData &outObjectData, size_t renderQueue) |
| Requests memory for the given ObjectData, initializing values.
|
|
void | objectDestroyed (ObjectData &outObjectData, size_t renderQueue) |
| Releases current memory.
|
|
void | objectMoved (ObjectData &inOutObjectData, size_t oldRenderQueue, size_t newRenderQueue) |
| Requests memory for the given ObjectData to be moved to a different render queue, transferring existing values inside to the new memory slot.
|
|
virtual void | performCleanup (uint16 level, const MemoryPoolVec &basePtrs, size_t const *elementsMemSizes, size_t startInstance, size_t diffInstances) |
| Called when too many nodes were destroyed in a non-LIFO fashion.
|
|
void | shrinkToFit (void) |
| Defragments memory, then reallocates a smaller pool that tightly fits the current number of objects.
|
|
Wrap-around class that contains multiple ArrayMemoryManager, one per render queue.
- Note that some SceneManager implementations (i.e. Octree like) may want to have more than one ObjectMemoryManager, for example one per octant.
◆ ObjectMemoryManager()
Ogre::ObjectMemoryManager::ObjectMemoryManager |
( |
| ) |
|
◆ ~ObjectMemoryManager()
virtual Ogre::ObjectMemoryManager::~ObjectMemoryManager |
( |
| ) |
|
|
virtual |
◆ _getDummyNode()
SceneNode * Ogre::ObjectMemoryManager::_getDummyNode |
( |
| ) |
const |
|
inline |
Returns the pointer to the dummy node (useful when detaching)
◆ _getTotalRenderQueues()
size_t Ogre::ObjectMemoryManager::_getTotalRenderQueues |
( |
| ) |
const |
|
inline |
◆ _setTwin()
◆ applyRebase()
Called when the manager already grew it's memory pool to honour more node requests.
- See also
- buildDiffList() to know what mChunkPtr & mIndex needs to be set for each ArrayVector3/etc we have.
- Parameters
-
level | The hierarchy depth level |
newBasePtrs | The new base ptr. |
diffsList | The list built in buildDiffList |
Implements Ogre::ArrayMemoryManager::RebaseListener.
◆ buildDiffList()
Called when the manager needs to grow it's memory pool to honour more node requests.
See the class description on why we need to do this (to avoid C++ undefined behavior)
- Parameters
-
level | The hierarchy depth level |
basePtrs | The base pointers from each pool so we can calculate the differences |
utDiffsList | The list we'll generate. "outDiffsList" already has enough reserved space |
Implements Ogre::ArrayMemoryManager::RebaseListener.
◆ calculateTotalNumObjectDataIncludingFragmentedSlots()
size_t Ogre::ObjectMemoryManager::calculateTotalNumObjectDataIncludingFragmentedSlots |
( |
| ) |
const |
This is the opposite of getTotalNumObjects.
This function returns the sum of the return values of getFirstObjectData
◆ defragment()
void Ogre::ObjectMemoryManager::defragment |
( |
void |
| ) |
|
Triggers on demand a defragmentation of the pools, so that all slots become contiguous in memory.
ArrayMemoryManager::destroySlot already does this when the number of fragmented slots reaches mCleanupThreshold
◆ getFirstObjectData()
◆ getMemoryManagerType()
◆ getNumRenderQueues()
size_t Ogre::ObjectMemoryManager::getNumRenderQueues |
( |
| ) |
const |
Retrieves the number of render queues that have been created.
◆ getTotalNumObjects()
size_t Ogre::ObjectMemoryManager::getTotalNumObjects |
( |
| ) |
const |
|
inline |
Retrieves the sum of the number of objects in all render queues.
- When ARRAY_PACKED_REALS = 4, and 4 objects have been created but the 2nd one has been deleted, getFirstObjectData will still return 4 until the 4th object is removed or a cleanup is performed; whereas getTotalNumObjects will return the actual number of objects.
◆ getTwin()
Note the return value can be null.
◆ migrateTo()
Releases memory belonging to us, not before copying it into another manager.
- Parameters
-
inOutTransform | Valid Transform that belongs to us. Output will belong to the other memory mgr. |
depth | Current hierarchy level depth it belongs to. |
dstObjectMemoryManager | ObjectMemoryManager that will now own the transform. |
◆ objectCreated()
Requests memory for the given ObjectData, initializing values.
- Parameters
-
◆ objectDestroyed()
Releases current memory.
- Parameters
-
outObjectData | ObjectData whose pointers will be nullified. |
renderQueue | Current render queue it belongs to. |
◆ objectMoved()
Requests memory for the given ObjectData to be moved to a different render queue, transferring existing values inside to the new memory slot.
- Parameters
-
◆ performCleanup()
Called when too many nodes were destroyed in a non-LIFO fashion.
Without cleaning up, the scene manager will waste CPU & bandwidth on processing vectors & matrices that are not in use. The more fragmented/unordered those removals were, the worst it is. Try to create everything static first, then dynamic content.
In a way, it's very similar to vector::remove(), as removing an element from the middle means we need to shift everything past that point one place (or more).
- Parameters
-
level | The hierarchy depth level |
basePtrs | The base ptrs. |
startInstance | The instance to which past that we need to shift |
diffInstances | How many places we need to shift backwards. |
Implements Ogre::ArrayMemoryManager::RebaseListener.
◆ shrinkToFit()
void Ogre::ObjectMemoryManager::shrinkToFit |
( |
void |
| ) |
|
Defragments memory, then reallocates a smaller pool that tightly fits the current number of objects.
Useful when you know you won't be creating more slots and you need to reclaim memory.
The documentation for this class was generated from the following file: