Wrap-around class that contains multiple ArrayMemoryManager, one per hierarchy depth.
More...
#include <OgreBoneMemoryManager.h>
|
| BoneMemoryManager () |
|
virtual | ~BoneMemoryManager () |
|
void | _growToDepth (const vector< size_t >::type &bonesPerDepth) |
| Since skeleton's hierarchy structure is known beforehand, we use this information for setting a better optimal cleanup value, to avoid excessive stalls when destroying skeleton instances. More...
|
|
void | applyRebase (uint16 level, const MemoryPoolVec &newBasePtrs, const ArrayMemoryManager::PtrdiffVec &diffsList) override |
| Called when the manager already grew it's memory pool to honour more node requests. More...
|
|
void | buildDiffList (uint16 level, const MemoryPoolVec &basePtrs, ArrayMemoryManager::PtrdiffVec &outDiffsList) override |
| Called when the manager needs to grow it's memory pool to honour more node requests. More...
|
|
size_t | getFirstNode (BoneTransform &outTransform, size_t depth) |
| Retrieves a Transform pointing to the first Node in the given depth. More...
|
|
size_t | getNumDepths () const |
| Retrieves the number of depth levels that have been created. More...
|
|
void | migrateTo (BoneTransform &inOutTransform, size_t depth, BoneMemoryManager *dstBoneMemoryManager) |
| Releases memory belonging to us, not before copying it into another manager. More...
|
|
void | nodeAttached (BoneTransform &outTransform, size_t depth) |
| Requests memory for the given transform to be attached, transferring existing values inside to the new memory block. More...
|
|
void | nodeCreated (BoneTransform &outTransform, size_t depth) |
| Requests memory for the given transform for the first, initializing values. More...
|
|
void | nodeDestroyed (BoneTransform &outTransform, size_t depth) |
| Releases current memory. More...
|
|
void | nodeDettached (BoneTransform &outTransform, size_t depth) |
| Releases current memory and requests memory from the root level. More...
|
|
void | nodeMoved (BoneTransform &inOutTransform, size_t oldDepth, size_t newDepth) |
| Requests memory for the given Node to be moved to a different depth level, transferring existing values inside to the new memory slot. More...
|
|
void | performCleanup (uint16 level, const MemoryPoolVec &basePtrs, size_t const *elementsMemSizes, size_t startInstance, size_t diffInstances) override |
| Called when too many nodes were destroyed in a non-LIFO fashion. More...
|
|
void | setBoneRebaseListener (BySkeletonDef *l) |
|
Wrap-around class that contains multiple ArrayMemoryManager, one per hierarchy depth.
- Note that some SceneManager implementations (i.e. Octree like) may want to have more than one BoneMemoryManager, for example one per octant.
◆ BoneMemoryManager()
Ogre::BoneMemoryManager::BoneMemoryManager |
( |
| ) |
|
◆ ~BoneMemoryManager()
virtual Ogre::BoneMemoryManager::~BoneMemoryManager |
( |
| ) |
|
|
virtual |
◆ _growToDepth()
void Ogre::BoneMemoryManager::_growToDepth |
( |
const vector< size_t >::type & |
bonesPerDepth | ) |
|
Since skeleton's hierarchy structure is known beforehand, we use this information for setting a better optimal cleanup value, to avoid excessive stalls when destroying skeleton instances.
◆ 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.
◆ getFirstNode()
size_t Ogre::BoneMemoryManager::getFirstNode |
( |
BoneTransform & |
outTransform, |
|
|
size_t |
depth |
|
) |
| |
Retrieves a Transform pointing to the first Node in the given depth.
- Parameters
-
outTransform | [out] Transform with filled pointers to the first Node in this depth |
depth | Current hierarchy level depth it belongs to. |
- Returns
- Number of Nodes in this depth level
◆ getNumDepths()
size_t Ogre::BoneMemoryManager::getNumDepths |
( |
| ) |
const |
Retrieves the number of depth levels that have been created.
◆ 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. |
dstBoneMemoryManager | BoneMemoryManager that will now own the transform. |
◆ nodeAttached()
void Ogre::BoneMemoryManager::nodeAttached |
( |
BoneTransform & |
outTransform, |
|
|
size_t |
depth |
|
) |
| |
Requests memory for the given transform to be attached, transferring existing values inside to the new memory block.
- Parameters
-
outTransform | Transform with filled pointers |
depth | Hierarchy level depth the node belongs to. If 0, nothing happens. |
◆ nodeCreated()
void Ogre::BoneMemoryManager::nodeCreated |
( |
BoneTransform & |
outTransform, |
|
|
size_t |
depth |
|
) |
| |
Requests memory for the given transform for the first, initializing values.
- Parameters
-
outTransform | Transform with filled pointers |
depth | Hierarchy level depth. 0 if not connected. |
◆ nodeDestroyed()
void Ogre::BoneMemoryManager::nodeDestroyed |
( |
BoneTransform & |
outTransform, |
|
|
size_t |
depth |
|
) |
| |
Releases current memory.
- Parameters
-
outTransform | Transform with nullified pointers |
depth | Current hierarchy level depth it belongs to. |
◆ nodeDettached()
void Ogre::BoneMemoryManager::nodeDettached |
( |
BoneTransform & |
outTransform, |
|
|
size_t |
depth |
|
) |
| |
Releases current memory and requests memory from the root level.
- outTransform.mParents[outTransform.mIndex] is reset to a dummy parent node
- Parameters
-
outTransform | Transform with filled pointers |
depth | Current hierarchy level depth it belongs to. If 0, nothing happens. |
◆ nodeMoved()
void Ogre::BoneMemoryManager::nodeMoved |
( |
BoneTransform & |
inOutTransform, |
|
|
size_t |
oldDepth, |
|
|
size_t |
newDepth |
|
) |
| |
Requests memory for the given Node to be moved to a different depth level, transferring existing values inside to the new memory slot.
- Parameters
-
inOutTransform | Transform with filled pointers |
oldDepth | Current hierarchy level depth it belongs to. |
newDepth | Hierarchy level depth it wants to belongs to. |
◆ performCleanup()
void Ogre::BoneMemoryManager::performCleanup |
( |
uint16 |
level, |
|
|
const MemoryPoolVec & |
basePtrs, |
|
|
size_t const * |
elementsMemSizes, |
|
|
size_t |
startInstance, |
|
|
size_t |
diffInstances |
|
) |
| |
|
overridevirtual |
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.
◆ setBoneRebaseListener()
void Ogre::BoneMemoryManager::setBoneRebaseListener |
( |
BySkeletonDef * |
l | ) |
|
|
inline |
The documentation for this class was generated from the following file: