natiny_material_set_texture
C
void natiny_material_set_texture(NatinyMaterial material, const char* texture_name, NatinyTexture texture, uint32_t min_filter, uint32_t mag_filter);
Assigns a texture to a named texture slot and configures its filtering. The
assigned texture overrides one supplied by a model or draw for the same slot.
Parameters
| Name |
Type |
Description |
material |
NatinyMaterial |
Material handle |
texture_name |
const char* |
Texture name declared in the shader |
texture |
NatinyTexture |
Texture handle; 0 selects the built-in white texture |
min_filter |
uint32_t |
Filter used when the texture is minified |
mag_filter |
uint32_t |
Filter used when the texture is magnified |
Filtering
| Constant |
Description |
NATINY_FILTER_LINEAR |
Blends neighbouring texels; minification also blends mip levels |
NATINY_FILTER_NEAREST |
Selects the nearest texel and mip level |
Example
C
natiny_material_set_texture(material, "albedo", texture, NATINY_FILTER_LINEAR, NATINY_FILTER_LINEAR);
Notes
- A slot that has not been assigned by this function can receive a texture
from the model part or draw command.
- Passing
0 still assigns the slot; it does not restore texture inheritance.
- An unknown
texture_name is reported to stderr and ignored.
- Any filter value other than
NATINY_FILTER_NEAREST is treated as
NATINY_FILTER_LINEAR.