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: PbrMaterialParameter 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: EmissiveThe 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.