impl UniformDataType for [f32; 2], [f32; 3] and [f32; 4]
@@ -16,6 +16,10 @@ impl UniformDataType for Vec2 {}
impl UniformDataType for Vec3 {}
impl UniformDataType for Vec4 {}
+impl UniformDataType for [f32; 2] {}
+impl UniformDataType for [f32; 3] {}
+impl UniformDataType for [f32; 4] {}
+
impl UniformDataType for Quat {}
impl UniformDataType for Mat2 {}
@@ -100,6 +104,33 @@ pub(in crate::core) mod internal_uniform {
}
}
+ impl UniformDataTypeExtension for [f32; 2] {
+ fn send(&self, context: &Context, location: &UniformLocation) {
+ context.uniform4fv(location, self);
+ }
+ fn send_array(data: &[Self], context: &Context, location: &UniformLocation) {
+ context.uniform4fv(location, &data.iter().flat_map(|v| *v).collect::<Vec<_>>());
+ }
+ }
+
+ impl UniformDataTypeExtension for [f32; 3] {
+ fn send(&self, context: &Context, location: &UniformLocation) {
+ context.uniform4fv(location, self);
+ }
+ fn send_array(data: &[Self], context: &Context, location: &UniformLocation) {
+ context.uniform4fv(location, &data.iter().flat_map(|v| *v).collect::<Vec<_>>());
+ }
+ }
+
+ impl UniformDataTypeExtension for [f32; 4] {
+ fn send(&self, context: &Context, location: &UniformLocation) {
+ context.uniform4fv(location, self);
+ }
+ fn send_array(data: &[Self], context: &Context, location: &UniformLocation) {
+ context.uniform4fv(location, &data.iter().flat_map(|v| *v).collect::<Vec<_>>());
+ }
+ }
+
impl UniformDataTypeExtension for Quat {
fn send(&self, context: &Context, location: &UniformLocation) {
context.uniform4fv(location, &self.as_array());
