natiny_model_set_material

C
void natiny_model_set_material(NatinyModel model, NatinyMaterial material);

Sets the material for every part of the model, and with it the tags that decide which passes draw the model.

Parameters

Name Type Description
model NatinyModel Model handle
material NatinyMaterial Material handle, or 0 for the built-in material

Example

C
natiny_model_set_material(box, stone);

Notes

  • Materials belong to model instances, not meshes; models sharing one mesh may use different materials.
  • Selection by tag reads this material and only this one. Per-part overrides from natiny_model_set_part_material change how a part is shaded, not whether the model is picked up.
  • 0 goes back to the built-in material, which carries the tag "model" and nothing else.
  • A material bound with natiny_material_bind overrides this for the length of the bind: the tag chooses which models a pass draws, the bound material chooses how.