pub struct GltfMaterial {
pub base_color_factor: [f32; 4],
pub base_color_texture: Option<String>,
pub metallic_factor: f32,
pub roughness_factor: f32,
pub metallic_roughness_texture: Option<String>,
pub normal_texture: Option<NormalTexture>,
pub occlusion_texture: Option<OcclusionTexture>,
pub emissive_texture: Option<String>,
pub emissive_factor: [f32; 3],
pub alpha_mode: AlphaMode,
pub alpha_cutoff: f32,
pub double_sided: bool,
}Expand description
A gltf::material value with glTF 2.0 defaults filled in.
Factors are linear, as in glTF. Texture members keep the location string
as written; nothing is fetched or decoded. The reference viewer maps only
the RGB of baseColorFactor, metallicFactor, and roughnessFactor; the
other members are kept for the scene and GLB export.
Fields§
§base_color_factor: [f32; 4]pbrMetallicRoughness.baseColorFactor, default [1, 1, 1, 1].
base_color_texture: Option<String>pbrMetallicRoughness.baseColorTexture.
metallic_factor: f32pbrMetallicRoughness.metallicFactor, default 1.
roughness_factor: f32pbrMetallicRoughness.roughnessFactor, default 1.
metallic_roughness_texture: Option<String>pbrMetallicRoughness.metallicRoughnessTexture.
normal_texture: Option<NormalTexture>§occlusion_texture: Option<OcclusionTexture>§emissive_texture: Option<String>§emissive_factor: [f32; 3]Default [0, 0, 0].
alpha_mode: AlphaModeDefault AlphaMode::Opaque.
alpha_cutoff: f32Default 0.5.
double_sided: boolDefault false.
Implementations§
Source§impl GltfMaterial
impl GltfMaterial
Sourcepub fn from_value(value: &Value) -> Result<Option<Self>, DecodeError>
pub fn from_value(value: &Value) -> Result<Option<Self>, DecodeError>
Decodes a gltf::material value. Returns None when the object sets
none of the members the reference viewer looks for, in which case the
node falls back to bsi::ifc::presentation. Unknown members are
ignored.
Trait Implementations§
Source§impl Clone for GltfMaterial
impl Clone for GltfMaterial
Source§fn clone(&self) -> GltfMaterial
fn clone(&self) -> GltfMaterial
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more