natiny_render_tag

C
void natiny_render_tag(const char* tag, uint32_t sort);
void natiny_render_tags(const char* const* tags, uint32_t count, uint32_t sort);

Draws every visible model whose own material has the requested tag. natiny_render_tags requires the material to have every requested tag. Per-part materials and a material bound with natiny_material_bind do not affect selection.

Parameters

Name Type Description
tag const char* One tag name
tags const char* const* Array of distinct tag names
count uint32_t Number of entries in tags; maximum 8
sort uint32_t Draw order; one of the NATINY_SORT_* constants below

Constants

Constant Value Description
NATINY_SORT_MATERIAL 0 Group by model material, then mesh
NATINY_SORT_NONE 1 Keep model storage order without sorting
NATINY_SORT_BACK_TO_FRONT 2 Sort model bounds centers from farthest to nearest
NATINY_SORT_FRONT_TO_BACK 3 Sort model bounds centers from nearest to farthest

Example

C
const char* tags[] = { "world", "transparent" };
natiny_render_tags(tags, 2, NATINY_SORT_BACK_TO_FRONT);

Notes

  • A model must be visible and have a valid, non-empty mesh. Hidden models are skipped; see natiny_model_set_visible.
  • A model using the built-in material matches only the "model" tag. A custom material matches tags added with natiny_material_add_tag.
  • A bound material controls how selected models are drawn, but selection still reads each model's own material.
  • Distance sorts use the world-space center of each mesh's bounds. Without a bound camera every distance is equal, so the original selection order is preserved.
  • natiny_render_tags does nothing when tags is null, count is 0, a tag is unknown, or an entry is null or empty. A count above 8 is reported to stderr and nothing is drawn.