wip: remove color

This commit is contained in:
Jonathan Kelley committed 2022-05-05 16:50:36 -04:00
1 parent 356f37e9ee
commit bded314251
1 file changed
+7 -40
+7 -40
View File
@@ -12,16 +12,15 @@ pub enum AttributeValue<'a> {
Uint32(u32),
Uint64(u64),
Bool(bool),
ColorRGB(u8, u8, u8),
ColorRGBA(u8, u8, u8, u8),
ColorHex(u32),
ColorHexAlpha(u32, u8),
Vec3Float(f32, f32, f32),
Vec3Int(i32, i32, i32),
Vec3Uint(u32, u32, u32),
Vec4Float(f32, f32, f32, f32),
Vec4Int(i32, i32, i32, i32),
Vec4Uint(u32, u32, u32, u32),
Bytes(&'a [u8]),
Any(ArbitraryAttributeValue<'a>),
}
@@ -55,10 +54,6 @@ impl<'a> std::fmt::Display for AttributeValue<'a> {
AttributeValue::Uint32(a) => write!(f, "{}", a),
AttributeValue::Uint64(a) => write!(f, "{}", a),
AttributeValue::Bool(a) => write!(f, "{}", a),
AttributeValue::ColorRGB(_, _, _) => todo!(),
AttributeValue::ColorRGBA(_, _, _, _) => todo!(),
AttributeValue::ColorHex(_) => todo!(),
AttributeValue::ColorHexAlpha(_, _) => todo!(),
AttributeValue::Vec3Float(_, _, _) => todo!(),
AttributeValue::Vec3Int(_, _, _) => todo!(),
AttributeValue::Vec3Uint(_, _, _) => todo!(),
@@ -174,34 +169,6 @@ impl<'a> AttributeValue<'a> {
}
}
pub fn as_color_rgb(&self) -> Option<(u8, u8, u8)> {
match self {
AttributeValue::ColorRGB(r, g, b) => Some((*r, *g, *b)),
_ => None,
}
}
pub fn as_color_rgba(&self) -> Option<(u8, u8, u8, u8)> {
match self {
AttributeValue::ColorRGBA(r, g, b, a) => Some((*r, *g, *b, *a)),
_ => None,
}
}
pub fn as_color_hex(&self) -> Option<u32> {
match self {
AttributeValue::ColorHex(c) => Some(*c),
_ => None,
}
}
pub fn as_color_hex_alpha(&self) -> Option<(u32, u8)> {
match self {
AttributeValue::ColorHexAlpha(c, a) => Some((*c, *a)),
_ => None,
}
}
pub fn as_vec3_float(&self) -> Option<(f32, f32, f32)> {
match self {
AttributeValue::Vec3Float(x, y, z) => Some((*x, *y, *z)),
@@ -259,7 +226,7 @@ impl<'a> AttributeValue<'a> {
}
}
#[test]
fn test_attribute_value_size() {
assert_eq!(std::mem::size_of::<AttributeValue<'_>>(), 24);
}
// #[test]
// fn test_attribute_value_size() {
// assert_eq!(std::mem::size_of::<AttributeValue<'_>>(), 24);
// }