TextureSlot
Description
Section titled “Description”Names one of the five texture slots of a PBR Material, the maps glTF 2.0
defines for metallic-roughness materials.
Each slot and the setter that binds its texture:
BaseColor, whichMaterial::base_color_texturebindsMetallicRoughness, whichMaterial::metallic_roughness_texturebindsNormal, whichMaterial::normal_texturebindsOcclusion, whichMaterial::occlusion_texturebindsEmissive, whichMaterial::emissive_texturebinds
Each slot samples its own UV set through its own transform.
Material::texture_uv
picks the set, and
Material::texture_transform
sets the transform. A glTF file loaded with Scene::load sets both from
each texture’s texCoord and KHR_texture_transform.
Example
Section titled “Example”use fragmentcolor::{Material, TextureSlot};
let material = Material::pbr() .texture_uv(TextureSlot::Occlusion, 1)? .texture_transform(TextureSlot::Normal, [0.0, 0.0], [4.0, 4.0], 0.0)?;import { Material, TextureSlot } from "fragmentcolor";
const material = Material.pbr().textureUv(TextureSlot.Occlusion, 1).textureTransform(TextureSlot.Normal, [0.0, 0.0], [4.0, 4.0], 0.0);from fragmentcolor import Material, TextureSlot
material = Material.pbr().texture_uv(TextureSlot.Occlusion, 1).texture_transform(TextureSlot.Normal, [0.0, 0.0], [4.0, 4.0], 0.0)import FragmentColor
let material = try Material.pbr().textureUv(TextureSlot.occlusion, 1).textureTransform(TextureSlot.normal, [0.0, 0.0], [4.0, 4.0], 0.0)import org.fragmentcolor.*
val material = Material.pbr().textureUv(TextureSlot.OCCLUSION, 1u).textureTransform(TextureSlot.NORMAL, listOf(0.0f, 0.0f), listOf(4.0f, 4.0f), 0.0f)