C4 Engine
C4 Engine API Documentation

Model::GetModel

Defined in:  C4Models.h
Returns a new instances of a particular type of model.
Prototype

static Model *GetModel(ModelType type);

Description
The GetModel function is used to create new instances of the type of model specified by the type parameter. This function will always clone an existing model of the same type if possible, and it will load the model's model resource if no instances have been created yet and the model has not been precached.

In order to create new model instances with this function, the model type corresponding to the value of the type parameter must have previously been registered through the instantiation of a ModelRegistration object. If there is no registration matching the type parameter, then the return value is nullptr.

If the model type corresponding to the value of the type parameter has been registered, but the model resource named in the registration does not exist, then a generic model is loaded, and a pointer to a clone of it is returned by the GetModel function.
See Also

ModelRegistration