natiny_model_set_part_texture

C
void natiny_model_set_part_texture(NatinyModel model, uint32_t part, NatinyTexture texture);

Overrides the texture of one part of the model, in place of the one the mesh loaded for it.

Parameters

Name Type Description
model NatinyModel Model handle
part uint32_t Zero-based part index
texture NatinyTexture Texture handle, or 0 to go back to the mesh's

Example

C
natiny_model_set_part_texture(crate, 0, label);

Notes

  • A part's texture belongs to the mesh, because it is what the file said. This is the per-instance override of that, so two models can share one mesh and still look different.
  • The texture reaches the built-in material directly, and fills any sampler slot a custom material left unassigned - the same rule the mesh part's own texture follows.
  • Overrides are stored only for parts that have one; 0 clears one. They are cleared by natiny_model_set_mesh.