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: f32
reflection_mixing_coef: f32
refraction_mixing_coef: f32
Implementations
impl Material
[src]
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]
color: (f32, f32, f32),
weights: (f32, f32, f32, f32),
specular_exponent: f32,
refraction_index: f32
) -> Self
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.