Skip to main content

engvis_core/
material.rs

1/// Describes a PBR material
2#[derive(Debug, Clone)]
3pub struct PbrMaterial {
4    pub name: String,
5    pub albedo: [f32; 4],
6    pub metallic: f32,
7    pub roughness: f32,
8    pub emissive: [f32; 3],
9    pub normal_scale: f32,
10    pub alpha_cutoff: f32,
11
12    /// Texture indices (into a TextureCache)
13    pub albedo_texture: Option<usize>,
14    pub metallic_roughness_texture: Option<usize>,
15    pub normal_texture: Option<usize>,
16    pub emissive_texture: Option<usize>,
17}
18
19impl Default for PbrMaterial {
20    fn default() -> Self {
21        Self {
22            name: "Default".to_string(),
23            albedo: [0.8, 0.8, 0.8, 1.0],
24            metallic: 0.0,
25            roughness: 0.5,
26            emissive: [0.0, 0.0, 0.0],
27            normal_scale: 1.0,
28            alpha_cutoff: 0.5,
29            albedo_texture: None,
30            metallic_roughness_texture: None,
31            normal_texture: None,
32            emissive_texture: None,
33        }
34    }
35}
36
37/// Vertex (point) overlay rendering options
38#[derive(Debug, Clone, Copy)]
39pub struct VertexRenderOptions {
40    pub enabled: bool,
41    pub color: [f32; 3],
42    pub point_size: f32,
43}
44
45impl Default for VertexRenderOptions {
46    fn default() -> Self {
47        Self {
48            enabled: false,
49            color: [1.0, 0.85, 0.3],
50            point_size: 4.0,
51        }
52    }
53}
54
55/// Edge (line) overlay rendering options
56#[derive(Debug, Clone, Copy)]
57pub struct EdgeRenderOptions {
58    pub enabled: bool,
59    pub color: [f32; 3],
60    pub line_width: f32,
61}
62
63impl Default for EdgeRenderOptions {
64    fn default() -> Self {
65        Self {
66            enabled: true,
67            color: [0.2, 0.8, 1.0],
68            line_width: 5.0,
69        }
70    }
71}