C4 Engine Terathon Software C4 Engine API Documentation

• World Manager

API Links
Developer Links

GeometryLevel::AllocateStorage

Defined in:  C4GeometryLevel.h
Allocates memory for the contents of a geometry level.
Prototype

void AllocateStorage(long vertCount, long arrayCount, const ArrayDescriptor *arrayDesc, unsigned long weightSize = 0);

void AllocateStorage(const GeometryLevel *inputLevel, long arrayCount, const ArrayDescriptor *arrayDesc, unsigned long weightSize = 0);

Parameters
vertCount 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.
weightSize The size of the weighting data, in bytes.
inputLevel The input geometry level 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 geometry level. 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 vertCount parameter is called, then memory is only allocated for the arrays specified by the arrayDesc array. Any data previously existing in the geometry level is deleted, and the newly allocated space is uninitialized.

If the function taking the inputLevel parameter is called, then memory is allocated for the arrays specified by the arrayDesc array in addition to any other arrays existing in the geometry level specified by inputLevel. 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 geometry level.
See Also

ArrayDescriptor