ent_mtlset (ENTITY*, MATERIAL*, var skin);

Replaces a model's skin lighting and skin effect that was set in MED. This function can be used for assigning different effects to different entity skins.

Parameters:

ENTITY* Target entity pointer (models or nonchunked terrain only).
MATERIAL* Source material pointer. If the entity skin contains no material, it gets the light parameters from the source material. If it already contains a material, its light parameters are replaced by the source material lighting. If the source material contains an effect or shader, it replaces the skin effect.
skin Number of the skin (as in MED) , starting with 1. If the skin does not exist, it is automatically created and the entity skin number is increased.

Returns:

NULL if the skin material could not be set, otherwise a MATERIAL* pointer with the original effect.

Modifies:

ENTITY - the model's skin lighting and skin effect are modified. Material parameters that do not belong to a skin - for instance material skills or matrices - are not modified.

Speed:

Medium

Remarks:

Example:

ent_mtlset(me,mtl_new,1); // replaces the ligthing and effect of the first entity skin

See also:

Skin Parameters, MATERIAL, ent_cloneskin, ent_setskin

► latest version online