pub struct Material {
pub pbr: PbrMaterial,
pub normal: Option<NormalMap>,
pub occlusion: Option<Occlusion>,
pub emissive: Emissive,
}
Expand description
Contains material properties of models.
Fields§
§pbr: PbrMaterial
Parameter values that define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.
normal: Option<NormalMap>
Defines the normal texture of a material.
occlusion: Option<Occlusion>
Defines the occlusion texture of a material.
emissive: Emissive
The emissive color of the material.
Implementations§
source§impl Material
impl Material
sourcepub fn get_base_color_alpha(&self, tex_coords: Vector2<f32>) -> Vector4<f32>
pub fn get_base_color_alpha(&self, tex_coords: Vector2<f32>) -> Vector4<f32>
Get the color base Rgb(A) (in RGB-color space) of the material given a
texture coordinate. If no base_color_texture
is available then the
base_color_factor
is returned.
Important: tex_coords
must contain values between [0., 1.]
otherwise the function will fail.
sourcepub fn get_base_color(&self, tex_coords: Vector2<f32>) -> Vector3<f32>
pub fn get_base_color(&self, tex_coords: Vector2<f32>) -> Vector3<f32>
Get the color base Rgb (in RGB-color space) of the material given a
texture coordinate. If no base_color_texture
is available then the
base_color_factor
is returned.
Important: tex_coords
must contain values between [0., 1.]
otherwise the function will fail.
sourcepub fn get_metallic(&self, tex_coords: Vector2<f32>) -> f32
pub fn get_metallic(&self, tex_coords: Vector2<f32>) -> f32
Get the metallic value of the material given a texture coordinate. If no
metallic_texture
is available then the metallic_factor
is returned.
Important: tex_coords
must contain values between [0., 1.]
otherwise the function will fail.
sourcepub fn get_roughness(&self, tex_coords: Vector2<f32>) -> f32
pub fn get_roughness(&self, tex_coords: Vector2<f32>) -> f32
Get the roughness value of the material given a texture coordinate. If no
roughness_texture
is available then the roughness_factor
is returned.
Important: tex_coords
must contain values between [0., 1.]
otherwise the function will fail.
sourcepub fn get_normal(&self, tex_coords: Vector2<f32>) -> Option<Vector3<f32>>
pub fn get_normal(&self, tex_coords: Vector2<f32>) -> Option<Vector3<f32>>
Get the normal vector of the material given a texture coordinate. If no
normal_texture
is available then None
is returned.
Important: tex_coords
must contain values between [0., 1.]
otherwise the function will fail.
sourcepub fn get_occlusion(&self, tex_coords: Vector2<f32>) -> Option<f32>
pub fn get_occlusion(&self, tex_coords: Vector2<f32>) -> Option<f32>
Get the occlusion value of the material given a texture coordinate. If no
occlusion_texture
is available then None
is returned.
Important: tex_coords
must contain values between [0., 1.]
otherwise the function will fail.
sourcepub fn get_emissive(&self, tex_coords: Vector2<f32>) -> Vector3<f32>
pub fn get_emissive(&self, tex_coords: Vector2<f32>) -> Vector3<f32>
Get the emissive color Rgb of the material given a texture coordinate.
If no emissive_texture
is available then the emissive_factor
is
returned.
Important: tex_coords
must contain values between [0., 1.]
otherwise the function will fail.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Material
impl RefUnwindSafe for Material
impl Send for Material
impl Sync for Material
impl Unpin for Material
impl UnwindSafe for Material
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.