cf_make_texture_from_model_image¶
Category: model
GitHub: cute_model.h
Decodes one of a model's embedded images into a ready-to-sample CF_Texture.
| Parameters | Description |
|---|---|
model |
The model from cf_make_model. |
image_index |
An index into the model's images, e.g. a CM_TextureRef's image member. |
Return Value¶
Returns a linear-filtered texture with a full mip chain generated.
Remarks¶
Embedded glTF images are PNG or JPEG bytes; both decode here. An image_index of -1
(the loader's "slot unused" sentinel), an out-of-range index, or an undecodable image
all return a 1x1 white texture, so feeding a material slot straight through always
yields something drawable:
CF_Texture albedo = cf_make_texture_from_model_image(model, model->materials[0].base_color_texture.image);
Destroy the result with cf_destroy_texture. For block-compressed shipping textures see cf_make_texture_from_dds and the Shipping 3D topic.
Related Pages¶
cf_make_model
CF_Texture
cf_make_texture_from_dds
cf_destroy_texture