C4 Engine
C4 Engine API Documentation

Animator::AllocateStorage

Defined in:  C4Animation.h
Allocates storage space for an animator's tables.
Prototype

void AllocateStorage(int32 nodeStart, int32 nodeCount, int32 transformDataCount, uint32 animatorDataSize = 0);

Parameters
nodeStart The index of the first node that is actually animated.
nodeCount The total number of nodes that are actually animated.
transformDataCount The number of new transforms calculated by the animator.
animatorDataSize The size of extra storage space needed by the animator, in bytes.
Description
The AllocateStorage function should be called by an animator's implementation of the Animator::ConfigureAnimator function to allocate space for the various tables to be used when the animator does its job. In particular, the AllocateStorage function allocates space for an output transform table that holds pointers to the transforms of the animated nodes, and it allocates space for an animator transform table that holds any new transforms that are calculated by the animator inside its Animator::MoveAnimator function.

After the AllocateStorage function has been called, the output table can be retrieved by calling the Animator::GetOutputTransformTable function. The number of entries in this table is given by the nodeCount parameter, and these entries represent the output transforms for nodeCount consecutive animated nodes beginning at the index given by the nodeStart parameter. The Animator::GetOutputTransformNodeStart and Animator::GetOutputTransformNodeCount functions subsequently return the values specified for the nodeStart and nodeCount parameters.

The animator transform table can be retrieved by calling the Animator::GetAnimatorTransformTable function. The number of entries in this table is given by the transformDataCount parameter, which only needs to be as large as the number of new transforms calculated by the animator. An animator is not required to calculate new transforms for all of the nodes that it animates and may reuse transforms calculated by subanimators. In particular, the transformDataCount parameter can be zero when all transforms are taken from subanimators, as is the case for the MergeAnimator class.

The animatorDataSize parameter specifies the size of any additional storage space that may be required by the animator to be used in any custom manner. If this is not zero, then a pointer to this storage can be retrieved by calling the Animator::GetAnimatorData function.
See Also

Animator::PreprocessAnimator

Animator::MoveAnimator

Animator::GetAnimatorData