Struct tobj::Material

source ·
pub struct Material {
Show 15 fields pub name: String, pub ambient: Option<[f64; 3]>, pub diffuse: Option<[f64; 3]>, pub specular: Option<[f64; 3]>, pub shininess: Option<f64>, pub dissolve: Option<f64>, pub optical_density: Option<f64>, pub ambient_texture: Option<String>, pub diffuse_texture: Option<String>, pub specular_texture: Option<String>, pub normal_texture: Option<String>, pub shininess_texture: Option<String>, pub dissolve_texture: Option<String>, pub illumination_model: Option<u8>, pub unknown_param: AHashMap<String, String>,
}
Expand description

A material that may be referenced by one or more Meshes.

Standard MTL attributes are supported. Any unrecognized parameters will be stored as key-value pairs in the unknown_param HashMap, which maps the unknown parameter to the value set for it.

No path is pre-pended to the texture file names specified in the MTL file.

Fields§

§name: String

Material name as specified in the MTL file.

§ambient: Option<[f64; 3]>

Ambient color of the material.

§diffuse: Option<[f64; 3]>

Diffuse color of the material.

§specular: Option<[f64; 3]>

Specular color of the material.

§shininess: Option<f64>

Material shininess attribute. Also called glossiness.

§dissolve: Option<f64>

Dissolve attribute is the alpha term for the material. Referred to as dissolve since that’s what the MTL file format docs refer to it as.

§optical_density: Option<f64>

Optical density also known as index of refraction. Called optical_density in the MTL specc. Takes on a value between 0.001 and 10.0. 1.0 means light does not bend as it passes through the object.

§ambient_texture: Option<String>

Name of the ambient texture file for the material.

§diffuse_texture: Option<String>

Name of the diffuse texture file for the material.

§specular_texture: Option<String>

Name of the specular texture file for the material.

§normal_texture: Option<String>

Name of the normal map texture file for the material.

§shininess_texture: Option<String>

Name of the shininess map texture file for the material.

§dissolve_texture: Option<String>

Name of the alpha/opacity map texture file for the material.

Referred to as dissolve to match the MTL file format specification.

§illumination_model: Option<u8>

The illumnination model to use for this material. The different illumination models are specified in the MTL spec.

§unknown_param: AHashMap<String, String>

Key value pairs of any unrecognized parameters encountered while parsing the material.

Trait Implementations§

source§

impl Clone for Material

source§

fn clone(&self) -> Material

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Material

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Material

source§

fn default() -> Material

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.