Struct gltf::Material[][src]

pub struct Material<'a> { /* fields omitted */ }
Expand description

The material appearance of a primitive.

Implementations

impl<'a> Material<'a>[src]

pub fn index(&self) -> Option<usize>[src]

Returns the internal JSON index if this Material was explicity defined.

This function returns None if the Material is the default material.

pub fn alpha_cutoff(&self) -> Option<f32>[src]

The optional alpha cutoff value of the material.

pub fn alpha_mode(&self) -> AlphaMode[src]

The alpha rendering mode of the material. The material’s alpha rendering mode enumeration specifying the interpretation of the alpha value of the main factor and texture.

  • In Opaque mode (default) the alpha value is ignored and the rendered output is fully opaque.
  • In Mask mode, the rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value.
  • In Blend mode, the alpha value is used to composite the source and destination areas and the rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator).

pub fn double_sided(&self) -> bool[src]

Specifies whether the material is double-sided.

  • When this value is false, back-face culling is enabled.
  • When this value is true, back-face culling is disabled and double sided lighting is enabled. The back-face must have its normals reversed before the lighting equation is evaluated.

pub fn name(&self) -> Option<&'a str>[src]

This is supported on crate feature names only.

Optional user-defined name for this object.

pub fn pbr_metallic_roughness(&self) -> PbrMetallicRoughness<'a>[src]

Parameter values that define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.

pub fn pbr_specular_glossiness(&self) -> Option<PbrSpecularGlossiness<'a>>[src]

This is supported on crate feature KHR_materials_pbrSpecularGlossiness only.

Parameter values that define the specular-glossiness material model from Physically-Based Rendering (PBR) methodology.

pub fn transmission(&self) -> Option<Transmission<'a>>[src]

This is supported on crate feature KHR_materials_transmission only.

Parameter values that define the transmission of light through the material

pub fn ior(&self) -> Option<f32>[src]

This is supported on crate feature KHR_materials_ior only.

Parameter values that define the index of refraction of the material

pub fn normal_texture(&self) -> Option<NormalTexture<'a>>[src]

A tangent space normal map.

The texture contains RGB components in linear space. Each texel represents the XYZ components of a normal vector in tangent space.

  • Red [0 to 255] maps to X [-1 to 1].
  • Green [0 to 255] maps to Y [-1 to 1].
  • Blue [128 to 255] maps to Z [1/255 to 1].

The normal vectors use OpenGL conventions where +X is right, +Y is up, and +Z points toward the viewer.

pub fn occlusion_texture(&self) -> Option<OcclusionTexture<'a>>[src]

The occlusion map texture.

The occlusion values are sampled from the R channel. Higher values indicate areas that should receive full indirect lighting and lower values indicate no indirect lighting. These values are linear.

If other channels are present (GBA), they are ignored for occlusion calculations.

pub fn emissive_texture(&self) -> Option<Info<'a>>[src]

The emissive map texture.

The emissive map controls the color and intensity of the light being emitted by the material.

This texture contains RGB components in sRGB color space. If a fourth component (A) is present, it is ignored.

pub fn emissive_factor(&self) -> [f32; 3][src]

The emissive color of the material.

The default value is [0.0, 0.0, 0.0].

pub fn unlit(&self) -> bool[src]

This is supported on crate feature KHR_materials_unlit only.

Specifies whether the material is unlit.

Returns true if the [KHR_materials_unlit] property was specified, in which case the renderer should prefer to ignore all PBR values except baseColor.

KHR_materials_unlit

pub fn extras(&self) -> &'a Extras[src]

Optional application specific data.

Trait Implementations

impl<'a> Clone for Material<'a>[src]

fn clone(&self) -> Material<'a>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> Debug for Material<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a> RefUnwindSafe for Material<'a>

impl<'a> Send for Material<'a>

impl<'a> Sync for Material<'a>

impl<'a> Unpin for Material<'a>

impl<'a> UnwindSafe for Material<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.