Struct dot_vox::Material

source ·
pub struct Material {
    pub id: u32,
    pub properties: Dict,
}
Expand description

A material used to render this model.

Fields§

§id: u32

The Material’s ID. Corresponds to an index in the palette.

§properties: Dict

Properties of the material, mapped by property name.

Implementations§

source§

impl Material

source

pub fn material_type(&self) -> Option<&str>

The _type field, if present

source

pub fn weight(&self) -> Option<f32>

The _weight field associated with the material

source

pub fn metalness(&self) -> Option<f32>

The _metal field associated with the material

source

pub fn roughness(&self) -> Option<f32>

The _rough field associated with the material

source

pub fn specular(&self) -> Option<f32>

The _sp field associated with the material.

source

pub fn refractive_index(&self) -> Option<f32>

The _ior field associated with the material

source

pub fn emission(&self) -> Option<f32>

The _emit field associated with the material

source

pub fn low_dynamic_range_scale(&self) -> Option<f32>

The ‘_ldr’ field associated with the material. This is a ‘hack’ factor to scale emissive materials visually by so they look less bright when rendered. I.e. this blends between the actual color of the resp. voxel (low_dynamic_range_scale = 0) and its pure diffuse color (low_dynamic_range_scale = 1)

source

pub fn ri(&self) -> Option<f32>

The ‘_ri’ field associated with the material (appears to just be 1 + _ior)

source

pub fn attenuation(&self) -> Option<f32>

The _att field associated with the glass material.

This is the falloff that models the optiocal density of the medium.

source

pub fn radiant_flux(&self) -> Option<f32>

The _flux field associated with the emissive material.

source

pub fn phase(&self) -> Option<f32>

The _g field associated with the material.

source

pub fn opacity(&self) -> Option<f32>

The _alpha field associated with the material.

This is the alpha/blending value that is used to blend the voxel with the background (compositing related, has no relation to physics).

source

pub fn transparency(&self) -> Option<f32>

The _trans field associated with the material.

This is the transparency of the material. I.e. a physical property, honours refractive_index(), see above.

source

pub fn density(&self) -> Option<f32>

The _d field associated with the cloud material.

This is the density of the volumetric medium.

source

pub fn media(&self) -> Option<f32>

The _media field associated with the material. This corresponds to the cloud material.

source

pub fn media_type(&self) -> Option<&str>

The _media_type field associated with the material.

Corresponds to the type of cloud: absorb, scatter, emissive, subsurface scattering

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 PartialEq<Material> for Material

source§

fn eq(&self, other: &Material) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Material

source§

impl StructuralEq for Material

source§

impl StructuralPartialEq for Material

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.