Esc

Gltf_Texture_Info

structextensionsince 0.36.1Source
  • macOS: Gltf_Texture_Info works on macOS
  • Linux: Gltf_Texture_Info works on Linux
  • Windows: Gltf_Texture_Info works on Windows
  • Wasm: Gltf_Texture_Info works on Wasm

Declaration

Gltf_Texture_Info :: struct @json(rename_all=camelCase) {
    index: u32;    tex_coord: u32 = 0; @json(default)    scale: float32 = 1.0; @json(default)    strength: float32 = 1.0; @json(default)    name: string; @json(default,skip_serializing_if=empty)    extensions: Json_Value; @json(default,skip_serializing_if=null)    extras: Json_Value; @json(default,skip_serializing_if=null)}

A texture reference from a material: the texture index, the UV set tex_coord, and the scale (normal) or strength (occlusion) that applies.

Example↗
asset, error := gltf_load("{\"asset\":{\"version\":\"2.0\"},\"images\":[{\"uri\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==\"}],\"samplers\":[{\"magFilter\":9729,\"wrapS\":33071}],\"textures\":[{\"sampler\":0,\"source\":0}],\"materials\":[{\"pbrMetallicRoughness\":{\"baseColorTexture\":{\"index\":0},\"metallicFactor\":0.5},\"alphaMode\":\"BLEND\"}]}");
assert(error.kind == .NONE);
defer gltf_free(*asset);
info := asset.document.materials[0].pbr_metallic_roughness.base_color_texture;
assert(info.index == 0 && info.tex_coord == 0);

See also