[−][src]Struct easy_gltf::Material
Contains material properties of models.
Fields
base_color_factor: Vector4<f32>
The base_color_factor
contains scaling factors for the red, green,
blue and alpha component of the color. If no texture is used, these
values will define the color of the whole object in RGB color space.
base_color_texture: Option<Arc<RgbaImage>>
The base_color_texture
is the main texture that will be applied to the
object.
The texture contains RGB(A) components in sRGB color space.
alpha_cutoff: f32
The alpha cutoff value of the material.
metallic_texture: Option<Arc<GrayImage>>
Contains the metalness value
metallic_factor: f32
metallic_factor
is multiply to the metallic_texture
value. If no
texture is given, then the factor define the metalness for the whole
object.
roughness_texture: Option<Arc<GrayImage>>
Contains the roughness value
roughness_factor: f32
roughness_factor
is multiply to the roughness_texture
value. If no
texture is given, then the factor define the roughness for the whole
object.
normal_texture: Option<Arc<RgbImage>>
A tangent space normal map. The texture contains RGB components in linear space. Each texel represents the XYZ components of a normal vector in tangent space.
- Red [0 to 255] maps to X [-1 to 1].
- Green [0 to 255] maps to Y [-1 to 1].
- Blue [128 to 255] maps to Z [1/255 to 1].
The normal vectors use OpenGL conventions where +X is right, +Y is up, and +Z points toward the viewer.
normal_factor: f32
The normal_factor
is the normal strength to be applied to the
texture value.
occlusion_texture: Option<Arc<GrayImage>>
The occlusion_texture
refers to a texture that defines areas of the
surface that are occluded from light, and thus rendered darker.
occlusion_factor: f32
The occlusion_factor
is the occlusion strength to be applied to the
texture value.
emissive_factor: Vector3<f32>
The emissive_factor
contains scaling factors for the red, green and
blue components of this texture.
emissive_texture: Option<Arc<RgbImage>>
The emissive_texture
refers to a texture that may be used to illuminate parts of the
model surface: It defines the color of the light that is emitted from the surface
Implementations
impl Material
[src]
pub fn get_base_color_alpha(&self, tex_coords: Vector2<f32>) -> Vector4<f32>
[src]
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.
pub fn get_base_color(&self, tex_coords: Vector2<f32>) -> Vector3<f32>
[src]
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.
pub fn get_metallic(&self, tex_coords: Vector2<f32>) -> f32
[src]
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.
pub fn get_roughness(&self, tex_coords: Vector2<f32>) -> f32
[src]
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.
pub fn get_normal(&self, tex_coords: Vector2<f32>) -> Option<Vector3<f32>>
[src]
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.
pub fn get_occlusion(&self, tex_coords: Vector2<f32>) -> Option<f32>
[src]
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.
pub fn get_emissive(&self, tex_coords: Vector2<f32>) -> Vector3<f32>
[src]
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 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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,