Detailed Description

The resulting base pointer address may have changed and hence each ArrayVector3, ArrayMatrix4, etc needs to be rebased (alter it's mChunkBase pointer).

It consists in two steps: First build a list of relative differences before deallocation and then apply the new base offseting based on that list. The list is needed because as per C++ standard, once the memory freed, using the pointers is undefined behavior (even freedPtr > someValid pointer is now UB). Most systems using a flat memory model in which case the list wouldn't be needed (since 99% of the times, the ptr is just an integer). However we can't guarantee in which architectures this code will run on.

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)

Remarks

Needs to builds a list that will contain the difference in bytes between each ArrayVector3/ArrayMatrix4/etc and the base pointers in_the_order in which the derived class holds those pointers (i.e. in the order the SceneNodes are arranged in memory)

Parameters

managerType

The derived type of this manager, so listener knows whether this is an Node or ObjectData manager

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.

Remarks

The manager behaves similarly to a Garbage Collector, as it is triggered after certain amount of nodes have been freed (unless they respected LIFO order)

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

managerType

The derived type of this manager, so listener knows whether this is an Node or ObjectData manager