Esc

Gltf_Texture

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

Declaration

Gltf_Texture :: struct @json(rename_all=camelCase) {
    sampler: Json_Maybe(u32);    source: Json_Maybe(u32);    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 sampler and an image source, by index.

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);
texture := asset.document.textures[0];
assert(texture.sampler.state == .SET && texture.source.value == 0);

See also