Another project
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 1.4 kB View raw
1use serde::{Deserialize, Serialize}; 2 3#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] 4pub enum DisplayMode { 5 Wireframe, 6 HiddenLineRemoved, 7 HiddenLineGray, 8 ShadedWithEdges, 9 ShadedNoEdges, 10} 11 12impl DisplayMode { 13 pub const DEFAULT: Self = Self::ShadedWithEdges; 14 15 #[must_use] 16 pub const fn label(self) -> &'static str { 17 match self { 18 Self::Wireframe => "wireframe", 19 Self::HiddenLineRemoved => "hidden_line_removed", 20 Self::HiddenLineGray => "hidden_line_gray", 21 Self::ShadedWithEdges => "shaded_with_edges", 22 Self::ShadedNoEdges => "shaded_no_edges", 23 } 24 } 25} 26 27impl core::fmt::Display for DisplayMode { 28 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 29 f.write_str(self.label()) 30 } 31} 32 33#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] 34pub enum ShadingModel { 35 Flat, 36 Gouraud, 37 Phong, 38} 39 40impl ShadingModel { 41 #[must_use] 42 pub const fn label(self) -> &'static str { 43 match self { 44 Self::Flat => "flat", 45 Self::Gouraud => "gouraud", 46 Self::Phong => "phong", 47 } 48 } 49} 50 51impl core::fmt::Display for ShadingModel { 52 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 53 f.write_str(self.label()) 54 } 55}