Skip to main content

he3d_core/
material.rs

1use crate::Rgb;
2
3/// Per-object shading parameters.
4/// 每个对象的着色参数。
5///
6/// First version only carries a tint; texture tint and additional surface parameters are added without breaking the constructor shape.
7/// 首个版本只携带一个色调;纹理色调和额外的表面参数会在不破坏构造函数形态的前提下添加。
8#[derive(Clone, Copy, PartialEq, Debug)]
9pub struct Material {
10   /// Multiplicative tint applied to the sampled texture or solid color.
11   /// 应用于采样纹理或纯色的倍增色调。
12   pub tint: Rgb,
13}
14
15impl Material {
16   /// Construct a material from a tint.
17   /// 用色调构造一个材质。
18   #[must_use]
19   pub const fn new(tint: Rgb) -> Self {
20      Self { tint }
21   }
22}
23
24impl Default for Material {
25   fn default() -> Self {
26      Self { tint: Rgb::WHITE }
27   }
28}