use std::fmt;
#[derive(Clone, Debug, PartialEq, Default)]
pub enum Mode {
Points,
Lines,
LineLoop,
LineStrip,
#[default]
Triangles,
TriangleStrip,
TriangleFan,
}
impl From<gltf::mesh::Mode> for Mode {
fn from(mode: gltf::mesh::Mode) -> Self {
match mode {
gltf::mesh::Mode::Points => Self::Points,
gltf::mesh::Mode::Lines => Self::Lines,
gltf::mesh::Mode::LineLoop => Self::LineLoop,
gltf::mesh::Mode::LineStrip => Self::LineStrip,
gltf::mesh::Mode::Triangles => Self::Triangles,
gltf::mesh::Mode::TriangleFan => Self::TriangleFan,
gltf::mesh::Mode::TriangleStrip => Self::TriangleStrip,
}
}
}
#[derive(Clone, Debug)]
pub struct BadMode {
pub mode: Mode,
}
impl fmt::Display for BadMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Invalid mode \"{:?}\"", self.mode,)
}
}