C4 Engine
C4 Engine API Documentation

Geometry::SetMaterialObject

Defined in:  C4Geometries.h
Sets a material object.
Prototype

void SetMaterialObject(int32 index, MaterialObject *object);

Parameters
index The index of the material slot to which a material object is to be assigned.
object The new material object. This can be nullptr.
Description
The SetMaterialObject function assigns the material object specified by the object parameter to a geometry node in the material slot specified by the index parameter. If object is nullptr, then the geometry node does not have a material in the specified material slot after this function is called. Otherwise, the reference count of the material object is incremented, and the new material object is assigned to the geometry node. The reference count of any material object previously assigned to the geometry node in the same slot is decremented, and the old material object is deleted if its reference count reaches zero.

The number of material slots can be determined using the Geometry::GetMaterialCount function.
See Also

MaterialObject

Geometry::GetMaterialObject

Geometry::GetMaterialCount

Geometry::SetMaterialCount