easy_gltf/scene/model/
mode.rs1use std::fmt;
2
3#[derive(Clone, Debug, PartialEq, Default)]
8pub enum Mode {
9 Points,
11 Lines,
13 LineLoop,
15 LineStrip,
17 #[default]
19 Triangles,
20 TriangleStrip,
22 TriangleFan,
24}
25
26impl From<gltf::mesh::Mode> for Mode {
27 fn from(mode: gltf::mesh::Mode) -> Self {
28 match mode {
29 gltf::mesh::Mode::Points => Self::Points,
30 gltf::mesh::Mode::Lines => Self::Lines,
31 gltf::mesh::Mode::LineLoop => Self::LineLoop,
32 gltf::mesh::Mode::LineStrip => Self::LineStrip,
33 gltf::mesh::Mode::Triangles => Self::Triangles,
34 gltf::mesh::Mode::TriangleFan => Self::TriangleFan,
35 gltf::mesh::Mode::TriangleStrip => Self::TriangleStrip,
36 }
37 }
38}
39
40#[derive(Clone, Debug)]
43pub struct BadMode {
44 pub mode: Mode,
46}
47
48impl fmt::Display for BadMode {
49 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
50 write!(f, "Invalid mode \"{:?}\"", self.mode,)
51 }
52}