Struct tinyraytracer::blocks::Material[][src]

pub struct Material {
    color: (f32, f32, f32),
    pub pixel: Rgb<u8>,
    pub specular_exponent: f32,
    pub refraction_index: f32,
    diff_mixing_coef: f32,
    spec_mixing_coef: f32,
    reflection_mixing_coef: f32,
    refraction_mixing_coef: f32,
}

Material represents the color and light reflecting properties. (Open the struct page to see images)

This is something completely new to me. The wikipedia article is interesting Phong Reflection Model. Particularly this image

Another image that provides good explanation about diffused and specular reflection is this:

Fields

color: (f32, f32, f32)pixel: Rgb<u8>specular_exponent: f32

How strong this material reflects direct light

refraction_index: f32

How refracting is the material

diff_mixing_coef: f32

Whiteness of an object

spec_mixing_coef: f32reflection_mixing_coef: f32refraction_mixing_coef: f32

Implementations

impl Material[src]

fn _to_pixel(color: (f32, f32, f32)) -> Rgb<u8>[src]

pub fn new(
    color: (f32, f32, f32),
    weights: (f32, f32, f32, f32),
    specular_exponent: f32,
    refraction_index: f32
) -> Self
[src]

pub fn adjust_light(self, diffuse: f32, specular: f32) -> Self[src]

fn _mix_materials(self, other: Material, coef: f32) -> Self[src]

pub fn mix_reflection(self, other: Material) -> Self[src]

Mix two materials color together, by the amount of reflectiveness of the first material.

pub fn mix_refraction(self, other: Material) -> Self[src]

Mix two materials color together, by the amount of refraction of the first material.

Trait Implementations

impl Clone for Material[src]

impl Debug for Material[src]

impl Default for Material[src]

impl Copy for Material[src]

Auto Trait Implementations

impl RefUnwindSafe for Material

impl Send for Material

impl Sync for Material

impl Unpin for Material

impl UnwindSafe for Material

Blanket Implementations

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

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

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

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

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.