C4 Engine
C4 Engine API Documentation

Mesh::AllocateStorage

Defined in:  C4Mesh.h
Allocates memory for the contents of a mesh.
Prototype

void AllocateStorage(int32 vertexCount, int32 arrayCount, const ArrayDescriptor *arrayDesc, uint32 skinSize = 0, int32 morphCount = 0);

void AllocateStorage(const Mesh *inputMesh, int32 arrayCount, const ArrayDescriptor *arrayDesc, uint32 skinSize = 0, int32 morphCount = 0);

Parameters
vertexCount The new vertex count.
arrayCount The number of arrays to allocate space for.
arrayDesc A pointer to an array (of size arrayCount) of array descriptors.
skinSize The size of the skin weight data, in bytes.
morphCount The number of morph targets, excluding the base mesh.
inputMesh The input mesh from which data is copied for arrays not being replaced. This may not be the same object for which AllocateStorage is called.
Description
The AllocateStorage function allocates space for all of the geometrical data stored in a mesh. There are two variants of this function, and both take an array of ArrayDescriptor records describing what types of arrays memory needs to be allocated for. The arrayDesc parameter should point to an array having the size specified by the arrayCount parameter.

If the function taking the vertexCount parameter is called, then memory is only allocated for the arrays specified by the arrayDesc array. Any data previously existing in the mesh is deleted, and the newly allocated space is uninitialized.

If the function taking the inputMesh parameter is called, then memory is allocated for the arrays specified by the arrayDesc array in addition to any other arrays existing in the mesh specified by inputMesh. In this case, the new (or replaced) arrays specified by the arrayDesc array are uninitialized, but data for all other arrays is copied from the input mesh.
See Also

ArrayDescriptor