diff options
Diffstat (limited to 'src/classes/mesh.rs')
-rw-r--r-- | src/classes/mesh.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/classes/mesh.rs b/src/classes/mesh.rs index f828b7c..348c61c 100644 --- a/src/classes/mesh.rs +++ b/src/classes/mesh.rs @@ -1,7 +1,7 @@ use super::streaminginfo::StreamingInfo; use crate::object::{Value, parser::FromValue}; use anyhow::{Result, anyhow, bail}; -use glam::{Mat4, Vec3, Vec3A}; +use glam::{Mat4, Vec2, Vec3, Vec3A, Vec4}; use log::debug; use serde::Serialize; use std::mem::transmute; @@ -216,6 +216,18 @@ impl VectorType for Vec3 { a.into_iter().array_chunks().map(Vec3::from_array).collect() } } +impl VectorType for Vec2 { + const DIM: usize = 2; + fn convert_array(a: Vec<f32>) -> Vec<Self> { + a.into_iter().array_chunks().map(Vec2::from_array).collect() + } +} +impl VectorType for Vec4 { + const DIM: usize = 4; + fn convert_array(a: Vec<f32>) -> Vec<Self> { + a.into_iter().array_chunks().map(Vec4::from_array).collect() + } +} impl FromValue for ChannelInfo { fn from_value(v: Value) -> Result<Self> { |