aboutsummaryrefslogtreecommitdiff
path: root/src/classes/mesh.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/mesh.rs')
-rw-r--r--src/classes/mesh.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/classes/mesh.rs b/src/classes/mesh.rs
index b6e6821..b8b9e90 100644
--- a/src/classes/mesh.rs
+++ b/src/classes/mesh.rs
@@ -162,7 +162,16 @@ impl VertexData {
out.push(match channel.format {
VertexFormat::Float => f32::from_le_bytes([e[0], e[1], e[2], e[3]]),
VertexFormat::Float16 => f16::from_le_bytes([e[0], e[1]]) as f32,
- x => todo!("vertex format {x:?}"),
+ VertexFormat::SInt8 => i8::from_le_bytes([e[0]]) as f32,
+ VertexFormat::UInt8 => u8::from_le_bytes([e[0]]) as f32,
+ VertexFormat::SInt16 => i16::from_le_bytes([e[0], e[1]]) as f32,
+ VertexFormat::UInt16 => u16::from_le_bytes([e[0], e[1]]) as f32,
+ VertexFormat::SInt32 => i32::from_le_bytes([e[0], e[1], e[2], e[3]]) as f32,
+ VertexFormat::UInt32 => u32::from_le_bytes([e[0], e[1], e[2], e[3]]) as f32,
+ VertexFormat::UNorm8 => u8::from_le_bytes([e[0]]) as f32 / 256.,
+ VertexFormat::SNorm8 => i8::from_le_bytes([e[0]]) as f32 / 128.,
+ VertexFormat::UNorm16 => u16::from_le_bytes([e[0], e[1]]) as f32 / 65536.,
+ VertexFormat::SNorm16 => i16::from_le_bytes([e[0], e[1]]) as f32 / 32768.,
})
}
}
@@ -242,6 +251,7 @@ impl FromValue for VertexFormat {
}
}
}
+
impl VertexFormat {
pub fn component_size(&self) -> usize {
use VertexFormat::*;