wip transpose

This commit is contained in:
Quaternions 2024-08-28 11:05:02 -07:00
parent 9ef9b5ff3f
commit 23a6ffb243
2 changed files with 32 additions and 23 deletions

View File

@ -252,9 +252,18 @@ macro_rules! impl_vector {
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_vector {
( $struct: ident { $($field: ident), + }, ( $($generic: ident), + ), $size: expr,
$struct: ident { $($field: ident), + }, ( $($generic: ident), + ), $size: expr ) => {
macro_rules! impl_matrix {
( $struct_outer: ident { $($field_outer: ident), + }, $size_outer: expr,
$struct_inner: ident { $($field_inner: ident), + }, $size_inner: expr ) => {
impl<T> Transpose for $struct_outer<$struct_inner<T>> {
fn transpose(self) -> $struct_inner<$struct_outer<T>> {
$struct_inner{
$( $field_inner: $struct_outer {
$( $field_outer: self.$field_outer.$field_inner), +
} ), +
}
}
}
}
}

View File

@ -67,43 +67,43 @@ crate::impl_vector!(Vector2 { x, y }, (T, T), 2);
crate::impl_vector!(Vector3 { x, y, z }, (T, T, T), 3);
crate::impl_vector!(Vector4 { x, y, z, w }, (T, T, T, T), 4);
/*
//*
crate::impl_matrix!(
Vector2 { x, y }, (T, T), 2,
Vector2 { x, y }, (T, T), 2,
Vector2 { x, y }, 2,
Vector2 { x, y }, 2
);
crate::impl_matrix!(
Vector2 { x, y }, (T, T), 2,
Vector3 { x, y, z }, (T, T, T), 3,
Vector2 { x, y }, 2,
Vector3 { x, y, z }, 3
);
crate::impl_matrix!(
Vector2 { x, y }, (T, T), 2,
Vector4 { x, y, z, w }, (T, T, T, T), 4,
Vector2 { x, y }, 2,
Vector4 { x, y, z, w }, 4
);
crate::impl_matrix!(
Vector3 { x, y, z }, (T, T, T), 3,
Vector2 { x, y }, (T, T), 2,
Vector3 { x, y, z }, 3,
Vector2 { x, y }, 2
);
crate::impl_matrix!(
Vector3 { x, y, z }, (T, T, T), 3,
Vector3 { x, y, z }, (T, T, T), 3,
Vector3 { x, y, z }, 3,
Vector3 { x, y, z }, 3
);
crate::impl_matrix!(
Vector3 { x, y, z }, (T, T, T), 3,
Vector4 { x, y, z, w }, (T, T, T, T), 4,
Vector3 { x, y, z }, 3,
Vector4 { x, y, z, w }, 4
);
crate::impl_matrix!(
Vector4 { x, y, z, w }, (T, T, T, T), 4,
Vector2 { x, y }, (T, T), 2,
Vector4 { x, y, z, w }, 4,
Vector2 { x, y }, 2
);
crate::impl_matrix!(
Vector4 { x, y, z, w }, (T, T, T, T), 4,
Vector3 { x, y, z }, (T, T, T), 3,
Vector4 { x, y, z, w }, 4,
Vector3 { x, y, z }, 3
);
crate::impl_matrix!(
Vector4 { x, y, z, w }, (T, T, T, T), 4,
Vector4 { x, y, z, w }, (T, T, T, T), 4,
Vector4 { x, y, z, w }, 4,
Vector4 { x, y, z, w }, 4
);
*/
//*/